-
Notifications
You must be signed in to change notification settings - Fork 4
/
Makefile
156 lines (127 loc) · 4.87 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
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
147
148
149
150
151
152
153
154
155
156
#
# Makefile for Pysic
#
# fortran compiler
FORTRAN = gfortran
# mpi fortran compiler
MPIFORTRAN = mpif90
# build directory
BUILDDIR = build
TMPDIR = fortran_tmp
# compiler flags
DEBUG_FLAGS = "-g -fbounds-check"
F90_FLAGS =
# module name suffix
DEBUG_SUFFIX = ""
NOOPT_SUFFIX = ""
SERIAL_SUFFIX = ""
# source files, do not edit
FORTRAN_FILES = pysic_fortran.pyf Mersenne.F90 MPI.F90 Quaternions.F90 Utility.F90 Geometry.F90 Potentials.F90 Core.F90 PyInterface.F90
.PHONY: help clean test debug noopt serial parallel
help:
@echo "Please use \`make <target>' where <target> is one of"
@echo " help print this message"
@echo " clean trash previous build"
@echo " debug compile debug version"
@echo " noopt compile unoptimized version"
@echo " serial compile serial version"
@echo " parallel compile parallel version"
test:
mkdir -p $(TMPDIR)
cp ./fortran/MPI.f90 $(TMPDIR)/MPI.F90
cp ./fortran/Quaternions.f90 $(TMPDIR)/Quaternions.F90
cp ./fortran/Utility.f90 $(TMPDIR)/Utility.F90
cp ./fortran/Potentials.f90 $(TMPDIR)/Potentials.F90
cp ./fortran/Core.f90 $(TMPDIR)/Core.F90
cp ./fortran/Geometry.f90 $(TMPDIR)/Geometry.F90
cp ./fortran/PyInterface.f90 $(TMPDIR)/PyInterface.F90
cp ./fortran/Mersenne.F90 $(TMPDIR)/Mersenne.F90
cd $(TMPDIR); f2py -m pysic_fortran -h pysic_fortran.pyf PyInterface.F90; \
f2py -c --noopt --fcompiler=$(FORTRAN) --f90exec=$(FORTRAN) $(FORTRAN_FILES)
rm $(TMPDIR)/*
rmdir $(TMPDIR)
@echo
@echo "Test build finished."
clean:
-rm -rf $(TMPDIR)
-rm -rf $(BUILDDIR)
debug:
mkdir -p $(BUILDDIR)
mkdir $(BUILDDIR)/pysic
cp -r ./pysic/* $(BUILDDIR)/pysic
mkdir $(TMPDIR)
cp ./fortran/MPI.f90 $(TMPDIR)/MPI.F90
cp ./fortran/Quaternions.f90 $(TMPDIR)/Quaternions.F90
cp ./fortran/Utility.f90 $(TMPDIR)/Utility.F90
cp ./fortran/Potentials.f90 $(TMPDIR)/Potentials.F90
cp ./fortran/Core.f90 $(TMPDIR)/Core.F90
cp ./fortran/Geometry.f90 $(TMPDIR)/Geometry.F90
cp ./fortran/PyInterface.f90 $(TMPDIR)/PyInterface.F90
cp ./fortran/Mersenne.F90 $(TMPDIR)/Mersenne.F90
cd $(TMPDIR); f2py --debug-capi -m pysic_fortran -h pysic_fortran.pyf PyInterface.F90; \
f2py --debug-capi -c --debug --noopt --fcompiler=$(FORTRAN) --f90exec=$(FORTRAN) --f90flags=$(DEBUG_FLAGS) $(FORTRAN_FILES)
mv $(TMPDIR)/pysic_fortran.so $(BUILDDIR)/pysic
rm $(TMPDIR)/*
rmdir $(TMPDIR)
@echo
@echo "Build finished. The module pysic is in the directory $(BUILDDIR)."
noopt:
mkdir -p $(BUILDDIR)
mkdir $(BUILDDIR)/pysic
cp -r ./pysic/* $(BUILDDIR)/pysic
mkdir -p $(TMPDIR)
cp ./fortran/MPI.f90 $(TMPDIR)/MPI.F90
cp ./fortran/Quaternions.f90 $(TMPDIR)/Quaternions.F90
cp ./fortran/Utility.f90 $(TMPDIR)/Utility.F90
cp ./fortran/Potentials.f90 $(TMPDIR)/Potentials.F90
cp ./fortran/Core.f90 $(TMPDIR)/Core.F90
cp ./fortran/Geometry.f90 $(TMPDIR)/Geometry.F90
cp ./fortran/PyInterface.f90 $(TMPDIR)/PyInterface.F90
cp ./fortran/Mersenne.F90 $(TMPDIR)/Mersenne.F90
cd $(TMPDIR); f2py -m pysic_fortran -h pysic_fortran.pyf PyInterface.F90; \
f2py -c --noopt --fcompiler=$(FORTRAN) --f90exec=$(FORTRAN) $(FORTRAN_FILES)
mv $(TMPDIR)/pysic_fortran.so $(BUILDDIR)/pysic
rm $(TMPDIR)/*
rmdir $(TMPDIR)
@echo
@echo "Build finished. The module pysic is in the directory $(BUILDDIR)."
serial:
mkdir -p $(BUILDDIR)
mkdir $(BUILDDIR)/pysic
cp -r ./pysic/* $(BUILDDIR)/pysic
mkdir -p $(TMPDIR)
cp ./fortran/MPI.f90 $(TMPDIR)/MPI.F90
cp ./fortran/Quaternions.f90 $(TMPDIR)/Quaternions.F90
cp ./fortran/Utility.f90 $(TMPDIR)/Utility.F90
cp ./fortran/Potentials.f90 $(TMPDIR)/Potentials.F90
cp ./fortran/Core.f90 $(TMPDIR)/Core.F90
cp ./fortran/Geometry.f90 $(TMPDIR)/Geometry.F90
cp ./fortran/PyInterface.f90 $(TMPDIR)/PyInterface.F90
cp ./fortran/Mersenne.F90 $(TMPDIR)/Mersenne.F90
cd $(TMPDIR); f2py -m pysic_fortran -h pysic_fortran.pyf PyInterface.F90; \
f2py -c --fcompiler=$(FORTRAN) --f90exec=$(FORTRAN) $(FORTRAN_FILES)
mv $(TMPDIR)/pysic_fortran.so $(BUILDDIR)/pysic
rm $(TMPDIR)/*
rmdir $(TMPDIR)
@echo
@echo "Build finished. The module pysic is in the directory $(BUILDDIR)."
parallel:
mkdir -p $(BUILDDIR)
mkdir $(BUILDDIR)/pysic
cp -r ./pysic/* $(BUILDDIR)/pysic
mkdir -p $(TMPDIR)
cp ./fortran/MPI.f90 $(TMPDIR)/MPI.F90
cp ./fortran/Quaternions.f90 $(TMPDIR)/Quaternions.F90
cp ./fortran/Utility.f90 $(TMPDIR)/Utility.F90
cp ./fortran/Potentials.f90 $(TMPDIR)/Potentials.F90
cp ./fortran/Core.f90 $(TMPDIR)/Core.F90
cp ./fortran/Geometry.f90 $(TMPDIR)/Geometry.F90
cp ./fortran/PyInterface.f90 $(TMPDIR)/PyInterface.F90
cp ./fortran/Mersenne.F90 $(TMPDIR)/Mersenne.F90
cd $(TMPDIR); f2py -m pysic_fortran -h pysic_fortran.pyf PyInterface.F90; \
f2py -c --fcompiler=$(FORTRAN) --f90exec=$(MPIFORTRAN) --f90flags="-D MPI $(F90_FLAGS)" $(FORTRAN_FILES)
mv $(TMPDIR)/pysic_fortran.so $(BUILDDIR)/pysic
rm $(TMPDIR)/*
rmdir $(TMPDIR)
@echo
@echo "Build finished. The module pysic is in the directory $(BUILDDIR)."