Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 25 additions & 10 deletions Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -117,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 \
Expand All @@ -131,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
Expand Down Expand Up @@ -231,10 +252,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!)
Expand All @@ -258,10 +276,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
Expand Down Expand Up @@ -1078,7 +1093,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)
Expand Down
5 changes: 4 additions & 1 deletion include/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -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 ; \
Expand Down
Loading