1 # Copyright (C) 2007-2008 CEA/DEN, EDF R&D
3 # This library is free software; you can redistribute it and/or
4 # modify it under the terms of the GNU Lesser General Public
5 # License as published by the Free Software Foundation; either
6 # version 2.1 of the License.
8 # This library is distributed in the hope that it will be useful,
9 # but WITHOUT ANY WARRANTY; without even the implied warranty of
10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 # Lesser General Public License for more details.
13 # You should have received a copy of the GNU Lesser General Public
14 # License along with this library; if not, write to the Free Software
15 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
19 #=======================================================================
20 # This section of this makefile comes from the file
21 # 'adm/unix/make_conclude' which was generated with config.status
22 # from file adm/unix/make_conclude.in
23 #=======================================================================
25 # Authors : Patrick GOLDBRONN (CEA) - Marc Tajchman (CEA)
32 # transform idl reference in appropriate obj file
33 LIB_CLIENT_SRC = $(LIB_CLIENT_IDL:%.idl=%$(IDL_CLN_CXX))
34 LIB_SERVER_SRC = $(LIB_SERVER_IDL:%.idl=%$(IDL_SRV_CXX))
35 LIB_MOC_SRC = $(LIB_MOC:%.h=%_moc.cxx)
36 LIB_SRC+=$(LIB_MOC_SRC)
37 LIB_SWIG_SRC = $(SWIG_DEF:%.i=%_wrap.cxx)
38 LIB_DEP= $(LIB_SRC) $(LIB_CLIENT_SRC) $(LIB_SERVER_SRC) $(LIB_SWIG_SRC)
40 LIB_CLIENT_OBJ = $(LIB_CLIENT_IDL:%.idl=%$(IDL_CLN_OBJ))
41 LIB_SERVER_OBJ = $(LIB_SERVER_IDL:%.idl=%$(IDL_SRV_OBJ))
43 # declare dependences between SWIG input files
44 $(LIB_SWIG_SRC): $(SWIG_DEP:%=$(inc_builddir)/%)
46 # transform c file in appropriate libtool obj file (.c, .cc and .cxx)
47 LIB_OBJ_C = $(patsubst %.c, %.lo, $(filter %.c, $(LIB_SRC)))
48 LIB_OBJ_CC = $(patsubst %.cc, %.lo, $(filter %.cc, $(LIB_SRC)))
49 LIB_OBJ_CXX = $(patsubst %.cxx, %.lo, $(filter %.cxx, $(LIB_SRC)))
50 LIB_SWIG_OBJ = $(LIB_SWIG_SRC:%.cxx=%.lo)
51 LIB_OBJ_F = $(patsubst %.f, %.lo, $(filter %.f, $(LIB_SRC)))
53 # all libtool obj file in library
54 LIB_OBJ = $(LIB_OBJ_CXX) $(LIB_OBJ_CC) $(LIB_OBJ_C) $(LIB_CLIENT_OBJ:%.o=%.lo) $(LIB_SERVER_OBJ:%.o=%.lo) $(LIB_SWIG_OBJ) $(LIB_OBJ_F)
56 # LIB_BUILD = $(LIB:%.la=$(top_builddir)/lib@LIB_LOCATION_SUFFIX@/salome/%.la)
57 LIB_BUILD = $(patsubst %.la, $(top_builddir)/lib@LIB_LOCATION_SUFFIX@/salome/%.la, $(filter %.la, $(LIB)))
58 LIB_BUILD_A = $(patsubst %.a, $(top_builddir)/lib@LIB_LOCATION_SUFFIX@/salome/%.a, $(filter %.a, $(LIB)))
60 ifneq ($(findstring cmodule.la,$(filter %.la, $(LIB))),)
61 LIB_SWIG = $(patsubst %cmodule.la,%.so, $(filter %.la, $(LIB)))
66 lib: $(LIB_BUILD) $(LIB_CLIENT_PY)
67 # we don't build static library !
69 $(LIB_BUILD): $(top_builddir)/lib@LIB_LOCATION_SUFFIX@/salome/%.la: %.la
71 -$(RM) $(patsubst %.la, %.so, $@)
72 -$(RM) $(patsubst %.la, %.a, $@)
73 ln -sf $(CURDIR)/$< $@ || true
74 ln -sf $(patsubst %.la, %.so, $(CURDIR)/.libs/$<) \
75 $(patsubst %.la, %.so, $@) || true
76 ln -sf $(patsubst %.la, %.so, $(CURDIR)/.libs/$<).0 \
77 $(patsubst %.la, %.so, $@).0 || true
79 if test "X$(LIB_SWIG)" != X; then \
80 ln -sf $(patsubst %.la,%.so, $(CURDIR)/.libs/$<) $(top_builddir)/lib@LIB_LOCATION_SUFFIX@/salome/_$(LIB_SWIG) || true;\
83 $(LIB_BUILD_A): $(top_builddir)/lib@LIB_LOCATION_SUFFIX@/salome/%.a: %.a
85 ln -sf $(CURDIR)/$< $@ || true
88 @$(LT) --mode=link $(CXX) -rpath $(libdir) -o $@ $(CXXFLAGS) $(LIB_OBJ) $(LDFLAGS) $(LIBS)
90 # transform idl reference in appropriate obj file
91 BIN_CLIENT_SRC = $(BIN_CLIENT_IDL:%.idl=%$(IDL_CLN_CXX))
92 BIN_SERVER_SRC = $(BIN_SERVER_IDL:%.idl=%$(IDL_SRV_CXX))
93 BIN_MOC_SRC = $(BIN_MOC:%.h=%_moc.cxx)
94 BIN_SRC+=$(BIN_MOC_SRC)
95 BIN_DEP=$(BIN:%=%.cxx) $(BIN_SRC) $(BIN_CLIENT_SRC) $(BIN_SERVER_SRC)
97 BIN_CLIENT_OBJ = $(BIN_CLIENT_IDL:%.idl=%$(IDL_CLN_OBJ))
98 BIN_SERVER_OBJ = $(BIN_SERVER_IDL:%.idl=%$(IDL_SRV_OBJ))
99 # transform c file in appropriate libtool obj file (.c)
100 BIN_OBJ_C = $(patsubst %.c, %.o, $(filter %.c, $(BIN_SRC)))
101 # transform c++ file in appropriate libtool obj file (.cc and .cxx)
102 BIN_OBJ_CC = $(patsubst %.cc, %.o, $(filter %.cc, $(BIN_SRC)))
103 BIN_OBJ_CXX = $(patsubst %.cxx, %.o, $(filter %.cxx, $(BIN_SRC)))
104 # all obj file in bin target
105 BIN_OBJ = $(BIN_OBJ_CC) $(BIN_OBJ_CXX) $(BIN_OBJ_C) $(BIN_CLIENT_OBJ) $(BIN_SERVER_OBJ)
107 bin: $(BIN:%=$(top_builddir)/bin/salome/%) $(BIN) $(LIB) pyscripts sharedpyscripts
109 BIN_LIB=$(LIB:lib%.la=-l%)
111 $(BIN:%=$(top_builddir)/bin/salome/%) $(TEST_PROGS:%=$(top_builddir)/bin/salome/%): $(top_builddir)/bin/salome/%: %
113 ln -sf $(CURDIR)/$< $@
115 $(BIN) $(TEST_PROGS): %: %.lo $(BIN_OBJ)
116 $(CXX) $(CXXFLAGS) -o $@ $^ $(BIN_LIB) $(LDFLAGSFORBIN) $(LIBSFORBIN)
118 # copy python scripts in $(top_builddir)/bin/salome
120 DEST_PYSCRIPTS = $(EXPORT_PYSCRIPTS:%=$(top_builddir)/bin/salome/%)
121 pyscripts: $(DEST_PYSCRIPTS)
122 $(DEST_PYSCRIPTS): $(top_builddir)/bin/salome/%: %
125 # copy pyqt files in $(PYTHON_SHARED_SITE)
127 PYTHON_SHARED_SITE=$(top_builddir)/lib@LIB_LOCATION_SUFFIX@/python$(PYTHON_VERSION)/site-packages/salome/shared_modules
129 $(PYTHON_SHARED_SITE):
132 DEST_SHAREDPYSCRIPTS = $(EXPORT_SHAREDPYSCRIPTS:%=$(PYTHON_SHARED_SITE)/%)
133 sharedpyscripts: $(PYTHON_SHARED_SITE) $(DEST_SHAREDPYSCRIPTS)
134 $(DEST_SHAREDPYSCRIPTS): $(PYTHON_SHARED_SITE)/%: %
137 #check: test !!!! version before AG changes
139 #tests: test !!!! version before AG changes
141 #test: $(LIB) $(TEST_PROGS:%=$(top_builddir)/bin/salome/%) !!!! version before AG changes
150 @( LD_LIBRARY_PATH=$(top_builddir)/src/MEDMEM/.libs:$(top_builddir)/src/MEDWrapper/V2_1/Core/.libs:$${LD_LIBRARY_PATH} ; \
151 SALOME_trace=local ; \
152 export SALOME_trace ; \
154 x=$${x#runtest_*} ; \
155 echo -n "Passing test : "$$x ; \
156 ./$$x > /dev/null ; \
157 if test $$? != "0"; then \
158 echo $$'\033'[1\;31m [ FAILED ] $$'\033'[0m ; \
161 echo $$'\033'[1\;32m [ OK ] $$'\033'[0m \ ; \
165 @( LD_LIBRARY_PATH=$(top_builddir)/src/MEDMEM/.libs:$(top_builddir)/src/MEDWrapper/V2_1/Core/.libs:$${LD_LIBRARY_PATH} ; \
166 PYTHONPATH=$(top_builddir)/src/MEDMEM_SWIG:$${PYTHONPATH} ; \
167 SALOME_trace=local ; \
168 export SALOME_trace ; \
170 x=$${x#runpytest_*} ; \
171 echo -n "Passing python test : "$$x ; \
172 python $(srcdir)/$$x > /dev/null ; \
173 if test $$? != "0"; then \
174 echo $$'\033'[1\;31m [ FAILED ] $$'\033'[0m ; \
177 echo $$'\033'[1\;32m [ OK ] $$'\033'[0m \ ; \
180 ALL_CHECK_TARGETS = $(patsubst %, runtest_%, $(TEST_PROGS))
182 tests: $(LIB) $(TEST_PROGS) $(ALL_CHECK_TARGETS)
183 @ln -fs $(top_builddir)/src/MEDMEM_SWIG/.libs/libMEDMEM_Swigcmodule.so $(top_builddir)/src/MEDMEM_SWIG/_libMEDMEM_Swig.so ; \
184 for f in $(TEST_PYSCRIPTS); do \
185 if [ x"$${f#*test}" != x"$${f}" ]; then \
186 $(MAKE) runpytest_$$f ; \
187 if test $$? != "0"; then \
188 rm -f $(top_builddir)/src/MEDMEM_SWIG/_libMEDMEM_Swig.so ; \
193 rm -f $(top_builddir)/src/MEDMEM_SWIG/_libMEDMEM_Swig.so ;
198 # copy header file in $(inc_builddir)
200 DEST_HEADERS = $(EXPORT_HEADERS:%=$(inc_builddir)/%)
202 $(DEST_HEADERS): $(inc_builddir)/%: %
205 # build resources file (icons and messages) : .qm file from .po file
206 resources: $(PO_FILES:%.po=$(top_builddir)/share/salome/resources/$(MODULE_NAME)/%.qm)
208 # Make installation directories if they don't exist.
209 $(libdir) $(includedir) $(bindir) $(datadir) $(idldir) $(sharedpydir):
210 $(INSTALL) -d $@ && chmod 755 $@
212 # Install the library, the public header files, and programs.
213 install: $(LIB) $(BIN) $(TEST_PROGS) $(libdir) $(includedir) $(bindir) $(datadir) $(idldir) install-python install-sharedpyqt install-qm
214 #install: $(LIB) $(BIN) $(libdir) $(includedir) $(bindir) $(datadir) $(idldir) install-python install-sharedpyqt install-qm
215 @for f in X $(LIB); do \
216 if test $$f != X; then \
217 ($(LT_INSTALL_LIB) $$f $(libdir)/. || exit 1); \
220 @if test "X$(LIB_SWIG)" != X ; then \
221 (cd $(libdir); ln -sf $(patsubst %.so, %cmodule.so, $(LIB_SWIG)) _$(LIB_SWIG) || true); \
223 @for f in X $(BIN); do \
224 if test $$f != X; then \
225 ($(LT_INSTALL_PROG) $$f $(bindir)/. || exit 1); \
228 # Install tests programmes in bindir
229 @for f in X $(TEST_PROGS); do \
230 if test $$f != X; then \
231 ($(LT_INSTALL_PROG) $$f $(bindir)/. || exit 1); \
234 # Install exported includes in includedir
235 @for f in X $(EXPORT_HEADERS:%=$(srcdir)/%); do \
236 if test $$f != X; then \
237 (cp -p -f $$f $(includedir) || exit 1); \
241 # Install python script in $(bindir)
242 install-python: $(bindir) $(EXPORT_PYSCRIPTS:%=install-%)
244 $(EXPORT_PYSCRIPTS:%=install-%): install-%: %
245 $(INSTALL_PROGRAM) $< $(bindir)/.
247 #install-python: $(bindir) $(EXPORT_PYSCRIPTS)
248 # @for f in X $(EXPORT_PYSCRIPTS); do \
249 # if test $$f != X; then \
250 # ($(INSTALL_PROGRAM) $$f $(bindir)/. || exit 1); \
254 # Install pyqt script in $(install-sharedpyqt)
255 install-sharedpyqt: $(sharedpydir) $(EXPORT_SHAREDPYSCRIPTS:%=install-%)
257 $(EXPORT_SHAREDPYSCRIPTS:%=install-%): install-%: %
258 $(INSTALL_PROGRAM) $< $(sharedpydir)/.
261 # generic rule to install .qm files :
262 install-qm: resources
263 $(INSTALL) -d $(datadir)/resources/$(MODULE_NAME)
264 @for f in X $(PO_FILES:%.po=$(top_builddir)/share/salome/resources/$(MODULE_NAME)/%.qm); do \
265 if test $$f != X; then \
266 ($(INSTALL_DATA) $$f $(datadir)/resources/$(MODULE_NAME)/. || exit 1); \
270 # Removes those things that `make install' (would have) installed.
272 @if test "X$(LIB)" != X; then \
273 for f in $(LIB); do \
274 $(LT_UNINSTALL) $(libdir)/$$f; \
277 @if test "X$(BIN)" != X; then \
278 for f in $(BIN); do \
279 $(LT_UNINSTALL) $(bindir)/$$f; \
282 @for f in X $(TEST_PROGS); do \
283 if test $$f != X; then \
284 $(LT_UNINSTALL) $(bindir)/$$f; \
287 # Uninstall exported includes in includedir
288 @for f in X $(EXPORT_HEADERS); do \
289 if test $$f != X; then \
290 $(LT_UNINSTALL) $(includedir)/$$f; \
293 # Uninstall python script in $(bindir)
294 @for f in X $(EXPORT_PYSCRIPTS); do \
295 if test $$f != X; then \
296 $(LT_UNINSTALL) $(bindir)/$$f ; \
300 # Uninstall pyqt script in $(sharedpydir)
301 @for f in X $(EXPORT_SHAREDPYSCRIPTS); do \
302 if test $$f != X; then \
303 $(LT_UNINSTALL) $(sharedpydir)/$$f ; \
308 @for f in X $(PO_FILES:%.po=%.qm); do \
309 if test $$f != X; then \
310 $(LT_UNINSTALL) $(datadir)/resources/$(MODULE_NAME)/$$f ; \
314 # remove all dependencies files
319 # Removes temporary files without removing the final target files. That is,
320 # remove things like object files but not libraries or executables.
322 mostlyclean: cleandep
323 -$(RM) $(LIB_OBJ) $(LIB_OBJ:.lo=.o)
324 -$(RM) $(BIN_OBJ) $(BIN:%=%.o)
325 -$(RM) $(TEST_OBJ) $(TEST_OBJ:.lo=.o)
326 -$(RM) $(PROG_OBJ) $(PROG_OBJ:.lo=.o) $(MOSTLYCLEAN)
328 # Like `mostlyclean' except it also removes the final targets: things like
329 # libraries and executables. This target doesn't remove any file that
330 # is part of the SALOME distribution.
333 -$(RM) $(LIB) $(TEST_PROGS) $(BIN) $(CLEAN)
334 -$(RM) TAGS *~ *# core *.core
336 -$(RM) $(top_builddir)/lib@LIB_LOCATION_SUFFIX@/salome/$(LIB)
337 -$(RM) $(patsubst %,$(top_builddir)/bin/salome/%, $(BIN))
338 -$(RM) $(patsubst %.la, %.so, $(top_builddir)/lib@LIB_LOCATION_SUFFIX@/salome/$(LIB))
339 -$(RM) $(patsubst %.la, %.a, $(top_builddir)/lib@LIB_LOCATION_SUFFIX@/salome/$(LIB))
340 # remove idl generated files (sources)
341 -$(RM) $(LIB_CLIENT_SRC) $(LIB_SERVER_SRC) $(BIN_CLIENT_SRC) $(BIN_SERVER_SRC)
342 # remove idl generated files (headers)
343 -$(RM) $(LIB_CLIENT_IDL:%.idl=%$(IDL_CLN_H)) $(LIB_SERVER_IDL:%.idl=%$(IDL_SRV_H))
344 -$(RM) $(BIN_CLIENT_IDL:%.idl=%$(IDL_CLN_H)) $(BIN_SERVER_IDL:%.idl=%$(IDL_SRV_H))
345 -$(RM) $(LIB_MOC_SRC) $(BIN_MOC_SRC)
346 -$(RM) $(LIB_SWIG_SRC)
348 # Like `clean' except it also removes files that were created by running
349 # configure. If you've unpacked the source and built without creating
350 # any other files, then `make distclean' will leave only the files that were
351 # in the distribution.
355 -$(RM) $(PO_FILES:%.po=%.qm) $(PO_FILES:%.po=$(top_builddir)/share/salome/resources/$(MODULE_NAME)/%.qm)
356 #remove include files
357 -$(RM) $(DEST_HEADERS)
358 -$(RM) $(DISTCLEAN) *.bak *.old *.new .dep*
359 @if test -f $(srcdir)/Makefile.in; then \
360 (@SETX@; $(RM) Makefile); \
366 $(CXX) $(CXXFLAGS) $(CPPFLAGS) -c $<
369 $(LT) --mode=compile $(CXX) $(CXXFLAGS) $(CPPFLAGS) -c $<
372 $(CXX) $(CXXFLAGS) $(CPPFLAGS) -c $<
375 $(LT) --mode=compile $(CXX) $(CXXFLAGS) $(CPPFLAGS) -c $<
378 $(CC) $(CFLAGS) $(CPPFLAGS) -c $<
381 $(LT_COMPILE) $(CFLAGS) $(CPPFLAGS) -c $<
384 $(FC) $(FFLAGS) -c $< -o $@
387 $(LT) --mode=compile $(FC) $(FFLAGS) -c $<
393 $(UIC) -o $@ -i $*.h $<
400 $(SWIG) $(SWIG_FLAGS) -o $@ $<
402 $(top_builddir)/share/salome/resources/$(MODULE_NAME)/%.qm: %.po
405 #------------------------------------------------------------------------------
406 # The following section of this makefile contains dependencies between the
407 # source files and the header files. If GNU make and GCC are being used then
408 # the dependencies are in the form of rules that cause the information to
409 # be kept updated automatically. Otherwise the dependencies are listed
410 # explicitly and come from the `.distdep' files in the various directories.
411 # These files are part of the distribution and are generated automatically on
413 #------------------------------------------------------------------------------