-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathMakefile
206 lines (160 loc) · 4.88 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
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
# ------------------------------------------------------------
# Components of the main library
# ------------------------------------------------------------
ULMSP_STORAGE = \
Lib/storage/coo.c \
Lib/storage/crs.c \
Lib/storage/realvector.c \
Lib/storage/indexvector.c \
Lib/storage/realmatrix.c \
Lib/storage/indexmatrix.c \
ULMSP_OPS= \
Lib/ops/gecoomv.c \
Lib/ops/gecrsmv.c \
ULMSP_SOLVERS= \
Lib/solvers/cgcrs.c \
Lib/solvers/cgcoo.c \
Lib/solvers/gausscrs.c \
Lib/solvers/gscrs.c \
Lib/solvers/precs.c \
Lib/solvers/multigrid.c \
ULMSP_SETTINGS= \
Lib/settings.c
ULMSP_MESH= \
Lib/mesh/mesh.c \
SOURCES_libulmsp := \
$(ULMSP_STORAGE) \
$(ULMSP_OPS) \
$(ULMSP_SOLVERS) \
$(ULMSP_MESH) \
$(ULMSP_SETTINGS) \
HEADERS_libulmsp := $(SOURCES_libulmsp:.c=.h)
OBJECTS_libulmsp := $(SOURCES_libulmsp:.c=.o)
DEPENDENCIES_libulmsp := $(SOURCES_libulmsp:.c=.d)
# ------------------------------------------------------------
# Test programs
# ------------------------------------------------------------
SOURCES_stable := \
Tests/setup_coo.c \
Tests/setup_crs.c \
Tests/setup_realvector.c \
Tests/laplace_crs.c \
Tests/coo2crs.c \
Tests/testSolveGauss.c \
Tests/refinetria.c \
Tests/solveLaplace.c \
Tests/solveLaplaceL.c \
Tests/solveLaplace_multigrid.c \
SOURCES_tests = $(SOURCES_stable) \
OBJECTS_tests := \
$(SOURCES_tests:.c=.o)
DEPENDENCIES_tests := \
$(SOURCES_tests:.c=.d)
PROGRAMS_tests := \
$(SOURCES_tests:.c=)
# ------------------------------------------------------------
# All files
# ------------------------------------------------------------
SOURCES := \
$(SOURCES_libulmsp) \
$(SOURCES_tests)
HEADERS := \
$(HEADER_libulmsp)
OBJECTS := \
$(OBJECTS_libulmsp) \
$(OBJECTS_tests)
DEPENDENCIES := \
$(DEPENDENCIES_libulmsp) \
$(DEPENDENCIES_tests)
PROGRAMS := \
$(PROGRAMS_tests)
# ------------------------------------------------------------
# Standard target
# ------------------------------------------------------------
all: programs
# ------------------------------------------------------------
# Build configuration
# ------------------------------------------------------------
$(OBJECTS): options.inc
include options.inc
# ------------------------------------------------------------
# System-dependent parameters (e.g., name of compiler)
# ------------------------------------------------------------
$(OBJECTS): system.inc
include system.inc
# ------------------------------------------------------------
# System-independent configuration (e.g., variants of algorithms)
# ------------------------------------------------------------
# ------------------------------------------------------------
# Rules for test programs
# ------------------------------------------------------------
programs: $(PROGRAMS_tests)
$(PROGRAMS_tests): %: %.o
ifdef BRIEF_OUTPUT
@echo Linking $@
@$(CC) $(LDFLAGS) -Wl,-L,.,-rpath,. $< -o $@ -lulmsp $(LIBS)
else
$(CC) $(LDFLAGS) -Wl,-L,.,-rpath,. $< -o $@ -lulmsp $(LIBS)
endif
$(PROGRAMS_tests) $(PROGRAMS_tools): libulmsp.a
$(OBJECTS_tests): %.o: %.c
ifdef BRIEF_OUTPUT
@echo Compiling $<
@$(GCC) -MT $@ -MM -I Lib -I Lib/storage -I Lib/ops -I Lib/solvers \
-I Lib/mesh \
$< > $(<:%.c=%.d)
@$(CC) $(CFLAGS) -I Lib -I Lib/storage -I Lib/ops -I Lib/solvers \
-I Lib/mesh \
-c $< -o $@
else
@$(GCC) -MT $@ -MM -I Lib -I Lib/storage -I Lib/ops -I Lib/solvers \
-I Lib/mesh \
$< > $(<:%.c=%.d)
$(CC) $(CFLAGS) -I Lib -I Lib/storage -I Lib/ops -I Lib/solvers \
-I Lib/mesh \
-c $< -o $@
endif
-include $(DEPENDENCIES_tests) $(DEPENDENCIES_tools)
$(OBJECTS_tests): Makefile
# ------------------------------------------------------------
# Rules for the Doxygen documentation
# ------------------------------------------------------------
doc:
doxygen Doc/doxyfile
# ------------------------------------------------------------
# Rules for the main library
# ------------------------------------------------------------
libulmsp.a: $(OBJECTS_libulmsp)
ifdef BRIEF_OUTPUT
@echo Building $@
@$(AR) $(ARFLAGS) $@ $(OBJECTS_libulmsp)
else
$(AR) $(ARFLAGS) $@ $(OBJECTS_libulmsp)
endif
$(OBJECTS_libulmsp): %.o: %.c
ifdef BRIEF_OUTPUT
@echo Compiling $<
@$(GCC) -MT $@ -MM -I Lib -I Lib/storage -I Lib/ops -I Lib/solvers \
-I Lib/mesh \
$< > $(<:%.c=%.d)
@$(CC) $(CFLAGS) -I Lib -I Lib/storage -I Lib/ops -I Lib/solvers \
-I Lib/mesh \
-c $< -o $@
else
@$(GCC) -MT $@ -MM -I Lib -I Lib/storage -I Lib/ops -I Lib/solvers \
-I Lib/mesh \
$< > $(<:%.c=%.d)
$(CC) $(CFLAGS) -I Lib -I Lib/storage -I Lib/ops -I Lib/solvers \
-I Lib/mesh \
-c $< -o $@
endif
-include $(DEPENDENCIES_libulmsp)
$(OBJECTS_libulmsp): Makefile
# ------------------------------------------------------------
# Useful additions
# ------------------------------------------------------------
.PHONY: clean cleandoc programs indent
clean:
$(RM) -f $(OBJECTS) $(DEPENDENCIES) $(PROGRAMS) libulmsp.a
cleandoc:
$(RM) -rf Doc/html Doc/latex