mirror of
https://github.com/HDFGroup/hdf5.git
synced 2024-12-03 02:32:04 +08:00
b5d11111b0
Purpose: Bug Fix Description: The way we were generating Dependencies and .depend files was broken. If the $srcdir or other macros began with a ".", then it would match anything and cause problems since it would then overwrite the beginning of the header file's path. Solution: Wrote a Perl script which can handle this type of weirdness better. It's only used when the environment is a GNU one with a GCC compiler... Platforms tested: Linux
52 lines
2.8 KiB
Makefile
52 lines
2.8 KiB
Makefile
## -*- makefile -*-
|
|
|
|
## We keep a list of dependencies in `.depend' for each of the source
|
|
## files on which it depends. When one of the source files is modified
|
|
## we remove its record from .depend and regenerate its dependencies,
|
|
## tacking them onto the end of .depend. By including the .depend file
|
|
## into the makefile, we're telling make that the makefile depends on
|
|
## the dependency list in the .depend file.
|
|
##
|
|
## This is as fast as the `.d' method described in the GNU make manual
|
|
## for automatic dependencies, but has the added advantage that all
|
|
## dependencies are stored in one place. The advantage over the
|
|
## `makedepend' program is that only those files that are out of date
|
|
## have dependency information rebuilt, and the Makefile is not
|
|
## modified.
|
|
##
|
|
## This is also where tracing information is updated. The $(TRACE)
|
|
## program is run on each source file to make sure that the H5TRACE()
|
|
## macros are up to date. If they are then the file is not modified,
|
|
## otherwise the file is changed and a backup is saved by appending a
|
|
## tilde to the file name.
|
|
##
|
|
$(srcdir)/Dependencies: .depend
|
|
@if test "$(srcdir)" != "."; then \
|
|
echo '## This file is machine generated on GNU systems.' >$@; \
|
|
echo '## Only temporary changes may be made here.' >>$@; \
|
|
echo >>$@; \
|
|
$(PERL) -p $(top_srcdir)/bin/distdep .depend >>$@; \
|
|
else \
|
|
echo 'Dependencies cannot be built when $$srcdir == $$builddir'; \
|
|
fi
|
|
|
|
.depend: $(LIB_SRC) $(TEST_SRC) $(PROG_SRC)
|
|
@touch .depend
|
|
@for dep in $? dummy; do \
|
|
if test $$dep != "dummy" -a -n "$(PERL)"; then \
|
|
case "$$dep" in \
|
|
*.c) \
|
|
echo Building dependencies for $$dep; \
|
|
obj=`basename $$dep .c`.lo; \
|
|
sed '\%^'"$$obj"':%,\%[^\\]$$%d' <$@ >$@- && mv $@- $@; \
|
|
$(TRACE) $$dep; \
|
|
$(CC) -MM -MG $(CPPFLAGS) $$dep 2>/dev/null >>$@; \
|
|
$(PERL) -w $(top_srcdir)/bin/dependencies --srcdir=$(srcdir) --top_srcdir=$(top_srcdir) --top_builddir=$(top_builddir) $@; \
|
|
;; \
|
|
esac; \
|
|
fi; \
|
|
done
|
|
|
|
-include .depend
|
|
|