-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathMakefile
100 lines (88 loc) · 2.33 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
#==========================================================================
## Usage: compiles fortran code and links to FFTW
##
## Configured for two compiler options (variable FC): ifort and gfortran
#==========================================================================
TOP= ./
SRC= $(TOP)src/
BIN= $(TOP)bin/
OBJDIR= $(TOP)obj/
vpath %.mod $(OBJDIR)
vpath %.o $(OBJDIR)
vpath %.f90 $(SRC)
#==========================================================================
## for FFTW
INCFFTW= /usr/include
LIBFFTW= /lib/x86_64-linux-gnu
#==========================================================================
FC = gfortran#ifort#
FFLAGS= -g -fmax-errors=5 -O2
SYSLIB= -lfftw3
#==========================================================================
ifeq ($(FC),gfortran)
FFLAGS+= -std=f2008 -Wall -Wextra -fimplicit-none -fopenmp \
-ftree-vectorize -march=native \
-J$(OBJDIR)
#-fcheck=all
endif
ifeq ($(FC),ifort)
FFLAGS+= -std08 -ipo -warn declarations -warn all -qopenmp \
-module $(OBJDIR)
#-check-bounds
endif
#==========================================================================
RUN = $(BIN)default.run
MAIN = main.f90
OBJ= $(addprefix $(OBJDIR), \
mod_prec.o \
mod_params.o \
mod_field.o \
mod_fields_list.o \
mod_io.o \
mod_cheb_fftw.o \
mod_swal.o \
mod_bkgrd.o \
mod_ghp.o \
mod_metric_recon.o \
mod_scd_order_source.o \
mod_initial_data.o \
mod_teuk.o \
mod_write_level.o \
)
DEPS = $(addprefix $(SRC), \
mod_prec.f90 \
mod_params.f90 \
mod_field.f90 \
mod_fields_list.f90 \
mod_io.f90 \
mod_cheb_fftw.f90 \
mod_swal.f90 \
mod_bkgrd.f90 \
mod_ghp.f90 \
mod_metric_recon.f90 \
mod_scd_order_source.f90 \
initial_data.f90 \
mod_teuk.f90 \
mod_write_level.f90 \
)
#==========================================================================
all: $(RUN)
%.run: $(MAIN) $(OBJ)
$(FC) -o $(BIN)$@ $^ -I$(INCFFTW) -L$(LIBFFTW) $(SYSLIB) $(FFLAGS)
$(RUN): $(MAIN) $(OBJ)
$(FC) -o $@ $^ -I$(INCFFTW) -L$(LIBFFTW) $(SYSLIB) $(FFLAGS)
$(OBJDIR)%.o: %.f90
$(FC) $(FFLAGS) -I$(INCFFTW) -L$(LIBFFTW) $(SYSLIB) -c -o $@ $^
#==========================================================================
clean_obj:
rm -f $(OBJDIR)*.o
rm -f $(OBJDIR)*.mod
clean_bin:
rm -f $(BIN)*.run
clean_out:
rm -rf output/*
clean_all:
rm -f $(OBJDIR)*.o
rm -f $(OBJDIR)*.mod
rm -f $(BIN)*.run
rm -rf output/*