xref: /freebsd/contrib/ntp/sntp/depsver.mf (revision a466cc55373fc3cf86837f09da729535b57e69a1)
12b15cb3dSCy Schubert$(DEPDIR)/deps-ver: $(top_srcdir)/deps-ver
22b15cb3dSCy Schubert	@[ -f $@ ] ||							\
32b15cb3dSCy Schubert		cp $(top_srcdir)/deps-ver $@
42b15cb3dSCy Schubert	@[ -w $@ ] ||							\
5*a466cc55SCy Schubert		chmod u+w $@
62b15cb3dSCy Schubert	@cmp $(top_srcdir)/deps-ver $@ > /dev/null || (			\
72b15cb3dSCy Schubert		$(MAKE) $(AM_MAKEFLAGS) clean &&			\
82b15cb3dSCy Schubert		echo -n "Prior $(subdir)/$(DEPDIR) version " &&		\
92b15cb3dSCy Schubert		cat $@ &&						\
102b15cb3dSCy Schubert		rm -rf $(DEPDIR) &&					\
112b15cb3dSCy Schubert		mkdir $(DEPDIR) && 					\
122b15cb3dSCy Schubert		case "$(top_builddir)" in				\
132b15cb3dSCy Schubert		 .)							\
142b15cb3dSCy Schubert		    ./config.status Makefile depfiles			\
152b15cb3dSCy Schubert		    ;;							\
162b15cb3dSCy Schubert		 *)							\
172b15cb3dSCy Schubert		    cd "$(top_builddir)" &&				\
182b15cb3dSCy Schubert		    ./config.status $(subdir)/Makefile depfiles &&	\
192b15cb3dSCy Schubert		    cd $(subdir)					\
202b15cb3dSCy Schubert		    ;;							\
212b15cb3dSCy Schubert		esac &&							\
222b15cb3dSCy Schubert		echo -n "Cleaned $(subdir)/$(DEPDIR) version " &&	\
232b15cb3dSCy Schubert		cat $(top_srcdir)/deps-ver				\
242b15cb3dSCy Schubert	)
25*a466cc55SCy Schubert	$(AM_V_at)cp $(top_srcdir)/deps-ver $@
262b15cb3dSCy Schubert
272b15cb3dSCy Schubert.deps-ver: $(top_srcdir)/deps-ver
282b15cb3dSCy Schubert	@[ ! -d $(DEPDIR) ] || $(MAKE) $(AM_MAKEFLAGS) $(DEPDIR)/deps-ver
292b15cb3dSCy Schubert	@touch $@
302b15cb3dSCy Schubert
312b15cb3dSCy SchubertBUILT_SOURCES += .deps-ver
322b15cb3dSCy SchubertCLEANFILES += .deps-ver
33*a466cc55SCy SchubertDISTCLEANFILES += $(DEPDIR)/deps-ver
342b15cb3dSCy Schubert
352b15cb3dSCy Schubert#
362b15cb3dSCy Schubert# depsver.mf	included in Makefile.am for directories with .deps
372b15cb3dSCy Schubert#
382b15cb3dSCy Schubert# When building in the same directory with sources that change over
392b15cb3dSCy Schubert# time, such as when tracking using bk, the .deps files can become
402b15cb3dSCy Schubert# stale with respect to moved, deleted, or superceded headers.  Most
412b15cb3dSCy Schubert# commonly, this would exhibit as make reporting a failure to make a
422b15cb3dSCy Schubert# header file which is no longer in the location given.  To address
432b15cb3dSCy Schubert# this issue, we use a deps-ver file which is updated with each change
442b15cb3dSCy Schubert# that breaks old .deps files.  A copy of deps-ver is made into
452b15cb3dSCy Schubert# $(DEPDIR) if not already present.  If $(DEPDIR)/deps-ver is present
462b15cb3dSCy Schubert# with different contents than deps-ver, we make clean to ensure all
472b15cb3dSCy Schubert# .o files built before the incompatible change are rebuilt along with
482b15cb3dSCy Schubert# their updated .deps files, then remove $(DEPDIR) and recreate it as
492b15cb3dSCy Schubert# empty stubs.
502b15cb3dSCy Schubert#
512b15cb3dSCy Schubert# It is normal when configured with --disable-dependency-tracking for
522b15cb3dSCy Schubert# the DEPDIR to not have been created.  For this reason, we use the
532b15cb3dSCy Schubert# intermediate target .deps-ver, which invokes make recursively if
542b15cb3dSCy Schubert# DEPDIR exists.
552b15cb3dSCy Schubert#
562b15cb3dSCy Schubert# If you modify depsver.mf, please make the changes to the master
572b15cb3dSCy Schubert# copy, the one in sntp is copied by the bootstrap script from it.
582b15cb3dSCy Schubert#
59*a466cc55SCy Schubert# This comment block follows rather than leads the related rules so that
602b15cb3dSCy Schubert# it stays with it in the generated Makefile.in and Makefile.
612b15cb3dSCy Schubert#
62