Salome HOME
Merge from BR_V5_DEV 16Feb09
[modules/med.git] / adm_local_without_kernel / unix / make_module.in
1 #  Copyright (C) 2007-2008  CEA/DEN, EDF R&D, OPEN CASCADE
2 #
3 #  Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 #  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
5 #
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.
10 #
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.
15 #
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
19 #
20 #  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
21 #
22 # generic rule to put in top module Makefile 
23 # (for example with module SALOME, SALOME/Makefile.in and SALOME/src/Makefile.in)
24 # build all lib in all subdir
25 #
26 lib:$(SUBDIRS:%=lib_%)
27
28 $(SUBDIRS:%=lib_%):lib_%:%
29         cd $< ; $(MAKE) lib
30
31 # build all bin in all subdir
32 bin:
33         @@SETX@; for d in $(SUBDIRS); do        \
34            (cd $$d && $(MAKE) $@) || exit 1;    \
35         done
36
37 # launch check in all subdir
38 check: tests
39 tests:
40         @@SETX@; for d in $(SUBDIRS); do        \
41            (cd $$d && $(MAKE) $@) || exit 1;    \
42         done
43
44 # copy all header files in common directory
45 inc:
46         @@SETX@; for d in $(SUBDIRS); do        \
47            (cd $$d && $(MAKE) $@) || exit 1;    \
48         done
49
50 exportinc:
51         @@SETX@; for d in $(SUBDIRS); do        \
52            (cd $$d && $(MAKE) $@) || exit 1;    \
53         done
54
55 # copy all idl files in common directory
56 idl:
57         @@SETX@; for d in $(SUBDIRS); do        \
58            (cd $$d && $(MAKE) $@) || exit 1;    \
59         done
60
61 dep: depend
62
63 depend:
64         @@SETX@; for d in $(SUBDIRS); do        \
65            (cd $$d && $(MAKE) $@) || exit 1;    \
66         done
67
68 # copy all resources files in common directory
69 RESOURCES_FILES_ALL := $(notdir $(wildcard $(srcdir)/resources/*))
70 RESOURCES_FILES_ALL := $(filter-out CVS, $(RESOURCES_FILES_ALL))
71 RESOURCES_FILES_ALL := $(filter-out %.po, $(RESOURCES_FILES_ALL))
72 RESOURCES_FILES_ALL := $(filter-out %.in, $(RESOURCES_FILES_ALL))
73 RESOURCES_FILES ?= $(RESOURCES_FILES_ALL)
74
75 resources: resources-cp
76         @@SETX@; for d in $(SUBDIRS); do        \
77            (cd $$d && $(MAKE) $@) || exit 1;    \
78         done
79
80 resources-cp: $(RESOURCES_FILES:%=$(top_builddir)/share/salome/resources/$(MODULE_NAME)/%)
81
82 $(RESOURCES_FILES:%=$(top_builddir)/share/salome/resources/$(MODULE_NAME)/%): $(top_builddir)/share/salome/resources/$(MODULE_NAME)/% : %
83         cp -fr $< $@;
84
85 data:
86         @if test "X$(top_builddir)" = "X."; then                                                         \
87         ((cd examples && $(MAKE) $@) || exit 1);                         \
88         fi;
89 # Commented because we need not to make docs when we make BUILD         
90 # docs: 
91 #       @if test "X$(top_builddir)" = "X."; then \
92 #       ((cd doc && $(MAKE) $@) || exit 1); \
93 #       fi;     
94
95 install: install-resources
96         @@SETX@; for d in $(SUBDIRS); do        \
97            (cd $$d && $(MAKE) $@) || exit 1;    \
98         done
99         @if test "X$(top_builddir)" = "X."; then        \
100            $(LT) --mode=finish $(libdir) ;              \
101         fi
102
103 uninstall: uninstall-resources
104         @@SETX@; for d in $(SUBDIRS); do        \
105            (cd $$d && $(MAKE) $@) || exit 1;    \
106         done
107
108 cleandep:
109         @@SETX@; for d in $(SUBDIRS); do        \
110            (cd $$d && $(MAKE) $@) || exit 1;    \
111         done
112
113 mostlyclean:
114         @@SETX@; for d in $(SUBDIRS); do        \
115            (cd $$d && $(MAKE) $@) || exit 1;    \
116         done
117
118 clean:
119         @@SETX@; for d in $(SUBDIRS); do        \
120            (cd $$d && $(MAKE) $@) || exit 1;    \
121         done
122         -$(RM) .depend *~ *% core *.core *.bak *.new *.old
123
124 distclean: clean
125         @@SETX@; for d in $(SUBDIRS); do        \
126            (cd $$d && $(MAKE) $@) || exit 1;    \
127         done
128         -$(RM) $(RESOURCES_FILES:%=$(top_builddir)/share/salome/resources/$(MODULE_NAME)/%)
129         -$(RM) Makefile
130
131 install-resources: resources-cp
132 # one resources directory for all salome modules
133         $(INSTALL) -d $(datadir)/resources/$(MODULE_NAME)
134         @for f in X $(RESOURCES_FILES:%=$(top_builddir)/share/salome/resources/$(MODULE_NAME)/%); do \
135            if test $$f != X; then                                                        \
136              ($(INSTALL_DATA) $$f $(datadir)/resources/$(MODULE_NAME)/. || exit 1);                      \
137            fi;                                                                           \
138         done
139
140 # Uninstall resources files
141 uninstall-resources:
142         @for f in X $(RESOURCES_FILES); do            \
143            if test $$f != X; then                                             \
144              $(LT_UNINSTALL) $(datadir)/resources/$(MODULE_NAME)/$$f ;                        \
145            fi;                                                                \
146         done
147