xref: /freebsd/contrib/ntp/depsver.mf (revision 6829dae12bb055451fa467da4589c43bd03b1e64)
1$(DEPDIR)/deps-ver: $(top_srcdir)/deps-ver
2	@[ -f $@ ] ||							\
3		cp $(top_srcdir)/deps-ver $@
4	@[ -w $@ ] ||							\
5		chmod ug+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	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
33
34#
35# depsver.mf	included in Makefile.am for directories with .deps
36#
37# When building in the same directory with sources that change over
38# time, such as when tracking using bk, the .deps files can become
39# stale with respect to moved, deleted, or superceded headers.  Most
40# commonly, this would exhibit as make reporting a failure to make a
41# header file which is no longer in the location given.  To address
42# this issue, we use a deps-ver file which is updated with each change
43# that breaks old .deps files.  A copy of deps-ver is made into
44# $(DEPDIR) if not already present.  If $(DEPDIR)/deps-ver is present
45# with different contents than deps-ver, we make clean to ensure all
46# .o files built before the incompatible change are rebuilt along with
47# their updated .deps files, then remove $(DEPDIR) and recreate it as
48# empty stubs.
49#
50# It is normal when configured with --disable-dependency-tracking for
51# the DEPDIR to not have been created.  For this reason, we use the
52# intermediate target .deps-ver, which invokes make recursively if
53# DEPDIR exists.
54#
55# If you modify depsver.mf, please make the changes to the master
56# copy, the one in sntp is copied by the bootstrap script from it.
57#
58# This comment block follows rather than leads the related code so that
59# it stays with it in the generated Makefile.in and Makefile.
60#
61