From 03496e976dbb492c4f58db1a82ca6351ea937fc4 Mon Sep 17 00:00:00 2001 From: Robin Haberkorn Date: Tue, 18 Nov 2025 20:16:25 +0100 Subject: avoid GNU Make grouped targets and templates to build womanpages * grosciteco.tes generates two output files. First this was modeled with `%.woman %.woman.tec : ...`, but it creates independant rules which could result in superfluous builds and broke parallel builds. Then I tried grouped targets (`%.woman %.woman.tec &: ...`) which were supposed to solve the problem cleanly. However they turned out to be buggy with pattern rules, so I used templates instead. Unfortunately grouped targets turned out to be unreliable in general and that broke some older platforms, resulting in broken .woman.tec files. * The same can be achieved by declaring .woman files the main artifact and having an empty rule like `%.woman.tec : %.woman;`. If anything draws in .woman.tec, it will still execute the rule only once. --- doc/Makefile.am | 23 +++++++++-------------- 1 file changed, 9 insertions(+), 14 deletions(-) (limited to 'doc') diff --git a/doc/Makefile.am b/doc/Makefile.am index 9929099..8ac9fad 100644 --- a/doc/Makefile.am +++ b/doc/Makefile.am @@ -80,20 +80,15 @@ EXTRA_DIST += tutorial.ms.in CLEANFILES += $(women_DATA) -# Using pattern rules is bugged in some versions of GNU make in -# combination with grouped targets (&:). -define woman_man_rule -$(1).woman $(1).woman.tec &: $(1) sciteco.tmac grosciteco.tes - @GROFF@ @GROFF_FLAGS@ -wall -Z -Tutf8 -t -man -M@srcdir@ -msciteco $$< | \ - $(SCITECO_FULL) -im -- @srcdir@/grosciteco.tes $$@ -endef - -$(eval $(call woman_man_rule,grosciteco.tes.1)) -$(eval $(call woman_man_rule,tedoc.tes.1)) -$(eval $(call woman_man_rule,sciteco.1)) -$(eval $(call woman_man_rule,sciteco.7)) - -tutorial.woman tutorial.woman.tec &: tutorial.ms sciteco.tmac grosciteco.tes +# NOTE: grosciteco.tes generates two artifacts, but two targets in one rule would be independent. +# Grouped targets (&:) on the other hand are unreliable/buggy. +%.woman.tec : %.woman; + +%.woman : % sciteco.tmac grosciteco.tes + @GROFF@ @GROFF_FLAGS@ -wall -Z -Tutf8 -t -man -M@srcdir@ -msciteco $< | \ + $(SCITECO_FULL) -im -- @srcdir@/grosciteco.tes $@ + +tutorial.woman : tutorial.ms sciteco.tmac grosciteco.tes @GROFF@ @GROFF_FLAGS@ -wall -Z -Tutf8 -t -ms -M@srcdir@ -msciteco $< | \ $(SCITECO_FULL) -im -- @srcdir@/grosciteco.tes $@ -- cgit v1.2.3