-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathMakefile
64 lines (49 loc) · 1.73 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
#compiler
CXX=g++
#compiler CFLAGS
CFLAGS=-Wall -Wextra -pedantic -O3
#openmp flag
omp=-fopenmp
#path to top libode directory
odepath=../../../code/libode
#-------------------------------------------------------------------------------
#local directories
#source code directory
dirs=src
#built object directory
diro=obj
#built executable directory
dirb=bin
#CFLAGS to include libode
odesrc=-I$(odepath)/src
odelib=-L$(odepath)/bin -lode
#-------------------------------------------------------------------------------
#stuff to compile
#independent objects to compile
obj=$(diro)/io.o $(diro)/util.o $(diro)/settings.o
#model object
mod=$(diro)/grid.o $(diro)/richards.o
#default targets
all: libodemake \
$(dirb)/richards.exe \
$(dirb)/richards_periodic.exe \
$(dirb)/richards_periodic_batch.exe
#-------------------------------------------------------------------------------
#compilation rules
libodemake:
$(MAKE) -C $(odepath)
$(obj): $(diro)/%.o: $(dirs)/%.cc $(dirs)/%.h
$(CXX) $(CFLAGS) -o $@ -c $< -I$(dirs)
$(diro)/grid.o: $(dirs)/grid.cc $(dirs)/grid.h $(diro)/io.o
$(CXX) $(CFLAGS) -o $@ -c $< -I$(dirs)
$(diro)/richards.o: $(dirs)/richards.cc $(dirs)/richards.h $(dirs)/grid.h $(obj) $(diro)/grid.o $(libodemake)
$(CXX) $(CFLAGS) -o $@ -c $< -I$(dirs) $(odesrc) $(odelib)
$(dirb)/richards.exe: $(dirs)/main.cc $(obj) $(mod)
$(CXX) $(CFLAGS) -o $@ $< $(obj) $(mod) -I$(dirs) $(odesrc) $(odelib)
$(dirb)/richards_periodic.exe: $(dirs)/main_periodic.cc $(obj) $(mod)
$(CXX) $(CFLAGS) -o $@ $< $(obj) $(mod) -I$(dirs) $(odesrc) $(odelib)
$(dirb)/richards_periodic_batch.exe: $(dirs)/main_periodic_batch.cc $(obj) $(mod)
$(CXX) $(CFLAGS) $(omp) -o $@ $< $(obj) $(mod) -I$(dirs) $(odesrc) $(odelib)
.PHONY : clean
clean:
rm obj/* bin/*