xref: /netbsd-src/external/bsd/ntp/dist/depsver.mf (revision 897be3a4bac39d8b2e92077bf29f4a2e67d31983)
1abb0f93cSkardel$(DEPDIR)/deps-ver: $(top_srcdir)/deps-ver
2abb0f93cSkardel	@[ -f $@ ] ||							\
3abb0f93cSkardel		cp $(top_srcdir)/deps-ver $@
4abb0f93cSkardel	@[ -w $@ ] ||							\
5*897be3a4Schristos		chmod u+w $@
6abb0f93cSkardel	@cmp $(top_srcdir)/deps-ver $@ > /dev/null || (			\
78585484eSchristos		$(MAKE) $(AM_MAKEFLAGS) clean &&			\
8abb0f93cSkardel		echo -n "Prior $(subdir)/$(DEPDIR) version " &&		\
9abb0f93cSkardel		cat $@ &&						\
10abb0f93cSkardel		rm -rf $(DEPDIR) &&					\
11abb0f93cSkardel		mkdir $(DEPDIR) && 					\
12abb0f93cSkardel		case "$(top_builddir)" in				\
13abb0f93cSkardel		 .)							\
14abb0f93cSkardel		    ./config.status Makefile depfiles			\
15abb0f93cSkardel		    ;;							\
168585484eSchristos		 *)							\
178585484eSchristos		    cd "$(top_builddir)" &&				\
18abb0f93cSkardel		    ./config.status $(subdir)/Makefile depfiles &&	\
19abb0f93cSkardel		    cd $(subdir)					\
20abb0f93cSkardel		    ;;							\
21abb0f93cSkardel		esac &&							\
22abb0f93cSkardel		echo -n "Cleaned $(subdir)/$(DEPDIR) version " &&	\
23abb0f93cSkardel		cat $(top_srcdir)/deps-ver				\
24abb0f93cSkardel	)
25*897be3a4Schristos	$(AM_V_at)cp $(top_srcdir)/deps-ver $@
26abb0f93cSkardel
27abb0f93cSkardel.deps-ver: $(top_srcdir)/deps-ver
288585484eSchristos	@[ ! -d $(DEPDIR) ] || $(MAKE) $(AM_MAKEFLAGS) $(DEPDIR)/deps-ver
29abb0f93cSkardel	@touch $@
30abb0f93cSkardel
31abb0f93cSkardelBUILT_SOURCES += .deps-ver
32abb0f93cSkardelCLEANFILES += .deps-ver
33*897be3a4SchristosDISTCLEANFILES += $(DEPDIR)/deps-ver
34abb0f93cSkardel
35abb0f93cSkardel#
36abb0f93cSkardel# depsver.mf	included in Makefile.am for directories with .deps
37abb0f93cSkardel#
38abb0f93cSkardel# When building in the same directory with sources that change over
39abb0f93cSkardel# time, such as when tracking using bk, the .deps files can become
40abb0f93cSkardel# stale with respect to moved, deleted, or superceded headers.  Most
41abb0f93cSkardel# commonly, this would exhibit as make reporting a failure to make a
42abb0f93cSkardel# header file which is no longer in the location given.  To address
43abb0f93cSkardel# this issue, we use a deps-ver file which is updated with each change
44abb0f93cSkardel# that breaks old .deps files.  A copy of deps-ver is made into
45abb0f93cSkardel# $(DEPDIR) if not already present.  If $(DEPDIR)/deps-ver is present
46abb0f93cSkardel# with different contents than deps-ver, we make clean to ensure all
47abb0f93cSkardel# .o files built before the incompatible change are rebuilt along with
48abb0f93cSkardel# their updated .deps files, then remove $(DEPDIR) and recreate it as
49abb0f93cSkardel# empty stubs.
50abb0f93cSkardel#
51abb0f93cSkardel# It is normal when configured with --disable-dependency-tracking for
52abb0f93cSkardel# the DEPDIR to not have been created.  For this reason, we use the
53abb0f93cSkardel# intermediate target .deps-ver, which invokes make recursively if
54abb0f93cSkardel# DEPDIR exists.
55abb0f93cSkardel#
56abb0f93cSkardel# If you modify depsver.mf, please make the changes to the master
57abb0f93cSkardel# copy, the one in sntp is copied by the bootstrap script from it.
58abb0f93cSkardel#
59*897be3a4Schristos# This comment block follows rather than leads the related rules so that
60abb0f93cSkardel# it stays with it in the generated Makefile.in and Makefile.
61abb0f93cSkardel#
62