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