1212# include directory for aclocal
1313ACLOCAL_AMFLAGS = -I m4
1414
15+ CLEANFILES =
16+ DISTCLEANFILES =
17+ MAINTAINERCLEANFILES =
18+
1519# Autotools' SUBDIRS (our values are listed below) allow for powerful recursive
1620# recipe automation, with one notable weakness: the dirs are processed in a
1721# loop sequentially, even in parallel builds (each such sub-make is parallel
@@ -91,13 +95,24 @@ SUBDIRS_ALL_LIBS_LOCAL = \
9195# all all-recursive all-am-local all-local: all-fanout-maybe
9296all-recursive : all-fanout-maybe
9397
98+ all : all-fanout-cleanup
99+
100+ # Run as part of "all", but after the autotools-standard "all-recursive"
101+ # where we quiesce nut_version.h regeneration attempts for each subdir
102+ all-fanout-cleanup : all-recursive
103+ @rm -f include/.all.nut_version-generated.timestamp \
104+ clients/.all.libupsclient_version-generated.timestamp
105+
94106# Verbosity for fanout rule tracing; 0/1 (or "default" that may auto-set
95107# to 0 or 1 in some rules below)
96108SUBDIR_MAKE_VERBOSE = default
97109
98110# Run the standard build if going sequential (or with unknown MAKEFLAGS),
99111# or fanout if parallel (presuming GNU/BSD/Sun make at least):
112+ CLEANFILES += include/.all.nut_version-generated.timestamp clients/.all.libupsclient_version-generated.timestamp
100113all-fanout-maybe : @dotMAKE@
114+ @rm -f include/.all.nut_version-generated.timestamp \
115+ clients/.all.libupsclient_version-generated.timestamp
101116 +@if [ x" $( NUT_MAKE_SKIP_FANOUT) " = xtrue ] ; then \
102117 if [ x" $( SUBDIR_MAKE_VERBOSE) " != x0 ] ; then \
103118 echo " SUBDIR-MAKE $@ : skip optimization for parallel make - NUT_MAKE_SKIP_FANOUT is set" ; \
@@ -216,6 +231,10 @@ SUBDIR_TGT_RULE = ( \
216231all-libs-local/include : @dotMAKE@
217232 +@NUT_VERSION_H_GENERATED=false; export NUT_VERSION_H_GENERATED; \
218233 $(SUBDIR_TGT_RULE )
234+ @[ -s include/nut_version.h ]
235+ @touch -r include/nut_version.h -d ' -10 seconds' include/.all.nut_version-generated.timestamp && exit ; \
236+ touch -d ' 1970-01-01' include/.all.nut_version-generated.timestamp && exit ; \
237+ touch include/.all.nut_version-generated.timestamp
219238
220239# ## Delivers: libcommon.la libcommonclient.la libcommonstr.la libcommonstrjson.la
221240# ## (consume only one of these at a time!)
@@ -239,6 +258,10 @@ all-libs-local/common: all-libs-local/include @dotMAKE@
239258all-libs-local/clients : all-libs-local/common @dotMAKE@
240259 +@NUT_VERSION_H_GENERATED=true; export NUT_VERSION_H_GENERATED; \
241260 $(SUBDIR_TGT_RULE )
261+ @[ -s clients/libupsclient-version.h ]
262+ @touch -r clients/libupsclient-version.h -d ' -10 seconds' clients/.all.libupsclient_version-generated.timestamp && exit ; \
263+ touch -d ' 1970-01-01' clients/.all.libupsclient_version-generated.timestamp && exit ; \
264+ touch clients/.all.libupsclient_version-generated.timestamp
242265
243266# ## Delivers: libdummy_main.la libdummy_serial.la libdummy_upsdrvquery.la
244267# ## Delivers: libdummy_mockdrv.la libserial-nutscan.la
@@ -630,8 +653,8 @@ distcleancheck:
630653realclean : maintainer-clean
631654
632655# Files made by our targets:
633- CLEANFILES = *-spellchecked *.adoc-parsed cppcheck*.xml config.log.inplace-outer
634- DISTCLEANFILES = ChangeLog
656+ CLEANFILES + = *-spellchecked *.adoc-parsed cppcheck*.xml config.log.inplace-outer
657+ DISTCLEANFILES + = ChangeLog
635658
636659# Most of the files generated by custom rules in the configure script
637660# or by autogen.sh are cleaned by the Makefile.am in their directories.
@@ -647,7 +670,7 @@ DISTCLEANFILES += include/config.h.in~
647670# from their installation, or made by `automake` etc. on the system
648671# which generates `configure`; rebuilding NUT after deleting these
649672# requires `autogen.sh` script to be re-run (and tools available):
650- MAINTAINERCLEANFILES = INSTALL
673+ MAINTAINERCLEANFILES + = INSTALL
651674MAINTAINERCLEANFILES += aclocal.m4 config.guess config.sub
652675MAINTAINERCLEANFILES += configure
653676MAINTAINERCLEANFILES += depcomp install-sh ltmain.sh test-driver ar-lib
@@ -1048,10 +1071,13 @@ ChangeLog.adoc: ChangeLog @dotMAKE@
10481071 +cd $(abs_top_builddir ) /docs && $(MAKE ) $(AM_MAKEFLAGS ) ../ChangeLog.adoc
10491072
10501073nut_version.h include/nut_version.h : @dotMAKE@
1074+ @rm -f include/.all.nut_version-generated.timestamp
10511075 +cd $(abs_top_builddir ) /include && $(MAKE ) $(AM_MAKEFLAGS ) nut_version.h
10521076
1077+ # May depend on nut_version.h at least when we ENABLE_SHARED_PRIVATE_LIBS
10531078# May involve (re-)build of libupsclient.la
1054- libupsclient-version.h clients/libupsclient-version.h : @dotMAKE@
1079+ libupsclient-version.h clients/libupsclient-version.h : include/nut_version.h @dotMAKE@
1080+ @rm -f clients/.all.libupsclient_version-generated.timestamp
10551081 +cd $(abs_top_builddir ) /include && $(MAKE ) $(AM_MAKEFLAGS ) libupsclient-version.h
10561082
10571083tools/gitlog2changelog.py : tools/gitlog2changelog.py.in @dotMAKE@
0 commit comments