master b0d799c0161 2/2: Don't build untranslated doc directories per language (bug#81332)
Eli Zaretskii <[email protected]> Sat, 18 Jul 2026 05:22:44 -0400 (EDT)
| Newsgroups | gmane.emacs.diffs |
|---|---|
| Message-ID | <[email protected]> |
branch: master commit b0d799c0161c64744c29853097aeb2578dfd6a08 Author: Boris Buliga <[email protected]> Commit: Eli Zaretskii <[email protected]> Don't build untranslated doc directories per language (bug#81332) With DOCLANGS='default fr', the top-level doc targets ran a sub-make in every doc directory once per language. The Makefiles of the directories without translations (emacs, lispintro, lispref) ignore DOCLANG, so the non-default sub-make repeated the default-language build, and under "make -j" two sub-makes produced the same outputs concurrently, failing intermittently with: cp: cannot create regular file '../../info/cons-2a.txt': File exists * Makefile.in (FILTER_DOCLANGS): New function: languages from DOCLANGS to build for a doc directory, the default language when present in DOCLANGS plus every language that has translations for this directory (doc/translations/<lang>/<dir>). Do not force the default language when DOCLANGS omits it. Suggested by Vincent Belaiche <[email protected]>. (MAKE_DOC): Take the list of languages as a second argument and use it instead of DOCLANGS. --- Makefile.in | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/Makefile.in b/Makefile.in index 4933c077788..534d8dca38f 100644 --- a/Makefile.in +++ b/Makefile.in @@ -1151,15 +1151,26 @@ $(1)-DOCLANG-$(2): $(1)-common $$(MAKE) -C doc/$$(subst -, DOCLANG=$(2) ,$(1)) endef +## Languages from DOCLANGS to build the manuals in doc/$(1) for: the +## default language (when in DOCLANGS), plus every other language in +## DOCLANGS that has translations for this directory +## (doc/translations/<lang>/$(1)). Directories without translations +## for a language must not run a sub-make for it: the doc Makefiles of +## untranslated directories ignore DOCLANG, so such a sub-make would +## just repeat the default-language build, and two sub-makes producing +## the same outputs race under "make -j" (e.g. "cp: cannot create +## regular file ...: File exists"). +FILTER_DOCLANGS = $(filter $(DOCLANGS),default) $(foreach lang,$(filter-out default,$(DOCLANGS)),$(if $(wildcard ${srcdir}/doc/translations/$(lang)/$(1)),$(lang))) +# $(1) = doc target (e.g. lispintro-info), $(2) = languages to build define MAKE_DOC # Define a target to which dependencies common to all of the doc files # in this directory may be assigned. $(1)-common: -$(1): $$(addprefix $(1)-DOCLANG-,$(DOCLANGS)) +$(1): $$(addprefix $(1)-DOCLANG-,$(2)) -$$(foreach lang,$(DOCLANGS),$$(eval $$(call MAKE_DOC_FOR_DOCLANG,$(1),$$(lang)))) +$$(foreach lang,$(2),$$(eval $$(call MAKE_DOC_FOR_DOCLANG,$(1),$$(lang)))) endef -$(foreach doc,$(DOCS),$(eval $(call MAKE_DOC,$(doc)))) +$(foreach doc,$(DOCS),$(eval $(call MAKE_DOC,$(doc),$(call FILTER_DOCLANGS,$(word 1,$(subst -, ,$(doc))))))) .PHONY: $(DOCS) docs pdf ps .PHONY: info dvi dist html info-dir check-info