1 | |
---|
2 | ifndef RP_INSTALL_BASE |
---|
3 | RP_INSTALL_BASE = @prefix@ |
---|
4 | endif |
---|
5 | |
---|
6 | # tell make where to find the expat & libscew headers |
---|
7 | INCL_RP_DEPS = -I$(RP_INSTALL_BASE)/include |
---|
8 | |
---|
9 | LIB_SCEW_FLAG = -L$(RP_INSTALL_BASE)/lib -lscew |
---|
10 | |
---|
11 | # define the top of the rappture directory structure |
---|
12 | RP_BASE = @RP_BASE@ |
---|
13 | |
---|
14 | # define which programs can be made |
---|
15 | PROGS = librappture \ |
---|
16 | libRpObjects \ |
---|
17 | Rappture.Units |
---|
18 | |
---|
19 | # define our compiling environment |
---|
20 | # |
---|
21 | CC = @CC@ |
---|
22 | CXX = @CXX@ |
---|
23 | DEBUG = -g -Wall |
---|
24 | DEBUG_PLUS = -g -DDEBUG |
---|
25 | PY = $(RP_INSTALL_BASE)/bin/python |
---|
26 | MEX = mex |
---|
27 | OCT = mkoctfile |
---|
28 | LN = ln |
---|
29 | |
---|
30 | # define our directories |
---|
31 | # |
---|
32 | INCLUDES_DIR = $(RP_BASE)/include |
---|
33 | BIN_DIR = $(RP_BASE)/bin |
---|
34 | LIB_DIR = $(RP_BASE)/src |
---|
35 | SRC_DIR = $(RP_BASE)/src |
---|
36 | TEST_DIR = $(RP_BASE)/test |
---|
37 | |
---|
38 | CORE_SRC = $(SRC_DIR)/core |
---|
39 | FORT_SRC = $(SRC_DIR)/fortran |
---|
40 | CEE_SRC = $(SRC_DIR)/cee |
---|
41 | PY_SRC = $(SRC_DIR)/python |
---|
42 | MATLAB_SRC = $(SRC_DIR)/matlab |
---|
43 | OCTAVE_SRC = $(SRC_DIR)/octave |
---|
44 | TCL_SRC = $(SRC_DIR)/tcl |
---|
45 | |
---|
46 | LIB_INC_PREFIX = -Wl,-rpath,$(LIB_DIR) -L$(LIB_DIR) |
---|
47 | LIB_RP_OBJECTS = $(LIB_INC_PREFIX) -lRpObjects |
---|
48 | LIB_RAPPTURE = -Wl,-rpath,$(LIB_DIR) -L$(LIB_DIR) -lrappture |
---|
49 | |
---|
50 | INCL_CORE = -I$(INCLUDES_DIR)/core |
---|
51 | INCL_CEE = -I$(INCLUDES_DIR)/cee |
---|
52 | INCL_FORTRAN = -I$(INCLUDES_DIR)/fortran |
---|
53 | INCL_PY = -I$(INCLUDES_DIR)/python |
---|
54 | INCL_MATLAB = -I$(INCLUDES_DIR)/matlab |
---|
55 | INCL_OCTAVE = -I$(INCLUDES_DIR)/octave |
---|
56 | |
---|
57 | CFLAGS = -fPIC |
---|
58 | |
---|
59 | # default: |
---|
60 | |
---|
61 | all: ${PROGS} |
---|
62 | install: install_py \ |
---|
63 | install_rappture \ |
---|
64 | install_rpobjs \ |
---|
65 | install_matlab \ |
---|
66 | install_octave |
---|
67 | # install_tcl |
---|
68 | |
---|
69 | RP_IO_DEPS = RpLibrary.o RpLibraryCInterface.o RpLibraryFInterface.o \ |
---|
70 | scew_extras.o RpEntityRef.o |
---|
71 | RP_UNITS_DEPS = RpUnitsStd.o RpUnits.o RpUnitsCInterface.o RpUnitsFInterface.o |
---|
72 | RP_OTHER_DEPS = RpFortranCommon.o RpBindingsDict.o |
---|
73 | RP_OBJS_DEP = RpVariable.o RpAbout.o RpNumber.o RpString.o RpBoolean.o \ |
---|
74 | RpChoice.o RpOption.o RpUnitsStd.o RpUnits.o #RpValue.o\ |
---|
75 | # RpValueDouble.o RpValueString.o |
---|
76 | |
---|
77 | LDLIB_MACOSX = -dynamiclib -o $(LIB_DIR)/$@.dylib |
---|
78 | LDLIB_LINUX = -shared -Wl,-rpath,$(LIB_DIR)/ -Wl,-soname,$@.so -o $(LIB_DIR)/$@.so.0.0 |
---|
79 | |
---|
80 | # include rappture library definitions |
---|
81 | |
---|
82 | #### librappture shared object ########################################### |
---|
83 | |
---|
84 | librappture: $(RP_IO_DEPS) $(RP_UNITS_DEPS) $(RP_OTHER_DEPS) |
---|
85 | if test "`uname`" == "Darwin"; then \ |
---|
86 | $(CXX) $(DEGUG) $(LDLIB_MACOSX) $^ $(LIB_SCEW_FLAG) -lm; \ |
---|
87 | ar -r $@.a $^; \ |
---|
88 | ranlib -s $@.a; \ |
---|
89 | else \ |
---|
90 | $(CXX) $(DEGUG) $(LDLIB_LINUX) $^ $(LIB_SCEW_FLAG) -lm; \ |
---|
91 | /sbin/ldconfig -n $(LIB_DIR); \ |
---|
92 | ar -r $@.a $^; \ |
---|
93 | ranlib $@.a; \ |
---|
94 | fi |
---|
95 | |
---|
96 | install_rappture: librappture |
---|
97 | if test "`uname`" == "Darwin"; then \ |
---|
98 | cp $<.dylib $(RP_INSTALL_BASE)/lib; \ |
---|
99 | cp $<.a $(RP_INSTALL_BASE)/lib; \ |
---|
100 | else \ |
---|
101 | cp -d $<.so* $(RP_INSTALL_BASE)/lib; \ |
---|
102 | cp -d $<.a $(RP_INSTALL_BASE)/lib; \ |
---|
103 | fi |
---|
104 | |
---|
105 | #### libRpObjects ######################################################## |
---|
106 | libRpObjects: $(RP_OBJS_DEP) |
---|
107 | if test "`uname`" == "Darwin"; then \ |
---|
108 | $(CXX) $(DEGUG) $(LDLIB_MACOSX) $^ -lstdc++; \ |
---|
109 | else \ |
---|
110 | $(CXX) $(DEGUG) $(LDLIB_LINUX) $^ -lstdc++; \ |
---|
111 | /sbin/ldconfig -n $(LIB_DIR); \ |
---|
112 | fi |
---|
113 | |
---|
114 | install_rpobjs: libRpObjects |
---|
115 | if test "`uname`" == "Darwin"; then \ |
---|
116 | cp $<.dylib $(RP_INSTALL_BASE)/lib; \ |
---|
117 | else \ |
---|
118 | cp -d $<.so* $(RP_INSTALL_BASE)/lib; \ |
---|
119 | fi |
---|
120 | |
---|
121 | #### Python ######################################################## |
---|
122 | Rappture.Units: RpUnits.o RpUnitsStd.o |
---|
123 | $(PY) $(PY_SRC)/setup.py build |
---|
124 | |
---|
125 | install_py: RpUnits.o RpUnitsStd.o |
---|
126 | $(PY) $(PY_SRC)/setup.py install |
---|
127 | |
---|
128 | |
---|
129 | #### Matlab ######################################################## |
---|
130 | install_matlab: librappture |
---|
131 | cd $(MATLAB_SRC); make install; cd - |
---|
132 | |
---|
133 | # if test ! -d $(RP_INSTALL_BASE)/lib/matlab; then \ |
---|
134 | # mkdir $(RP_INSTALL_BASE)/lib/matlab; \ |
---|
135 | # fi |
---|
136 | # cp $(MATLAB_SRC)/*.mex* $(RP_INSTALL_BASE)/lib/matlab |
---|
137 | |
---|
138 | #### Octave ######################################################## |
---|
139 | install_octave: librappture |
---|
140 | cd $(OCTAVE_SRC); make install; cd - |
---|
141 | |
---|
142 | # if test ! -d $(RP_INSTALL_BASE)/lib/octave; then \ |
---|
143 | # mkdir $(RP_INSTALL_BASE)/lib/octave; \ |
---|
144 | # fi |
---|
145 | # cp $(OCTAVE_SRC)/*.oct* $(RP_INSTALL_BASE)/lib/octave |
---|
146 | |
---|
147 | #### Tcl ########################################################### |
---|
148 | install_tcl: librappture |
---|
149 | cd $(TCL_SRC) && make install && cd - |
---|
150 | |
---|
151 | #################################################################### |
---|
152 | |
---|
153 | # include core source files |
---|
154 | |
---|
155 | RpLibrary.o: $(CORE_SRC)/RpLibrary.cc |
---|
156 | $(CXX) $(CFLAGS) $(DEBUG) $(INCL_CORE) $(INCL_RP_DEPS) -o $@ -c $? |
---|
157 | |
---|
158 | scew_extras.o: $(CORE_SRC)/scew_extras.c |
---|
159 | $(CC) $(CFLAGS) $(DEBUG) $(INCL_CORE) $(INCL_RP_DEPS) -o $@ -c $? |
---|
160 | |
---|
161 | RpEntityRef.o: $(CORE_SRC)/RpEntityRef.cc |
---|
162 | $(CXX) $(CFLAGS) $(DEBUG) $(INCL_CORE) -o $@ -c $? |
---|
163 | |
---|
164 | RpVariable.o: $(CORE_SRC)/RpVariable.cc |
---|
165 | $(CXX) $(CFLAGS) $(DEBUG) $(INCL_CORE) -o $@ -c $? |
---|
166 | |
---|
167 | RpAbout.o: $(CORE_SRC)/RpAbout.cc |
---|
168 | $(CXX) $(CFLAGS) $(DEBUG) $(INCL_CORE) -o $@ -c $? |
---|
169 | |
---|
170 | RpNumber.o: $(CORE_SRC)/RpNumber.cc |
---|
171 | $(CXX) $(CFLAGS) $(DEBUG) $(INCL_CORE) -o $@ -c $? |
---|
172 | |
---|
173 | RpString.o: $(CORE_SRC)/RpString.cc |
---|
174 | $(CXX) $(CFLAGS) $(DEBUG) $(INCL_CORE) -o $@ -c $? |
---|
175 | |
---|
176 | RpBoolean.o: $(CORE_SRC)/RpBoolean.cc |
---|
177 | $(CXX) $(CFLAGS) $(DEBUG) $(INCL_CORE) -o $@ -c $? |
---|
178 | |
---|
179 | RpChoice.o: $(CORE_SRC)/RpChoice.cc |
---|
180 | $(CXX) $(CFLAGS) $(DEBUG) $(INCL_CORE) -o $@ -c $? |
---|
181 | |
---|
182 | RpOption.o: $(CORE_SRC)/RpOption.cc |
---|
183 | $(CXX) $(CFLAGS) $(DEBUG) $(INCL_CORE) -o $@ -c $? |
---|
184 | |
---|
185 | RpUnitsStd.o: $(CORE_SRC)/RpUnitsStd.cc |
---|
186 | $(CXX) $(CFLAGS) $(DEBUG) $(INCL_CORE) -o $@ -c $? |
---|
187 | |
---|
188 | RpUnits.o: $(CORE_SRC)/RpUnits.cc |
---|
189 | $(CXX) $(CFLAGS) $(DEBUG) $(INCL_CORE) -o $@ -c $? |
---|
190 | |
---|
191 | RpBindingsDict.o: $(CORE_SRC)/RpBindingsDict.cc |
---|
192 | $(CXX) $(CFLAGS) $(DEBUG) $(INCL_CORE) -o $@ -c $? |
---|
193 | |
---|
194 | RpValue.o: $(CORE_SRC)/RpValue.cc |
---|
195 | $(CXX) $(CFLAGS) $(DEBUG) $(INCL_CORE) -o $@ -c $? |
---|
196 | |
---|
197 | RpValueDouble.o: $(CORE_SRC)/RpValueDouble.cc |
---|
198 | $(CXX) $(CFLAGS) $(DEBUG) $(INCL_CORE) -o $@ -c $? |
---|
199 | |
---|
200 | RpValueString.o: $(CORE_SRC)/RpValueString.cc |
---|
201 | $(CXX) $(CFLAGS) $(DEBUG) $(INCL_CORE) -o $@ -c $? |
---|
202 | |
---|
203 | |
---|
204 | |
---|
205 | # include cee binding definitions |
---|
206 | |
---|
207 | RpUnitsCInterface.o: $(CEE_SRC)/RpUnitsCInterface.cc |
---|
208 | $(CXX) $(CFLAGS) $(DEBUG) $(INCL_CORE) $(INCL_CEE) -o $@ -c $? |
---|
209 | |
---|
210 | RpLibraryCInterface.o: $(CEE_SRC)/RpLibraryCInterface.cc |
---|
211 | $(CXX) $(CFLAGS) $(DEBUG) $(INCL_CORE) $(INCL_CEE) $(INCL_RP_DEPS) -o $@ -c $? |
---|
212 | |
---|
213 | |
---|
214 | |
---|
215 | |
---|
216 | # include fortran binding definitions |
---|
217 | |
---|
218 | RpUnitsFInterface.o: $(FORT_SRC)/RpUnitsFInterface.cc |
---|
219 | $(CXX) $(CFLAGS) $(DEBUG) $(INCL_CORE) $(INCL_FORTRAN) -o $@ -c $? |
---|
220 | |
---|
221 | RpFortranCommon.o: $(FORT_SRC)/RpFortranCommon.c |
---|
222 | $(CXX) $(CFLAGS) $(DEBUG) $(INCL_FORTRAN) -o $@ -c $< |
---|
223 | |
---|
224 | RpLibraryFInterface.o: $(FORT_SRC)/RpLibraryFInterface.cc |
---|
225 | $(CXX) $(CFLAGS) $(DEBUG) $(INCL_CORE) $(INCL_FORTRAN) $(INCL_RP_DEPS) -o $@ -c $? |
---|
226 | |
---|
227 | |
---|
228 | # matlab bindings |
---|
229 | RpMatlab: librappture |
---|
230 | cd $(MATLAB_SRC); make clean; make RpMatlab; cd - |
---|
231 | |
---|
232 | # octave bindings |
---|
233 | RpOctave: librappture |
---|
234 | cd $(OCTAVE_SRC); make clean; make RpOctave; cd - |
---|
235 | |
---|
236 | docs: |
---|
237 | if test ! -d docs; then \ |
---|
238 | mkdir docs; \ |
---|
239 | fi |
---|
240 | if test ! -d docs/doxygen; then \ |
---|
241 | mkdir docs/doxygen; \ |
---|
242 | fi |
---|
243 | doxygen |
---|
244 | |
---|
245 | #### CLEAN UP ############################################################ |
---|
246 | clean: |
---|
247 | - rm -f *.o librappture.so* librappture.a libRp*.so* |
---|
248 | - rm -rf build |
---|
249 | |
---|
250 | distclean: clean |
---|
251 | - rm Makefile |
---|