-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathMakefile
59 lines (40 loc) · 2.04 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
# External dependencies
HYPRE_DIR = lib/hypre/src
LIBS = -L$(HYPRE_DIR)/lib -lHYPRE -lm
src_dir = src/
TEST_OPTS = -g -fprofile-arcs -ftest-coverage -O1 -fcheck=all -ffpe-trap=invalid,zero,overflow -Wuninitialized -Werror
CORE_OPTS = -g -Ofast -fno-stack-arrays
PROF_OPTS = -g -pg -Ofast
FILES = declarations advection_schemes adams_bashforth end_run enforce_thickness boundaries exchange vorticity momentum io thickness bernoulli state_deriv time_stepping barotropic_mode model_main aronnax
TEST_objects = $(patsubst %, $(src_dir)%_TEST.o, $(FILES))
CORE_objects = $(patsubst %, $(src_dir)%_CORE.o, $(FILES))
PROF_objects = $(patsubst %, $(src_dir)%_PROF.o, $(FILES))
HYPRE_TEST_objects = $(patsubst %, $(src_dir)%_HYPRE_TEST.o, $(FILES))
HYPRE_CORE_objects = $(patsubst %, $(src_dir)%_HYPRE_CORE.o, $(FILES))
HYPRE_PROF_objects = $(patsubst %, $(src_dir)%_HYPRE_PROF.o, $(FILES))
# Profiling execuable
aronnax_prof: $(PROF_objects) Makefile
mpif90 $(PROF_objects) $(PROF_OPTS) -o $@ -cpp
%_PROF.o: %.f90
mpif90 $(PROF_OPTS) -J $(src_dir) -c $< -o $@ -cpp
# Testing executables with compile-time flags for catching errors
aronnax_test: $(TEST_objects) Makefile
mpif90 $(TEST_objects) $(TEST_OPTS) -o $@ -cpp
%_TEST.o: %.f90
mpif90 $(TEST_OPTS) -J $(src_dir) -c $< -o $@ -cpp
aronnax_external_solver_test: $(HYPRE_TEST_objects) Makefile
mpif90 $(HYPRE_TEST_objects) $(TEST_OPTS) -o $@ -cpp -DuseExtSolver $(LIBS)
%_HYPRE_TEST.o: %.f90
mpif90 $(TEST_OPTS) -J $(src_dir) -c $< -o $@ -cpp -DuseExtSolver $(LIBS)
# Highly optimised executables for faster simulations
aronnax_core: $(CORE_objects) Makefile
mpif90 $(CORE_objects) $(CORE_OPTS) -o $@ -cpp
%_CORE.o: %.f90
mpif90 $(CORE_OPTS) -J $(src_dir) -c $< -o $@ -cpp
aronnax_external_solver: $(HYPRE_CORE_objects) Makefile
mpif90 $(HYPRE_CORE_objects) $(CORE_OPTS) -o $@ -cpp -DuseExtSolver $(LIBS)
%_HYPRE_CORE.o: %.f90
mpif90 $(CORE_OPTS) -J $(src_dir) -c $< -o $@ -cpp -DuseExtSolver $(LIBS)
# shortcuts for removing compiled files
clean:
rm $(src_dir)*.o $(src_dir)*.gcno $(src_dir)*.gcda $(src_dir)*.mod