1 # Copyright (C) 2007-2020 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, or (at your option) any later version.
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
23 #=======================================================================
24 # This section of this makefile comes from the file
25 # 'adm/unix/make_conclude' which was generated with config.status
26 # from file adm/unix/make_conclude.in
27 #=======================================================================
29 # Authors : Patrick GOLDBRONN (CEA) - Marc Tajchman (CEA)
36 # transform idl reference in appropriate obj file
37 LIB_CLIENT_SRC = $(LIB_CLIENT_IDL:%.idl=%$(IDL_CLN_CXX)) $(LIB_CLIENT_IDL:%.idl=%DynSK.cc)
38 LIB_SERVER_SRC = $(LIB_SERVER_IDL:%.idl=%$(IDL_SRV_CXX))
39 LIB_MOC_SRC = $(LIB_MOC:%.h=%_moc.cxx)
40 LIB_SRC+=$(LIB_MOC_SRC)
41 LIB_SWIG_SRC = $(SWIG_DEF:%.i=%_wrap.cxx)
42 LIB_DEP= $(LIB_SRC) $(LIB_CLIENT_SRC) $(LIB_SERVER_SRC) $(LIB_SWIG_SRC)
44 LIB_CLIENT_OBJ = $(LIB_CLIENT_IDL:%.idl=%$(IDL_CLN_OBJ)) $(LIB_CLIENT_IDL:%.idl=%DynSK.o)
45 LIB_SERVER_OBJ = $(LIB_SERVER_IDL:%.idl=%$(IDL_SRV_OBJ))
48 # transform c file in appropriate libtool obj file (.c, .cc and .cxx)
49 LIB_OBJ_C = $(patsubst %.c, %.lo, $(filter %.c, $(LIB_SRC)))
50 LIB_OBJ_CC = $(patsubst %.cc, %.lo, $(filter %.cc, $(LIB_SRC)))
51 LIB_OBJ_CXX = $(patsubst %.cxx, %.lo, $(filter %.cxx, $(LIB_SRC)))
52 LIB_SWIG_OBJ = $(LIB_SWIG_SRC:%.cxx=%.lo)
53 LIB_OBJ_F = $(patsubst %.f, %.lo, $(filter %.f, $(LIB_SRC)))
55 # all libtool obj file in library
56 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)
58 # LIB_BUILD = $(LIB:%.la=$(top_builddir)/lib@LIB_LOCATION_SUFFIX@/salome/%.la)
59 LIB_BUILD = $(patsubst %.la, $(top_builddir)/lib@LIB_LOCATION_SUFFIX@/salome/%.la, $(filter %.la, $(LIB)))
60 LIB_BUILD_A = $(patsubst %.a, $(top_builddir)/lib@LIB_LOCATION_SUFFIX@/salome/%.a, $(filter %.a, $(LIB)))
61 LIB_BUILD_SO = $(patsubst %.so, $(top_builddir)/lib@LIB_LOCATION_SUFFIX@/salome/%.so, $(filter %.so, $(LIB)))
63 ifneq ($(findstring cmodule.la,$(filter %.la, $(LIB))),)
64 LIB_SWIG = $(patsubst %cmodule.la,%.so, $(filter %.la, $(LIB)))
69 lib: $(LIB_BUILD) $(LIB_BUILD_SO) $(LIB_CLIENT_PY)
70 # we don't build static library !
72 $(LIB_BUILD): $(top_builddir)/lib@LIB_LOCATION_SUFFIX@/salome/%.la: %.la
74 -$(RM) $(patsubst %.la, %.so, $@)
75 -$(RM) $(patsubst %.la, %.a, $@)
76 ln -sf $(CURDIR)/$< $@ || true
77 ln -sf $(patsubst %.la, %.so, $(CURDIR)/.libs/$<) \
78 $(patsubst %.la, %.so, $@) || true
79 ln -sf $(patsubst %.la, %.so, $(CURDIR)/.libs/$<).0 \
80 $(patsubst %.la, %.so, $@).0 || true
82 if test "X$(LIB_SWIG)" != "X"; then \
83 ln -sf $(patsubst %.la,%.so, $(CURDIR)/.libs/$<) $(top_builddir)/lib@LIB_LOCATION_SUFFIX@/salome/_$(LIB_SWIG) || true;\
86 $(LIB_BUILD_A): $(top_builddir)/lib@LIB_LOCATION_SUFFIX@/salome/%.a: %.a
88 ln -sf $(CURDIR)/$< $@ || true
90 $(LIB_BUILD_SO): $(top_builddir)/lib@LIB_LOCATION_SUFFIX@/salome/%.so: %.so
92 ln -sf $(CURDIR)/$< $@ || true
95 @$(LT) --mode=link $(CXX) -shared -rpath $(libdir) -o $@ $(CXXFLAGS) $(LIB_OBJ) $(LDFLAGS) $(LIBS)
97 # transform idl reference in appropriate obj file
98 BIN_CLIENT_SRC = $(BIN_CLIENT_IDL:%.idl=%$(IDL_CLN_CXX)) $(BIN_CLIENT_IDL:%.idl=%DynSK.cc)
99 BIN_SERVER_SRC = $(BIN_SERVER_IDL:%.idl=%$(IDL_SRV_CXX))
100 BIN_MOC_SRC = $(BIN_MOC:%.h=%_moc.cxx)
101 BIN_SRC+=$(BIN_MOC_SRC)
102 BIN_DEP=$(BIN:%=%.cxx) $(BIN_SRC) $(BIN_CLIENT_SRC) $(BIN_SERVER_SRC)
104 BIN_CLIENT_OBJ = $(BIN_CLIENT_IDL:%.idl=%$(IDL_CLN_OBJ)) $(BIN_CLIENT_IDL:%.idl=%DynSK.o)
105 BIN_SERVER_OBJ = $(BIN_SERVER_IDL:%.idl=%$(IDL_SRV_OBJ))
106 # transform c file in appropriate libtool obj file (.c)
107 BIN_OBJ_C = $(patsubst %.c, %.o, $(filter %.c, $(BIN_SRC)))
108 # transform c++ file in appropriate libtool obj file (.cc and .cxx)
109 BIN_OBJ_CC = $(patsubst %.cc, %.o, $(filter %.cc, $(BIN_SRC)))
110 BIN_OBJ_CXX = $(patsubst %.cxx, %.o, $(filter %.cxx, $(BIN_SRC)))
111 # all obj file in bin target
112 BIN_OBJ = $(BIN_OBJ_CC) $(BIN_OBJ_CXX) $(BIN_OBJ_C) $(BIN_CLIENT_OBJ) $(BIN_SERVER_OBJ)
114 bin: $(BIN:%=$(top_builddir)/bin/salome/%) $(BIN) $(LIB) pyscripts sharedpyscripts
116 BIN_LIB=$(LIB:lib%.la=-l%)
118 $(BIN:%=$(top_builddir)/bin/salome/%) $(TEST_PROGS:%=$(top_builddir)/bin/salome/%): $(top_builddir)/bin/salome/%: %
120 ln -sf $(CURDIR)/$< $@
122 $(BIN) $(TEST_PROGS): %: %.lo $(BIN_OBJ)
123 $(CXX) $(CPPFLAGS) $(CXXFLAGS) -o $@ $^ $(BIN_LIB) $(LDFLAGSFORBIN) $(LIBSFORBIN)
125 # copy python scripts in $(top_builddir)/bin/salome
128 UI_FILES = $(notdir $(wildcard $(srcdir)/*.ui))
129 UI_PY_FILES_PY = $(patsubst %.ui, %.py, $(UI_FILES))
130 UI_PY_FILES = $(filter-out $(EXPORT_PYSCRIPTS) ,$(UI_PY_FILES_PY))
132 DEST_PYSCRIPTS = $(EXPORT_PYSCRIPTS:%=$(top_builddir)/bin/salome/%)
133 DEST_UI_PY_FILES = $(UI_PY_FILES:%=$(top_builddir)/bin/salome/%)
134 pyscripts: $(DEST_PYSCRIPTS) $(UI_PY_FILES) $(DEST_UI_PY_FILES)
135 $(DEST_PYSCRIPTS): $(top_builddir)/bin/salome/%: %
138 # generate generic python scripts from *.ui files
140 $(UI_PY_FILES): %.py: %.ui
143 # copy ui-generated python scripts in $(top_builddir)/bin
145 $(DEST_UI_PY_FILES): $(top_builddir)/bin/salome/%: %
148 # copy pyqt files in $(PYTHON_SHARED_SITE)
150 PYTHON_SHARED_SITE=$(top_builddir)/lib@LIB_LOCATION_SUFFIX@/python$(PYTHON_VERSION)/site-packages/salome/shared_modules
152 $(PYTHON_SHARED_SITE):
155 DEST_SHAREDPYSCRIPTS = $(EXPORT_SHAREDPYSCRIPTS:%=$(PYTHON_SHARED_SITE)/%)
156 sharedpyscripts: $(PYTHON_SHARED_SITE) $(DEST_SHAREDPYSCRIPTS)
157 $(DEST_SHAREDPYSCRIPTS): $(PYTHON_SHARED_SITE)/%: %
164 test: $(LIB) $(TEST_PROGS:%=$(top_builddir)/bin/salome/%)
167 @if test "x$(UNIT_TEST_PROG)" != "x"; then \
168 $(top_builddir)/bin/salome/$(UNIT_TEST_PROG); \
171 # copy header file in $(inc_builddir)
173 DEST_HEADERS = $(EXPORT_HEADERS:%=$(inc_builddir)/%)
175 $(DEST_HEADERS): $(inc_builddir)/%: %
178 # build resources file (icons and messages) : .qm file from .po file
179 RESOURCES_FILES_ALL := $(notdir $(wildcard $(srcdir)/resources/*))
180 RESOURCES_FILES_ALL := $(filter-out CVS, $(RESOURCES_FILES_ALL))
181 RESOURCES_FILES_ALL := $(filter-out %.po, $(RESOURCES_FILES_ALL))
182 RESOURCES_FILES_ALL := $(filter-out %.in, $(RESOURCES_FILES_ALL))
183 RESOURCES_FILES ?= $(RESOURCES_FILES_ALL)
185 resources: resources-po resources-cp
187 resources-po: $(PO_FILES:%.po=$(top_builddir)/share/salome/resources/$(MODULE_NAME)/%.qm)
189 resources-cp: $(RESOURCES_FILES:%=$(top_builddir)/share/salome/resources/$(MODULE_NAME)/%)
191 $(RESOURCES_FILES:%=$(top_builddir)/share/salome/resources/$(MODULE_NAME)/%): $(top_builddir)/share/salome/resources/$(MODULE_NAME)/% : %
194 # Make installation directories if they don't exist.
195 $(libdir) $(includedir) $(bindir) $(datadir) $(idldir) $(sharedpydir):
196 $(INSTALL) -d $@ && chmod 755 $@
198 # Install the library, the public header files, and programs.
199 install: $(LIB) $(BIN) $(TEST_PROGS) $(libdir) $(includedir) $(bindir) $(datadir) $(idldir) install-python install-sharedpyqt install-qm install-res
200 @for f in X $(LIB); do \
201 if test $$f != X; then \
202 ($(LT_INSTALL_LIB) $$f $(libdir)/. || exit 1); \
205 @if test "X$(LIB_SWIG)" != "X"; then \
206 (cd $(libdir); ln -sf $(patsubst %.so, %cmodule.so, $(LIB_SWIG)) _$(LIB_SWIG) || true); \
208 @for f in X $(BIN); do \
209 if test $$f != X; then \
210 ($(LT_INSTALL_PROG) $$f $(bindir)/. || exit 1); \
213 # Install tests programmes in bindir
214 @for f in X $(TEST_PROGS); do \
215 if test $$f != X; then \
216 ($(LT_INSTALL_PROG) $$f $(bindir)/. || exit 1); \
219 # Install exported includes in includedir
220 @for f in X $(EXPORT_HEADERS:%=$(srcdir)/%); do \
221 if test $$f != X; then \
222 (cp -p -f $$f $(includedir) || exit 1); \
226 # Install python script in $(bindir)
227 install-python: $(bindir) $(EXPORT_PYSCRIPTS:%=install-%) $(UI_PY_FILES:%=install-%)
229 $(UI_PY_FILES:%=install-%): install-%: %
230 $(INSTALL_PROGRAM) $< $(bindir)/.
232 $(EXPORT_PYSCRIPTS:%=install-%): install-%: %
233 $(INSTALL_PROGRAM) $< $(bindir)/.
235 #install-python: $(bindir) $(EXPORT_PYSCRIPTS)
236 # @for f in X $(EXPORT_PYSCRIPTS); do \
237 # if test $$f != X; then \
238 # ($(INSTALL_PROGRAM) $$f $(bindir)/. || exit 1); \
242 # Install pyqt script in $(install-sharedpyqt)
243 install-sharedpyqt: $(sharedpydir) $(EXPORT_SHAREDPYSCRIPTS:%=install-%)
245 $(EXPORT_SHAREDPYSCRIPTS:%=install-%): install-%: %
246 $(INSTALL_PROGRAM) $< $(sharedpydir)/.
249 # generic rule to install .qm files :
250 install-qm: resources
251 $(INSTALL) -d $(datadir)/resources/$(MODULE_NAME)
252 @for f in X $(PO_FILES:%.po=$(top_builddir)/share/salome/resources/$(MODULE_NAME)/%.qm); do \
253 if test $$f != X; then \
254 ($(INSTALL_DATA) $$f $(datadir)/resources/$(MODULE_NAME)/. || exit 1); \
258 # generic rule to install resources files (png, ini ...):
259 install-res: resources
260 $(INSTALL) -d $(datadir)/resources/$(MODULE_NAME)
261 @for f in X $(RESOURCES_FILES:%=$(top_builddir)/share/salome/resources/$(MODULE_NAME)/%); do \
262 if test $$f != X; then \
263 ($(INSTALL_DATA) $$f $(datadir)/resources/$(MODULE_NAME)/. || exit 1); \
267 # Removes those things that `make install' (would have) installed.
269 @if test "X$(LIB)" != X; then \
270 for f in $(LIB); do \
271 $(LT_UNINSTALL) $(libdir)/$$f; \
274 @if test "X$(BIN)" != X; then \
275 for f in $(BIN); do \
276 $(LT_UNINSTALL) $(bindir)/$$f; \
279 @for f in X $(TEST_PROGS); do \
280 if test $$f != X; then \
281 $(LT_UNINSTALL) $(bindir)/$$f; \
284 # Uninstall exported includes in includedir
285 @for f in X $(EXPORT_HEADERS); do \
286 if test $$f != X; then \
287 $(LT_UNINSTALL) $(includedir)/$$f; \
290 # Uninstall python script in $(bindir)
291 @for f in X $(EXPORT_PYSCRIPTS); do \
292 if test $$f != X; then \
293 $(LT_UNINSTALL) $(bindir)/$$f ; \
297 # Uninstall python script in $(bindir)
298 @for f in X $(UI_PY_FILES); do \
299 if test $$f != X; then \
300 $(LT_UNINSTALL) $(bindir)/$$f ; \
304 # Uninstall pyqt script in $(sharedpydir)
305 @for f in X $(EXPORT_SHAREDPYSCRIPTS); do \
306 if test $$f != X; then \
307 $(LT_UNINSTALL) $(sharedpydir)/$$f ; \
312 @for f in X $(PO_FILES:%.po=%.qm); do \
313 if test $$f != X; then \
314 $(LT_UNINSTALL) $(datadir)/resources/$(MODULE_NAME)/$$f ; \
318 # remove all dependencies files
323 # Removes temporary files without removing the final target files. That is,
324 # remove things like object files but not libraries or executables.
326 mostlyclean: cleandep
327 -$(RM) $(LIB_OBJ) $(LIB_OBJ:.lo=.o)
328 -$(RM) $(BIN_OBJ) $(BIN:%=%.o)
329 -$(RM) $(TEST_OBJ) $(TEST_OBJ:.lo=.o)
330 -$(RM) $(PROG_OBJ) $(PROG_OBJ:.lo=.o) $(MOSTLYCLEAN)
332 # Like `mostlyclean' except it also removes the final targets: things like
333 # libraries and executables. This target doesn't remove any file that
334 # is part of the SALOME distribution.
337 -$(RM) $(LIB) $(TEST_PROGS) $(BIN) $(CLEAN)
338 -$(RM) TAGS *~ *# core *.core
340 -$(RM) $(top_builddir)/lib@LIB_LOCATION_SUFFIX@/salome/$(LIB)
341 -$(RM) $(patsubst %,$(top_builddir)/bin/salome/%, $(BIN))
342 -$(RM) $(patsubst %.la, %.so, $(top_builddir)/lib@LIB_LOCATION_SUFFIX@/salome/$(LIB))
343 -$(RM) $(patsubst %.la, %.a, $(top_builddir)/lib@LIB_LOCATION_SUFFIX@/salome/$(LIB))
344 # remove idl generated files (sources)
345 -$(RM) $(LIB_CLIENT_SRC) $(LIB_SERVER_SRC) $(BIN_CLIENT_SRC) $(BIN_SERVER_SRC)
346 # remove idl generated files (headers)
347 -$(RM) $(LIB_CLIENT_IDL:%.idl=%$(IDL_CLN_H)) $(LIB_SERVER_IDL:%.idl=%$(IDL_SRV_H))
348 -$(RM) $(BIN_CLIENT_IDL:%.idl=%$(IDL_CLN_H)) $(BIN_SERVER_IDL:%.idl=%$(IDL_SRV_H))
349 -$(RM) $(LIB_MOC_SRC) $(BIN_MOC_SRC)
350 -$(RM) $(LIB_SWIG_SRC)
352 # Like `clean' except it also removes files that were created by running
353 # configure. If you've unpacked the source and built without creating
354 # any other files, then `make distclean' will leave only the files that were
355 # in the distribution.
359 -$(RM) $(PO_FILES:%.po=%.qm) $(PO_FILES:%.po=$(top_builddir)/share/salome/resources/$(MODULE_NAME)/%.qm)
360 #remove include files
361 -$(RM) $(DEST_HEADERS)
362 -$(RM) $(DISTCLEAN) *.bak *.old *.new .dep*
363 @if test -f $(srcdir)/Makefile.in; then \
364 (@SETX@; $(RM) Makefile); \
370 $(CXX) $(CXXFLAGS) $(CPPFLAGS) -c $<
373 $(LT) --mode=compile $(CXX) $(CXXFLAGS) $(CPPFLAGS) -c $<
376 $(CXX) $(CXXFLAGS) $(CPPFLAGS) -c $<
379 $(LT) --mode=compile $(CXX) $(CXXFLAGS) $(CPPFLAGS) -c $<
382 $(CC) $(CFLAGS) $(CPPFLAGS) -c $<
385 $(LT_COMPILE) $(CFLAGS) $(CPPFLAGS) -c $<
388 $(FC) $(FFLAGS) -c $< -o $@
391 $(LT) --mode=compile $(FC) $(FFLAGS) -c $<
397 $(UIC) -o $@ -i $*.h $<
404 $(SWIG) $(SWIG_FLAGS) -o $@ $<
406 $(top_builddir)/share/salome/resources/$(MODULE_NAME)/%.qm: %.po
409 #------------------------------------------------------------------------------
410 # The following section of this makefile contains dependencies between the
411 # source files and the header files. If GNU make and GCC are being used then
412 # the dependencies are in the form of rules that cause the information to
413 # be kept updated automatically. Otherwise the dependencies are listed
414 # explicitly and come from the `.distdep' files in the various directories.
415 # These files are part of the distribution and are generated automatically on
417 #------------------------------------------------------------------------------