git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: "Ævar Arnfjörð Bjarmason" <avarab@gmail.com>
To: Paul Smith <psmith@gnu.org>
Cc: git@vger.kernel.org, Alexander Kanavin <alex.kanavin@gmail.com>
Subject: Re: [PATCH 1/1] Avoid multiple patterns when recipes generate one file
Date: Mon, 28 Nov 2022 14:08:35 +0100	[thread overview]
Message-ID: <221128.86mt8bkyqt.gmgdl@evledraar.gmail.com> (raw)
In-Reply-To: <20221127224251.2508200-2-psmith@gnu.org>


On Sun, Nov 27 2022, Paul Smith wrote:

> 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.
>
> Modify Documentation/Makefile to split the man page-creating pattern
> rule into a separate pattern rule for each pattern.
>
> Reported-by: Alexander Kanavin <alex.kanavin@gmail.com>
> Signed-off-by: Paul Smith <psmith@gnu.org>
> ---

Thanks for fixing downstream, and for working on GNU make.

>  Documentation/Makefile | 12 ++++++++++--
>  1 file changed, 10 insertions(+), 2 deletions(-)
>
> diff --git a/Documentation/Makefile b/Documentation/Makefile
> index d47acb2e25..21375cd3f2 100644
> --- a/Documentation/Makefile
> +++ b/Documentation/Makefile
> @@ -351,8 +351,16 @@ $(OBSOLETE_HTML): %.html : %.txto $(ASCIIDOC_DEPS)
>  manpage-base-url.xsl: manpage-base-url.xsl.in
>  	$(QUIET_GEN)sed "s|@@MAN_BASE_URL@@|$(MAN_BASE_URL)|" $< > $@
>  
> -%.1 %.5 %.7 : %.xml manpage-base-url.xsl $(wildcard manpage*.xsl)
> -	$(QUIET_XMLTO)$(XMLTO) -m $(MANPAGE_XSL) $(XMLTO_EXTRA) man $<
> +
> +manpage-prereqs := manpage-base-url.xsl $(wildcard manpage*.xsl)
> +manpage-cmd = $(QUIET_XMLTO)$(XMLTO) -m $(MANPAGE_XSL) $(XMLTO_EXTRA) man $<
> +
> +%.1 : %.xml $(manpage-prereqs)
> +	$(manpage-cmd)
> +%.5 : %.xml $(manpage-prereqs)
> +	$(manpage-cmd)
> +%.7 : %.xml $(manpage-prereqs)
> +	$(manpage-cmd)
>  
>  %.xml : %.txt $(ASCIIDOC_DEPS)
>  	$(QUIET_ASCIIDOC)$(TXT_TO_XML) -d manpage -o $@ $<

Whether we use eval/define or not (I just tried to avoid the repetition)
I think referring to $(DOC_MAN[157]) here probably makes more sense if
we're poking at these rules.

I.e. in this case the rest of the Makefile is carrying forward what
manpages we're generating exactly, so rather than a wildcard %.1 to
%.xml we can narrow it down to just the %.1 files we're going to b
generating (but maybe that's best left for later...):

diff --git a/Documentation/Makefile b/Documentation/Makefile
index 5e1a7f655c2..7404cead084 100644
--- a/Documentation/Makefile
+++ b/Documentation/Makefile
@@ -351,8 +351,12 @@ $(OBSOLETE_HTML): %.html : %.txto $(ASCIIDOC_DEPS)
 manpage-base-url.xsl: manpage-base-url.xsl.in
 	$(QUIET_GEN)sed "s|@@MAN_BASE_URL@@|$(MAN_BASE_URL)|" $< > $@
 
-%.1 %.5 %.7 : %.xml manpage-base-url.xsl $(wildcard manpage*.xsl)
-	$(QUIET_XMLTO)$(XMLTO) -m $(MANPAGE_XSL) $(XMLTO_EXTRA) man $<
+define doc-man-tmpl
+$$(DOC_MAN$(1)): %.$(1) : %.xml manpage-base-url.xsl $$(wildcard manpage*.xsl)
+	$$(QUIET_XMLTO)$$(XMLTO) -m $$(MANPAGE_XSL) $$(XMLTO_EXTRA) man $$<
+
+endef
+$(eval $(foreach n,1 5 7,$(call doc-man-tmpl,$(n))))
 
 %.xml : %.txt $(ASCIIDOC_DEPS)
 	$(QUIET_ASCIIDOC)$(TXT_TO_XML) -d manpage -o $@ $<

  reply	other threads:[~2022-11-28 13:16 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-27 22:42 [PATCH 0/1] Avoid multiple patterns when recipes generate one file Paul Smith
2022-11-27 22:42 ` [PATCH 1/1] " Paul Smith
2022-11-28 13:08   ` Ævar Arnfjörð Bjarmason [this message]
2022-11-28 18:33     ` Paul Smith
2022-11-28 18:57       ` Ævar Arnfjörð Bjarmason
2022-11-29 14:09 ` [PATCH v2 0/4] Makefiles: GNU make 4.4 fixes Ævar Arnfjörð Bjarmason
2022-11-29 14:09   ` [PATCH v2 1/4] Documentation/Makefile: de-duplicate *.[157] dependency list Ævar Arnfjörð Bjarmason
2022-11-30  4:17     ` Junio C Hamano
2022-11-29 14:09   ` [PATCH v2 2/4] Documentation/Makefile: avoid multiple patterns when generating one file Ævar Arnfjörð Bjarmason
2022-11-30  4:18     ` Junio C Hamano
2022-11-29 14:09   ` [PATCH v2 3/4] Makefiles: change search through $(MAKEFLAGS) for GNU make 4.4 Ævar Arnfjörð Bjarmason
2022-11-30  4:28     ` Junio C Hamano
2022-11-30  5:49       ` Paul Smith
2022-12-01 12:37         ` Ævar Arnfjörð Bjarmason
2022-11-29 14:09   ` [PATCH v2 4/4] Documentation/Makefile: narrow wildcard rules to our known files Ævar Arnfjörð Bjarmason
2022-11-30  1:27   ` [PATCH v2 0/4] Makefiles: GNU make 4.4 fixes Junio C Hamano
2022-11-30  8:23   ` [PATCH v3 0/1] " Ævar Arnfjörð Bjarmason
2022-11-30  8:23     ` [PATCH v3 1/1] Makefiles: change search through $(MAKEFLAGS) for GNU make 4.4 Ævar Arnfjörð Bjarmason
2022-11-30 16:29       ` Paul Smith
2022-11-30 22:23         ` Junio C Hamano
2022-12-06  7:48           ` Johannes Schindelin
2022-12-06  8:13             ` Ævar Arnfjörð Bjarmason
2022-12-06  9:13               ` Junio C Hamano

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: http://vger.kernel.org/majordomo-info.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=221128.86mt8bkyqt.gmgdl@evledraar.gmail.com \
    --to=avarab@gmail.com \
    --cc=alex.kanavin@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=psmith@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).