Salome HOME
e2cb77b849f40e2b9570bdca635a98070ea67d5b
[modules/kernel.git] / salome_adm / unix / DEPRECATED / depend.in
1 # Copyright (C) 2007-2023  CEA, EDF, 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, or (at your option) any later version.
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
23 ##                                                             -*- makefile -*-
24 ## We keep a list of dependencies in `.depend' for each of the source
25 ## files on which it depends.  When one of the source files is modified
26 ## we remove its record from .depend and regenerate its dependencies,
27 ## tacking them onto the end of .depend.  By including the .depend file
28 ## into the makefile, we're telling make that the makefile depends on
29 ## the dependency list in the .depend file.
30 ## This is as fast as the `.d' method described in the GNU make manual
31 ## for automatic dependencies, but has the added advantage that all
32 ## dependencies are stored in one place.  The advantage over the
33 ## `makedepend' program is that only those files that are out of date
34 ## have dependency information rebuilt, and the Makefile is not
35 ## modified.
36 ## This is also where tracing information is updated.  The $(TRACE)
37 ## program is run on each source file to make sure that the H5TRACE()
38 ## macros are up to date.  If they are then the file is not modified,
39 ## otherwise the file is changed and a backup is saved by appending a
40 ## tilde to the file name.
41 #
42 $(srcdir)/Dependencies: .depend
43         @if test "$(srcdir)" != "."; then                                     \
44             echo '## This file is machine generated on GNU systems.' >$@;     \
45             echo '## Only temporary changes may be made here.' >>$@;          \
46             echo >>$@;                                                        \
47             perl -p $(top_srcdir)/bin/distdep .depend >>$@;                   \
48         else                                                                  \
49             echo 'Dependencies cannot be built when $$srcdir == $$builddir';  \
50         fi
51
52 depend:.depend
53
54 # when use the path as regexp, prevent taking "." for "any symbol"
55 srcdir_re = $(subst .,[.],$(srcdir))
56 top_srcdir_re = $(subst .,[.],$(top_srcdir))
57 top_builddir_re = $(subst .,[.],$(top_builddir))
58
59 # we had Makefile target, because we want Makefile rebuild before include .depend
60 .depend: $(LIB_DEP) $(TEST_SRC) $(BIN_DEP)
61         @touch .depend
62         @for dep in X $? ; do                                                 \
63            if [ $$dep != "X" ]; then                                          \
64            if [ $$dep != "Makefile" ]; then                                   \
65               case "$$dep" in                                                 \
66                  *.c)                                                         \
67                     echo Building dependencies for $$dep;                     \
68                     obj=`basename $$dep .c`.lo;                               \
69                     sed '\%^'"$$obj"':%,\%[^\\]$$%d' <$@ >$@- && mv $@- $@;   \
70                     $(CC) $(C_DEPEND_FLAG) $(CPPFLAGS) $$dep 2>/dev/null |    \
71                         sed 's% $(srcdir_re)/% $$(srcdir)/%g' |               \
72                         sed 's% $(top_srcdir_re)/% $$(top_srcdir)/%g' |       \
73                         sed 's% $(top_builddir_re)/% $$(top_builddir)/%g' |      \
74                         sed 's/\.o/.lo/' >>$@;                                \
75                     ;;                                                        \
76                  *.cc)                                                        \
77                     echo Building dependencies for $$dep;                     \
78                     obj=`basename $$dep .cc`.lo;                              \
79                     sed '\%^'"$$obj"':%,\%[^\\]$$%d' <$@ >$@- && mv $@- $@;   \
80                     $(CXX) $(CXX_DEPEND_FLAG) $(CXXFLAGS) $(CPPFLAGS) $$dep 2>/dev/null | \
81                         sed 's% $(srcdir_re)/% $$(srcdir)/%g' |               \
82                         sed 's% $(top_srcdir_re)/% $$(top_srcdir)/%g' |       \
83                         sed 's% $(top_builddir_re)/% $$(top_builddir)/%g' |      \
84                         sed 's/\.o/.lo/' >>$@;                                \
85                     ;;                                                        \
86                  *.cxx)                                                       \
87                     echo Building dependencies for $$dep;                     \
88                     obj=`basename $$dep .cxx`.lo;                             \
89                     sed '\%^'"$$obj"':%,\%[^\\]$$%d' <$@ >$@- && mv $@- $@;   \
90                     $(CXX) $(CXX_DEPEND_FLAG) $(CXXFLAGS) $(CPPFLAGS) $$dep 2>/dev/null | \
91                         sed 's% $(srcdir_re)/% $$(srcdir)/%g' |               \
92                         sed 's% $(top_srcdir_re)/% $$(top_srcdir)/%g' |       \
93                         sed 's% $(top_builddir_re)/% $$(top_builddir)/%g' |      \
94                         sed 's/\.o/.lo/' >>$@;                                \
95                     ;;                                                        \
96               esac;                                                           \
97            fi;                                                                \
98            fi;                                                                \
99         done;
100
101
102 -include .depend
103
104 # idl depend
105 -include $(top_builddir)/idl/.depidl
106
107