-
Notifications
You must be signed in to change notification settings - Fork 0
/
makefile.git
73 lines (55 loc) · 2.16 KB
/
makefile.git
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
# Set FORTRAN90 compiler
FC = gfortran
# Location of files for netcdf library
NETCDF = -I/usr/local/netcdf/include
NETCDFLIB = -L/usr/local/netcdf/lib -lnetcdff
# Set compiler flags
FFLAGS = -O3 -Wall -Wno-unused-variable -fcheck=all -Wtabs -Wextra -ffast-math -funroll-loops --param max-unroll-times=5
parallelflags = -fopenmp
# Set build parameters
TARGET = SFT_1D
# --------------------------------------------------
# Shouldn't need to touch below here
# --------------------------------------------------
OBJDIR = obj
BINDIR = bin
DOCDIR = doc
SRCDIR = src
OBJFILES = main.o variables.o write_data.o output.o grid_SFT.o flows.o evolSFT.o init_condition.o
FULLTARGET = $(BINDIR)/$(TARGET)
VPATH = $(SRCDIR):$(OBJDIR)
# Rule to build the fortran files
%.o: $(SRCDIR)/%.f90
@mkdir -p $(BINDIR) $(OBJDIR)
@cd $(SRCDIR)
$(FC) -c $(FFLAGS) $(NETCDF) $(parallelflags) -J $(OBJDIR) -o $(OBJDIR)/$@ $<
%.o: $(SRCDIR)/%.F90
@mkdir -p $(BINDIR) $(OBJDIR)
@cd $(SRCDIR)
$(FC) -c $(FFLAGS) $(NETCDF) $(parallelflags) -J $(OBJDIR) -o $(OBJDIR)/$@ $(PREPROFLAGS) $<
$(FULLTARGET): $(OBJFILES)
$(FC) $(parallelflags) $(FFLAGS) -J $(OBJDIR) -o $@ $(addprefix $(OBJDIR)/,$(OBJFILES)) $(NETCDFLIB)
.PHONEY: clean
clean:
@rm -rf *~ $(BINDIR) $(OBJDIR) *.sh.* *.log $(DOCDIR)/user*.pdf
PDF:
@cd doc; make pdf; make clean
.PHONEY: tidy
tidy:
@rm -rf $(OBJDIR) *.pbs.* *.sh.* $(SRCDIR)/*~ *.log
help:
@printf "\nusage : make <commands> \n\nthe following commands are available : \n\n"
@printf "<> : Generates the SFT executable in the bin directory.\n\n"
@printf "PDF : Creates the PDF documentation files in the doc directory.\n\n"
@printf "clean : Removes the executable and supporting compilation files.\n\n"
@printf "help : Shows the available commands.\n\n"
@printf "\n"
# All the dependencies
variables.o:variables.f90
output.o:output.f90 variables.o
grid_SFT.o:grid_SFT.f90 flows.o variables.o
write_data.o:write_data.f90 variables.o grid_SFT.o
flows.o:flows.f90 variables.o
evolSFT.o:evolSFT.f90 variables.o grid_SFT.o flows.o
init_condition.o:init_condition.f90 variables.o grid_SFT.o
main.o: main.f90 variables.o write_data.o output.o grid_SFT.o flows.o evolSFT.o init_condition.o