source: trunk/src/mesh/Makefile @ 246

Last change on this file since 246 was 240, checked in by cxsong, 18 years ago

added new test files

File size: 13.8 KB
Line 
1# you need to change this to where your version of python is installed.
2# tell make where to find python header files
3RP_INSTALL_BASE = /opt/rappture
4
5# tell make where to find the expat & libscew sources
6INCL_RP_DEPS    = -I$(RP_INSTALL_BASE)/include
7
8#EXPAT_HEADERS   = $(RP_INSTALL_BASE)/include
9#LIB_EXPAT_INCL  = -I $(EXPAT_HEADERS)
10#SCEW_HEADERS    = $(RP_INSTALL_BASE)/include/scew
11#LIB_SCEW_INCL   = -I $(SCEW_HEADERS) -I $(EXPAT_HEADERS)
12
13LIB_SCEW_FLAG   = -L$(RP_INSTALL_BASE)/lib -lscew
14
15#LIB_SCEW_FLAG   = /opt/rappture/lib/libscew.a
16#LIB_SCEW_FLAG   = -static -L/opt/rappture/lib -lscew
17
18
19# everything below should be ok, but check to make sure
20#
21# define the top of our directory structure
22# replace this with the full path of the directory
23# containing the rappture directory
24TOP_DIR         = /home/cxsong
25
26# define the top of the rappture directory structure
27RP_BASE   = $(TOP_DIR)/rappture
28
29# define which programs can be made
30PROGS           =   librpmesh
31TEST_PROGS =    test_node2d \
32                test_node3d \
33                test_element \
34                test_elem2 \
35                test_mesh
36
37# define our compiling environment
38#
39CC              = gcc
40CXX             = g++
41DEBUG           = -g -Wall $(DEBUG_PLUS)
42DEBUG_PLUS      = -DDEBUG
43PY              = $(RP_INSTALL_BASE)/bin/python
44MEX             = mex
45OCT             = mkoctfile
46LN              = ln
47
48# define our directories
49#
50INCLUDES_DIR    = $(RP_BASE)/include
51BIN_DIR         = $(RP_BASE)/bin
52LIB_DIR         = $(RP_BASE)/src
53SRC_DIR         = $(RP_BASE)/src
54TEST_DIR        = $(RP_BASE)/test
55
56MESH_SRC        = $(SRC_DIR)/mesh
57CORE_SRC        = $(SRC_DIR)/core
58FORT_SRC        = $(SRC_DIR)/fortran
59CEE_SRC         = $(SRC_DIR)/cee
60PY_SRC          = $(SRC_DIR)/python
61MATLAB_SRC      = $(SRC_DIR)/matlab
62OCTAVE_SRC      = $(SRC_DIR)/octave
63
64LIB_INC_PREFIX  = -Wl,-rpath,$(LIB_DIR) -L$(LIB_DIR)
65LIB_RP_OBJECTS  = $(LIB_INC_PREFIX) -lRpObjects
66LIB_RAPPTURE    = -Wl,-rpath,$(LIB_DIR) -L$(LIB_DIR) -lrappture
67LIB_RPMESH      = -Wl,-rpath,$(LIB_DIR) -L/$(LIB_DIR) -lrpmesh
68
69INCL_CORE       = -I$(INCLUDES_DIR)/core
70INCL_CEE        = -I$(INCLUDES_DIR)/cee
71INCL_FORTRAN    = -I$(INCLUDES_DIR)/fortran
72INCL_PY         = -I$(INCLUDES_DIR)/python
73INCL_MATLAB     = -I$(INCLUDES_DIR)/matlab
74INCL_OCTAVE     = -I$(INCLUDES_DIR)/octave
75
76CFLAGS = -fPIC
77
78# default:
79
80all: ${PROGS}
81
82test: ${TEST_PROGS}
83
84#install: install_py install_rappture install_rpobjs install_matlab install_octave
85
86RP_IO_DEPS      = RpLibrary.o RpLibraryCInterface.o RpLibraryFInterface.o \
87                  scew_extras.o
88RP_UNITS_DEPS   = RpUnitsStd.o RpUnits.o RpUnitsCInterface.o RpUnitsFInterface.o
89RP_OTHER_DEPS   = RpFortranCommon.o RpBindingsDict.o
90RP_OBJS_DEP     = RpVariable.o RpAbout.o RpNumber.o RpString.o RpBoolean.o \
91                  RpChoice.o RpOption.o RpUnitsStd.o RpUnits.o #RpValue.o\
92                  # RpValueDouble.o RpValueString.o
93RP_MESH_DEPS = util.o grid1d.o grid1d_reg.o grid2d.o node3d.o node2d.o element.o mesh.o #field.o endian.o
94
95LDLIB_MACOSX = -dynamiclib -o $(LIB_DIR)/$@.dylib
96LDLIB_LINUX = -shared -Wl,-rpath,$(LIB_DIR)/ -Wl,-soname,$@.so -o $(LIB_DIR)/$@.so.0.0
97LDLIB_LINUX_MESH = -shared -Wl,-rpath,$(LIB_DIR)/mesh/ -Wl,-soname,$@.so -o $(LIB_DIR)/mesh/$@.so.0.0
98
99# include rappture library definitions
100
101#### librappture shared object ###########################################
102
103librpmesh: $(RP_MESH_DEPS)
104        if test "`uname`" == "Darwin"; then \
105                $(CXX) $(DEGUG) $(LDLIB_MACOSX) $^ $(LIB_SCEW_FLAG) -lm; \
106                ar -r $@.a $^; \
107                ranlib -s $@.a; \
108        else \
109                $(CXX) $(DEGUG) $(LDLIB_LINUX) $^; \
110                /sbin/ldconfig -n $(LIB_DIR); \
111                ar -r $@.a $^; \
112                ranlib $@.a; \
113        fi
114librappture: $(RP_IO_DEPS) $(RP_UNITS_DEPS) $(RP_OTHER_DEPS)
115        if test "`uname`" == "Darwin"; then \
116                $(CXX) $(DEGUG) $(LDLIB_MACOSX) $^ $(LIB_SCEW_FLAG) -lm; \
117                ar -r $@.a $^; \
118                ranlib -s $@.a; \
119        else \
120                $(CXX) $(DEGUG) $(LDLIB_LINUX) $^ $(LIB_SCEW_FLAG) -lm; \
121                /sbin/ldconfig -n $(LIB_DIR); \
122                ar -r $@.a $^; \
123                ranlib $@.a; \
124        fi
125
126install_rappture: librappture
127        if test "`uname`" == "Darwin"; then \
128                cp $<.dylib $(RP_INSTALL_BASE)/lib; \
129                cp $<.a $(RP_INSTALL_BASE)/lib; \
130        else \
131                cp -d $<.so* $(RP_INSTALL_BASE)/lib; \
132                cp -d $<.a $(RP_INSTALL_BASE)/lib; \
133        fi
134
135#### libRpObjects ########################################################
136libRpObjects: $(RP_OBJS_DEP)
137        if test "`uname`" == "Darwin"; then \
138                $(CXX) $(DEGUG) $(LDLIB_MACOSX) $^ -lstdc++; \
139        else \
140                $(CXX) $(DEGUG) $(LDLIB_LINUX) $^ -lstdc++; \
141                /sbin/ldconfig -n $(LIB_DIR); \
142        fi
143
144install_rpobjs: libRpObjects
145        if test "`uname`" == "Darwin"; then \
146                cp $<.dylib $(RP_INSTALL_BASE)/lib; \
147        else \
148                cp -d $<.so* $(RP_INSTALL_BASE)/lib; \
149        fi
150
151#### Python ########################################################
152Rappture.Units: RpUnits.o RpUnitsStd.o
153        $(PY) $(PY_SRC)/setup.py build
154
155install_py: RpUnits.o RpUnitsStd.o
156        $(PY) $(PY_SRC)/setup.py install
157
158
159#### Matlab ########################################################
160install_matlab: librappture RpMatlab
161        if test ! -d $(RP_INSTALL_BASE)/lib/matlab; then \
162                mkdir $(RP_INSTALL_BASE)/lib/matlab; \
163        fi
164        cp -d $(MATLAB_SRC)/*.mex* $(RP_INSTALL_BASE)/lib/matlab
165
166#### Octave ########################################################
167install_octave: librappture RpOctave
168        if test ! -d $(RP_INSTALL_BASE)/lib/octave; then \
169                mkdir $(RP_INSTALL_BASE)/lib/octave; \
170        fi
171        cp -d $(OCTAVE_SRC)/*.oct* $(RP_INSTALL_BASE)/lib/octave
172
173
174###############################################
175# include mesh objects
176#
177grid2d.o: grid2d.cc
178        $(CXX) $(CFLAGS) $(DEBUG) -c $?
179grid1d.o: grid1d.cc
180        $(CXX) $(CFLAGS) $(DEBUG) -c $?
181grid1d_reg.o: grid1d_reg.cc
182        $(CXX) $(CFLAGS) $(DEBUG) -c $?
183util.o: util.cc
184        $(CXX) $(CFLAGS) $(DEBUG) -c $?
185node2d.o: node2d.cc
186        $(CXX) $(CFLAGS) $(DEBUG) -c $?
187node3d.o: node3d.cc
188        $(CXX) $(CFLAGS) $(DEBUG) -c $?
189endian.o: endian.cc
190        $(CXX) $(CFLAGS) $(DEBUG) -c $?
191element.o: element.cc
192        $(CXX) $(CFLAGS) $(DEBUG) -c $?
193mesh.o: mesh.cc
194        $(CXX) $(CFLAGS) $(DEBUG) -c $?
195
196# include core source files
197
198RpLibrary.o: $(CORE_SRC)/RpLibrary.cc
199        $(CXX) $(CFLAGS) $(DEBUG) $(INCL_CORE) $(INCL_RP_DEPS) -o $@ -c $?
200
201scew_extras.o: $(CORE_SRC)/scew_extras.c
202        $(CC) $(CFLAGS) $(DEBUG) $(INCL_CORE) $(INCL_RP_DEPS) -o $@ -c $?
203
204RpVariable.o: $(CORE_SRC)/RpVariable.cc
205        $(CXX) $(CFLAGS) $(DEBUG) $(INCL_CORE) -o $@ -c $?
206
207RpAbout.o: $(CORE_SRC)/RpAbout.cc
208        $(CXX) $(CFLAGS) $(DEBUG) $(INCL_CORE) -o $@ -c $?
209
210RpNumber.o: $(CORE_SRC)/RpNumber.cc
211        $(CXX) $(CFLAGS) $(DEBUG) $(INCL_CORE) -o $@ -c $?
212
213RpString.o: $(CORE_SRC)/RpString.cc
214        $(CXX) $(CFLAGS) $(DEBUG) $(INCL_CORE) -o $@ -c $?
215
216RpBoolean.o: $(CORE_SRC)/RpBoolean.cc
217        $(CXX) $(CFLAGS) $(DEBUG) $(INCL_CORE) -o $@ -c $?
218
219RpChoice.o: $(CORE_SRC)/RpChoice.cc
220        $(CXX) $(CFLAGS) $(DEBUG) $(INCL_CORE) -o $@ -c $?
221
222RpOption.o: $(CORE_SRC)/RpOption.cc
223        $(CXX) $(CFLAGS) $(DEBUG) $(INCL_CORE) -o $@ -c $?
224
225RpUnitsStd.o: $(CORE_SRC)/RpUnitsStd.cc
226        $(CXX) $(CFLAGS) $(DEBUG) $(INCL_CORE) -o $@ -c $?
227
228RpUnits.o: $(CORE_SRC)/RpUnits.cc
229        $(CXX) $(CFLAGS) $(DEBUG) $(INCL_CORE) -o $@ -c $?
230
231RpBindingsDict.o: $(CORE_SRC)/RpBindingsDict.cc
232        $(CXX) $(CFLAGS) $(DEBUG) $(INCL_CORE) -o $@ -c $?
233
234RpValue.o: $(CORE_SRC)/RpValue.cc
235        $(CXX) $(CFLAGS) $(DEBUG) $(INCL_CORE) -o $@ -c $?
236
237RpValueDouble.o: $(CORE_SRC)/RpValueDouble.cc
238        $(CXX) $(CFLAGS) $(DEBUG) $(INCL_CORE) -o $@ -c $?
239
240RpValueString.o: $(CORE_SRC)/RpValueString.cc
241        $(CXX) $(CFLAGS) $(DEBUG) $(INCL_CORE) -o $@ -c $?
242
243
244
245# include cee binding definitions
246
247RpUnitsCInterface.o: $(CEE_SRC)/RpUnitsCInterface.cc
248        $(CXX) $(CFLAGS) $(DEBUG) $(INCL_CORE) $(INCL_CEE) -o $@ -c $?
249
250RpLibraryCInterface.o: $(CEE_SRC)/RpLibraryCInterface.cc
251        $(CXX) $(CFLAGS) $(DEBUG) $(INCL_CORE) $(INCL_CEE) $(INCL_RP_DEPS) -o $@ -c $?
252
253
254
255
256# include fortran binding definitions
257
258RpUnitsFInterface.o: $(FORT_SRC)/RpUnitsFInterface.cc
259        $(CXX) $(CFLAGS) $(DEBUG) $(INCL_CORE) $(INCL_FORTRAN) -o $@ -c $?
260
261RpFortranCommon.o: $(FORT_SRC)/RpFortranCommon.c
262        $(CXX) $(CFLAGS) $(DEBUG) $(INCL_FORTRAN) -o $@ -c $<
263
264RpLibraryFInterface.o: $(FORT_SRC)/RpLibraryFInterface.cc
265        $(CXX) $(CFLAGS) $(DEBUG) $(INCL_CORE) $(INCL_FORTRAN) $(INCL_RP_DEPS) -o $@ -c $?
266
267
268# matlab bindings
269MEX_INCLS = $(INCL_MATLAB) $(INCL_CORE) $(INCL_CEE) $(INCL_RP_DEPS)
270MEX_OPTS = -g -outdir $(MATLAB_SRC) -L$(LIB_DIR) -lrappture
271MATLAB_COMP_ARGS = $(MATLAB_SRC)/RpMatlabInterface.cc $(MEX_INCLS) $(MEX_OPTS)
272
273RpMatlab:
274        $(MEX) $(MATLAB_SRC)/rpLib.cc                   $(MATLAB_COMP_ARGS)
275        $(MEX) $(MATLAB_SRC)/rpLibXml.cc                $(MATLAB_COMP_ARGS)
276        $(MEX) $(MATLAB_SRC)/rpLibElement.cc            $(MATLAB_COMP_ARGS)
277        $(MEX) $(MATLAB_SRC)/rpLibElementAsObject.cc    $(MATLAB_COMP_ARGS)
278        $(MEX) $(MATLAB_SRC)/rpLibElementAsType.cc      $(MATLAB_COMP_ARGS)
279        $(MEX) $(MATLAB_SRC)/rpLibElementAsComp.cc      $(MATLAB_COMP_ARGS)
280        $(MEX) $(MATLAB_SRC)/rpLibElementAsId.cc        $(MATLAB_COMP_ARGS)
281        $(MEX) $(MATLAB_SRC)/rpLibChildren.cc           $(MATLAB_COMP_ARGS)
282        $(MEX) $(MATLAB_SRC)/rpLibChildrenByType.cc     $(MATLAB_COMP_ARGS)
283#$(MEX) $(MATLAB_SRC)/rpChildrenAsObject.cc         $(MATLAB_COMP_ARGS)
284#$(MEX) $(MATLAB_SRC)/rpChildrenAsType.cc           $(MATLAB_COMP_ARGS)
285#$(MEX) $(MATLAB_SRC)/rpChildrenAsComp.cc           $(MATLAB_COMP_ARGS)
286#$(MEX) $(MATLAB_SRC)/rpChildrenAsId.cc             $(MATLAB_COMP_ARGS)
287        $(MEX) $(MATLAB_SRC)/rpLibGet.cc                $(MATLAB_COMP_ARGS)
288        $(MEX) $(MATLAB_SRC)/rpLibGetString.cc          $(MATLAB_COMP_ARGS)
289        $(MEX) $(MATLAB_SRC)/rpLibGetDouble.cc          $(MATLAB_COMP_ARGS)
290        $(MEX) $(MATLAB_SRC)/rpLibPut.cc                $(MATLAB_COMP_ARGS)
291        $(MEX) $(MATLAB_SRC)/rpLibPutString.cc          $(MATLAB_COMP_ARGS)
292        $(MEX) $(MATLAB_SRC)/rpLibPutDouble.cc          $(MATLAB_COMP_ARGS)
293        $(MEX) $(MATLAB_SRC)/rpLibNodeComp.cc           $(MATLAB_COMP_ARGS)
294        $(MEX) $(MATLAB_SRC)/rpLibNodeType.cc           $(MATLAB_COMP_ARGS)
295        $(MEX) $(MATLAB_SRC)/rpLibNodeId.cc             $(MATLAB_COMP_ARGS)
296        $(MEX) $(MATLAB_SRC)/rpLibResult.cc             $(MATLAB_COMP_ARGS)
297        $(MEX) $(MATLAB_SRC)/rpUnitsDefineUnit.cc       $(MATLAB_COMP_ARGS)
298#$(MEX) $(MATLAB_SRC)/rpDefineConv.cc               $(MATLAB_COMP_ARGS)
299        $(MEX) $(MATLAB_SRC)/rpUnitsGetUnits.cc         $(MATLAB_COMP_ARGS)
300        $(MEX) $(MATLAB_SRC)/rpUnitsGetUnitsName.cc     $(MATLAB_COMP_ARGS)
301        $(MEX) $(MATLAB_SRC)/rpUnitsGetExponent.cc      $(MATLAB_COMP_ARGS)
302        $(MEX) $(MATLAB_SRC)/rpUnitsGetBasis.cc         $(MATLAB_COMP_ARGS)
303        $(MEX) $(MATLAB_SRC)/rpUnitsFind.cc             $(MATLAB_COMP_ARGS)
304        $(MEX) $(MATLAB_SRC)/rpUnitsMakeMetric.cc       $(MATLAB_COMP_ARGS)
305        $(MEX) $(MATLAB_SRC)/rpUnitsConvert.cc          $(MATLAB_COMP_ARGS)
306        $(MEX) $(MATLAB_SRC)/rpUnitsConvertStr.cc       $(MATLAB_COMP_ARGS)
307        $(MEX) $(MATLAB_SRC)/rpUnitsConvertObjStr.cc    $(MATLAB_COMP_ARGS)
308        $(MEX) $(MATLAB_SRC)/rpUnitsConvertDbl.cc       $(MATLAB_COMP_ARGS)
309        $(MEX) $(MATLAB_SRC)/rpUnitsConvertObjDbl.cc    $(MATLAB_COMP_ARGS)
310        $(MEX) $(MATLAB_SRC)/rpAddPresets.cc            $(MATLAB_COMP_ARGS)
311
312OCT_INCLS = $(INCL_OCTAVE) $(INCL_CORE) $(INCL_RP_DEPS)
313OCTAVE_COMP_ARGS = $(OCT_INCLS) -L$(LIB_DIR) -lrappture
314RpOctave:
315        $(OCT) $(OCTAVE_SRC)/rpAddPresets.cc            $(OCTAVE_COMP_ARGS)
316        $(OCT) $(OCTAVE_SRC)/rpLib.cc                   $(OCTAVE_COMP_ARGS)
317        $(OCT) $(OCTAVE_SRC)/rpLibChildrenByType.cc     $(OCTAVE_COMP_ARGS)
318        $(OCT) $(OCTAVE_SRC)/rpLibChildren.cc           $(OCTAVE_COMP_ARGS)
319        $(OCT) $(OCTAVE_SRC)/rpLibElementAsComp.cc      $(OCTAVE_COMP_ARGS)
320        $(OCT) $(OCTAVE_SRC)/rpLibElementAsId.cc        $(OCTAVE_COMP_ARGS)
321        $(OCT) $(OCTAVE_SRC)/rpLibElementAsObject.cc    $(OCTAVE_COMP_ARGS)
322        $(OCT) $(OCTAVE_SRC)/rpLibElementAsType.cc      $(OCTAVE_COMP_ARGS)
323        $(OCT) $(OCTAVE_SRC)/rpLibElement.cc            $(OCTAVE_COMP_ARGS)
324        $(OCT) $(OCTAVE_SRC)/rpLibGet.cc                $(OCTAVE_COMP_ARGS)
325        $(OCT) $(OCTAVE_SRC)/rpLibGetString.cc          $(OCTAVE_COMP_ARGS)
326        $(OCT) $(OCTAVE_SRC)/rpLibGetDouble.cc          $(OCTAVE_COMP_ARGS)
327        $(OCT) $(OCTAVE_SRC)/rpLibNodeComp.cc           $(OCTAVE_COMP_ARGS)
328        $(OCT) $(OCTAVE_SRC)/rpLibNodeId.cc             $(OCTAVE_COMP_ARGS)
329        $(OCT) $(OCTAVE_SRC)/rpLibNodeType.cc           $(OCTAVE_COMP_ARGS)
330        $(OCT) $(OCTAVE_SRC)/rpLibPut.cc                $(OCTAVE_COMP_ARGS)
331        $(OCT) $(OCTAVE_SRC)/rpLibPutDouble.cc          $(OCTAVE_COMP_ARGS)
332        $(OCT) $(OCTAVE_SRC)/rpLibPutString.cc          $(OCTAVE_COMP_ARGS)
333        $(OCT) $(OCTAVE_SRC)/rpLibResult.cc             $(OCTAVE_COMP_ARGS)
334        $(OCT) $(OCTAVE_SRC)/rpLibXml.cc                $(OCTAVE_COMP_ARGS)
335        $(OCT) $(OCTAVE_SRC)/rpUnitsConvert.cc          $(OCTAVE_COMP_ARGS)
336        $(OCT) $(OCTAVE_SRC)/rpUnitsConvertDbl.cc       $(OCTAVE_COMP_ARGS)
337        $(OCT) $(OCTAVE_SRC)/rpUnitsConvertStr.cc       $(OCTAVE_COMP_ARGS)
338        $(OCT) $(OCTAVE_SRC)/rpUnitsConvertObjDbl.cc    $(OCTAVE_COMP_ARGS)
339        $(OCT) $(OCTAVE_SRC)/rpUnitsConvertObjStr.cc    $(OCTAVE_COMP_ARGS)
340        $(OCT) $(OCTAVE_SRC)/rpUnitsDefineUnit.cc       $(OCTAVE_COMP_ARGS)
341        $(OCT) $(OCTAVE_SRC)/rpUnitsFind.cc             $(OCTAVE_COMP_ARGS)
342        $(OCT) $(OCTAVE_SRC)/rpUnitsGetBasis.cc         $(OCTAVE_COMP_ARGS)
343        $(OCT) $(OCTAVE_SRC)/rpUnitsGetExponent.cc      $(OCTAVE_COMP_ARGS)
344        $(OCT) $(OCTAVE_SRC)/rpUnitsGetUnits.cc         $(OCTAVE_COMP_ARGS)
345        $(OCT) $(OCTAVE_SRC)/rpUnitsGetUnitsName.cc     $(OCTAVE_COMP_ARGS)
346        $(OCT) $(OCTAVE_SRC)/rpUnitsMakeMetric.cc       $(OCTAVE_COMP_ARGS)
347
348docs:
349        if test ! -d docs; then \
350                mkdir docs; \
351        fi
352        if test ! -d docs/doxygen; then \
353                mkdir docs/doxygen; \
354        fi
355        doxygen
356
357#### CLEAN UP ############################################################
358clean:
359        - rm -f *.o librpmesh.a ../librpmesh.so* $(TEST_PROGS)
360
361#################
362
363endiantest: endiantest.o
364        $(CXX) $(DEBUG) -o $@ $<
365test_node3d: test_node3d.o
366        $(CXX) $(DEBUG) -o $@ $< $(LIB_RPMESH)
367test_node2d: test_node2d.o
368        $(CXX) $(DEBUG) -o $@ $< $(LIB_RPMESH)
369test_element: test_element.o ../librpmesh.so
370        $(CXX) $(DEBUG) -o $@ $< $(LIB_RPMESH)
371test_elem2: test_elem2.o ../librpmesh.so
372        $(CXX) $(DEBUG) -o $@ $< $(LIB_RPMESH)
373test_mesh: test_mesh.o ../librpmesh.so
374        $(CXX) $(DEBUG) -o $@ $< $(LIB_RPMESH)
375test_mesh2: test_mesh2.o ../librpmesh.so
376        $(CXX) $(DEBUG) -o $@ $< $(LIB_RPMESH)
377etest: etest.o ../librpmesh.so
378        $(CXX) $(DEBUG) -o $@ $< $(LIB_RPMESH)
379try: try.o ../librpmesh.so
380        $(CXX) $(DEBUG) -o $@ $< $(LIB_RPMESH)
Note: See TracBrowser for help on using the repository browser.