Salome HOME
ENV: Windows porting.
[modules/kernel.git] / salome_adm / unix / make_conclude.in
index 63ea4a424ba79d7b3e2bf0c710346010211108c3..227bf1634f2d5c379073b22468df3dd4272698e5 100644 (file)
@@ -35,9 +35,10 @@ LIB_OBJ_F    = $(patsubst %.f,   %.lo, $(filter %.f, $(LIB_SRC)))
 # all libtool obj file in library
 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)
 
-# LIB_BUILD = $(LIB:%.la=$(top_builddir)/lib/%.la)
-LIB_BUILD = $(patsubst %.la, $(top_builddir)/lib/%.la, $(filter %.la, $(LIB)))
-LIB_BUILD_A = $(patsubst %.a, $(top_builddir)/lib/%.a, $(filter %.a, $(LIB)))
+# LIB_BUILD = $(LIB:%.la=$(top_builddir)/lib/salome/%.la)
+LIB_BUILD = $(patsubst %.la, $(top_builddir)/lib/salome/%.la, $(filter %.la, $(LIB)))
+LIB_BUILD_A = $(patsubst %.a, $(top_builddir)/lib/salome/%.a, $(filter %.a, $(LIB)))
+LIB_BUILD_SO = $(patsubst %.so, $(top_builddir)/lib/salome/%.so, $(filter %.so, $(LIB)))
 
 ifneq ($(findstring cmodule.la,$(filter %.la, $(LIB))),)
 LIB_SWIG = $(patsubst %cmodule.la,%.so, $(filter %.la, $(LIB)))
@@ -45,10 +46,10 @@ else
 LIB_SWIG = 
 endif
 
-lib: $(LIB_BUILD) $(LIB_CLIENT_PY)
+lib: $(LIB_BUILD) $(LIB_BUILD_SO) $(LIB_CLIENT_PY)
 # we don't build static library !
 
-$(LIB_BUILD): $(top_builddir)/lib/%.la: %.la
+$(LIB_BUILD): $(top_builddir)/lib/salome/%.la: %.la
        -$(RM) $@
        -$(RM) $(patsubst %.la, %.so, $@)
        -$(RM) $(patsubst %.la, %.a, $@)
@@ -59,15 +60,19 @@ $(LIB_BUILD): $(top_builddir)/lib/%.la: %.la
              $(patsubst %.la, %.so, $@).0 || true
 
        if ! test -z $(LIB_SWIG) ; then \
-          ln -sf $(patsubst %.la,%.so, $(CURDIR)/.libs/$<) $(top_builddir)/lib/_$(LIB_SWIG) || true;\
+          ln -sf $(patsubst %.la,%.so, $(CURDIR)/.libs/$<) $(top_builddir)/lib/salome/_$(LIB_SWIG) || true;\
        fi;
 
-$(LIB_BUILD_A): $(top_builddir)/lib/%.a: %.a
+$(LIB_BUILD_A): $(top_builddir)/lib/salome/%.a: %.a
+       -$(RM) $@
+       ln -sf $(CURDIR)/$< $@ || true
+
+$(LIB_BUILD_SO): $(top_builddir)/lib/salome/%.so: %.so
        -$(RM) $@
        ln -sf $(CURDIR)/$< $@ || true
 
 $(LIB): $(LIB_OBJ)
-       @$(LT) --mode=link $(CXX) -rpath $(libdir) -o $@ $(CXXFLAGS) $(LIB_OBJ) $(LDFLAGS) $(LIBS)
+       @$(LT) --mode=link $(CXX) -shared -rpath $(libdir) -o $@ $(CXXFLAGS) $(LIB_OBJ) $(LDFLAGS) $(LIBS)
 
 # transform idl reference in appropriate obj file
 BIN_CLIENT_SRC = $(BIN_CLIENT_IDL:%.idl=%$(IDL_CLN_CXX))
@@ -86,22 +91,38 @@ BIN_OBJ_CXX = $(patsubst %.cxx,  %.o, $(filter %.cxx, $(BIN_SRC)))
 # all obj file in bin target
 BIN_OBJ = $(BIN_OBJ_CC) $(BIN_OBJ_CXX) $(BIN_OBJ_C) $(BIN_CLIENT_OBJ) $(BIN_SERVER_OBJ) 
 
-bin: $(BIN:%=$(top_builddir)/bin/%) $(BIN) $(LIB) pyscripts sharedpyscripts
+bin: $(BIN:%=$(top_builddir)/bin/salome/%) $(BIN) $(LIB) pyscripts sharedpyscripts
 
 BIN_LIB=$(LIB:lib%.la=-l%)
 
-$(BIN:%=$(top_builddir)/bin/%) $(TEST_PROGS:%=$(top_builddir)/bin/%): $(top_builddir)/bin/%: %
+$(BIN:%=$(top_builddir)/bin/salome/%) $(TEST_PROGS:%=$(top_builddir)/bin/salome/%): $(top_builddir)/bin/salome/%: %
        -$(RM) $@
        ln -sf $(CURDIR)/$< $@
 
 $(BIN) $(TEST_PROGS): %: %.lo $(BIN_OBJ)
-       $(CXX) $(CXXFLAGS) -o $@ $^ $(BIN_LIB) $(LDFLAGS) $(LIBS)
+       $(CXX) $(CPPFLAGS) $(CXXFLAGS) -o $@ $^ $(BIN_LIB) $(LDFLAGSFORBIN) $(LIBSFORBIN)
+
+# copy python scripts in $(top_builddir)/bin/salome
+#
+
+UI_FILES = $(notdir $(wildcard $(srcdir)/*.ui))
+UI_PY_FILES_PY = $(patsubst %.ui, %.py, $(UI_FILES))
+UI_PY_FILES = $(filter-out $(EXPORT_PYSCRIPTS) ,$(UI_PY_FILES_PY))
+
+DEST_PYSCRIPTS = $(EXPORT_PYSCRIPTS:%=$(top_builddir)/bin/salome/%)
+DEST_UI_PY_FILES = $(UI_PY_FILES:%=$(top_builddir)/bin/salome/%)
+pyscripts: $(DEST_PYSCRIPTS) $(UI_PY_FILES) $(DEST_UI_PY_FILES)
+$(DEST_PYSCRIPTS): $(top_builddir)/bin/salome/%: %
+       cp -f $< $@
+
+# generate generic python scripts from *.ui files
+#
+$(UI_PY_FILES): %.py: %.ui
+       $(PYUIC) $< -o $@
 
-# copy python scripts in $(top_builddir)/bin
+# copy ui-generated python scripts in $(top_builddir)/bin
 #
-DEST_PYSCRIPTS = $(EXPORT_PYSCRIPTS:%=$(top_builddir)/bin/%)
-pyscripts: $(DEST_PYSCRIPTS)
-$(DEST_PYSCRIPTS): $(top_builddir)/bin/%: %
+$(DEST_UI_PY_FILES): $(top_builddir)/bin/salome/%: %
        cp -f $< $@
 
 # copy pyqt files in $(PYTHON_SHARED_SITE)
@@ -120,7 +141,7 @@ check: test
 
 tests: test
 
-test: $(LIB) $(TEST_PROGS:%=$(top_builddir)/bin/%) 
+test: $(LIB) $(TEST_PROGS:%=$(top_builddir)/bin/salome/%) 
 
 
 # copy header file in $(inc_builddir)
@@ -131,14 +152,21 @@ $(DEST_HEADERS): $(inc_builddir)/%: %
        cp -f $< $@
 
 # build resources file (icons and messages) : .qm file from .po file
-resources: $(PO_FILES:%.po=$(top_builddir)/share/salome/resources/%.qm)
+resources: resources-po resources-cp 
+
+resources-po: $(PO_FILES:%.po=$(top_builddir)/share/salome/resources/%.qm)
+
+resources-cp: $(RESOURCES_FILES:%=$(top_builddir)/share/salome/resources/%)
+
+$(RESOURCES_FILES:%=$(top_builddir)/share/salome/resources/%): $(top_builddir)/share/salome/resources/% : %
+       cp -f $< $@
 
 # Make installation directories if they don't exist.
 $(libdir) $(includedir) $(bindir) $(datadir) $(idldir) $(sharedpydir):
        $(INSTALL) -d $@ && chmod 755 $@
 
 # Install the library, the public header files, and programs.
-install: $(LIB) $(BIN) $(TEST_PROGS) $(libdir) $(includedir) $(bindir) $(datadir) $(idldir) install-python install-sharedpyqt install-qm
+install: $(LIB) $(BIN) $(TEST_PROGS) $(libdir) $(includedir) $(bindir) $(datadir) $(idldir) install-python install-sharedpyqt install-qm install-res
        @for f in X $(LIB); do                                                \
           if test $$f != X; then                                             \
              ($(LT_INSTALL_LIB) $$f $(libdir)/. || exit 1);                  \
@@ -161,12 +189,15 @@ install: $(LIB) $(BIN) $(TEST_PROGS) $(libdir) $(includedir) $(bindir) $(datadir
 # Install exported includes in includedir
        @for f in X $(EXPORT_HEADERS:%=$(srcdir)/%); do                       \
           if test $$f != X; then                                             \
-            (cp -p $$f $(includedir) || exit 1);                             \
+            (cp -p -f $$f $(includedir) || exit 1);                          \
           fi;                                                                \
        done
 
 # Install python script in $(bindir)
-install-python: $(bindir) $(EXPORT_PYSCRIPTS:%=install-%)
+install-python: $(bindir) $(EXPORT_PYSCRIPTS:%=install-%) $(UI_PY_FILES:%=install-%)
+
+$(UI_PY_FILES:%=install-%): install-%: %
+       $(INSTALL_PROGRAM) $< $(bindir)/.
 
 $(EXPORT_PYSCRIPTS:%=install-%): install-%: %
        $(INSTALL_PROGRAM) $< $(bindir)/.
@@ -194,6 +225,15 @@ install-qm: resources
           fi;                                                                           \
        done
 
+# generic rule to install resources files (png, ini ...):
+install-res: resources
+       $(INSTALL) -d $(datadir)/resources
+       @for f in X $(RESOURCES_FILES:%=$(top_builddir)/share/salome/resources/%); do \
+          if test $$f != X; then                                                        \
+            ($(INSTALL_DATA) $$f $(datadir)/resources/. || exit 1);                     \
+          fi;                                                                           \
+       done  
+
 # Removes those things that `make install' (would have) installed.
 uninstall:
        @if test "X$(LIB)" != X; then                                         \
@@ -224,6 +264,13 @@ uninstall:
           fi;                                                                \
        done
 
+# Uninstall python script in $(bindir)
+       @for f in X $(UI_PY_FILES); do                                        \
+          if test $$f != X; then                                             \
+            $(LT_UNINSTALL) $(bindir)/$$f ;                  \
+          fi;                                                                \
+       done
+
 # Uninstall pyqt script in $(sharedpydir)
        @for f in X $(EXPORT_SHAREDPYSCRIPTS); do                                     \
           if test $$f != X; then                                             \
@@ -260,10 +307,10 @@ clean: mostlyclean
        -$(RM) $(LIB) $(TEST_PROGS) $(BIN) $(CLEAN)
        -$(RM) TAGS *~ *# core *.core 
        -$(RM) -r .libs
-       -$(RM) $(top_builddir)/lib/$(LIB)
-       -$(RM) $(patsubst %,$(top_builddir)/bin/%, $(BIN))
-       -$(RM) $(patsubst %.la, %.so, $(top_builddir)/lib/$(LIB))
-       -$(RM) $(patsubst %.la, %.a, $(top_builddir)/lib/$(LIB))
+       -$(RM) $(top_builddir)/lib/salome/$(LIB)
+       -$(RM) $(patsubst %,$(top_builddir)/bin/salome/%, $(BIN))
+       -$(RM) $(patsubst %.la, %.so, $(top_builddir)/lib/salome/$(LIB))
+       -$(RM) $(patsubst %.la, %.a, $(top_builddir)/lib/salome/$(LIB))
 # remove idl generated files (sources)
        -$(RM) $(LIB_CLIENT_SRC) $(LIB_SERVER_SRC) $(BIN_CLIENT_SRC) $(BIN_SERVER_SRC)
 # remove idl generated files (headers)
@@ -327,7 +374,7 @@ distclean: clean
        $(SWIG) $(SWIG_FLAGS) -o $@ $<
 
 $(top_builddir)/share/salome/resources/%.qm: %.po
-       $(top_builddir)/bin/msg2qm $< $@
+       $(MSG2QM) $< $@ ; \
 
 #------------------------------------------------------------------------------
 # The following section of this makefile contains dependencies between the