@@ -94,22 +94,43 @@ SUBDIRS_ALL_LIBS_LOCAL = \
9494
9595# all all-recursive all-am-local all-local: all-fanout-maybe
9696all-recursive : all-fanout-maybe
97- check-recursive install-recursive : generated-headers-with-a-touch
9897
99- all check install : all-fanout-cleanup
98+ # Make sure automake-defined check/install goals begin with our hack for
99+ # touch-files for generated headers (so each depending sub-directory does
100+ # not re-evaluate those rules in whole); note that these goals may end up
101+ # also calling all-fanout-maybe (as they depend on "all"):
102+ check-recursive install-recursive : generated-headers-with-a-touch
100103
104+ # NOTE: Beside dependency above, also called from some code paths in
105+ # the all-fanout-maybe implementation:
101106generated-headers-with-a-touch : @dotMAKE@
102- $(MAKE ) $(AM_MAKEFLAGS ) NUT_VERSION_H_GENERATED=false nut_version.h
103- $(MAKE ) $(AM_MAKEFLAGS ) touch-include-all-nut_version-generated.timestamp
104- $(MAKE ) $(AM_MAKEFLAGS ) libupsclient-version.h
105- $(MAKE ) $(AM_MAKEFLAGS ) touch-clients-all-libupsclient_version-generated.timestamp
107+ +$(MAKE ) $(AM_MAKEFLAGS ) NUT_VERSION_H_GENERATED=false nut_version.h
108+ +$(MAKE ) $(AM_MAKEFLAGS ) touch-include-all-nut_version-generated.timestamp
109+ +$(MAKE ) $(AM_MAKEFLAGS ) libupsclient-version.h
110+ +$(MAKE ) $(AM_MAKEFLAGS ) touch-clients-all-libupsclient_version-generated.timestamp
111+
112+ # After completing the automake-defined goals, clean up:
113+ all : all-fanout-cleanup
114+ check : check-fanout-cleanup
115+ install : install-fanout-cleanup
106116
107117# Run as part of "all", but after the autotools-standard "all-recursive"
108118# where we quiesce nut_version.h regeneration attempts for each subdir
109- all-fanout-cleanup : all-recursive
119+ # which automake recipes iterate; similarly for "check" and "install":
120+ cleanup-touchfiles-for-generated-headers :
110121 @rm -f include/.all.nut_version-generated.timestamp \
111122 clients/.all.libupsclient_version-generated.timestamp
112123
124+ all-fanout-cleanup : all-recursive @dotMAKE@
125+ +@$(MAKE ) $(AM_MAKEFLAGS ) cleanup-touchfiles-for-generated-headers
126+
127+ check-fanout-cleanup : check-recursive @dotMAKE@
128+ +@$(MAKE ) $(AM_MAKEFLAGS ) cleanup-touchfiles-for-generated-headers
129+
130+ install-fanout-cleanup : install-recursive @dotMAKE@
131+ +@$(MAKE ) $(AM_MAKEFLAGS ) cleanup-touchfiles-for-generated-headers
132+
133+ # Called from generated-headers-with-a-touch:
113134touch-include-all-nut_version-generated.timestamp :
114135 @[ -s include/nut_version.h ]
115136 @touch -r include/nut_version.h -d ' -10 seconds' include/.all.nut_version-generated.timestamp && exit ; \
@@ -134,23 +155,23 @@ all-fanout-maybe: @dotMAKE@
134155 clients/.all.libupsclient_version-generated.timestamp
135156 +@if [ x" $( NUT_MAKE_SKIP_FANOUT) " = xtrue ] ; then \
136157 if [ x" $( SUBDIR_MAKE_VERBOSE) " != x0 ] ; then \
137- echo " SUBDIR-MAKE $@ : skip optimization for parallel make - NUT_MAKE_SKIP_FANOUT is set" ; \
158+ echo " SUBDIR-MAKE SKIP $@ : skip optimization for parallel make - NUT_MAKE_SKIP_FANOUT is set" ; \
138159 fi ; \
139160 $(MAKE ) $(AM_MAKEFLAGS ) generated-headers-with-a-touch || exit ; \
140161 exit 0 ; \
141162 fi ; \
142163 case " -$( MAKEFLAGS) $( AM_MAKEFLAGS) " in \
143164 * -j| * -j" " * | * -{j,l}{0,1,2,3,4,5,6,7,8,9}* | * -[jl][0123456789]* | * {-l,--jobs,--load-average,--max-load}" " {-,0,1,2,3,4,5,6,7,8,9}* | * --jobserver* | * --jobs" " [0123456789]* | * --load-average" " [0123456789]* | * --max-load" " [0123456789]* ) \
144165 if [ x" $( SUBDIR_MAKE_VERBOSE) " != x0 ] ; then \
145- echo " SUBDIR-MAKE $@ : implement optimization for parallel make as 'make all-fanout-subdirs'" ; \
166+ echo " SUBDIR-MAKE LAUNCH $@ : implement optimization for parallel make as 'make all-fanout-subdirs'" ; \
146167 fi ; \
147168 $(MAKE ) $(AM_MAKEFLAGS ) all-fanout-subdirs || exit ; \
148169 if [ x" $( SUBDIR_MAKE_VERBOSE) " != x0 ] ; then \
149- echo " SUBDIR-MAKE $@ : optimization for parallel make as 'make all-fanout-subdirs' finished; now automake rules can follow up with default implementation of 'all-recursive' and/or 'all' (may try to regenerate some files again; should keep existing results though)" ; \
170+ echo " SUBDIR-MAKE FINISH $@ : optimization for parallel make as 'make all-fanout-subdirs' finished; now automake rules can follow up with default implementation of 'all-recursive' and/or 'all' (may try to regenerate some files again; should keep existing results though)" ; \
150171 fi ;; \
151172 * ) \
152173 if [ x" $( SUBDIR_MAKE_VERBOSE) " != x0 ] ; then \
153- echo " SUBDIR-MAKE $@ : skip optimization for parallel make - we seem to run sequentially now, seen MAKEFLAGS='$( MAKEFLAGS) ' AM_MAKEFLAGS='$( AM_MAKEFLAGS) '" ; \
174+ echo " SUBDIR-MAKE SKIP $@ : skip optimization for parallel make - we seem to run sequentially now, seen MAKEFLAGS='$( MAKEFLAGS) ' AM_MAKEFLAGS='$( AM_MAKEFLAGS) '" ; \
154175 fi ; \
155176 $(MAKE ) $(AM_MAKEFLAGS ) generated-headers-with-a-touch || exit ; \
156177 ;; \
@@ -234,12 +255,12 @@ SUBDIR_TGT_RULE = ( \
234255 [ x"$${TGT-}" != x ] || TGT="` echo ' $@' | awk -F/ ' {print $$1}' ` " ; \
235256 [ x"$${DIR-}" != x ] || DIR="` echo ' $@' | sed ' s,^[^/]*/,,' ` " ; \
236257 if [ x"$(SUBDIR_MAKE_VERBOSE ) " != x0 ] ; then \
237- echo " SUBDIR-MAKE STARTING $@ : 'make $${SUBDIR_TGT_MAKEFLAGS-} $$TGT' in $$DIR ..." ; \
258+ echo " SUBDIR-MAKE STARTING $@ : 'make $${SUBDIR_TGT_MAKEFLAGS-} $$TGT' in $$DIR ..." ; \
238259 fi ; \
239260 cd "$(abs_builddir ) /$${DIR}" && \
240261 $(MAKE ) $(AM_MAKEFLAGS ) $${SUBDIR_TGT_MAKEFLAGS-} "$${TGT}" || { RES=$$? ; echo " SUBDIR-MAKE FAILURE: 'make $$TGT' in $$DIR" >&2 ; exit $$RES ; } ; \
241262 if [ x"$(SUBDIR_MAKE_VERBOSE ) " != x0 ] ; then \
242- echo " SUBDIR-MAKE SUCCESS $@ : 'make $${SUBDIR_TGT_MAKEFLAGS-} $$TGT' in $$DIR" ; \
263+ echo " SUBDIR-MAKE SUCCESS $@ : 'make $${SUBDIR_TGT_MAKEFLAGS-} $$TGT' in $$DIR" ; \
243264 fi ; \
244265 )
245266
@@ -761,7 +782,7 @@ spellcheck spellcheck-interactive: @dotMAKE@
761782 if [ x" $( NUT_MAKE_SKIP_FANOUT) " = xtrue ] ; then \
762783 RES=0 ; \
763784 if [ x" $( SUBDIR_MAKE_VERBOSE) " != x0 ] ; then \
764- echo " SUBDIR-MAKE $@ : skip optimization for parallel make - NUT_MAKE_SKIP_FANOUT is set" ; \
785+ echo " SUBDIR-MAKE SKIP $@ : skip optimization for parallel make - NUT_MAKE_SKIP_FANOUT is set" ; \
765786 fi ; \
766787 (cd $( builddir) /docs && $( MAKE) $( AM_MAKEFLAGS) -k -s $( abs_top_builddir) /docs/.prep-src-docs) || RES=$$? ; \
767788 (cd $( builddir) /docs/man && $( MAKE) $( AM_MAKEFLAGS) -k -s $( abs_top_builddir) /docs/man/.prep-src-docs) || RES=$$? ; \
@@ -781,8 +802,9 @@ spellcheck spellcheck-interactive: @dotMAKE@
781802 fi ; \
782803 export SUBDIR_MAKE_VERBOSE ; \
783804 ( $( MAKE) $( AM_MAKEFLAGS) SPELLCHECK_TGT=' $@' SUBDIR_MAKE_VERBOSE=" $$ {SUBDIR_MAKE_VERBOSE}" -k -s $( SPELLCHECK_DIRS) && exit ; \
784- echo " WARNING: FAILED fanned-out attempt in $@ , retrying with NUT_MAKE_SKIP_FANOUT" >&2 ; \
785- $(MAKE ) $(AM_MAKEFLAGS ) NUT_MAKE_SKIP_FANOUT=true SPELLCHECK_TGT=' $@' -k -s $(SPELLCHECK_DIRS ) ) || exit ; \
805+ echo " WARNING: FAILED fanned-out attempt in $@ , retrying with NUT_MAKE_SKIP_FANOUT" >&2 ; \
806+ $(MAKE ) $(AM_MAKEFLAGS ) NUT_MAKE_SKIP_FANOUT=true SPELLCHECK_TGT=' $@' -k -s $(SPELLCHECK_DIRS ) \
807+ ) || exit ; \
786808 if [ x' $@' = xspellcheck-interactive ] ; then \
787809 echo " SUCCESS: $@ : follow up with spellcheck-quick to revise and update timestamps" ; \
788810 $(MAKE ) $(AM_MAKEFLAGS ) spellcheck-quick ; \
0 commit comments