1290001Sglebius$(DEPDIR)/deps-ver: $(top_srcdir)/deps-ver
2290001Sglebius	@[ -f $@ ] ||							\
3290001Sglebius		cp $(top_srcdir)/deps-ver $@
4290001Sglebius	@[ -w $@ ] ||							\
5290001Sglebius		chmod ug+w $@
6290001Sglebius	@cmp $(top_srcdir)/deps-ver $@ > /dev/null || (			\
7290001Sglebius		$(MAKE) $(AM_MAKEFLAGS) clean &&					\
8290001Sglebius		echo -n "Prior $(subdir)/$(DEPDIR) version " &&		\
9290001Sglebius		cat $@ &&						\
10290001Sglebius		rm -rf $(DEPDIR) &&					\
11290001Sglebius		mkdir $(DEPDIR) && 					\
12290001Sglebius		case "$(top_builddir)" in				\
13290001Sglebius		 .)							\
14290001Sglebius		    ./config.status Makefile depfiles			\
15290001Sglebius		    ;;							\
16290001Sglebius		 *)							\
17290001Sglebius		    cd "$(top_builddir)" &&				\
18290001Sglebius		    ./config.status $(subdir)/Makefile depfiles &&	\
19290001Sglebius		    cd $(subdir)					\
20290001Sglebius		    ;;							\
21290001Sglebius		esac &&							\
22290001Sglebius		echo -n "Cleaned $(subdir)/$(DEPDIR) version " &&	\
23290001Sglebius		cat $(top_srcdir)/deps-ver				\
24290001Sglebius	)
25290001Sglebius	cp $(top_srcdir)/deps-ver $@
26290001Sglebius
27290001Sglebius.deps-ver: $(top_srcdir)/deps-ver
28290001Sglebius	@[ ! -d $(DEPDIR) ] || $(MAKE) $(AM_MAKEFLAGS) $(DEPDIR)/deps-ver
29290001Sglebius	@touch $@
30290001Sglebius
31290001SglebiusBUILT_SOURCES += .deps-ver
32290001SglebiusCLEANFILES += .deps-ver
33290001Sglebius
34290001Sglebius#
35290001Sglebius# depsver.mf	included in Makefile.am for directories with .deps
36290001Sglebius#
37290001Sglebius# When building in the same directory with sources that change over
38290001Sglebius# time, such as when tracking using bk, the .deps files can become
39290001Sglebius# stale with respect to moved, deleted, or superceded headers.  Most
40290001Sglebius# commonly, this would exhibit as make reporting a failure to make a
41290001Sglebius# header file which is no longer in the location given.  To address
42290001Sglebius# this issue, we use a deps-ver file which is updated with each change
43290001Sglebius# that breaks old .deps files.  A copy of deps-ver is made into
44290001Sglebius# $(DEPDIR) if not already present.  If $(DEPDIR)/deps-ver is present
45290001Sglebius# with different contents than deps-ver, we make clean to ensure all
46290001Sglebius# .o files built before the incompatible change are rebuilt along with
47290001Sglebius# their updated .deps files, then remove $(DEPDIR) and recreate it as
48290001Sglebius# empty stubs.
49290001Sglebius#
50290001Sglebius# It is normal when configured with --disable-dependency-tracking for
51290001Sglebius# the DEPDIR to not have been created.  For this reason, we use the
52290001Sglebius# intermediate target .deps-ver, which invokes make recursively if
53290001Sglebius# DEPDIR exists.
54290001Sglebius#
55290001Sglebius# If you modify depsver.mf, please make the changes to the master
56290001Sglebius# copy, the one in sntp is copied by the bootstrap script from it.
57290001Sglebius#
58290001Sglebius# This comment block follows rather than leads the related code so that
59290001Sglebius# it stays with it in the generated Makefile.in and Makefile.
60290001Sglebius#
61