1258945Sroberto$(DEPDIR)/deps-ver: $(top_srcdir)/deps-ver
2258945Sroberto	@[ -f $@ ] ||							\
3258945Sroberto		cp $(top_srcdir)/deps-ver $@
4258945Sroberto	@[ -w $@ ] ||							\
5258945Sroberto		chmod ug+w $@
6258945Sroberto	@cmp $(top_srcdir)/deps-ver $@ > /dev/null || (			\
7280849Scy		$(MAKE) $(AM_MAKEFLAGS) clean &&					\
8258945Sroberto		echo -n "Prior $(subdir)/$(DEPDIR) version " &&		\
9258945Sroberto		cat $@ &&						\
10258945Sroberto		rm -rf $(DEPDIR) &&					\
11258945Sroberto		mkdir $(DEPDIR) && 					\
12258945Sroberto		case "$(top_builddir)" in				\
13258945Sroberto		 .)							\
14258945Sroberto		    ./config.status Makefile depfiles			\
15258945Sroberto		    ;;							\
16258945Sroberto		 *)							\
17280849Scy		    cd "$(top_builddir)" &&				\
18280849Scy		    ./config.status $(subdir)/Makefile depfiles &&	\
19280849Scy		    cd $(subdir)					\
20258945Sroberto		    ;;							\
21258945Sroberto		esac &&							\
22258945Sroberto		echo -n "Cleaned $(subdir)/$(DEPDIR) version " &&	\
23258945Sroberto		cat $(top_srcdir)/deps-ver				\
24258945Sroberto	)
25258945Sroberto	cp $(top_srcdir)/deps-ver $@
26258945Sroberto
27258945Sroberto.deps-ver: $(top_srcdir)/deps-ver
28280849Scy	@[ ! -d $(DEPDIR) ] || $(MAKE) $(AM_MAKEFLAGS) $(DEPDIR)/deps-ver
29258945Sroberto	@touch $@
30258945Sroberto
31258945SrobertoBUILT_SOURCES += .deps-ver
32258945SrobertoCLEANFILES += .deps-ver
33258945Sroberto
34258945Sroberto#
35258945Sroberto# depsver.mf	included in Makefile.am for directories with .deps
36258945Sroberto#
37258945Sroberto# When building in the same directory with sources that change over
38258945Sroberto# time, such as when tracking using bk, the .deps files can become
39258945Sroberto# stale with respect to moved, deleted, or superceded headers.  Most
40258945Sroberto# commonly, this would exhibit as make reporting a failure to make a
41258945Sroberto# header file which is no longer in the location given.  To address
42258945Sroberto# this issue, we use a deps-ver file which is updated with each change
43258945Sroberto# that breaks old .deps files.  A copy of deps-ver is made into
44258945Sroberto# $(DEPDIR) if not already present.  If $(DEPDIR)/deps-ver is present
45258945Sroberto# with different contents than deps-ver, we make clean to ensure all
46258945Sroberto# .o files built before the incompatible change are rebuilt along with
47258945Sroberto# their updated .deps files, then remove $(DEPDIR) and recreate it as
48258945Sroberto# empty stubs.
49258945Sroberto#
50258945Sroberto# It is normal when configured with --disable-dependency-tracking for
51258945Sroberto# the DEPDIR to not have been created.  For this reason, we use the
52258945Sroberto# intermediate target .deps-ver, which invokes make recursively if
53258945Sroberto# DEPDIR exists.
54258945Sroberto#
55258945Sroberto# If you modify depsver.mf, please make the changes to the master
56258945Sroberto# copy, the one in sntp is copied by the bootstrap script from it.
57258945Sroberto#
58258945Sroberto# This comment block follows rather than leads the related code so that
59258945Sroberto# it stays with it in the generated Makefile.in and Makefile.
60258945Sroberto#
61