Salome HOME
sources v1.2
[modules/kernel.git] / salome_adm / unix / depend.in
1 ##                                                             -*- makefile -*-
2
3 ## We keep a list of dependencies in `.depend' for each of the source
4 ## files on which it depends.  When one of the source files is modified
5 ## we remove its record from .depend and regenerate its dependencies,
6 ## tacking them onto the end of .depend.  By including the .depend file
7 ## into the makefile, we're telling make that the makefile depends on
8 ## the dependency list in the .depend file.
9 ##
10 ## This is as fast as the `.d' method described in the GNU make manual
11 ## for automatic dependencies, but has the added advantage that all
12 ## dependencies are stored in one place.  The advantage over the
13 ## `makedepend' program is that only those files that are out of date
14 ## have dependency information rebuilt, and the Makefile is not
15 ## modified.
16 ##
17 ## This is also where tracing information is updated.  The $(TRACE)
18 ## program is run on each source file to make sure that the H5TRACE()
19 ## macros are up to date.  If they are then the file is not modified,
20 ## otherwise the file is changed and a backup is saved by appending a
21 ## tilde to the file name.
22 ##
23 $(srcdir)/Dependencies: .depend
24         @if test "$(srcdir)" != "."; then                                     \
25             echo '## This file is machine generated on GNU systems.' >$@;     \
26             echo '## Only temporary changes may be made here.' >>$@;          \
27             echo >>$@;                                                        \
28             perl -p $(top_srcdir)/bin/distdep .depend >>$@;                   \
29         else                                                                  \
30             echo 'Dependencies cannot be built when $$srcdir == $$builddir';  \
31         fi
32
33 depend:.depend
34
35 # we had Makefile target, because we want Makefile rebuild before include .depend
36 .depend: $(LIB_DEP) $(TEST_SRC) $(BIN_DEP)
37         @touch .depend
38         @for dep in X $? ; do                                                 \
39            if [ $$dep != "X" ]; then                                          \
40            if [ $$dep != "Makefile" ]; then                                   \
41               case "$$dep" in                                                 \
42                  *.c)                                                         \
43                     echo Building dependencies for $$dep;                     \
44                     obj=`basename $$dep .c`.lo;                               \
45                     sed '\%^'"$$obj"':%,\%[^\\]$$%d' <$@ >$@- && mv $@- $@;   \
46                     $(CC) $(C_DEPEND_FLAG) $(CPPFLAGS) $$dep 2>/dev/null |    \
47                         sed 's% $(srcdir)/% $$(srcdir)/%g' |                  \
48                         sed 's% $(top_srcdir)/% $$(top_srcdir)/%g' |          \
49                         sed 's% $(top_builddir)/% $$(top_builddir)/%g' |      \
50                         sed 's/\.o/.lo/' >>$@;                                \
51                     ;;                                                        \
52                  *.cc)                                                        \
53                     echo Building dependencies for $$dep;                     \
54                     obj=`basename $$dep .cc`.lo;                              \
55                     sed '\%^'"$$obj"':%,\%[^\\]$$%d' <$@ >$@- && mv $@- $@;   \
56                     $(CXX) $(CXX_DEPEND_FLAG) $(CXXFLAGS) $(CPPFLAGS) $$dep 2>/dev/null | \
57                         sed 's% $(srcdir)/% $$(srcdir)/%g' |                  \
58                         sed 's% $(top_srcdir)/% $$(top_srcdir)/%g' |          \
59                         sed 's% $(top_builddir)/% $$(top_builddir)/%g' |      \
60                         sed 's/\.o/.lo/' >>$@;                                \
61                     ;;                                                        \
62                  *.cxx)                                                       \
63                     echo Building dependencies for $$dep;                     \
64                     obj=`basename $$dep .cxx`.lo;                             \
65                     sed '\%^'"$$obj"':%,\%[^\\]$$%d' <$@ >$@- && mv $@- $@;   \
66                     $(CXX) $(CXX_DEPEND_FLAG) $(CXXFLAGS) $(CPPFLAGS) $$dep 2>/dev/null | \
67                         sed 's% $(srcdir)/% $$(srcdir)/%g' |                  \
68                         sed 's% $(top_srcdir)/% $$(top_srcdir)/%g' |          \
69                         sed 's% $(top_builddir)/% $$(top_builddir)/%g' |      \
70                         sed 's/\.o/.lo/' >>$@;                                \
71                     ;;                                                        \
72               esac;                                                           \
73            fi;                                                                \
74            fi;                                                                \
75         done;
76
77
78 -include .depend
79
80 # idl depend
81 -include $(top_builddir)/idl/.depidl
82
83