git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH v2 2/4] Documentation/Makefile: avoid multiple patterns when generating one file

From
Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Date
Nov 29, 2022, 14:09 UTC
Message-ID
<patch-v2-2.4-e232f308e40-20221129T140159Z-avarab@gmail.com>
In-Reply-To
<cover-v2-0.4-00000000000-20221129T140159Z-avarab@gmail.com>
From: Paul Smith <psmith@gnu.org>

A GNU make pattern rule with multiple targets has always meant that a single invocation of the recipe will build all the targets. However in older versions of GNU make a recipe that did not really build all the targets would be tolerated.

Starting with GNU make 4.4 this behavior is deprecated and pattern rules are expected to generate files to match all the patterns. If not all targets are created then GNU make will not consider any target up to date and will re-run the recipe when it is run again.

I.e. a command like:
	make -C Documentation git-am.1

Will never be satisfied that "git-am.1" has been made, because we didn't also make "git-am.5" and "git-am.7", as the warning it'll emit indicates:

	$ make -C Documentation git-am.1
	[...]
	    XMLTO git-am.1
	Makefile:355: warning: pattern recipe did not update peer target 'git-am.7'.
	Makefile:355: warning: pattern recipe did not update peer target 'git-am.5'.

Modify Documentation/Makefile to split the man page-creating pattern rule into a separate pattern rule for each pattern. This requires a small amount of copy/pasting, but due to splitting out the "DOC_MANN" in the preceding commit it's not too bad.

Reported-by: Alexander Kanavin <alex.kanavin@gmail.com>
Signed-off-by: Paul Smith <psmith@gnu.org>
Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
---
 Documentation/Makefile | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/Documentation/Makefile b/Documentation/Makefile
index d239f6751f0..89929e3d60b 100644
--- a/Documentation/Makefile
+++ b/Documentation/Makefile
@@ -356,7 +356,11 @@ manpage-base-url.xsl: manpage-base-url.xsl.in
 	$(QUIET_GEN)sed "s|@@MAN_BASE_URL@@|$(MAN_BASE_URL)|" $< > $@
 
 $(DOC_MANN): manpage-base-url.xsl $(wildcard manpage*.xsl)
-%.1 %.5 %.7 : %.xml
+%.1 : %.xml
+	$(QUIET_XMLTO)$(XMLTO) -m $(MANPAGE_XSL) $(XMLTO_EXTRA) man $<
+%.5 : %.xml
+	$(QUIET_XMLTO)$(XMLTO) -m $(MANPAGE_XSL) $(XMLTO_EXTRA) man $<
+%.7 : %.xml
 	$(QUIET_XMLTO)$(XMLTO) -m $(MANPAGE_XSL) $(XMLTO_EXTRA) man $<
 
 %.xml : %.txt $(ASCIIDOC_DEPS)
-- 
2.39.0.rc0.993.g0c499e58e3b
Previous: Junio C HamanoNext: Junio C Hamano
Message 13 of 23 in “Avoid multiple patterns when recipes generate one file”
  1. 0/1 Avoid multiple patterns when recipes generate one filePaul Smith, Nov 27, 2022
  2. 1/1 Avoid multiple patterns when recipes generate one filePaul Smith, Nov 27, 2022
  3. Ævar Arnfjörð BjarmasonNov 28, 2022
  4. Paul SmithNov 28, 2022
  5. Ævar Arnfjörð BjarmasonNov 28, 2022
  6. 0/4 Makefiles: GNU make 4.4 fixesÆvar Arnfjörð Bjarmason, Nov 29, 2022
  7. 3/4 Makefiles: change search through $(MAKEFLAGS) for GNU make 4.4Ævar Arnfjörð Bjarmason, Nov 29, 2022
  8. Junio C HamanoNov 30, 2022
  9. Paul SmithNov 30, 2022
  10. Ævar Arnfjörð BjarmasonDec 1, 2022
  11. 1/4 Documentation/Makefile: de-duplicate *.[157] dependency listÆvar Arnfjörð Bjarmason, Nov 29, 2022
  12. Junio C HamanoNov 30, 2022
  13. 2/4 Documentation/Makefile: avoid multiple patterns when generating one fileÆvar Arnfjörð Bjarmason, Nov 29, 2022
  14. Junio C HamanoNov 30, 2022
  15. 4/4 Documentation/Makefile: narrow wildcard rules to our known filesÆvar Arnfjörð Bjarmason, Nov 29, 2022
  16. Junio C HamanoNov 30, 2022
  17. 0/1 Makefiles: GNU make 4.4 fixesÆvar Arnfjörð Bjarmason, Nov 30, 2022
  18. 1/1 Makefiles: change search through $(MAKEFLAGS) for GNU make 4.4Ævar Arnfjörð Bjarmason, Nov 30, 2022
  19. Paul SmithNov 30, 2022
  20. Junio C HamanoNov 30, 2022
  21. Johannes SchindelinDec 6, 2022
  22. Ævar Arnfjörð BjarmasonDec 6, 2022
  23. Junio C HamanoDec 6, 2022

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.