-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
46 lines (32 loc) · 941 Bytes
/
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
# Fortran compiler
FC = gfortran
# Optimization flags
OPT = -O3 -fdefault-real-8 -fdefault-double-8
ifeq ($(BUILD), parallel)
PAR = -fopenmp
endif
ifeq ($(DEBUGMODE), 1)
DEBUG = -fbounds-check -fbacktrace -Wall
endif
# Glueing stuff together
FFLAGS = $(OPT) $(PAR) $(DEBUG)
# Source directory
SOURCE_DIR = sources
# Main source file
SRC_MAIN = $(SOURCE_DIR)/particle_code.f90
# Main executable
MAIN_EXE = particle_code
# Object files
OBJ_FILES = nrecip.o interpolation.o constants.o variables.o aerodynamics.o io.o memory.o coagulation.o
OBJ_MAIN = particle_code.o
all: $(MAIN_EXE) clean
$(MAIN_EXE): $(OBJ_FILES) $(OBJ_MAIN)
$(FC) $(FFLAGS) -o $(@) $(OBJ_FILES) $(OBJ_MAIN)
$(OBJ_FILES): $(SOURCE_DIR)/*.f90 Makefile
$(FC) $(FFLAGS) -c $(SOURCE_DIR)/$(@:%.o=%.f90)
$(OBJ_MAIN): $(SOURCE_DIR)/*.f90 Makefile
$(FC) $(FFLAGS) -c $(SRC_MAIN)
clean:
@rm -rf *.o *~ core *.mod
clobber:
@rm -rf *.o *~ core *.mod $(MAIN_EXE)