Makefile 10.1 KB
Newer Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
SHELL = /bin/sh

# ============================================================================
# ===== flags and directories (to be modified by the user) ===================
# ============================================================================

USE_PARALLEL_AMDIS = 0      # 1 if AMDiS was compiled with parallel support, 0 otherwise
USE_OPENMP = 0              # 1 if AMDiS was compiled with OpenMP support, 0 otherwise
USE_UMFPACK = 0             # 1 if AMDiS was compiled with the UMFPACK library, 0 otherwise
USE_SERVER =                # mars, deimos or themisto. If no special server blank
USE_COMPILER = gcc          # gcc  or icc
USE_SMI = 0
USE_MPCCI = 0
DEBUG = 0

AMDIS_DIR = /usr/local/AMDiS
17
18
MPI_DIR =
SMI_DIR = 
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
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
MPCCI_DIR = 





# ============================================================================
#                 !!! Do not edit the file after this line !!!
# ============================================================================





PARMETIS_DIR = $(AMDIS_DIR)/lib/ParMetis-3.1

# ============================================================================
# ===== includes pathes ======================================================
# ============================================================================

AMDIS_INCLUDE = -I$(AMDIS_DIR)/src
SMI_INCLUDE = -I$(SMI_DIR)/smi 
MPCCI_INCLUDE = -I$(MPCCI_DIR)/include
PARMETIS_INCLUDE = -I$(PARMETIS_DIR)
PARALLEL_INCLUDE = -I$(AMDIS_DIR)/src/parallel

INCLUDES = -I. $(AMDIS_INCLUDE) $(SMI_INCLUDE) $(MPCCI_INCLUDE) -I$(SMI_DIR)/etc/commoncpp/include $(PARALLEL_INCLUDE)

# ============================================================================
# ===== libraries ============================================================
# ============================================================================

AMDIS_LIB =  -L$(AMDIS_DIR)/lib -lamdis
PNG_LIB = -lpng

UMFPACK_LIB = -L$(AMDIS_DIR)/lib/AMD/Lib -L$(AMDIS_DIR)/lib/UMFPACK/Lib
ifeq ($(strip $(USE_SERVER)), mars)
	UMFPACK_LIB += -lmkl
else
	ifeq ($(strip $(USE_SERVER)), themisto)
		UMFPACK_LIB += $(MKL_LIB) -lmkl -lguide -lpthread
	else	
		UMFPACK_LIB += -lblas
	endif
endif
UMFPACK_LIB += -lumfpack -lamd

SMI_LIB = -L$(SMI_DIR)/lib -lsmi
MPCCI_LIB = -L$(MPCCI_DIR)/lib/linux-x86-glibc22 -lmpcci
PARMETIS_LIB = -L$(PARMETIS_DIR) -lparmetis -lmetis

LIBS = $(AMDIS_LIB) $(PNG_LIB)

ifeq ($(strip $(USE_UMFPACK)), 1)
	LIBS += $(UMFPACK_LIB)
endif

ifeq ($(strip $(USE_SMI)), 1)
	LIBS += $(SMI_LIB) 
endif

ifeq ($(strip $(USE_MPCCI)), 1)
	LIBS += $(MPCCI_LIB) 
endif



# ============================================================================
# ===== parallel or sequential ? =============================================
# ============================================================================

ifeq ($(strip $(USE_PARALLEL_AMDIS)), 1)
	ifeq ($(strip $(USE_SERVER)), mars)
		ifeq ($(strip $(USE_COMPILER)), gcc)
			COMPILE = g++
		else
			COMPILE = icpc
		endif
	else
		COMPILE = $(MPI_DIR)/bin/mpiCC
	endif

	LIBS += $(PARMETIS_LIB)
else
	ifeq ($(strip $(USE_COMPILER)), gcc)
		COMPILE = g++
	else
		COMPILE = icpc
	endif
endif

# ============================================================================
# ===== compile flags ========================================================
# ============================================================================

ifeq ($(strip $(DEBUG)), 0)
       CPPFLAGS = -O2
else
       CPPFLAGS = -g -O0
endif

ifeq ($(strip $(USE_OPENMP)), 1)
	ifeq ($(strip $(USE_COMPILER)), gcc)
		CPPFLAGS += -fopenmp
	else
		CPPFLAGS += -openmp
	endif
endif


# ============================================================================
# ===== libtool linking ======================================================
# ============================================================================

LIBTOOL = $(AMDIS_DIR)/libtool
LINK = $(LIBTOOL) --mode=link $(COMPILE)

# ============================================================================
# ===== rules ================================================================
# ============================================================================

all : 
	make $(PROGRAMS)

clean: 
	-rm -rf *.o
	-rm -rf $(PROGRAMS)

.cc.o: $*.cc
	$(COMPILE) $(DEFS) $(INCLUDES) $(CPPFLAGS) -c -o $*.o $^ 


# ============================================================================
# ===== user programs ========================================================
# ============================================================================

PROGRAMS = ellipt nonlin heat vecellipt vecnonlin vecheat sphere ball smitest parametric torus bunny navierstokes stokesnonlin vecmultigrid

VPATH = .:./src:/solhome/vey/sourcen/currentcvs/AMDiS/src

# ===== ellipt ============================================================

ELLIPT_OFILES = ellipt.o

ellipt: $(ELLIPT_OFILES)
	$(LINK) $(CPPFLAGS) -o ellipt $(ELLIPT_OFILES) $(LIBS)

# ===== nonlin ============================================================

NONLIN_OFILES = nonlin.o

nonlin: $(NONLIN_OFILES)
	$(LINK) $(CPPFLAGS) $(LDFLAGS) -o nonlin $(NONLIN_OFILES) $(LIBS)

# ===== heat ============================================================

HEAT_OFILES = heat.o

heat: 	$(HEAT_OFILES)
	$(LINK) $(CPPFLAGS) $(LDFLAGS) -o heat $(HEAT_OFILES) $(LIBS)

# ===== vecellipt ============================================================

VECELLIPT_OFILES = vecellipt.o

vecellipt: $(VECELLIPT_OFILES)
	$(LINK) $(CPPFLAGS) $(LDFLAGS) -o vecellipt $(VECELLIPT_OFILES) $(LIBS)

# ===== vecnonlin ============================================================

VECNONLIN_OFILES = vecnonlin.o

vecnonlin: $(VECNONLIN_OFILES)
	$(LINK) $(CPPFLAGS) $(LDFLAGS) -o vecnonlin $(VECNONLIN_OFILES) $(LIBS)

# ===== vecheat ============================================================

VECHEAT_OFILES = vecheat.o

vecheat: $(VECHEAT_OFILES)
	$(LINK) $(CPPFLAGS) $(LDFLAGS) -o vecheat $(VECHEAT_OFILES)  $(LIBS)

# ===== vecmultigrid ============================================================

VECMULTIGRID_OFILES = vecmultigrid.o

vecmultigrid: $(VECMULTIGRID_OFILES)
	$(LINK) $(CPPFLAGS) $(LDFLAGS) -o vecmultigrid $(VECMULTIGRID_OFILES) $(LIBS)

# ===== sphere ============================================================

SPHERE_OFILES = sphere.o

sphere: $(SPHERE_OFILES)
	$(LINK) $(CPPFLAGS) $(LDFLAGS) -o sphere $(SPHERE_OFILES) $(LIBS)

# ===== bunny ============================================================

BUNNY_OFILES = bunny.o

bunny: $(BUNNY_OFILES)
	$(LINK) $(CPPFLAGS) $(LDFLAGS) -o bunny $(BUNNY_OFILES) $(LIBS)

# ===== torus ============================================================

TORUS_OFILES = torus.o

torus: $(TORUS_OFILES)
	$(LINK) $(CPPFLAGS) $(LDFLAGS) -o torus $(TORUS_OFILES) $(AMDIS_LIB) $(LIBS)

# ===== ball ============================================================

BALL_OFILES = ball.o

ball: $(BALL_OFILES)
	$(LINK) $(CPPFLAGS) $(LDFLAGS) -o ball $(BALL_OFILES) $(LIBS)

# ===== parametric ============================================================

PARAMETRIC_OFILES = parametric.o

parametric: $(PARAMETRIC_OFILES)
	$(LINK) $(CPPFLAGS) $(LDFLAGS) -o parametric $(PARAMETRIC_OFILES) $(LIBS)

# ===== navierstokes ========================================================

NAVIERSTOKES_OFILES = navierstokes.o

navierstokes: $(NAVIERSTOKES_OFILES)
	$(LINK) $(CPPFLAGS) $(LDFLAGS) -o navierstokes $(NAVIERSTOKES_OFILES)  $(LIBS)

# ===== stokes non linear========================================================

STOKESNONLIN_OFILES = stokesnonlin.o

stokesnonlin: $(STOKESNONLIN_OFILES)
	$(LINK) $(CPPFLAGS) $(LDFLAGS) -o stokesnonlin $(STOKESNONLIN_OFILES)  $(LIBS)

# ===== smitest ============================================================

SMITEST_OFILES = smitest.o

smitest: $(SMITEST_OFILES)
	$(LINK) $(CPPFLAGS) $(LDFLAGS) -o smitest $(INCLUDES) $(SMITEST_OFILES) $(SMI_LIB)

# ===== mpccitest ============================================================

MPCCITEST_OFILES = mpccitest.o SMIAdapter.o MpCCIAdapter.o

mpccitest: $(MPCCITEST_OFILES)
	$(LINK) $(CPPFLAGS) $(LDFLAGS) -o mpccitest $(INCLUDES) $(MPCCITEST_OFILES) $(LIBS) $(MPCCI_LIB) $(SMI_LIB)

# ===== mpcci1 ============================================================

MPCCI1_OFILES = mpcci1.o SMIAdapter.o MpCCIAdapter.o

mpcci1: $(MPCCI1_OFILES)
	$(LINK) $(CPPFLAGS) $(LDFLAGS) -o mpcci1 $(INCLUDES) $(MPCCI1_OFILES) $(LIBS) $(MPCCI_LIB) $(SMI_LIB)

# ===== mpcci2 ============================================================

MPCCI2_OFILES = mpcci2.o SMIAdapter.o MpCCIAdapter.o

mpcci2: $(MPCCI2_OFILES)
	$(LINK) $(CPPFLAGS) $(LDFLAGS) -o mpcci2 $(INCLUDES) $(MPCCI2_OFILES) $(LIBS) $(MPCCI_LIB) $(SMI_LIB)

# ===== periodic ============================================================

PERIODIC_OFILES = periodic.o

periodic: $(PERIODIC_OFILES)
	$(LINK) $(CPPFLAGS) $(LDFLAGS) -o periodic $(INCLUDES) $(PERIODIC_OFILES) $(LIBS)

# ===== multigrid ============================================================

MULTIGRID_OFILES = multigrid.o

multigrid: $(MULTIGRID_OFILES)
	$(LINK) $(CPPFLAGS) $(LDFLAGS) -o multigrid $(INCLUDES) $(MULTIGRID_OFILES) $(LIBS)

# ===== bmp2amdis ============================================================

BMP2AMDIS_OFILES = bmp2amdis.o EasyBMP.o

bmp2amdis: $(BMP2AMDIS_OFILES)
	$(LINK) $(CPPFLAGS) $(LDFLAGS) -o bmp2amdis $(INCLUDES) $(BMP2AMDIS_OFILES) $(LIBS)

# ===== parallelellipt =======================================================

PARALLELELLIPT_OFILES = parallelellipt.o

parallelellipt: $(PARALLELELLIPT_OFILES)
	$(LINK) $(CPPFLAGS) -o parallelellipt $(PARALLELELLIPT_OFILES) $(LIBS) $(PARMETIS_LIB)

# ===== parallelheat =======================================================

PARALLELHEAT_OFILES = parallelheat.o

parallelheat: $(PARALLELHEAT_OFILES)
	$(LINK) $(CPPFLAGS) -o parallelheat $(PARALLELHEAT_OFILES) $(LIBS) $(PARMETIS_LIB)

# ===== couple ============================================================

COUPLE_OFILES = couple.o

couple: $(COUPLE_OFILES)
	$(LINK) $(CPPFLAGS) -o couple $(COUPLE_OFILES) $(LIBS)

# ===== nonlin2 ============================================================

NONLIN3_OFILES = nonlin3.o

nonlin3: $(NONLIN3_OFILES)
	$(LINK) $(CPPFLAGS) -o nonlin3 $(NONLIN3_OFILES) $(LIBS)

# ===== neumann ============================================================

NEUMANN_OFILES = neumann.o

neumann: $(NEUMANN_OFILES)
	$(LINK) $(CPPFLAGS) -o neumann $(NEUMANN_OFILES) $(LIBS)