1 | # L. Fita, LMD. October 2016 |
---|
2 | # Compilation of all required Fortran modules in `camelot' with gcc compilers |
---|
3 | # A following python 'library' creation is required |
---|
4 | |
---|
5 | # FOLLOWING: http://stackoverflow.com/questions/17156125/f2py-exposing-parameters-from-used-modules |
---|
6 | # FOLLOWING: http://osdir.com/ml/python.f2py.user/2006-08/msg00019.html |
---|
7 | # module load gnu/4.4.7 |
---|
8 | # module load python/2.7-anaconda |
---|
9 | # export LD_LIBRARY_PATH=/opt/anaconda/lib/:$LD_LIBRARY_PATH |
---|
10 | # Diagnostics compilation _______ |
---|
11 | # f2py -m module_ForDiag -h module_ForDiag.pyf module_generic.f90 module_ForDiagnosticsVars.f90 module_ForDiagnostics.f90 >& run_f2py_ForDiag_wrapper.log |
---|
12 | # make |
---|
13 | # f2py -L/opt/anaconda/lib/ -m module_ForDiag -c --fcompiler=gnu95 module_ForDiag.pyf module_generic.f90 module_ForDiagnosticsVars.f90 module_ForDiagnostics.f90 >& run_f2py_ForDiag_compile.log |
---|
14 | # Interpolation compilation _______ |
---|
15 | # f2py -m module_ForInt -h module_ForInt.pyf module_generic.f90 module_ForInterpolate.f90 >& run_f2py_ForInt_wrapper.log |
---|
16 | # f2py -L/opt/anaconda/lib/ -m module_ForInt -c --fcompiler=gnu95 module_ForInt.pyf module_generic.f90 module_ForInterpolate.f90 >& run_f2py_ForInt_compile.log |
---|
17 | # |
---|
18 | |
---|
19 | FC = /usr/bin/gfortran |
---|
20 | FCF = -c -fPIC |
---|
21 | LIB_INC = |
---|
22 | RM = rm -f |
---|
23 | F2PY = /usr/bin/f2py |
---|
24 | #DBGFLAGS = -g -Wall -Wextra -Warray-temporaries -Wconversion -fimplicit-none -fbacktrace -ffree-line-length-0 -fcheck=all -ffpe-trap=zero,overflow,underflow -finit-real=nan |
---|
25 | NCLIBFOLD = /usr/lib/64 |
---|
26 | NCINCFOLD = /usr/include |
---|
27 | LIB_NETCDF = -L$(NCLIBFOLD) -lnetcdff -lnetcdf -I$(NCINCFOLD) |
---|
28 | |
---|
29 | LIB_NETCDF = -L$(NCFOLD)/lib -lnetcdff -lnetcdf -I$(NCFOLD)/include |
---|
30 | |
---|
31 | FCFLAGS = $(FCF) $(DBGFLAGS) |
---|
32 | |
---|
33 | |
---|
34 | # Sources for f2py |
---|
35 | srcs = module_definitions.f90 module_basic.f90 module_generic.f90 module_scientific.f90 |
---|
36 | distrisrcs = $(srcs) module_DistriCorrection.f90 |
---|
37 | diagsrcs = $(srcs) module_ForDiagnosticsVars.f90 module_ForDiagnostics.f90 |
---|
38 | intsrcs = $(srcs) module_ForInterpolate.f90 |
---|
39 | scisrcs = $(srcs) |
---|
40 | defsrcs = module_definitions.f90 |
---|
41 | |
---|
42 | ####### ###### ##### #### ### ## # |
---|
43 | |
---|
44 | MODULES = \ |
---|
45 | module_definitions.o \ |
---|
46 | module_basic.o \ |
---|
47 | module_generic.o \ |
---|
48 | module_NCgeneric.o \ |
---|
49 | module_scientific.o \ |
---|
50 | module_ForDiagnosticsVars.o \ |
---|
51 | module_ForDiagnostics.o \ |
---|
52 | module_DistriCorrection.o |
---|
53 | |
---|
54 | all : \ |
---|
55 | module_ForDiagnostics.o \ |
---|
56 | DistriCorrection.o \ |
---|
57 | interpolate.o \ |
---|
58 | pydistrimods.o \ |
---|
59 | pydiagmods.o \ |
---|
60 | pyintmods.o \ |
---|
61 | pyscimods.o \ |
---|
62 | pydefmods.o \ |
---|
63 | trajectories_overlap.o |
---|
64 | |
---|
65 | diags : \ |
---|
66 | module_ForDiagnostics.o |
---|
67 | |
---|
68 | clean : |
---|
69 | $(RM) *.mod *.o interpolate module_ForDiag.so module_ForInt.so module_ForDistriCorrect.so module_ForSci.so module_ForDef.so |
---|
70 | |
---|
71 | ######## ####### |
---|
72 | ## |
---|
73 | ######## |
---|
74 | |
---|
75 | module_definitions.o: |
---|
76 | $(FC) $(FCFLAGS) module_definitions.f90 |
---|
77 | |
---|
78 | module_basic.o: module_definitions.o |
---|
79 | $(FC) $(FCFLAGS) module_basic.f90 |
---|
80 | |
---|
81 | module_generic.o: module_definitions.o module_basic.o |
---|
82 | $(FC) $(FCFLAGS) $(LIB_INC) module_generic.f90 |
---|
83 | |
---|
84 | module_NCgeneric.o: module_definitions.o module_basic.o module_generic.o |
---|
85 | $(FC) $(FCFLAGS) $(LIB_NETCDF) $(LIB_INC) module_NCgeneric.f90 |
---|
86 | |
---|
87 | module_scientific.o: module_definitions.o module_basic.o module_generic.o |
---|
88 | $(FC) $(FCFLAGS) module_scientific.f90 |
---|
89 | |
---|
90 | module_ForDiagnosticsVars.o: module_definitions.o module_basic.o module_generic.o |
---|
91 | $(FC) $(FCFLAGS) $(LIB_INC) module_ForDiagnosticsVars.f90 |
---|
92 | |
---|
93 | module_ForDiagnostics.o: module_definitions.o module_basic.o module_generic.o module_ForDiagnosticsVars.o |
---|
94 | $(FC) $(FCFLAGS) $(LIB_INC) module_ForDiagnostics.f90 |
---|
95 | |
---|
96 | module_DistriCorrection.o: module_definitions.o module_basic.o module_generic.o module_scientific.o |
---|
97 | $(FC) $(FCFLAGS) module_DistriCorrection.f90 |
---|
98 | |
---|
99 | FCEXECFLAGS = $(MODULES) $(LIB_NETCDF) $(LIB_INC) |
---|
100 | |
---|
101 | interpolate.o: module_definitions.o module_basic.o module_generic.o module_scientific.o |
---|
102 | $(FC) $(FCEXECFLAGS) interpolate.f90 -o interpolate |
---|
103 | |
---|
104 | DistriCorrection.o: module_definitions.o module_basic.o module_generic.o module_NCgeneric.o module_scientific.o module_DistriCorrection.o |
---|
105 | $(FC) $(FCEXECFLAGS) DistriCorrection.f90 -o DistriCorrection |
---|
106 | |
---|
107 | pydistrimods.o: |
---|
108 | $(F2PY) -c -I$(NCINCFOLD) -m module_ForDistriCorrect $(distrisrcs) -L$(NCLIBFOLD) |
---|
109 | |
---|
110 | pydiagmods.o: |
---|
111 | $(F2PY) -c -I$(NCINCFOLD) -m module_ForDiag $(diagsrcs) -L$(NCLIBFOLD) |
---|
112 | |
---|
113 | pyintmods.o: |
---|
114 | $(F2PY) -c -I$(NCINCFOLD) -m module_ForInt $(intsrcs) -L$(NCLIBFOLD) |
---|
115 | |
---|
116 | pyscimods.o: |
---|
117 | $(F2PY) -c -I$(NCINCFOLD) -m module_ForSci $(scisrcs) -L$(NCLIBFOLD) |
---|
118 | |
---|
119 | pydefmods.o: |
---|
120 | $(F2PY) -c -I$(NCINCFOLD) -m module_ForDef $(defsrcs) -L$(NCLIBFOLD) |
---|
121 | |
---|
122 | trajectories_overlap.o: module_definitions.o module_basic.o module_generic.o module_NCgeneric.o module_scientific.o |
---|
123 | $(FC) $(FCEXECFLAGS) trajectories_overlap.f90 -o trajectories_overlap |
---|