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.
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
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.
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.' >>$@; \
28 perl -p $(top_srcdir)/bin/distdep .depend >>$@; \
30 echo 'Dependencies cannot be built when $$srcdir == $$builddir'; \
35 # when use the path as regexp, prevent taking "." for "any symbol"
36 srcdir_re = $(subst .,[.],$(srcdir))
37 top_srcdir_re = $(subst .,[.],$(top_srcdir))
38 top_builddir_re = $(subst .,[.],$(top_builddir))
40 # we had Makefile target, because we want Makefile rebuild before include .depend
41 .depend: $(LIB_DEP) $(TEST_SRC) $(BIN_DEP)
43 @for dep in X $? ; do \
44 if [ $$dep != "X" ]; then \
45 if [ $$dep != "Makefile" ]; then \
48 echo Building dependencies for $$dep; \
49 obj=`basename $$dep .c`.lo; \
50 sed '\%^'"$$obj"':%,\%[^\\]$$%d' <$@ >$@- && mv $@- $@; \
51 $(CC) $(C_DEPEND_FLAG) $(CPPFLAGS) $$dep 2>/dev/null | \
52 sed 's% $(srcdir_re)/% $$(srcdir)/%g' | \
53 sed 's% $(top_srcdir_re)/% $$(top_srcdir)/%g' | \
54 sed 's% $(top_builddir_re)/% $$(top_builddir)/%g' | \
55 sed 's/\.o/.lo/' >>$@; \
58 echo Building dependencies for $$dep; \
59 obj=`basename $$dep .cc`.lo; \
60 sed '\%^'"$$obj"':%,\%[^\\]$$%d' <$@ >$@- && mv $@- $@; \
61 $(CXX) $(CXX_DEPEND_FLAG) $(CXXFLAGS) $(CPPFLAGS) $$dep 2>/dev/null | \
62 sed 's% $(srcdir_re)/% $$(srcdir)/%g' | \
63 sed 's% $(top_srcdir_re)/% $$(top_srcdir)/%g' | \
64 sed 's% $(top_builddir_re)/% $$(top_builddir)/%g' | \
65 sed 's/\.o/.lo/' >>$@; \
68 echo Building dependencies for $$dep; \
69 obj=`basename $$dep .cxx`.lo; \
70 sed '\%^'"$$obj"':%,\%[^\\]$$%d' <$@ >$@- && mv $@- $@; \
71 $(CXX) $(CXX_DEPEND_FLAG) $(CXXFLAGS) $(CPPFLAGS) $$dep 2>/dev/null | \
72 sed 's% $(srcdir_re)/% $$(srcdir)/%g' | \
73 sed 's% $(top_srcdir_re)/% $$(top_srcdir)/%g' | \
74 sed 's% $(top_builddir_re)/% $$(top_builddir)/%g' | \
75 sed 's/\.o/.lo/' >>$@; \
86 -include $(top_builddir)/idl/.depidl