File: Makefile.am

package info (click to toggle)
openmpi 5.0.8-4
  • links: PTS, VCS
  • area: main
  • in suites:
  • size: 201,684 kB
  • sloc: ansic: 613,078; makefile: 42,353; sh: 11,194; javascript: 9,244; f90: 7,052; java: 6,404; perl: 5,179; python: 1,859; lex: 740; fortran: 61; cpp: 20; tcl: 12
file content (146 lines) | stat: -rw-r--r-- 6,184 bytes parent folder | download | duplicates (7)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
#
# Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana
#                         University Research and Technology
#                         Corporation.  All rights reserved.
# Copyright (c) 2004-2005 The University of Tennessee and The University
#                         of Tennessee Research Foundation.  All rights
#                         reserved.
# Copyright (c) 2004-2009 High Performance Computing Center Stuttgart,
#                         University of Stuttgart.  All rights reserved.
# Copyright (c) 2004-2005 The Regents of the University of California.
#                         All rights reserved.
# Copyright (c) 2006-2010 Cisco Systems, Inc.  All rights reserved.
# Copyright (c) 2012-2013 Los Alamos National Security, Inc.  All rights reserved.
# Copyright (c) 2013-2019 Intel, Inc.  All rights reserved.
# Copyright (c) 2018      Research Organization for Information Science
#                         and Technology (RIST).  All rights reserved.
# Copyright (c) 2021      IBM Corporation.  All rights reserved.
# Copyright (c) 2022      Nanook Consulting.  All rights reserved.
# $COPYRIGHT$
#
# Additional copyrights may follow
#
# $HEADER$
#

# We do NOT want picky compilers down here
CFLAGS = $(PMIX_CFLAGS_BEFORE_PICKY)

helpers = \
        setup.py \
        construct.py

src_files = \
        pmix.pxi \
        pmix.pyx

EXTRA_DIST = $(helpers) $(src_files)

if WANT_PYTHON_BINDINGS

harvested_headers = \
        $(top_srcdir)/include/pmix.h \
        $(top_builddir)/include/pmix_common.h \
        $(top_srcdir)/include/pmix_deprecated.h \
        $(top_srcdir)/include/pmix_server.h \
        $(top_srcdir)/include/pmix_tool.h

constants_files = \
        pmix_constants.pxd \
        pmix_constants.pxi

# Create pmix_constants.pxd and pmix_constants.pxi by harvesting a
# bunch of PMIx header files These will be generated in the PMIx build
# dir.
$(constants_files): construct.py $(harvested_headers)
	$(PYTHON) $(top_srcdir)/bindings/python/construct.py --src="$(top_builddir)/include" --include-dir="$(top_srcdir)/include"

# Cython does not natively understand VPATH builds.  Specifically,
# Cython will build things in the same tree where it finds
# pmix.[pxi|pyx] (which is the PMIx source tree).
#
# Cython's "setup.py build_ext
# --build-lib=SOMEWHERE_IN_THE_BUILD_TREE" *almost* does what we want.
# But even though it makes the build/install trees in the directory we
# tell it (vs. the source tree), it still writes pmix.c in the source
# tree, which is definitely not what we want.
#
# We want to properly support VPATH builds, so we fake out Cython and
# force it to build in the PMIx build tree by making sym links for
# pmix.[pxi|pyx] from the source tree to the build tree.  Cython can
# then find these files in the build tree, and build everything there
# (including pmix.c).
#
# This is a little gross, but it works. :-/
$(PMIX_TOP_BUILDDIR)/bindings/python/pmix.pxi:
	$(LN_S) $(PMIX_TOP_SRCDIR)/bindings/python/pmix.pxi $(PMIX_TOP_BUILDDIR)/bindings/python/pmix.pxi
$(PMIX_TOP_BUILDDIR)/bindings/python/pmix.pyx:
	$(LN_S) $(PMIX_TOP_SRCDIR)/bindings/python/pmix.pyx $(PMIX_TOP_BUILDDIR)/bindings/python/pmix.pyx

# When we run "setup.pu build_ext ...", several files/directories are
# created.  The exact files / directory names may be system-dependent,
# so we don't try to check for most of them.  Instead, we just check
# for one sentinel file that is always created during this step:
# pmix.c, and use that as a proxy for all the other things that were
# created during this step.
SENTINEL_FILE = pmix.c

# Create $(SENTINEL_FILE) from its sources and the constants we
# harvested from various PMIx header files.  Ensure to depend on the
# pmix.[pxi|pyx] in the build tree so that those rules get triggered
# and we get sym links over to the source tree, if necessary.
$(SENTINEL_FILE): $(PMIX_TOP_BUILDDIR)/bindings/python/pmix.pxi
$(SENTINEL_FILE): $(PMIX_TOP_BUILDDIR)/bindings/python/pmix.pyx
$(SENTINEL_FILE): $(constants_files)
	PMIX_BINDINGS_TOP_SRCDIR=$(PMIX_TOP_SRCDIR) PMIX_BINDINGS_TOP_BUILDDIR=$(PMIX_TOP_BUILDDIR) \
		$(PYTHON) $(top_srcdir)/bindings/python/setup.py build_ext --library-dirs="$(PMIX_TOP_BUILDDIR)/src/.libs" --user

BUILT_SOURCES = $(constants_files)

# We don't put $(SENTINEL_FILE) BUILT_SOURCES because then "make dist"
# will fail if it can't be created (e.g., if no suitable Python +
# Cython + etc. is available) -- because the files in BUILT_SOURCES
# are dependencies of "distdir".
#
# More specifically: $(SENTINEL_FILE) isn't shipped in the tarball, so
# it doesn't seem right to require it to be able to be built for "make
# dist" to succeed.  Hence, we (slightly) abuse Automake's "noinst"
# and "DATA" to force $(SENTINEL_FILE) to be built during "make all"
# when WANT_PYTHON_BINDINGS is true.
noinst_DATA = $(SENTINEL_FILE)

install-exec-local:
	$(MKDIR_P) $(DESTDIR)$(pythondir)
	PYTHONPATH=$$PYTHONPATH:$(DESTDIR)$(pythondir):$(DESTDIR)$(pyexecdir) \
		PMIX_BINDINGS_TOP_SRCDIR=$(PMIX_TOP_SRCDIR) PMIX_BINDINGS_TOP_BUILDDIR=$(PMIX_TOP_BUILDDIR) \
		$(PYTHON) $(top_srcdir)/bindings/python/setup.py install --quiet --prefix="$(DESTDIR)$(prefix)"

# Be careful with easy-install.pth -- we may not be the only entity
# that put things in there.  Therefore, carefully remove the pmix
# entry from it, and then remove the file altogether if is then
# otherwise empty.  Finally, remove the installed pypmix Python egg.
uninstall-hook:
	-@file=$(pythondir)/easy-install.pth; \
	tmpfile=$(pythondir)/easy-install.pth.$$; \
	if test -r $$file; then \
	    grep -v /pypmix- $$file > $$tmpfile; \
	    diff -q $$file $$tmpfile 2>&1 >/dev/null; \
	    if test $$? -ne 0; then \
	        cp $$tmpfile $$file; \
	    fi; \
	    rm -f $$tmpfile; \
	    if test ! -s $$file; then \
	        rm -f $$file; \
	    fi; \
	fi
	rm -rf $(pythondir)/pypmix*

CLEANFILES += $(constants_files)

# Also delete the other files and dirs that Cython creates during its
# "setup.py build_ext ..." step.  We need to use clean-local because
# the names in CLEANFILE are not "rm -rf"'ed.
clean-local:
	rm -rf $(SENTINEL_FILE) build dist pypmix.egg-info

endif # WANT_PYTHON_BINDINGS