Salome HOME
Update copyright information
[modules/filter.git] / adm_local / unix / make_conclude.in
1 #  Copyright (C) 2007-2008  CEA/DEN, EDF R&D
2 #
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.
7 #
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.
12 #
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
16 #
17 #  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
18 #
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 #=======================================================================
24 # -* Makefile *- 
25 # Authors : Patrick GOLDBRONN (CEA) - Marc Tajchman (CEA)
26 # Date : 6/07/2001
27 # $Header$
28 # ORB Specifics rules
29 #
30 @CORBA@
31
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)
39  
40 LIB_CLIENT_OBJ = $(LIB_CLIENT_IDL:%.idl=%$(IDL_CLN_OBJ))
41 LIB_SERVER_OBJ = $(LIB_SERVER_IDL:%.idl=%$(IDL_SRV_OBJ))
42
43 # declare dependences between SWIG input files
44 $(LIB_SWIG_SRC): $(SWIG_DEP:%=$(inc_builddir)/%)
45  
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))) 
52
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)
55
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)))
59
60 ifneq ($(findstring cmodule.la,$(filter %.la, $(LIB))),)
61 LIB_SWIG = $(patsubst %cmodule.la,%.so, $(filter %.la, $(LIB)))
62 else
63 LIB_SWIG = 
64 endif
65
66 lib: $(LIB_BUILD) $(LIB_CLIENT_PY)
67 # we don't build static library !
68
69 $(LIB_BUILD): $(top_builddir)/lib@LIB_LOCATION_SUFFIX@/salome/%.la: %.la
70         -$(RM) $@
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
78
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;\
81         fi;
82
83 $(LIB_BUILD_A): $(top_builddir)/lib@LIB_LOCATION_SUFFIX@/salome/%.a: %.a
84         -$(RM) $@
85         ln -sf $(CURDIR)/$< $@ || true
86
87 $(LIB): $(LIB_OBJ)
88         @$(LT) --mode=link $(CXX) -rpath $(libdir) -o $@ $(CXXFLAGS) $(LIB_OBJ) $(LDFLAGS) $(LIBS)
89
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)
96
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) 
106
107 bin: $(BIN:%=$(top_builddir)/bin/salome/%) $(BIN) $(LIB) pyscripts sharedpyscripts
108
109 BIN_LIB=$(LIB:lib%.la=-l%)
110
111 $(BIN:%=$(top_builddir)/bin/salome/%) $(TEST_PROGS:%=$(top_builddir)/bin/salome/%): $(top_builddir)/bin/salome/%: %
112         -$(RM) $@
113         ln -sf $(CURDIR)/$< $@
114
115 $(BIN) $(TEST_PROGS): %: %.lo $(BIN_OBJ)
116         $(CXX) $(CXXFLAGS) -o $@ $^ $(BIN_LIB) $(LDFLAGSFORBIN) $(LIBSFORBIN)
117
118 # copy python scripts in $(top_builddir)/bin/salome
119 #
120 DEST_PYSCRIPTS = $(EXPORT_PYSCRIPTS:%=$(top_builddir)/bin/salome/%)
121 pyscripts: $(DEST_PYSCRIPTS)
122 $(DEST_PYSCRIPTS): $(top_builddir)/bin/salome/%: %
123         cp -f $< $@
124
125 # copy pyqt files in $(PYTHON_SHARED_SITE)
126 #
127 PYTHON_SHARED_SITE=$(top_builddir)/lib@LIB_LOCATION_SUFFIX@/python$(PYTHON_VERSION)/site-packages/salome/shared_modules
128
129 $(PYTHON_SHARED_SITE):
130         $(INSTALL) -d  $@
131
132 DEST_SHAREDPYSCRIPTS = $(EXPORT_SHAREDPYSCRIPTS:%=$(PYTHON_SHARED_SITE)/%)
133 sharedpyscripts: $(PYTHON_SHARED_SITE) $(DEST_SHAREDPYSCRIPTS)
134 $(DEST_SHAREDPYSCRIPTS): $(PYTHON_SHARED_SITE)/%: %
135         cp -f $< $@
136
137 #check: test !!!!   version before AG changes
138
139 #tests: test      !!!!   version before AG changes
140
141 #test: $(LIB) $(TEST_PROGS:%=$(top_builddir)/bin/salome/%)  !!!!   version before AG changes
142
143 check: tests
144
145
146
147
148
149 runtest_%:
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 ; \
153         x=$@ ; \
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 ; \
159           exit 2;                                       \
160         else  \
161           echo  $$'\033'[1\;32m [ OK ] $$'\033'[0m \ ; \
162         fi; )
163
164 runpytest_%:
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 ; \
169         x=$@ ; \
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 ; \
175           exit 2;                                       \
176         else  \
177           echo  $$'\033'[1\;32m [ OK ] $$'\033'[0m \ ; \
178         fi; )
179
180 ALL_CHECK_TARGETS = $(patsubst %, runtest_%, $(TEST_PROGS)) 
181
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 ; \
189                 exit 2; \
190              fi; \
191           fi;  \
192         done ; \
193         rm -f $(top_builddir)/src/MEDMEM_SWIG/_libMEDMEM_Swig.so ;
194
195
196
197
198 # copy header file in $(inc_builddir)
199 #
200 DEST_HEADERS = $(EXPORT_HEADERS:%=$(inc_builddir)/%)
201 inc: $(DEST_HEADERS)
202 $(DEST_HEADERS): $(inc_builddir)/%: %
203         cp -f $< $@
204
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)
207
208 # Make installation directories if they don't exist.
209 $(libdir) $(includedir) $(bindir) $(datadir) $(idldir) $(sharedpydir):
210         $(INSTALL) -d $@ && chmod 755 $@
211
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);                  \
218            fi;                                                                \
219         done
220         @if test "X$(LIB_SWIG)" != X ; then                                   \
221           (cd $(libdir); ln -sf $(patsubst %.so, %cmodule.so, $(LIB_SWIG)) _$(LIB_SWIG)  || true); \
222         fi;                                                                   
223         @for f in X $(BIN); do                                                \
224            if test $$f != X; then                                             \
225              ($(LT_INSTALL_PROG) $$f $(bindir)/. || exit 1);                  \
226            fi;                                                                \
227         done
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);                  \
232            fi;                                                                \
233         done
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);                          \
238            fi;                                                                \
239         done
240
241 # Install python script in $(bindir)
242 install-python: $(bindir) $(EXPORT_PYSCRIPTS:%=install-%)
243
244 $(EXPORT_PYSCRIPTS:%=install-%): install-%: %
245         $(INSTALL_PROGRAM) $< $(bindir)/.
246
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);          \
251 #          fi;                                                        \
252 #       done
253
254 # Install pyqt script in $(install-sharedpyqt)
255 install-sharedpyqt: $(sharedpydir) $(EXPORT_SHAREDPYSCRIPTS:%=install-%) 
256
257 $(EXPORT_SHAREDPYSCRIPTS:%=install-%): install-%: %
258         $(INSTALL_PROGRAM) $< $(sharedpydir)/.
259
260
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);                      \
267            fi;                                                                           \
268         done
269
270 # Removes those things that `make install' (would have) installed.
271 uninstall:
272         @if test "X$(LIB)" != X; then                                         \
273            for f in $(LIB); do                                                \
274               $(LT_UNINSTALL) $(libdir)/$$f;                                  \
275            done;                                                              \
276         fi
277         @if test "X$(BIN)" != X; then                                         \
278            for f in $(BIN); do                                                \
279               $(LT_UNINSTALL) $(bindir)/$$f;                                  \
280            done;                                                              \
281         fi
282         @for f in X $(TEST_PROGS); do                                         \
283            if test $$f != X; then                                             \
284              $(LT_UNINSTALL) $(bindir)/$$f;                                   \
285            fi;                                                                \
286         done
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;                               \
291            fi;                                                                \
292         done
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 ;                  \
297            fi;                                                                \
298         done
299
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 ;                     \
304            fi;                                                                \
305         done
306
307 # Uninstall qm files
308         @for f in X $(PO_FILES:%.po=%.qm); do         \
309            if test $$f != X; then                                             \
310              $(LT_UNINSTALL) $(datadir)/resources/$(MODULE_NAME)/$$f ;                        \
311            fi;                                                                \
312         done
313
314 # remove all dependencies files
315 #
316 cleandep:
317         -$(RM) .dep*
318
319 # Removes temporary files without removing the final target files.  That is,
320 # remove things like object files but not libraries or executables.
321 #
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)
327
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.
331 #
332 clean: mostlyclean
333         -$(RM) $(LIB) $(TEST_PROGS) $(BIN) $(CLEAN)
334         -$(RM) TAGS *~ *# core *.core 
335         -$(RM) -r .libs
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)
347
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.
352 #
353 distclean: clean
354         #remove qm file !
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);                                          \
361         fi
362
363
364 #implicits rules
365 .cc.o:
366         $(CXX) $(CXXFLAGS) $(CPPFLAGS) -c $<
367
368 .cc.lo:
369         $(LT) --mode=compile $(CXX) $(CXXFLAGS) $(CPPFLAGS) -c $<
370
371 .cxx.o:
372         $(CXX) $(CXXFLAGS) $(CPPFLAGS) -c $<
373
374 .cxx.lo:
375         $(LT) --mode=compile $(CXX) $(CXXFLAGS) $(CPPFLAGS) -c $<
376
377 .c.o:
378         $(CC) $(CFLAGS) $(CPPFLAGS) -c $<
379
380 .c.lo:
381         $(LT_COMPILE) $(CFLAGS) $(CPPFLAGS) -c $<
382
383 .f.o:
384         $(FC) $(FFLAGS) -c $< -o $@
385
386 .f.lo:
387         $(LT) --mode=compile $(FC) $(FFLAGS) -c $<
388
389 .ui.h:
390         $(UIC) -o $@  $<
391
392 .ui.cxx:
393         $(UIC) -o $@ -i $*.h $<
394
395 #pattern rules
396 %_moc.cxx : %.h
397         $(MOC) $< -o $@
398
399 %_wrap.cxx : %.i
400         $(SWIG) $(SWIG_FLAGS) -o $@ $<
401
402 $(top_builddir)/share/salome/resources/$(MODULE_NAME)/%.qm: %.po
403                 $(MSG2QM) $< $@ ; \
404
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
412 # GNU/GCC systems.
413 #------------------------------------------------------------------------------
414
415 @DEPEND@