source: trunk/src/Makefile @ 122

Last change on this file since 122 was 122, checked in by dkearney, 18 years ago

added initial version of octave language bindings.
1) no claiming language bindings work, but will happily take credit if they do.
2) bindings are untested
3) bindings happen to work with mystery example that happens to be located in examples/app-fermi/matlab/fermi_rp.m and happens to be invokable with examples/app-fermi/matlab/tool_rp.xml
4) bindings need octave2.1-headers installed (in debian: apt-get install octave2.1-headers) to get the mkoctfile program
5) binding function names might be changing to be more discriptive and more tightly bound to either the lib or units module.
6) adjusted Makefile to add octave bindings compilation.

File size: 11.4 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         = ../..
25
26# define the top of the rappture directory structure
27RP_BASE   = $(TOP_DIR)/rappture
28
29# define which programs can be made
30PROGS           =   librappture    \
31                    libRpObjects   \
32                    Rappture.Units
33#                    RpMatlab
34
35# define our compiling environment
36#
37CC              = gcc
38CXX             = g++
39DEBUG           = -g -Wall
40DEBUG_PLUS      = -g -DDEBUG
41PY              = python
42MEX             = mex
43OCT             = mkoctfile
44
45LN              = ln
46
47# define our directories
48#
49INCLUDES_DIR    = $(RP_BASE)/include
50BIN_DIR         = $(RP_BASE)/bin
51LIB_DIR         = $(RP_BASE)/src
52SRC_DIR         = $(RP_BASE)/src
53TEST_DIR        = $(RP_BASE)/test
54
55CORE_SRC        = $(SRC_DIR)/core
56FORT_SRC        = $(SRC_DIR)/fortran
57CEE_SRC         = $(SRC_DIR)/cee
58PY_SRC          = $(SRC_DIR)/python
59MATLAB_SRC      = $(SRC_DIR)/matlab
60OCTAVE_SRC      = $(SRC_DIR)/octave
61
62LIB_INC_PREFIX  = -Wl,-rpath,$(LIB_DIR) -L$(LIB_DIR)
63LIB_RP_OBJECTS  = $(LIB_INC_PREFIX) -lRpObjects
64LIB_RAPPTURE    = -Wl,-rpath,$(LIB_DIR) -L$(LIB_DIR) -lrappture
65
66INCL_CORE       = -I$(INCLUDES_DIR)/core
67INCL_CEE        = -I$(INCLUDES_DIR)/cee
68INCL_FORTRAN    = -I$(INCLUDES_DIR)/fortran
69INCL_PY         = -I$(INCLUDES_DIR)/python
70INCL_MATLAB     = -I$(INCLUDES_DIR)/matlab
71INCL_OCTAVE     = -I$(INCLUDES_DIR)/octave
72
73
74# default:
75
76all: ${PROGS}
77install: all install_py install_rappture install_rpobjs #install_matlab #install_octave
78
79RP_IO_DEPS      = RpLibrary.o RpLibraryCInterface.o RpLibraryFInterface.o \
80                  scew_extras.o
81RP_UNITS_DEPS   = RpUnitsStd.o RpUnits.o RpUnitsCInterface.o RpUnitsFInterface.o
82RP_OTHER_DEPS   = RpFortranCommon.o RpBindingsDict.o
83RP_OBJS_DEP     = RpVariable.o RpAbout.o RpNumber.o RpString.o RpBoolean.o \
84                  RpChoice.o RpOption.o RpUnitsStd.o RpUnits.o
85
86LDLIB_MACOSX = -dynamiclib -o $(LIB_DIR)/$@.dylib
87LDLIB_LINUX = -shared -Wl,-rpath,$(LIB_DIR)/ -Wl,-soname,$@.so -o $(LIB_DIR)/$@.so.0.0
88# include rappture library definitions
89
90#### librappture shared object ###########################################
91
92librappture: $(RP_IO_DEPS) $(RP_UNITS_DEPS) $(RP_OTHER_DEPS)
93        if test "`uname`" == "Darwin"; then \
94                $(CXX) $(DEGUG) $(LDLIB_MACOSX) $^ $(LIB_SCEW_FLAG) -lm; \
95        else \
96                $(CXX) $(DEGUG) $(LDLIB_LINUX) $^ $(LIB_SCEW_FLAG) -lm; \
97                /sbin/ldconfig -n $(LIB_DIR); \
98        fi
99
100install_rappture: librappture
101        if test "`uname`" == "Darwin"; then \
102                cp $<.dylib $(RP_INSTALL_BASE)/lib; \
103        else \
104                cp -d $<.so* $(RP_INSTALL_BASE)/lib; \
105        fi
106
107#### libRpObjects ########################################################
108libRpObjects: $(RP_OBJS_DEP)
109        if test "`uname`" == "Darwin"; then \
110                $(CXX) $(DEGUG) $(LDLIB_MACOSX) $^ -lstdc++; \
111        else \
112                $(CXX) $(DEGUG) $(LDLIB_LINUX) $^ -lstdc++; \
113                /sbin/ldconfig -n $(LIB_DIR); \
114        fi
115
116install_rpobjs: libRpObjects
117        if test "`uname`" == "Darwin"; then \
118                cp $<.dylib $(RP_INSTALL_BASE)/lib; \
119        else \
120                cp -d $<.so* $(RP_INSTALL_BASE)/lib; \
121        fi
122
123#### Python ########################################################
124Rappture.Units: RpUnits.o RpUnitsStd.o
125        $(PY) $(PY_SRC)/setup.py build
126
127install_py: RpUnits.o RpUnitsStd.o
128        $(PY) $(PY_SRC)/setup.py install
129
130
131#### Matlab ########################################################
132install_matlab: RpMatlab
133        cp -d $(MATLAB_SRC)/*.mex* $(RP_INSTALL_BASE)/lib
134
135#### Octave ########################################################
136install_octave: RpOctave
137        cp -d $(OCTAVE_SRC)/*.oct* $(RP_INSTALL_BASE)/lib
138
139# include core source files
140
141RpLibrary.o: $(CORE_SRC)/RpLibrary.cc
142        $(CXX) -fPIC $(DEBUG) $(INCL_CORE) $(INCL_RP_DEPS) -o $@ -c $?
143
144scew_extras.o: $(CORE_SRC)/scew_extras.c
145        $(CC) -fPIC $(DEBUG) $(INCL_CORE) $(INCL_RP_DEPS) -o $@ -c $?
146
147RpVariable.o: $(CORE_SRC)/RpVariable.cc
148        $(CXX) -fPIC $(DEBUG) $(INCL_CORE) -o $@ -c $?
149
150RpAbout.o: $(CORE_SRC)/RpAbout.cc
151        $(CXX) -fPIC $(DEBUG) $(INCL_CORE) -o $@ -c $?
152
153RpNumber.o: $(CORE_SRC)/RpNumber.cc
154        $(CXX) -fPIC $(DEBUG) $(INCL_CORE) -o $@ -c $?
155
156RpString.o: $(CORE_SRC)/RpString.cc
157        $(CXX) -fPIC $(DEBUG) $(INCL_CORE) -o $@ -c $?
158
159RpBoolean.o: $(CORE_SRC)/RpBoolean.cc
160        $(CXX) -fPIC $(DEBUG) $(INCL_CORE) -o $@ -c $?
161
162RpChoice.o: $(CORE_SRC)/RpChoice.cc
163        $(CXX) -fPIC $(DEBUG) $(INCL_CORE) -o $@ -c $?
164
165RpOption.o: $(CORE_SRC)/RpOption.cc
166        $(CXX) -fPIC $(DEBUG) $(INCL_CORE) -o $@ -c $?
167
168RpUnitsStd.o: $(CORE_SRC)/RpUnitsStd.cc
169        $(CXX) -fPIC $(DEBUG) $(INCL_CORE) -o $@ -c $?
170
171RpUnits.o: $(CORE_SRC)/RpUnits.cc
172        $(CXX) -fPIC $(DEBUG) $(INCL_CORE) -o $@ -c $?
173
174RpBindingsDict.o: $(CORE_SRC)/RpBindingsDict.cc
175        $(CXX) -fPIC $(DEBUG) $(INCL_CORE) -o $@ -c $?
176
177
178
179
180# include cee binding definitions
181
182rappture_interface.o: $(CEE_SRC)/rappture_interface.c
183        $(CXX) -fPIC $(DEBUG) $(INCL_CEE) $(INCL_PY) -o $@ -c $<
184
185RpUnitsCInterface.o: $(CEE_SRC)/RpUnitsCInterface.cc
186        $(CXX) -fPIC $(DEBUG) $(INCL_CORE) $(INCL_CEE) -o $@ -c $?
187
188RpLibraryCInterface.o: $(CEE_SRC)/RpLibraryCInterface.cc
189        $(CXX) -fPIC $(DEBUG) $(INCL_CORE) $(INCL_CEE) $(INCL_RP_DEPS) -o $@ -c $?
190
191
192
193
194# include fortran binding definitions
195
196rappture_fortran.o: $(FORT_SRC)/rappture_fortran.c
197        $(CXX) -fPIC $(DEBUG) $(INCL_FORTRAN) $(INCL_CORE) $(INCL_CEE) $(INCL_PY) -o $@ -c $<
198
199RpUnitsFInterface.o: $(FORT_SRC)/RpUnitsFInterface.cc
200        $(CXX) -fPIC $(DEBUG) $(INCL_CORE) $(INCL_FORTRAN) -o $@ -c $?
201
202RpFortranCommon.o: $(FORT_SRC)/RpFortranCommon.c
203        $(CXX) -fPIC $(DEBUG) $(INCL_FORTRAN) -o $@ -c $<
204
205RpLibraryFInterface.o: $(FORT_SRC)/RpLibraryFInterface.cc
206        $(CXX) -fPIC $(DEBUG) $(INCL_CORE) $(INCL_FORTRAN) $(INCL_RP_DEPS) -o $@ -c $?
207
208
209# matlab bindings
210MEX_INCLS = $(INCL_MATLAB) $(INCL_CORE) $(INCL_CEE) $(INCL_RP_DEPS)
211MATLAB_COMP_ARGS = $(MATLAB_SRC)/RpMatlabInterface.cc $(MEX_INCLS) -L$(LIB_DIR) -lrappture
212
213RpMatlab:
214        $(MEX) $(MATLAB_SRC)/rpLib.cc              $(MATLAB_COMP_ARGS)
215        $(MEX) $(MATLAB_SRC)/rpXml.cc              $(MATLAB_COMP_ARGS)
216        $(MEX) $(MATLAB_SRC)/rpElement.cc          $(MATLAB_COMP_ARGS)
217        $(MEX) $(MATLAB_SRC)/rpElementAsObject.cc  $(MATLAB_COMP_ARGS)
218        $(MEX) $(MATLAB_SRC)/rpElementAsType.cc    $(MATLAB_COMP_ARGS)
219        $(MEX) $(MATLAB_SRC)/rpElementAsComp.cc    $(MATLAB_COMP_ARGS)
220        $(MEX) $(MATLAB_SRC)/rpElementAsId.cc      $(MATLAB_COMP_ARGS)
221        $(MEX) $(MATLAB_SRC)/rpChildren.cc         $(MATLAB_COMP_ARGS)
222        $(MEX) $(MATLAB_SRC)/rpChildrenByType.cc   $(MATLAB_COMP_ARGS)
223#$(MEX) $(MATLAB_SRC)/rpChildrenAsObject.cc    $(MATLAB_COMP_ARGS)
224#$(MEX) $(MATLAB_SRC)/rpChildrenAsType.cc      $(MATLAB_COMP_ARGS)
225#$(MEX) $(MATLAB_SRC)/rpChildrenAsComp.cc      $(MATLAB_COMP_ARGS)
226#$(MEX) $(MATLAB_SRC)/rpChildrenAsId.cc        $(MATLAB_COMP_ARGS)
227        $(MEX) $(MATLAB_SRC)/rpGet.cc              $(MATLAB_COMP_ARGS)
228        $(MEX) $(MATLAB_SRC)/rpGet.cc              $(MATLAB_COMP_ARGS)
229        $(MEX) $(MATLAB_SRC)/rpGetString.cc        $(MATLAB_COMP_ARGS)
230        $(MEX) $(MATLAB_SRC)/rpGetDouble.cc        $(MATLAB_COMP_ARGS)
231        $(MEX) $(MATLAB_SRC)/rpPut.cc              $(MATLAB_COMP_ARGS)
232        $(MEX) $(MATLAB_SRC)/rpPutString.cc        $(MATLAB_COMP_ARGS)
233        $(MEX) $(MATLAB_SRC)/rpPutStringId.cc      $(MATLAB_COMP_ARGS)
234        $(MEX) $(MATLAB_SRC)/rpPutDouble.cc        $(MATLAB_COMP_ARGS)
235        $(MEX) $(MATLAB_SRC)/rpPutDoubleId.cc      $(MATLAB_COMP_ARGS)
236        $(MEX) $(MATLAB_SRC)/rpNodeComp.cc         $(MATLAB_COMP_ARGS)
237        $(MEX) $(MATLAB_SRC)/rpNodeType.cc         $(MATLAB_COMP_ARGS)
238        $(MEX) $(MATLAB_SRC)/rpNodeId.cc           $(MATLAB_COMP_ARGS)
239        $(MEX) $(MATLAB_SRC)/rpResult.cc           $(MATLAB_COMP_ARGS)
240        $(MEX) $(MATLAB_SRC)/rpDefineUnit.cc       $(MATLAB_COMP_ARGS)
241#$(MEX) $(MATLAB_SRC)/rpDefineConv.cc          $(MATLAB_COMP_ARGS)
242        $(MEX) $(MATLAB_SRC)/rpGetUnits.cc         $(MATLAB_COMP_ARGS)
243        $(MEX) $(MATLAB_SRC)/rpGetUnitsName.cc     $(MATLAB_COMP_ARGS)
244        $(MEX) $(MATLAB_SRC)/rpGetExponent.cc      $(MATLAB_COMP_ARGS)
245        $(MEX) $(MATLAB_SRC)/rpGetBasis.cc         $(MATLAB_COMP_ARGS)
246        $(MEX) $(MATLAB_SRC)/rpFind.cc             $(MATLAB_COMP_ARGS)
247        $(MEX) $(MATLAB_SRC)/rpMakeMetric.cc       $(MATLAB_COMP_ARGS)
248        $(MEX) $(MATLAB_SRC)/rpConvert.cc          $(MATLAB_COMP_ARGS)
249        $(MEX) $(MATLAB_SRC)/rpConvertStr.cc       $(MATLAB_COMP_ARGS)
250        $(MEX) $(MATLAB_SRC)/rpConvertObjStr.cc    $(MATLAB_COMP_ARGS)
251        $(MEX) $(MATLAB_SRC)/rpConvertDbl.cc       $(MATLAB_COMP_ARGS)
252        $(MEX) $(MATLAB_SRC)/rpConvertObjDbl.cc    $(MATLAB_COMP_ARGS)
253        $(MEX) $(MATLAB_SRC)/rpAddPresets.cc       $(MATLAB_COMP_ARGS)
254
255OCT_INCLS = $(INCL_OCTAVE) $(INCL_CORE) $(INCL_RP_DEPS)
256OCTAVE_COMP_ARGS = $(OCT_INCLS) -L$(LIB_DIR) -lrappture
257RpOctave:
258        $(OCT) $(OCTAVE_SRC)/rpAddPresets.cc       $(OCTAVE_COMP_ARGS)
259        $(OCT) $(OCTAVE_SRC)/rpChildrenByType.cc   $(OCTAVE_COMP_ARGS)
260        $(OCT) $(OCTAVE_SRC)/rpChildren.cc         $(OCTAVE_COMP_ARGS)
261        $(OCT) $(OCTAVE_SRC)/rpConvert.cc          $(OCTAVE_COMP_ARGS)
262        $(OCT) $(OCTAVE_SRC)/rpConvertDbl.cc       $(OCTAVE_COMP_ARGS)
263        $(OCT) $(OCTAVE_SRC)/rpConvertStr.cc       $(OCTAVE_COMP_ARGS)
264        $(OCT) $(OCTAVE_SRC)/rpConvertObjDbl.cc    $(OCTAVE_COMP_ARGS)
265        $(OCT) $(OCTAVE_SRC)/rpConvertObjStr.cc    $(OCTAVE_COMP_ARGS)
266        $(OCT) $(OCTAVE_SRC)/rpDefineUnit.cc       $(OCTAVE_COMP_ARGS)
267        $(OCT) $(OCTAVE_SRC)/rpElementAsComp.cc    $(OCTAVE_COMP_ARGS)
268        $(OCT) $(OCTAVE_SRC)/rpElementAsId.cc      $(OCTAVE_COMP_ARGS)
269        $(OCT) $(OCTAVE_SRC)/rpElementAsObject.cc  $(OCTAVE_COMP_ARGS)
270        $(OCT) $(OCTAVE_SRC)/rpElementAsType.cc    $(OCTAVE_COMP_ARGS)
271        $(OCT) $(OCTAVE_SRC)/rpElement.cc          $(OCTAVE_COMP_ARGS)
272        $(OCT) $(OCTAVE_SRC)/rpFind.cc             $(OCTAVE_COMP_ARGS)
273        $(OCT) $(OCTAVE_SRC)/rpGetBasis.cc         $(OCTAVE_COMP_ARGS)
274        $(OCT) $(OCTAVE_SRC)/rpGet.cc              $(OCTAVE_COMP_ARGS)
275        $(OCT) $(OCTAVE_SRC)/rpGetString.cc        $(OCTAVE_COMP_ARGS)
276        $(OCT) $(OCTAVE_SRC)/rpGetDouble.cc        $(OCTAVE_COMP_ARGS)
277        $(OCT) $(OCTAVE_SRC)/rpGetExponent.cc      $(OCTAVE_COMP_ARGS)
278        $(OCT) $(OCTAVE_SRC)/rpGetUnits.cc         $(OCTAVE_COMP_ARGS)
279        $(OCT) $(OCTAVE_SRC)/rpGetUnitsName.cc     $(OCTAVE_COMP_ARGS)
280        $(OCT) $(OCTAVE_SRC)/rpLib.cc              $(OCTAVE_COMP_ARGS)
281        $(OCT) $(OCTAVE_SRC)/rpMakeMetric.cc       $(OCTAVE_COMP_ARGS)
282        $(OCT) $(OCTAVE_SRC)/rpNodeComp.cc         $(OCTAVE_COMP_ARGS)
283        $(OCT) $(OCTAVE_SRC)/rpNodeId.cc           $(OCTAVE_COMP_ARGS)
284        $(OCT) $(OCTAVE_SRC)/rpNodeType.cc         $(OCTAVE_COMP_ARGS)
285        $(OCT) $(OCTAVE_SRC)/rpPut.cc              $(OCTAVE_COMP_ARGS)
286        $(OCT) $(OCTAVE_SRC)/rpPutDouble.cc        $(OCTAVE_COMP_ARGS)
287        $(OCT) $(OCTAVE_SRC)/rpPutDoubleId.cc      $(OCTAVE_COMP_ARGS)
288        $(OCT) $(OCTAVE_SRC)/rpPutDoubleId.cc      $(OCTAVE_COMP_ARGS)
289        $(OCT) $(OCTAVE_SRC)/rpPutString.cc        $(OCTAVE_COMP_ARGS)
290        $(OCT) $(OCTAVE_SRC)/rpPutStringId.cc      $(OCTAVE_COMP_ARGS)
291        $(OCT) $(OCTAVE_SRC)/rpResult.cc           $(OCTAVE_COMP_ARGS)
292        $(OCT) $(OCTAVE_SRC)/rpXml.cc              $(OCTAVE_COMP_ARGS)
293
294
295
296#### CLEAN UP ############################################################
297clean:
298        - rm -f *.o librappture.so* libRp*.so* rp*.mex* $(OCTAVE_SRC)/rp*.o*
299        - rm -rf build
Note: See TracBrowser for help on using the repository browser.