forked from pypr/pysph
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
76 lines (54 loc) · 1.83 KB
/
Makefile
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
ROOT = $(shell pwd)
MAKEFILE = $(ROOT)/Makefile
SRC = $(ROOT)
PKG2 = $(SRC)/pysph
SUBPKG2 = base sph sph/solid_mech parallel
PKG1 = $(SRC)/pyzoltan
SUBPKG1 = core sph
DIRS := $(foreach dir,$(SUBPKG1),$(PKG1)/$(dir)) \
$(foreach dir,$(SUBPKG2),$(PKG2)/$(dir))
# this is used for cython files on recursive call to make
PYX = $(wildcard *.pyx)
MPI4PY_INCL = $(shell python -c "import mpi4py; print mpi4py.get_include()")
# the default target to make
all : build
.PHONY : $(DIRS) bench build
build :
python setup.py build_ext --inplace
$(DIRS) :
cd $@; python $(ROOT)/pyzoltan/core/generator.py
$(MAKE) -f $(MAKEFILE) -C $@ cythoncpp ROOT=$(ROOT)
%.c : %.pyx
python `which cython` -I$(SRC) -I$(MPI4PY_INCL) $<
%.cpp : %.pyx
python `which cython` --cplus -I$(SRC) -I$(MPI4PY_INCL) $<
%.html : %.pyx
python `which cython` -I$(SRC) -I$(MPI4PY_INCL) -a $<
cython : $(PYX:.pyx=.c)
cythoncpp : $(PYX:.pyx=.cpp)
_annotate : $(PYX:.pyx=.html)
annotate :
for f in $(DIRS); do $(MAKE) -f $(MAKEFILE) -C $${f} _annotate ROOT=$(ROOT); done
clean :
python setup.py clean
-for dir in $(DIRS); do rm -f $$dir/*.c; done
-for dir in $(DIRS); do rm -f $$dir/*.cpp; done
cleanall : clean
-for dir in $(DIRS); do rm -f $$dir/*.so; done
# -rm $(patsubst %.pyx,%.c,$(wildcard $(PKG)/*/*.pyx))
test :
python `which pytest` -m 'not slow' pysph
testall :
python `which pytest` pysph
epydoc :
python cython-epydoc.py --config epydoc.cfg pysph
doc :
cd docs; make html
develop :
python setup.py develop
install :
python setup.py install
clang :
python $(ROOT)/pyzoltan/core/generator.py
for f in $(DIRS); do $(MAKE) -f $(MAKEFILE) -C $${f} cythoncpp ROOT=$(ROOT); done
cd pysph/; for f in */*.cpp */*/*.cpp; do clang++ -g -O2 -shared -fPIC -o $${f%.*}.so $$f -I /usr/include/python2.7/ $(shell mpicxx --showme:compile) $(shell mpicxx --showme:link); done