forked from TRACMASS/Tracmass_previous
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile.global
114 lines (95 loc) · 3.36 KB
/
Makefile.global
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
PROJMAKE := $(wildcard projects/$(PROJECT)/Makefile.prj)
CASEMAKE := $(wildcard projects/$(PROJECT)/$(CASE)Makefile.prj)
ifneq ($(strip $(CASEMAKE)),)
include projects/$(PROJECT)/$(CASE)Makefile.prj
else
ifneq ($(strip $(PROJMAKE)),)
include projects/$(PROJECT)/Makefile.prj
endif
endif
PROJECT_FLAG = -DPROJECT_NAME=\'$(PROJECT)\'
CASE_FLAG = -DCASE_NAME=\'$(CASE)\'
ARG_FLAGS = -DARG_INT1=$(INPUT_INT1) -DARG_INT2=$(INPUT_INT2)
OBJDIR := build_$(PROJECT)
ifeq ($(strip $(FF)),)
FF = $(F95COMPILER)
endif
ifeq ($(NETCDFLIBS),"none")
LIB_DIR =
INC_DIR =
ORM_FLAGS += -Dno_netcdf
endif
ifeq ($(NETCDFLIBS),"automatic")
LIB_DIR = $(shell nc-config --flibs)
INC_DIR = -I$(shell nc-config --includedir)
endif
ifeq ($(NETCDFLIBS),"automatic-44")
INC_DIR = $(shell nf-config --cflags)
LIB_DIR = $(shell nf-config --flibs)
endif
ifeq ($(NETCDFLIBS),"macports")
LIB_DIR = -L/opt/local/lib
INC_DIR = -I/opt/local/include/
LNK_FLAGS = -lnetcdf -lnetcdff
endif
ifeq ($(NETCDFLIBS),"gfdl")
LIB_DIR = -L/usr/local/x64/netcdf-4.2_optimized/lib
INC_DIR = -I/usr/local/x64/netcdf-4.2_optimized/include
LNK_FLAGS = -lnetcdf -lnetcdff
endif
ifeq ($(NETCDFLIBS),"fink")
LIB_DIR = -L/sw/lib # -L/sw/lib/netcdf-gfortran/lib
INC_DIR = -I/sw/include #-I/sw/lib/netcdf-gfortran/include
LNK_FLAGS = -lnetcdf -lnetcdff -lsz -Wl,-dead_strip_dylibs
endif
ifeq ($(F95COMPILER),"gfortran")
##### HEAD: Original Liz
# FF_FLAGS = -c -x f95-cpp-input -fconvert=big-endian -gdwarf-2
# FF_FLAGS = -O3 -c -x f95-cpp-input #-gdwarf-2
# F90_FLAGS = -fno-underscoring
#### NEW STUF
# FF_FLAGS = -O0 -c -x f95-cpp-input -g -fbacktrace
FF_FLAGS = -O0 -c -x f95-cpp-input -g -fbacktrace -fbounds-check
# FF_FLAGS = -O3 -c -x f95-cpp-input
F90_FLAGS = -fno-underscoring
### upstream/ver_6
FF += $(LIB_DIR) $(INC_DIR) $(F90_FLAGS) $(ORM_FLAGS) -pg -J$(OBJDIR)
endif
ifeq ($(F95COMPILER),"g95")
FF_FLAGS = -c -cpp -fendian=big
F90_FLAGS = -O3 -C -g -fno-underscoring
FF += $(LIB_DIR) $(INC_DIR) $(F90_FLAGS) $(ORM_FLAGS)
endif
ifeq ($(F95COMPILER),"ifort")
FF_FLAGS = -O3 -c -cpp -convert big_endian
F90_FLAGS = -free
# F90_FLAGS = -free -assume nounderscore
ARG_FLAGS += -Tf
FF += $(LIB_DIR) $(INC_DIR) $(F90_FLAGS) $(ORM_FLAGS)
endif
CC = gcc -O $(INC_DIR)
ACTVEL = empty.o
VPATH = src:projects/$(PROJECT):src/active_particles
all: runfile
objects := $(addprefix $(OBJDIR)/,modules.o savepsi.o loop_pos.o writetrajs.o \
seed.o init_seed.o sw_stat.o $(ACTVEL) getfile.o \
vertvel.o coord.o cross.o init_par.o time_subs.o \
interp.o interp2.o pos.o \
sw_seck.o sw_pres.o sw_dens0.o \
writepsi.o writetracer.o printinfo.o loop.o main.o \
setupgrid.o readfield.o diffusion.o)
runfile : $(objects)
$(FF) $(MYI_FLAGS) -o $(RUNFILE) $(objects) $(LNK_FLAGS) $(MYL_FLAGS)
$(OBJDIR)/%.o : %.f95
$(FF) $(FF_FLAGS) $(ORM_FLAGS) $(PROJECT_FLAG) $(CASE_FLAG) $(ARG_FLAGS) $< -o $@
$(objects) : | $(OBJDIR)
$(OBJDIR):
mkdir -p $(OBJDIR)
.PHONY : clean
clean :
-rm -rf $(OBJDIR)
-rm *.mod
-rm $(RUNFILE)
.PHONY : clean2
clean2:
-rm *.mod