From b007f67ade0aaa575dfaf246e8d9ceb119948d67 Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Wed, 4 Mar 2026 08:05:31 +0100 Subject: [PATCH 1/4] include/Makefile.am: nut_version.h: do not skip if NUT_VERSION_H_GENERATED==false even if touch-file exists [#3039] Signed-off-by: Jim Klimov --- include/Makefile.am | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/include/Makefile.am b/include/Makefile.am index 281ae4868f..8acb2da620 100644 --- a/include/Makefile.am +++ b/include/Makefile.am @@ -52,7 +52,10 @@ nut_version.h: @FORCE_NUT_VERSION@ fi ; \ exit 0 ; \ fi ; \ - if test -n "`find '$@' -newer '.all.nut_version-generated.timestamp' 2>/dev/null`" ; then \ + if test -n "`find '$@' -newer '.all.nut_version-generated.timestamp' 2>/dev/null`" \ + && [ x"$(NUT_VERSION_H_GENERATED)" != xfalse ] \ + && [ x"$${NUT_VERSION_H_GENERATED}" != xfalse ] \ + ; then \ if [ x"$(MAINTAINER_GENERATE_HEADER_DEBUG)" = xyes ] ; then \ echo "=== SKIP (include) $@ (.all.nut_version-generated.timestamp was made in this larger run and is older than the generated file)" >&2; \ fi ; \ From 203da04845fa9757b135b0c10b0a877e6160e778 Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Wed, 4 Mar 2026 08:06:40 +0100 Subject: [PATCH 2/4] Makefile.am: libupsclient-version.h: fix typo for working subdir Signed-off-by: Jim Klimov --- Makefile.am | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile.am b/Makefile.am index acc00c75ad..57271fff54 100644 --- a/Makefile.am +++ b/Makefile.am @@ -1078,7 +1078,7 @@ nut_version.h include/nut_version.h: @dotMAKE@ # May involve (re-)build of libupsclient.la libupsclient-version.h clients/libupsclient-version.h: include/nut_version.h @dotMAKE@ @rm -f clients/.all.libupsclient_version-generated.timestamp - +cd $(abs_top_builddir)/include && $(MAKE) $(AM_MAKEFLAGS) libupsclient-version.h + +cd $(abs_top_builddir)/clients && $(MAKE) $(AM_MAKEFLAGS) libupsclient-version.h tools/gitlog2changelog.py: tools/gitlog2changelog.py.in @dotMAKE@ +cd $(@D) && $(MAKE) $(AM_MAKEFLAGS) -s $(@F) From 4e0278e4c72c93108b7ad2bbe39a7ec18f454ce4 Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Wed, 4 Mar 2026 08:08:12 +0100 Subject: [PATCH 3/4] Makefile.am: refactor generated header touchfiles into reusable goals [#3039] Signed-off-by: Jim Klimov --- Makefile.am | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/Makefile.am b/Makefile.am index 57271fff54..60c351eb03 100644 --- a/Makefile.am +++ b/Makefile.am @@ -103,6 +103,18 @@ all-fanout-cleanup: all-recursive @rm -f include/.all.nut_version-generated.timestamp \ clients/.all.libupsclient_version-generated.timestamp +touch-include-all-nut_version-generated.timestamp: + @[ -s include/nut_version.h ] + @touch -r include/nut_version.h -d '-10 seconds' include/.all.nut_version-generated.timestamp && exit ; \ + touch -d '1970-01-01' include/.all.nut_version-generated.timestamp && exit ; \ + touch include/.all.nut_version-generated.timestamp + +touch-clients-all-libupsclient_version-generated.timestamp: + @[ -s clients/libupsclient-version.h ] + @touch -r clients/libupsclient-version.h -d '-10 seconds' clients/.all.libupsclient_version-generated.timestamp && exit ; \ + touch -d '1970-01-01' clients/.all.libupsclient_version-generated.timestamp && exit ; \ + touch clients/.all.libupsclient_version-generated.timestamp + # Verbosity for fanout rule tracing; 0/1 (or "default" that may auto-set # to 0 or 1 in some rules below) SUBDIR_MAKE_VERBOSE = default @@ -231,10 +243,7 @@ SUBDIR_TGT_RULE = ( \ all-libs-local/include: @dotMAKE@ +@NUT_VERSION_H_GENERATED=false; export NUT_VERSION_H_GENERATED; \ $(SUBDIR_TGT_RULE) - @[ -s include/nut_version.h ] - @touch -r include/nut_version.h -d '-10 seconds' include/.all.nut_version-generated.timestamp && exit ; \ - touch -d '1970-01-01' include/.all.nut_version-generated.timestamp && exit ; \ - touch include/.all.nut_version-generated.timestamp + +@$(MAKE) $(AM_MAKEFLAGS) touch-include-all-nut_version-generated.timestamp ### Delivers: libcommon.la libcommonclient.la libcommonstr.la libcommonstrjson.la ### (consume only one of these at a time!) @@ -258,10 +267,7 @@ all-libs-local/common: all-libs-local/include @dotMAKE@ all-libs-local/clients: all-libs-local/common @dotMAKE@ +@NUT_VERSION_H_GENERATED=true; export NUT_VERSION_H_GENERATED; \ $(SUBDIR_TGT_RULE) - @[ -s clients/libupsclient-version.h ] - @touch -r clients/libupsclient-version.h -d '-10 seconds' clients/.all.libupsclient_version-generated.timestamp && exit ; \ - touch -d '1970-01-01' clients/.all.libupsclient_version-generated.timestamp && exit ; \ - touch clients/.all.libupsclient_version-generated.timestamp + +@$(MAKE) $(AM_MAKEFLAGS) touch-clients-all-libupsclient_version-generated.timestamp ### Delivers: libdummy_main.la libdummy_serial.la libdummy_upsdrvquery.la ### Delivers: libdummy_mockdrv.la libserial-nutscan.la From 7d34c7aca739047ef0ed2cc0aa23b66e92388038 Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Wed, 4 Mar 2026 08:09:30 +0100 Subject: [PATCH 4/4] Makefile.am: apply generated header touchfiles also to default sequential `make all` [#3039] Signed-off-by: Jim Klimov --- Makefile.am | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/Makefile.am b/Makefile.am index 60c351eb03..46a3f8c80a 100644 --- a/Makefile.am +++ b/Makefile.am @@ -129,6 +129,10 @@ all-fanout-maybe: @dotMAKE@ if [ x"$(SUBDIR_MAKE_VERBOSE)" != x0 ] ; then \ echo " SUBDIR-MAKE $@: skip optimization for parallel make - NUT_MAKE_SKIP_FANOUT is set" ; \ fi ; \ + $(MAKE) $(AM_MAKEFLAGS) NUT_VERSION_H_GENERATED=false nut_version.h || exit ; \ + $(MAKE) $(AM_MAKEFLAGS) touch-include-all-nut_version-generated.timestamp || exit ; \ + $(MAKE) $(AM_MAKEFLAGS) libupsclient-version.h || exit ; \ + $(MAKE) $(AM_MAKEFLAGS) touch-clients-all-libupsclient_version-generated.timestamp || exit ; \ exit 0 ; \ fi ; \ case "-$(MAKEFLAGS) $(AM_MAKEFLAGS)" in \ @@ -143,7 +147,12 @@ all-fanout-maybe: @dotMAKE@ *) \ if [ x"$(SUBDIR_MAKE_VERBOSE)" != x0 ] ; then \ echo " SUBDIR-MAKE $@: skip optimization for parallel make - we seem to run sequentially now, seen MAKEFLAGS='$(MAKEFLAGS)' AM_MAKEFLAGS='$(AM_MAKEFLAGS)'" ; \ - fi ;; \ + fi ; \ + $(MAKE) $(AM_MAKEFLAGS) NUT_VERSION_H_GENERATED=false nut_version.h || exit ; \ + $(MAKE) $(AM_MAKEFLAGS) touch-include-all-nut_version-generated.timestamp || exit ; \ + $(MAKE) $(AM_MAKEFLAGS) libupsclient-version.h || exit ; \ + $(MAKE) $(AM_MAKEFLAGS) touch-clients-all-libupsclient_version-generated.timestamp || exit \ + ;; \ esac # We start with a pass to `make all` in `common` dir because our wild recipes