-
Notifications
You must be signed in to change notification settings - Fork 30
/
makefile_test_oscillation
104 lines (93 loc) · 3.09 KB
/
makefile_test_oscillation
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
#!/usr/bin/make
# defaults
COMPILER = gnu
# main building variables
ifeq "$(COMPILER)" "gnu"
FC = gfortran
OPTSC = -cpp -c -frealloc-lhs -O2 -J $(DMOD)
OPTSL = -J $(DMOD)
endif
ifeq "$(COMPILER)" "intel"
FC = ifort
OPTSC = -c -O2 -module $(DMOD)
OPTSL = -module $(DMOD)
endif
ifeq "$(COMPILER)" "ibm"
FC = bgxlf2008_r
OPTSC = -c -O2 -qmoddir=$(DMOD) -I$(DMOD)
OPTSL = -qmoddir=$(DMOD) -I$(DMOD)
endif
ifeq "$(COMPILER)" "cray"
FC = ftn
OPTSC = -c -O 0 -e Z -g
endif
DSRC = src/tests/accuracy/oscillation
DOBJ = build/tests/accuracy/oscillation/obj/
DMOD = build/tests/accuracy/oscillation/mod/
DEXE = build/tests/accuracy/oscillation/
LIBS = src/third_party/lib/flap/libflap.a build/lib/libfoodie.a src/third_party/lib/pyplot-fortran/libpyplot-fortran.a src/third_party/lib/wenoof/libwenoof.a
MODINC = -Isrc/third_party/lib/flap/mod -Ibuild/lib/mod -Isrc/third_party/lib/pyplot-fortran/mod -Isrc/third_party/lib/wenoof/mod
VPATH = $(DSRC) $(DOBJ) $(DMOD)
MKDIRS = $(DBLD) $(DOBJ) $(DMOD)
LCEXES = $(shell echo $(EXES) | tr '[:upper:]' '[:lower:]')
EXESPO = $(addsuffix .o,$(LCEXES))
EXESOBJ = $(addprefix $(DOBJ),$(EXESPO))
#auxiliary variables
COTEXT = "Compiling $(<F)"
LITEXT = "Assembling $@"
MKLIBS = flap foodie pyplot wenoof
#building rules
$(DEXE)oscillation: $(MKDIRS) $(DOBJ)oscillation.o
@rm -f $(filter-out $(DOBJ)oscillation.o,$(EXESOBJ))
@echo $(LITEXT)
@$(FC) $(OPTSL) $(DOBJ)*.o $(LIBS) -o $@
EXES := $(EXES) oscillation
#compiling rules
$(DOBJ)oscillation_t.o: src/tests/accuracy/oscillation/oscillation_t.f90 $(MKLIBS)
@echo $(COTEXT)
@$(FC) $(OPTSC) $(MODINC) $< -o $@
$(DOBJ)oscillation.o: src/tests/accuracy/oscillation/oscillation.f90 \
$(DOBJ)oscillation_t.o \
$(MKLIBS)
@echo $(COTEXT)
@$(FC) $(OPTSC) $(MODINC) $< -o $@
# libraries
.PHONY : flap
flap:
@rm -rf src/third_party/lib/flap
@mkdir -p src/third_party/lib
@$(MAKE) COMPILER="$(COMPILER)" STATIC=yes --directory=src/third_party/FLAP
@mv src/third_party/FLAP/static src/third_party/lib/flap
.PHONY : foodie
foodie:
@$(MAKE) -f makefile_foodie COMPILER="$(COMPILER)"
.PHONY : pyplot
pyplot:
@rm -rf src/third_party/lib/pyplot-fortran/
@mkdir -p src/third_party/lib/pyplot-fortran/mod
@mkdir -p src/third_party/lib/pyplot-fortran/obj
@$(FC) -c src/third_party/pyplot-fortran/src/pyplot_module.f90 -o pyplot_module.o
@ar -rcs libpyplot-fortran.a pyplot_module.o ; ranlib libpyplot-fortran.a
@mv libpyplot-fortran.a src/third_party/lib/pyplot-fortran/
@mv pyplot_module.mod src/third_party/lib/pyplot-fortran/mod
@mv pyplot_module.o src/third_party/lib/pyplot-fortran/obj
.PHONY : wenoof
wenoof:
@rm -rf src/third_party/lib/wenoof
@mkdir -p src/third_party/lib
@$(MAKE) COMPILER="$(COMPILER)" STATIC=yes --directory=src/third_party/WenOOF
@mv src/third_party/WenOOF/static src/third_party/lib/wenoof
#phony auxiliary rules
.PHONY : $(MKDIRS)
$(MKDIRS):
@mkdir -p $@
.PHONY : cleanthirdpartylib
cleanthirdpartylib:
@echo deleting third party libs
@rm -fr src/third_party/lib
.PHONY : clean
clean:
@echo deleting build
@rm -fr build/
.PHONY : cleanall
cleanall: clean cleanthirdpartylib