-
Notifications
You must be signed in to change notification settings - Fork 8
/
Makefile
161 lines (130 loc) · 3.92 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
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
#you probably shouldn't need to edit anything in here
-include config.mk
#-------------------------------------------------------------------------------
#local directory names
# include directory
di=include/ode
#source code directory
ds=src
#test code directory
dt=tests
#compiled object directory
do=obj
#compiled executable directory
db=bin
#-------------------------------------------------------------------------------
#stuff to compile
#modules with support functions or classes
auxil= ode_io.o \
ode_util.o \
ode_linalg.o
#base classes
base= ode_base.o \
ode_adaptive.o \
ode_embedded.o \
ode_rk.o \
ode_erk.o \
ode_irk.o \
ode_rosenbrock.o \
ode_newton.o \
#solver classes
solver= ode_euler.o \
ode_trapz.o \
ode_ssp_3.o \
ode_rkf_32.o \
ode_rk_4.o \
ode_rk_43.o \
ode_dopri_54.o \
ode_rkck.o \
ode_vern_65.o \
ode_vern_76.o \
ode_dopri_87.o \
ode_vern_98.o \
ode_grk4a.o \
ode_row6a.o \
ode_backward_euler.o \
ode_gauss_6.o \
ode_lobatto_iiic_6.o \
ode_radau_iia_5.o \
ode_geng_5.o \
ode_sdirk_43.o
#executables to be built for testing when `make tests` is used
execs= test_fixed.exe \
test_all.exe \
test_snaps.exe \
test_conv.exe \
test_adapt.exe \
test_stiff.exe \
test_work.exe \
test_linalg.exe \
test_newton.exe
#-------------------------------------------------------------------------------
#prepend appropriate directories to names
aux=$(patsubst %,$(do)/%,$(auxil))
bas=$(patsubst %,$(do)/%,$(base))
sol=$(patsubst %,$(do)/%,$(solver))
exe=$(patsubst %,$(db)/%,$(execs))
#-------------------------------------------------------------------------------
#make some short names for the base classes
B=ode_base
BA=ode_adaptive
BE=ode_embedded
BRK=ode_rk
BERK=ode_erk
BIRK=ode_irk
BR=ode_rosenbrock
N=ode_newton
NB=ode_newton_bridge
#-------------------------------------------------------------------------------
#automatic target for everything except the tests
all: $(db)/libode.a
#target for everything including tests
tests: all $(exe)
#-------------------------------------------------------------------------------
#compile objects
#auxils, the support functions and stuff don't have complicated dependencies
$(aux): $(do)/%.o: $(ds)/%.cc $(di)/%.h
$(CXX) $(CFLAGS) -o $@ -c $< -I$(di)
#OdeNewton
$(do)/$(N).o: $(ds)/$(N).cc $(di)/$(N).h $(di)/$(NB).h $(do)/ode_linalg.o
$(CXX) $(CFLAGS) -o $@ -c $< -I$(di)
#OdeBase
$(do)/$(B).o: $(ds)/$(B).cc $(di)/$(B).h $(do)/ode_io.o $(do)/ode_util.o
$(CXX) $(CFLAGS) -o $@ -c $< -I$(di)
#OdeAdaptive
$(do)/$(BA).o: $(ds)/$(BA).cc $(di)/$(BA).h $(do)/$(B).o $(do)/ode_io.o $(do)/ode_util.o
$(CXX) $(CFLAGS) -o $@ -c $< -I$(di)
#OdeRK
$(do)/$(BRK).o: $(ds)/$(BRK).cc $(di)/$(BRK).h
$(CXX) $(CFLAGS) -o $@ -c $< -I$(di)
#OdeERK
$(do)/$(BERK).o: $(ds)/$(BERK).cc $(di)/$(BERK).h
$(CXX) $(CFLAGS) -o $@ -c $< -I$(di)
#OdeIRK
$(do)/$(BIRK).o: $(ds)/$(BIRK).cc $(di)/$(BIRK).h
$(CXX) $(CFLAGS) -o $@ -c $< -I$(di)
#OdeEmbedded
$(do)/$(BE).o: $(ds)/$(BE).cc $(di)/$(BE).h $(do)/$(BA).o $(do)/ode_util.o
$(CXX) $(CFLAGS) -o $@ -c $< -I$(di)
#OdeRosenbrock
$(do)/$(BR).o: $(ds)/$(BR).cc $(di)/$(BR).h $(do)/ode_linalg.o
$(CXX) $(CFLAGS) -o $@ -c $< -I$(di)
#solver classes can all just depend on the base classes
$(sol): $(do)/%.o: $(ds)/%.cc $(di)/%.h $(bas)
$(CXX) $(CFLAGS) -o $@ -c $< -I$(di)
#-------------------------------------------------------------------------------
#create library of solvers from the compiled objects
$(db)/libode.a: $(bas) $(sol) $(aux)
ar r $(db)/libode.a $(aux) $(bas) $(sol)
#-------------------------------------------------------------------------------
#compile test programs
$(exe): $(db)/%.exe: $(dt)/%.cc $(sol) $(bas) $(aux) $(dt)/test_systems.h
$(CXX) $(CFLAGS) -o $@ $< -I$(di) -L$(db) -lode
#-------------------------------------------------------------------------------
#auxil things
#target to remove all the compiled files
clean:
-rm $(do)/*.o
-rm $(db)/*.exe
-rm $(db)/*.a
.PHONY: clean