Salome HOME
4b801243f381f64c4eb95787e3a6e1c1e4743352
[modules/yacs.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
24 DEPCC = @DEPCC@
25 DEPCXX = @DEPCXX@
26 DEPCXXFLAGS = @DEPCXXFLAGS@
27
28 $(srcdir)/Dependencies: .depend
29         @if test "$(srcdir)" != "."; then                                     \
30             echo '## This file is machine generated on GNU systems.' >$@;     \
31             echo '## Only temporary changes may be made here.' >>$@;          \
32             echo >>$@;                                                        \
33             perl -p $(top_srcdir)/bin/distdep .depend >>$@;                   \
34         else                                                                  \
35             echo 'Dependencies cannot be built when $$srcdir == $$builddir';  \
36         fi
37
38 depend:.depend
39
40 # we had Makefile target, because we want Makefile rebuild before include .depend
41 .depend: $(LIB_DEP) $(TEST_SRC) $(BIN_DEP)
42         @touch .depend
43         @for dep in X $? ; do                                                 \
44            if [ $$dep != "X" ]; then                                          \
45            if [ $$dep != "Makefile" ]; then                                   \
46               case "$$dep" in                                                 \
47                  *.c)                                                         \
48                     echo Building dependencies for $$dep;                     \
49                     obj=`basename $$dep .c`.lo;                               \
50                     sed '\%^'"$$obj"':%,\%[^\\]$$%d' <$@ >$@- && mv $@- $@;   \
51                     $(DEPCC) $(C_DEPEND_FLAG) $(CPPFLAGS) $$dep 2>/dev/null |    \
52                         sed 's% $(srcdir)/% $$(srcdir)/%g' |                  \
53                         sed 's% $(top_srcdir)/% $$(top_srcdir)/%g' |          \
54                         sed 's% $(top_builddir)/% $$(top_builddir)/%g' |      \
55                         sed 's/\.o/.lo/' >>$@;                                \
56                     ;;                                                        \
57                  *.cc)                                                        \
58                     echo Building dependencies for $$dep;                     \
59                     obj=`basename $$dep .cc`.lo;                              \
60                     sed '\%^'"$$obj"':%,\%[^\\]$$%d' <$@ >$@- && mv $@- $@;   \
61                     $(DEPCXX) $(CXX_DEPEND_FLAG) $(DEPCXXFLAGS) $(CPPFLAGS) $$dep 2>/dev/null | \
62                         sed 's% $(srcdir)/% $$(srcdir)/%g' |                  \
63                         sed 's% $(top_srcdir)/% $$(top_srcdir)/%g' |          \
64                         sed 's% $(top_builddir)/% $$(top_builddir)/%g' |      \
65                         sed 's/\.o/.lo/' >>$@;                                \
66                     ;;                                                        \
67                  *.cxx)                                                       \
68                     echo Building dependencies for $$dep;                     \
69                     obj=`basename $$dep .cxx`.lo;                             \
70                     sed '\%^'"$$obj"':%,\%[^\\]$$%d' <$@ >$@- && mv $@- $@;   \
71                     $(DEPCXX) $(CXX_DEPEND_FLAG) $(DEPCXXFLAGS) $(CPPFLAGS) $$dep 2>/dev/null | \
72                         sed 's% $(srcdir)/% $$(srcdir)/%g' |                  \
73                         sed 's% $(top_srcdir)/% $$(top_srcdir)/%g' |          \
74                         sed 's% $(top_builddir)/% $$(top_builddir)/%g' |      \
75                         sed 's/\.o/.lo/' >>$@;                                \
76                     ;;                                                        \
77               esac;                                                           \
78            fi;                                                                \
79            fi;                                                                \
80         done;
81
82
83 -include .depend
84
85 # idl depend
86 -include $(top_builddir)/idl/.depidl
87
88