From ea86d9af544743b1309e361e633726963a8e6ba3 Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Tue, 27 Feb 2024 09:47:56 +0000 Subject: [PATCH 1/5] Makefile.am: fix out-of-tree build of ChangeLog file Signed-off-by: Jim Klimov --- Makefile.am | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/Makefile.am b/Makefile.am index bac4f8eb2b..af266fb0b1 100644 --- a/Makefile.am +++ b/Makefile.am @@ -321,14 +321,22 @@ GITLOG_START_POINT=v2.6.0 # the current dir, and defaults to generate a "ChangeLog" in the current dir. # The script itself is generated from a template, so resides in builddir. dummy-stamp: -ChangeLog: tools/gitlog2changelog.py dummy-stamp +# Be sure to not confuse with a DIST'ed file (and try to overwrite it): +ChangeLog: $(abs_top_builddir)/ChangeLog +$(abs_top_builddir)/ChangeLog: tools/gitlog2changelog.py dummy-stamp cd $(abs_top_srcdir) && \ if test -e .git ; then \ CHANGELOG_FILE="$@" $(abs_top_builddir)/tools/gitlog2changelog.py $(GITLOG_START_POINT) || \ { printf "gitlog2changelog.py failed to generate the ChangeLog.\n\nNOTE: See https://github.com/networkupstools/nut/commits/master for change history.\n\n" > "$@" ; } ; \ else \ - if ! test -s "$@" ; then \ - printf "Failed to generate the ChangeLog.\n\nNOTE: See https://github.com/networkupstools/nut/commits/master for change history.\n\n" > "$@" ; \ + if x"$(abs_top_srcdir)" != x"$(abs_top_builddir)" -a -s ./ChangeLog ; then \ + echo "Using distributed ChangeLog file from sources" >&2 ; \ + rm -f "$@" || true ; \ + cat ./ChangeLog > "$@" ; \ + else \ + if ! test -s "$@" ; then \ + printf "Failed to generate the ChangeLog.\n\nNOTE: See https://github.com/networkupstools/nut/commits/master for change history.\n\n" > "$@" ; \ + fi ; \ fi ; \ fi From f8359cf2ac20475fa0f7e74aa04c3b2b96e8cb0b Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Tue, 27 Feb 2024 12:34:17 +0100 Subject: [PATCH 2/5] docs/Makefile.am: produce proper asciidoc markup for ChangeLog.adoc if "FAILED to resolve input or output filename with this make implementation..." Signed-off-by: Jim Klimov --- docs/Makefile.am | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/Makefile.am b/docs/Makefile.am index 33f0ff5d77..c2fba72854 100644 --- a/docs/Makefile.am +++ b/docs/Makefile.am @@ -240,7 +240,7 @@ $(top_builddir)/ChangeLog.adoc: $(top_builddir)/ChangeLog || { \ MSG="FAILED to resolve input or output filename with this make implementation, or input was not generated!"; \ echo " DOC-CHANGELOG-ASCIIDOC SKIP: $${MSG}" >&2; \ - test -n "$@" && echo "$${MSG}" > "$@" ; \ + test -n "$@" && { printf '=== Failed to generate the ChangeLog\n\n%s\n\nNOTE: See https://github.com/networkupstools/nut/commits/master for change history.\n\n' "$${MSG}" > "$@" ; } ; \ exit ; \ } ; \ echo " DOC-CHANGELOG-ASCIIDOC $${INPUT} => $@" \ From b43ad592362e705bafc3124a9c139e094a343e39 Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Tue, 27 Feb 2024 12:59:22 +0100 Subject: [PATCH 3/5] Makefile.am: make sure "make ChangeLog" does some work ...even with OpenBSD make implementation Signed-off-by: Jim Klimov --- Makefile.am | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Makefile.am b/Makefile.am index af266fb0b1..dda908e7f1 100644 --- a/Makefile.am +++ b/Makefile.am @@ -323,8 +323,10 @@ GITLOG_START_POINT=v2.6.0 dummy-stamp: # Be sure to not confuse with a DIST'ed file (and try to overwrite it): ChangeLog: $(abs_top_builddir)/ChangeLog + +@$(MAKE) $(AM_MAKEFLAGS) $(abs_top_builddir)/ChangeLog + $(abs_top_builddir)/ChangeLog: tools/gitlog2changelog.py dummy-stamp - cd $(abs_top_srcdir) && \ + @cd $(abs_top_srcdir) && \ if test -e .git ; then \ CHANGELOG_FILE="$@" $(abs_top_builddir)/tools/gitlog2changelog.py $(GITLOG_START_POINT) || \ { printf "gitlog2changelog.py failed to generate the ChangeLog.\n\nNOTE: See https://github.com/networkupstools/nut/commits/master for change history.\n\n" > "$@" ; } ; \ From 7ad56ab778031ad060939f441d9203af0ba639f8 Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Tue, 27 Feb 2024 13:20:13 +0100 Subject: [PATCH 4/5] Makefile.am: avoid what some makes see as a loop for ChangeLog Signed-off-by: Jim Klimov --- Makefile.am | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Makefile.am b/Makefile.am index dda908e7f1..b1835af9ae 100644 --- a/Makefile.am +++ b/Makefile.am @@ -321,10 +321,10 @@ GITLOG_START_POINT=v2.6.0 # the current dir, and defaults to generate a "ChangeLog" in the current dir. # The script itself is generated from a template, so resides in builddir. dummy-stamp: -# Be sure to not confuse with a DIST'ed file (and try to overwrite it): -ChangeLog: $(abs_top_builddir)/ChangeLog +ChangeLog: dummy-stamp +@$(MAKE) $(AM_MAKEFLAGS) $(abs_top_builddir)/ChangeLog +# Be sure to not confuse with a DIST'ed file (and so try to overwrite it): $(abs_top_builddir)/ChangeLog: tools/gitlog2changelog.py dummy-stamp @cd $(abs_top_srcdir) && \ if test -e .git ; then \ From b6cc4e24b1007066522df06fdb91f590e0658599 Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Tue, 27 Feb 2024 14:40:02 +0000 Subject: [PATCH 5/5] Makefile.am: ChangeLog: fix shell-scripting typo Signed-off-by: Jim Klimov --- Makefile.am | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile.am b/Makefile.am index b1835af9ae..e1c62d90c6 100644 --- a/Makefile.am +++ b/Makefile.am @@ -331,7 +331,7 @@ $(abs_top_builddir)/ChangeLog: tools/gitlog2changelog.py dummy-stamp CHANGELOG_FILE="$@" $(abs_top_builddir)/tools/gitlog2changelog.py $(GITLOG_START_POINT) || \ { printf "gitlog2changelog.py failed to generate the ChangeLog.\n\nNOTE: See https://github.com/networkupstools/nut/commits/master for change history.\n\n" > "$@" ; } ; \ else \ - if x"$(abs_top_srcdir)" != x"$(abs_top_builddir)" -a -s ./ChangeLog ; then \ + if test x"$(abs_top_srcdir)" != x"$(abs_top_builddir)" -a -s ./ChangeLog ; then \ echo "Using distributed ChangeLog file from sources" >&2 ; \ rm -f "$@" || true ; \ cat ./ChangeLog > "$@" ; \