/
Makefile
174 lines (151 loc) · 4.02 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
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
###############################################################################
#
# make all
# Compile example programs and tests in their directories.
#
# make run-fortran-tests
# Run the Fortran examples and test suite
#
# make run-fortran-tests-no-timing
# Run the Fortran examples and test suite
#
# make clean
# Delete the compile executibles.
#
###############################################################################
F95 = gfortran
FFTW ?= -lfftw3
LIBPATH = ../../lib
MODPATH = ../../modules/
LIBNAME = SHTOOLS
SHELL=/bin/sh
.PHONY: all clean run-fortran-tests
EXAMPLES = \
MarsCrustalThickness/MarsCrustalThickness \
SHCilmPlus/TestCilmPlus \
SHExpandDH/TestExpandDH \
SHExpandLSQ/TestSHExpandLSQ \
SHLocalizedAdmitCorr/LocalizedAdmitCorr \
SHMag/SHMag \
SHRotate/TestSHRotate \
TimingAccuracy/TimingAccuracyDH \
TimingAccuracy/TimingAccuracyDHC \
TimingAccuracy/TimingAccuracyGLQ \
TimingAccuracy/TimingAccuracyGLQC
all: $(EXAMPLES)
%: %.f95 $(LIBPATH)/lib$(LIBNAME).a
$(F95) $(F95FLAGS) $< $(MODFLAG) -L$(LIBPATH) -l$(LIBNAME) $(FFTW) -lm $(LAPACK) $(BLAS) -o $@
run-fortran-tests: $(EXAMPLES)
@echo MARS-CRUSTAL-THICKNESS
cd MarsCrustalThickness ; ./MarsCrustalThickness < input.txt
@echo
@echo TEST-CILMPLUS
cd SHCilmPlus ; ./TestCilmPlus
@echo
@echo TEST-EXPANDDH
cd SHExpandDH ; ./TestExpandDH
@echo
@echo TEST-SHEXPANDLSQ
cd SHExpandLSQ ; ./TestSHExpandLSQ < input.txt
@echo
@echo LOCALIZED-ADMIT-CORR
cd SHLocalizedAdmitCorr ; ./LocalizedAdmitCorr < input.txt
@echo
@echo SHMAG
cd SHMag ; ./SHMag
@echo
@echo TEST-SHROTATE
cd SHRotate ; ./TestSHRotate < input.txt
@echo
@echo "*** The following 8 timing and accuracy tests will take about an hour to complete ***"
@echo "*** If you are impatient, press Control-C to exit ***"
@echo
@echo TIMING-ACCURACY-GLQ
cd TimingAccuracy ; ./TimingAccuracyGLQ < input1 > output1
@echo
@echo TIMING-ACCURACY-GLQ
cd TimingAccuracy ; ./TimingAccuracyGLQ < input2 > output2
@echo
@echo TIMING-ACCURACY-DH
cd TimingAccuracy ; ./TimingAccuracyDH < input3 > output3
@echo
@echo TIMING-ACCURACY-DH
cd TimingAccuracy ; ./TimingAccuracyDH < input4 > output4
@echo
@echo TIMING-ACCURACY-DHC
cd TimingAccuracy ; ./TimingAccuracyDHC < input5 > output5
@echo
@echo TIMING-ACCURACY-DHC
cd TimingAccuracy ; ./TimingAccuracyDHC < input6 > output6
@echo
@echo TIMING-ACCURACY-GLQC
cd TimingAccuracy ; ./TimingAccuracyGLQC < input7 > output7
@echo
@echo TIMING-ACCURACY-GLQC
cd TimingAccuracy ; ./TimingAccuracyGLQC < input8 > output8
run-fortran-tests-no-timing: $(EXAMPLES)
@echo MARS-CRUSTAL-THICKNESS
cd MarsCrustalThickness ; ./MarsCrustalThickness < input.txt
@echo
@echo TEST-CILMPLUS
cd SHCilmPlus ; ./TestCilmPlus
@echo
@echo TEST-EXPANDDH
cd SHExpandDH ; ./TestExpandDH
@echo
@echo TEST-SHEXPANDLSQ
cd SHExpandLSQ ; ./TestSHExpandLSQ < input.txt
@echo
@echo LOCALIZED-ADMIT-CORR
cd SHLocalizedAdmitCorr ; ./LocalizedAdmitCorr < input.txt
@echo
@echo SHMAG
cd SHMag ; ./SHMag
@echo
@echo TEST-SHROTATE
cd SHRotate ; ./TestSHRotate < input.txt
ifeq ($(F95),f95)
F95FLAGS ?= -m64 -O3 -YEXT_NAMES=LCS -YEXT_SFX=_ -fpic
MODFLAG = -p $(MODPATH)
LAPACK ?= -llapack
BLAS ?= -lblas
endif
ifeq ($(F95),gfortran)
F95FLAGS ?= -m64 -fPIC -O3
MODFLAG = -I$(MODPATH)
LAPACK ?= -llapack
BLAS ?= -lblas
endif
ifeq ($(F95),ifort)
F95FLAGS ?= -m64 -fpp -free -O3 -Tf
MODFLAG = -I$(MODPATH)
LAPACK ?= -mkl
BLAS ?=
endif
ifeq ($(F95),g95)
F95FLAGS ?= -O3 -fno-second-underscore
MODFLAG = -I$(MODPATH)
LAPACK ?= -llapack
BLAS ?= -lblas
endif
ifeq ($(F95),pgf90)
F95FLAGS ?= -fast
MODFLAG = -Imodpath
LAPACK ?= -llapack
BLAS ?= -lblas
endif
ifeq ($(origin F95FLAGS), undefined)
F95FLAGS = -m64 -O3
MODFLAG = -I$(MODPATH)
LAPACK ?= -llapack
BLAS ?= -lblas
endif
clean:
@-rm -f $(EXAMPLES)
@-rm -f $(addsuffix *.sh, $(dir $(EXAMPLES)))
@-rm -f $(addsuffix *.dat, $(dir $(EXAMPLES)))
@-rm -f TimingAccuracy/output*
@-rm -f TimingAccuracy/*.maxerror
@-rm -f TimingAccuracy/*.rmserror
@-rm -f TimingAccuracy/*.timef
@-rm -f TimingAccuracy/*.timei