1 # Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
3 # Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 # CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
6 # This library is free software; you can redistribute it and/or
7 # modify it under the terms of the GNU Lesser General Public
8 # License as published by the Free Software Foundation; either
9 # version 2.1 of the License.
11 # This library is distributed in the hope that it will be useful,
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 # Lesser General Public License for more details.
16 # You should have received a copy of the GNU Lesser General Public
17 # License along with this library; if not, write to the Free Software
18 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
22 #=======================================================================
23 # This section of this makefile comes from the file
24 # 'adm/unix/make_conclude' which was generated with config.status
25 # from file adm/unix/make_conclude.in
26 #=======================================================================
28 # Authors : Patrick GOLDBRONN (CEA) - Marc Tajchman (CEA)
32 ifneq ($(GUI_DISABLE_CORBA),yes)
37 # transform idl reference in appropriate obj file
38 LIB_CLIENT_SRC = $(LIB_CLIENT_IDL:%.idl=%$(IDL_CLN_CXX))
39 LIB_SERVER_SRC = $(LIB_SERVER_IDL:%.idl=%$(IDL_SRV_CXX))
40 LIB_SWIG_SRC = $(SWIG_DEF:%.i=%_wrap.cxx)
47 LIB_MOC_SRC = $(LIB_MOC:%.h=%_moc.cxx)
48 LIB_SRC+=$(LIB_MOC_SRC)
49 LIB_DEP= $(LIB_SRC) $(LIB_CLIENT_SRC) $(LIB_SERVER_SRC) $(LIB_SWIG_SRC)
51 ifneq ($(GUI_DISABLE_CORBA),yes)
52 LIB_CLIENT_OBJ = $(LIB_CLIENT_IDL:%.idl=%$(IDL_CLN_OBJ))
53 LIB_SERVER_OBJ = $(LIB_SERVER_IDL:%.idl=%$(IDL_SRV_OBJ))
54 LIB_SWIG_OBJ = $(LIB_SWIG_SRC:%.cxx=%.lo)
61 # transform c file in appropriate libtool obj file (.c, .cc and .cxx)
62 LIB_OBJ_C = $(patsubst %.c, %.lo, $(filter %.c, $(LIB_SRC)))
63 LIB_OBJ_CC = $(patsubst %.cc, %.lo, $(filter %.cc, $(LIB_SRC)))
64 LIB_OBJ_CXX = $(patsubst %.cxx, %.lo, $(filter %.cxx, $(LIB_SRC)))
65 LIB_OBJ_F = $(patsubst %.f, %.lo, $(filter %.f, $(LIB_SRC)))
67 # all libtool obj file in library
68 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)
70 # LIB_BUILD = $(LIB:%.la=$(top_builddir)/lib@LIB_LOCATION_SUFFIX@/salome/%.la)
71 LIB_BUILD = $(patsubst %.la, $(top_builddir)/lib@LIB_LOCATION_SUFFIX@/salome/%.la, $(filter %.la, $(LIB)))
72 LIB_BUILD_A = $(patsubst %.a, $(top_builddir)/lib@LIB_LOCATION_SUFFIX@/salome/%.a, $(filter %.a, $(LIB)))
73 LIB_BUILD_SO = $(patsubst %.so, $(top_builddir)/lib@LIB_LOCATION_SUFFIX@/salome/%.so, $(filter %.so, $(LIB)))
75 ifneq ($(findstring cmodule.la,$(filter %.la, $(LIB))),)
76 ifneq ($(GUI_DISABLE_CORBA),yes)
77 LIB_SWIG = $(patsubst %cmodule.la,%.so, $(filter %.la, $(LIB)))
85 lib: $(LIB_BUILD) $(LIB_BUILD_SO) $(LIB_CLIENT_PY)
86 # we don't build static library !
88 $(LIB_BUILD): $(top_builddir)/lib@LIB_LOCATION_SUFFIX@/salome/%.la: %.la
90 -$(RM) $(patsubst %.la, %.so, $@)
91 -$(RM) $(patsubst %.la, %.a, $@)
92 ln -sf $(CURDIR)/$< $@ || true
93 ln -sf $(patsubst %.la, %.so, $(CURDIR)/.libs/$<) \
94 $(patsubst %.la, %.so, $@) || true
95 ln -sf $(patsubst %.la, %.so, $(CURDIR)/.libs/$<).0 \
96 $(patsubst %.la, %.so, $@).0 || true
98 if ! test -z $(LIB_SWIG) ; then \
99 ln -sf $(patsubst %.la,%.so, $(CURDIR)/.libs/$<) $(top_builddir)/lib@LIB_LOCATION_SUFFIX@/salome/_$(LIB_SWIG) || true;\
102 $(LIB_BUILD_A): $(top_builddir)/lib@LIB_LOCATION_SUFFIX@/salome/%.a: %.a
104 ln -sf $(CURDIR)/$< $@ || true
106 $(LIB_BUILD_SO): $(top_builddir)/lib@LIB_LOCATION_SUFFIX@/salome/%.so: %.so
108 ln -sf $(CURDIR)/$< $@ || true
111 @$(LT) --mode=link $(CXX) -shared -rpath $(libdir) -o $@ $(CXXFLAGS) $(LIB_OBJ) $(LDFLAGS) $(LIBS)
113 # transform idl reference in appropriate obj file
114 ifneq ($(GUI_DISABLE_CORBA),yes)
115 BIN_CLIENT_SRC = $(BIN_CLIENT_IDL:%.idl=%$(IDL_CLN_CXX))
116 BIN_SERVER_SRC = $(BIN_SERVER_IDL:%.idl=%$(IDL_SRV_CXX))
121 BIN_MOC_SRC = $(BIN_MOC:%.h=%_moc.cxx)
122 BIN_SRC+=$(BIN_MOC_SRC)
123 BIN_DEP=$(BIN:%=%.cxx) $(BIN_SRC) $(BIN_CLIENT_SRC) $(BIN_SERVER_SRC)
125 ifneq ($(GUI_DISABLE_CORBA),yes)
126 BIN_CLIENT_OBJ = $(BIN_CLIENT_IDL:%.idl=%$(IDL_CLN_OBJ))
127 BIN_SERVER_OBJ = $(BIN_SERVER_IDL:%.idl=%$(IDL_SRV_OBJ))
132 # transform c file in appropriate libtool obj file (.c)
133 BIN_OBJ_C = $(patsubst %.c, %.o, $(filter %.c, $(BIN_SRC)))
134 # transform c++ file in appropriate libtool obj file (.cc and .cxx)
135 BIN_OBJ_CC = $(patsubst %.cc, %.o, $(filter %.cc, $(BIN_SRC)))
136 BIN_OBJ_CXX = $(patsubst %.cxx, %.o, $(filter %.cxx, $(BIN_SRC)))
137 # all obj file in bin target
138 BIN_OBJ = $(BIN_OBJ_CC) $(BIN_OBJ_CXX) $(BIN_OBJ_C) $(BIN_CLIENT_OBJ) $(BIN_SERVER_OBJ)
140 bin: $(BIN:%=$(top_builddir)/bin/salome/%) $(BIN) $(LIB) pyscripts sharedpyscripts
142 BIN_LIB=$(LIB:lib%.la=-l%)
144 $(BIN:%=$(top_builddir)/bin/salome/%) $(TEST_PROGS:%=$(top_builddir)/bin/salome/%): $(top_builddir)/bin/salome/%: %
146 ln -sf $(CURDIR)/$< $@
148 $(BIN) $(TEST_PROGS): %: %.lo $(BIN_OBJ)
149 $(CXX) $(CPPFLAGS) $(CXXFLAGS) -o $@ $^ $(BIN_LIB) $(LDFLAGSFORBIN) $(LIBSFORBIN)
151 # copy python scripts in $(top_builddir)/bin/salome
154 UI_FILES = $(notdir $(wildcard $(srcdir)/*.ui))
155 UI_PY_FILES_PY = $(patsubst %.ui, %.py, $(UI_FILES))
156 UI_PY_FILES = $(filter-out $(EXPORT_PYSCRIPTS) ,$(UI_PY_FILES_PY))
158 DEST_PYSCRIPTS = $(EXPORT_PYSCRIPTS:%=$(top_builddir)/bin/salome/%)
159 DEST_UI_PY_FILES = $(UI_PY_FILES:%=$(top_builddir)/bin/salome/%)
160 pyscripts: $(DEST_PYSCRIPTS) $(UI_PY_FILES) $(DEST_UI_PY_FILES)
161 $(DEST_PYSCRIPTS): $(top_builddir)/bin/salome/%: %
164 # generate generic python scripts from *.ui files
166 $(UI_PY_FILES): %.py: %.ui
169 # copy ui-generated python scripts in $(top_builddir)/bin
171 $(DEST_UI_PY_FILES): $(top_builddir)/bin/salome/%: %
174 # copy pyqt files in $(PYTHON_SHARED_SITE)
176 PYTHON_SHARED_SITE=$(top_builddir)/lib@LIB_LOCATION_SUFFIX@/python$(PYTHON_VERSION)/site-packages/salome/shared_modules
178 $(PYTHON_SHARED_SITE):
181 DEST_SHAREDPYSCRIPTS = $(EXPORT_SHAREDPYSCRIPTS:%=$(PYTHON_SHARED_SITE)/%)
182 sharedpyscripts: $(PYTHON_SHARED_SITE) $(DEST_SHAREDPYSCRIPTS)
183 $(DEST_SHAREDPYSCRIPTS): $(PYTHON_SHARED_SITE)/%: %
190 test: $(LIB) $(TEST_PROGS:%=$(top_builddir)/bin/salome/%)
193 @if test "x$(UNIT_TEST_PROG)" != "x"; then \
194 $(top_builddir)/bin/salome/$(UNIT_TEST_PROG); \
197 # copy header file in $(inc_builddir)
199 DEST_HEADERS = $(EXPORT_HEADERS:%=$(inc_builddir)/%)
201 $(DEST_HEADERS): $(inc_builddir)/%: %
204 # build resources file (icons and messages) : .qm file from .po file
205 RESOURCES_FILES_ALL := $(notdir $(wildcard $(srcdir)/resources/*))
206 RESOURCES_FILES_ALL := $(filter-out CVS, $(RESOURCES_FILES_ALL))
207 RESOURCES_FILES_ALL := $(filter-out %.po, $(RESOURCES_FILES_ALL))
208 RESOURCES_FILES_ALL := $(filter-out %.in, $(RESOURCES_FILES_ALL))
209 RESOURCES_FILES ?= $(RESOURCES_FILES_ALL)
211 resources: resources-po resources-cp
213 resources-po: $(PO_FILES:%.po=$(top_builddir)/share/salome/resources/$(MODULE_NAME)/%.qm)
215 resources-cp: $(RESOURCES_FILES:%=$(top_builddir)/share/salome/resources/$(MODULE_NAME)/%)
217 $(RESOURCES_FILES:%=$(top_builddir)/share/salome/resources/$(MODULE_NAME)/%): $(top_builddir)/share/salome/resources/$(MODULE_NAME)/% : %
220 # Make installation directories if they don't exist.
221 $(libdir) $(includedir) $(bindir) $(datadir) $(idldir) $(sharedpydir):
222 $(INSTALL) -d $@ && chmod 755 $@
224 # Install the library, the public header files, and programs.
225 install: $(LIB) $(BIN) $(TEST_PROGS) $(libdir) $(includedir) $(bindir) $(datadir) $(idldir) install-python install-sharedpyqt install-qm install-res
226 @for f in X $(LIB); do \
227 if test $$f != X; then \
228 ($(LT_INSTALL_LIB) $$f $(libdir)/. || exit 1); \
231 @if ! test -z $(LIB_SWIG) ; then \
232 (cd $(libdir); ln -sf $(patsubst %.so, %cmodule.so, $(LIB_SWIG)) _$(LIB_SWIG) || true); \
234 @for f in X $(BIN); do \
235 if test $$f != X; then \
236 ($(LT_INSTALL_PROG) $$f $(bindir)/. || exit 1); \
239 # Install tests programmes in bindir
240 @for f in X $(TEST_PROGS); do \
241 if test $$f != X; then \
242 ($(LT_INSTALL_PROG) $$f $(bindir)/. || exit 1); \
245 # Install exported includes in includedir
246 @for f in X $(EXPORT_HEADERS:%=$(srcdir)/%); do \
247 if test $$f != X; then \
248 (cp -p -f $$f $(includedir) || exit 1); \
252 # Install python script in $(bindir)
253 install-python: $(bindir) $(EXPORT_PYSCRIPTS:%=install-%) $(UI_PY_FILES:%=install-%)
255 $(UI_PY_FILES:%=install-%): install-%: %
256 $(INSTALL_PROGRAM) $< $(bindir)/.
258 $(EXPORT_PYSCRIPTS:%=install-%): install-%: %
259 $(INSTALL_PROGRAM) $< $(bindir)/.
261 #install-python: $(bindir) $(EXPORT_PYSCRIPTS)
262 # @for f in X $(EXPORT_PYSCRIPTS); do \
263 # if test $$f != X; then \
264 # ($(INSTALL_PROGRAM) $$f $(bindir)/. || exit 1); \
268 # Install pyqt script in $(install-sharedpyqt)
269 install-sharedpyqt: $(sharedpydir) $(EXPORT_SHAREDPYSCRIPTS:%=install-%)
271 $(EXPORT_SHAREDPYSCRIPTS:%=install-%): install-%: %
272 $(INSTALL_PROGRAM) $< $(sharedpydir)/.
275 # generic rule to install .qm files :
276 install-qm: resources
277 $(INSTALL) -d $(datadir)/resources/$(MODULE_NAME)
278 @for f in X $(PO_FILES:%.po=$(top_builddir)/share/salome/resources/$(MODULE_NAME)/%.qm); do \
279 if test $$f != X; then \
280 ($(INSTALL_DATA) $$f $(datadir)/resources/$(MODULE_NAME)/. || exit 1); \
284 # generic rule to install resources files (png, ini ...):
285 install-res: resources
286 $(INSTALL) -d $(datadir)/resources/$(MODULE_NAME)
287 @for f in X $(RESOURCES_FILES:%=$(top_builddir)/share/salome/resources/$(MODULE_NAME)/%); do \
288 if test $$f != X; then \
289 ($(INSTALL_DATA) $$f $(datadir)/resources/$(MODULE_NAME)/. || exit 1); \
293 # Removes those things that `make install' (would have) installed.
295 @if test "X$(LIB)" != X; then \
296 for f in $(LIB); do \
297 $(LT_UNINSTALL) $(libdir)/$$f; \
300 @if test "X$(BIN)" != X; then \
301 for f in $(BIN); do \
302 $(LT_UNINSTALL) $(bindir)/$$f; \
305 @for f in X $(TEST_PROGS); do \
306 if test $$f != X; then \
307 $(LT_UNINSTALL) $(bindir)/$$f; \
310 # Uninstall exported includes in includedir
311 @for f in X $(EXPORT_HEADERS); do \
312 if test $$f != X; then \
313 $(LT_UNINSTALL) $(includedir)/$$f; \
316 # Uninstall python script in $(bindir)
317 @for f in X $(EXPORT_PYSCRIPTS); do \
318 if test $$f != X; then \
319 $(LT_UNINSTALL) $(bindir)/$$f ; \
323 # Uninstall python script in $(bindir)
324 @for f in X $(UI_PY_FILES); do \
325 if test $$f != X; then \
326 $(LT_UNINSTALL) $(bindir)/$$f ; \
330 # Uninstall pyqt script in $(sharedpydir)
331 @for f in X $(EXPORT_SHAREDPYSCRIPTS); do \
332 if test $$f != X; then \
333 $(LT_UNINSTALL) $(sharedpydir)/$$f ; \
338 @for f in X $(PO_FILES:%.po=%.qm); do \
339 if test $$f != X; then \
340 $(LT_UNINSTALL) $(datadir)/resources/$(MODULE_NAME)/$$f ; \
344 # remove all dependencies files
349 # Removes temporary files without removing the final target files. That is,
350 # remove things like object files but not libraries or executables.
352 mostlyclean: cleandep
353 -$(RM) $(LIB_OBJ) $(LIB_OBJ:.lo=.o)
354 -$(RM) $(BIN_OBJ) $(BIN:%=%.o)
355 -$(RM) $(TEST_OBJ) $(TEST_OBJ:.lo=.o)
356 -$(RM) $(PROG_OBJ) $(PROG_OBJ:.lo=.o) $(MOSTLYCLEAN)
358 # Like `mostlyclean' except it also removes the final targets: things like
359 # libraries and executables. This target doesn't remove any file that
360 # is part of the SALOME distribution.
363 -$(RM) $(LIB) $(TEST_PROGS) $(BIN) $(CLEAN)
364 -$(RM) TAGS *~ *# core *.core
366 -$(RM) $(top_builddir)/lib@LIB_LOCATION_SUFFIX@/salome/$(LIB)
367 -$(RM) $(patsubst %,$(top_builddir)/bin/salome/%, $(BIN))
368 -$(RM) $(patsubst %.la, %.so, $(top_builddir)/lib@LIB_LOCATION_SUFFIX@/salome/$(LIB))
369 -$(RM) $(patsubst %.la, %.a, $(top_builddir)/lib@LIB_LOCATION_SUFFIX@/salome/$(LIB))
370 # remove idl generated files (sources)
371 -$(RM) $(LIB_CLIENT_SRC) $(LIB_SERVER_SRC) $(BIN_CLIENT_SRC) $(BIN_SERVER_SRC)
372 # remove idl generated files (headers)
373 -$(RM) $(LIB_CLIENT_IDL:%.idl=%$(IDL_CLN_H)) $(LIB_SERVER_IDL:%.idl=%$(IDL_SRV_H))
374 -$(RM) $(BIN_CLIENT_IDL:%.idl=%$(IDL_CLN_H)) $(BIN_SERVER_IDL:%.idl=%$(IDL_SRV_H))
375 -$(RM) $(LIB_MOC_SRC) $(BIN_MOC_SRC)
376 -$(RM) $(LIB_SWIG_SRC)
378 # Like `clean' except it also removes files that were created by running
379 # configure. If you've unpacked the source and built without creating
380 # any other files, then `make distclean' will leave only the files that were
381 # in the distribution.
385 -$(RM) $(PO_FILES:%.po=%.qm) $(PO_FILES:%.po=$(top_builddir)/share/salome/resources/$(MODULE_NAME)/%.qm)
386 #remove include files
387 -$(RM) $(DEST_HEADERS)
388 -$(RM) $(DISTCLEAN) *.bak *.old *.new .dep*
389 @if test -f $(srcdir)/Makefile.in; then \
390 (@SETX@; $(RM) Makefile); \
396 $(CXX) $(CXXFLAGS) $(CPPFLAGS) -c $<
399 $(LT) --mode=compile $(CXX) $(CXXFLAGS) $(CPPFLAGS) -c $<
402 $(CXX) $(CXXFLAGS) $(CPPFLAGS) -c $<
405 $(LT) --mode=compile $(CXX) $(CXXFLAGS) $(CPPFLAGS) -c $<
408 $(CC) $(CFLAGS) $(CPPFLAGS) -c $<
411 $(LT_COMPILE) $(CFLAGS) $(CPPFLAGS) -c $<
414 $(FC) $(FFLAGS) -c $< -o $@
417 $(LT) --mode=compile $(FC) $(FFLAGS) -c $<
423 $(UIC) -o $@ -i $*.h $<
430 $(SWIG) $(SWIG_FLAGS) -o $@ $<
432 $(top_builddir)/share/salome/resources/$(MODULE_NAME)/%.qm: %.po
435 #------------------------------------------------------------------------------
436 # The following section of this makefile contains dependencies between the
437 # source files and the header files. If GNU make and GCC are being used then
438 # the dependencies are in the form of rules that cause the information to
439 # be kept updated automatically. Otherwise the dependencies are listed
440 # explicitly and come from the `.distdep' files in the various directories.
441 # These files are part of the distribution and are generated automatically on
443 #------------------------------------------------------------------------------