-
Notifications
You must be signed in to change notification settings - Fork 11
Expand file tree
/
Copy pathMakefile
More file actions
97 lines (74 loc) · 2.64 KB
/
Makefile
File metadata and controls
97 lines (74 loc) · 2.64 KB
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
UNAME_S := $(shell uname -s)
UNAME_N := $(shell uname -n | sed 's/[0-9]*//g')
ARCH := $(shell uname -p)
ifeq ($(UNAME_S),Linux)
ifeq ($(ARCH),ppc64le)
LIB =
F2PY = f2py3
OPTFLAG = -O
FFLAGS= -fopenmp -cpp
CMD = ${F2PY} --fcompiler=gfortran -c --link-lapack_opt --opt="-cpp -heap-arrays ${OPTFLAG}" ${LIB} --f90flags="${FFLAGS}"
F90=gfortran
F77=${F90}
F77FLAGS = ${FFLAGS}
else
# Use the active Python's f2py and a GNU Fortran toolchain by default.
# These variables can still be overridden, e.g. `make F90=ifort F2PY=f2py3`.
LIB ?=
F2PY ?= python3 -m numpy.f2py
OPTFLAG ?= -O3
FFLAGS ?= -fopenmp -cpp
CMD = ${F2PY} -c --link-lapack_opt --opt="${OPTFLAG}" ${LIB} --f90flags="${FFLAGS}"
F90 ?= gfortran
F77 = ${F90}
F77FLAGS ?= ${FFLAGS}
endif
endif
ifeq ($(UNAME_S),Darwin)
LIB = -L${HOME}/lib
F2PY = f2py
OPTFLAG = -O
FFLAGS = -ffree-line-length-none -std=f2008 -fopenmp -cpp
CMD = ${F2PY} --fcompiler=gfortran -c --link-lapack_opt --opt="-cpp ${OPTFLAG}" ${LIB} --f90flags="${FFLAGS}"
F90 = gfortran
# WARNING: DO NOT use -O* options otherwise code behavior is crazy, seemingly due to the associate statement of fortran 2003
F77=${F90}
F77FLAGS =-fopenmp -O -cpp
endif
#FFLAGS+= -g -fbacktrace -fbounds-check -ffree-line-length-none -ftrapv
.SUFFIXES:
#BINARIES = bregman.so f_phonon.so f_util.so bcs_driver.so
BINARIES = bregman.so f_phonon.so f_util.so
BCSSOLVER= cssolve/num_types.f90 cssolve/matrix_sets.f90 cssolve/laplace.f90 cssolve/bcs.f90
BCSSOLVEROBJ=$(BCSSOLVER:.f90=.o)
TET = csld/phonon/dostet.f90 csld/phonon/pdstet.f90 csld/phonon/setk06.f90
TET_OBJ=$(TET:.f90=.o)
DMdipole = csld/phonon/DM_dipole_dipole.f csld/phonon/gbox.f csld/phonon/tripl.f csld/phonon/derfc.f csld/phonon/find_Ewald_eta_screened.f csld/phonon/DMstandard.f csld/phonon/lattc.f csld/phonon/cross.f csld/phonon/Fewald.f
DMdipole_OBJ=$(DMdipole:.f=.o)
.PHONY: all FORCE
all : $(BINARIES)
$(TET_OBJ) $(DMdipole_OBJ): FORCE
bregman.so: cssolve/bregman.f90
f_phonon.so: csld/phonon/f_phonon.f90 ${TET_OBJ} ${DMdipole_OBJ}
f_util.so: compile/f_util/f_util.f90
clean:
rm -f cssolve/*.o cssolve/*.mod cssolve/*.a *.o *.mod $(BINARIES) csld/phonon/*.o
%.o: %.f90
$(F90) -fPIC -c $(FFLAGS) $< -o $@
%.o: %.f
$(F77) -fPIC -c $(F77FLAGS) $< -o $@
cssolve/bcs.a: $(BCSSOLVEROBJ)
ar ru $@ $?
ranlib $@
cssolve/bcs.so: $(BCSSOLVEROBJ)
$(F90) -shared -fPIC $(FFLAGS) -o $@ $^
$(BINARIES):
rm -f $@
${CMD} -m $(basename $@) $^
if [ ! -f $@ ]; then mv -f $(basename $@).*.so $@; fi
bcs_driver.so: cssolve/bcs_driver.f90 $(BCSSOLVEROBJ)
rm -f $@
echo "dict(real=dict(dp='double'))" > .f2py_f2cmap
${CMD} -m $(basename $@) $^
if [ ! -f $@ ]; then mv -f $(basename $@).*.so $@; fi
rm .f2py_f2cmap