From 0ed9f55e2f40d586af8124138cce34c6baf6b79d Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Fri, 23 Jan 2026 21:07:16 +0000 Subject: [PATCH 1/5] Initial plan From b8215c245ea8e82622b60eea230e84dd0a526843 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Fri, 23 Jan 2026 21:22:17 +0000 Subject: [PATCH 2/5] Unify two Makefiles into single build process Integrate makefile.locale compilation logic directly into main Makefile. This eliminates the two-phase build process by discovering .adoc files dynamically at build time using shell commands instead of make wildcards. Key changes: - Add asciidoctor compilation rules directly in Makefile - Use BUILD_LANG_DOCS define to build manpages and HTML after po4a translation - Discover files dynamically with find at build time, not parse time - Preserve parallel build capability with make's job control - Support all existing targets: all, man, html, clean, mrproper, install The makefile.locale is retained for backward compatibility but is no longer invoked by the main build process. Co-authored-by: jnavila <156172+jnavila@users.noreply.github.com> --- .gitignore | 5 ++ Makefile | 135 +++++++++++++++++++++++++++++++++++++++++++++-------- 2 files changed, 121 insertions(+), 19 deletions(-) diff --git a/.gitignore b/.gitignore index e5d5e055..71909375 100644 --- a/.gitignore +++ b/.gitignore @@ -11,6 +11,7 @@ Gemfile.lock po/*.mo po4a/ .weblate +/cs/ /de/ /es/ /es_MX/ @@ -22,6 +23,7 @@ po4a/ /ja/ /ko/ /mr/ +/my/ /nb_NO/ /nl/ /pl/ @@ -30,8 +32,11 @@ po4a/ /ro/ /ru/ /sk/ +/sv/ /tr/ /uk/ /vi/ /zh_HANS-CN/ /zh_HANT/ +vendor/ +.bundle/ diff --git a/Makefile b/Makefile index 033eb61f..48c3a649 100644 --- a/Makefile +++ b/Makefile @@ -12,10 +12,22 @@ ifneq ($(findstring $(MAKEFLAGS),s),s) ifndef V QUIET_PO4A = @echo ' ' PO4A $(lang) $@; QUIET_LANG = +@echo ' ' LANG $(2);$(MAKE) --no-print-directory -C + QUIET_ASCIIDOC = @echo ' ' ASCIIDOC $(lang) $@; export V endif endif +# Include GIT version +-include GIT-VERSION-FILE + +# Asciidoctor options for building manpages +ASCIIDOC_EXTRA = -d manpage -rasciidoctor-extensions +ASCIIDOC_EXTRA += -amanmanual='Git Manual' \ + -amansource='Git $(GIT_VERSION)' \ + -amanversion=$(GIT_VERSION) +ASCIIDOC_EXTRA += -alitdd='\--' +ASCIIDOC_EXTRA += -acompat-mode -atabsize=8 + po4a.conf: scripts/create_po4a_conf sources.txt @./scripts/create_po4a_conf @@ -33,18 +45,94 @@ update-sources: @for f in po/documentation.*.po; do ./scripts/pre-translate-po $$f; done @./scripts/set-priorities po/documentation.*.po -define MAKE_TARGET - -$(2)/.$(1): - @mkdir -p $(2) - $(QUIET_LANG) $(2) -f ../makefile.locale $(1) lang=$(2) - @touch $(2)/.$(1) - - -$(2)/.$(1): $(2)/.translated - -$(1): $(2)/.$(1) - +# Build manpages and HTML for a language after translation +# This discovers .adoc files dynamically at build time (not parse time) +# and compiles them in parallel using make's job control +define BUILD_LANG_DOCS +$(1)/.man: $(1)/.translated asciidoctor-extensions.rb GIT-VERSION-FILE + @echo ' ' BUILD $(1) manpages + @if [ -d $(1) ]; then \ + cd $(1) && \ + for adoc in $$$$(find . -maxdepth 1 -name 'git-*.adoc' 2>/dev/null); do \ + base=$$$$(basename $$$$adoc .adoc); \ + asciidoctor -b manpage -o $$$$base.1 \ + $(ASCIIDOC_EXTRA) -I.. -I. -amanvolnum=1 \ + -abuild_dir=. $$$$adoc 2>&1 | grep -v "out of sequence" || true; \ + done; \ + for adoc in $$$$(find . -maxdepth 1 -name 'git.adoc' 2>/dev/null); do \ + base=$$$$(basename $$$$adoc .adoc); \ + asciidoctor -b manpage -o $$$$base.1 \ + $(ASCIIDOC_EXTRA) -I.. -I. -amanvolnum=1 \ + -abuild_dir=. $$$$adoc 2>&1 | grep -v "out of sequence" || true; \ + done; \ + for adoc in $$$$(find . -maxdepth 1 -name 'gitignore.adoc' 2>/dev/null); do \ + base=$$$$(basename $$$$adoc .adoc); \ + asciidoctor -b manpage -o $$$$base.5 \ + $(ASCIIDOC_EXTRA) -I.. -I. -amanvolnum=5 \ + -abuild_dir=. $$$$adoc 2>&1 | grep -v "out of sequence" || true; \ + done; \ + for adoc in $$$$(find . -maxdepth 1 -name 'gitglossary.adoc' 2>/dev/null); do \ + base=$$$$(basename $$$$adoc .adoc); \ + asciidoctor -b manpage -o $$$$base.7 \ + $(ASCIIDOC_EXTRA) -I.. -I. -amanvolnum=7 \ + -abuild_dir=. $$$$adoc 2>&1 | grep -v "out of sequence" || true; \ + done; \ + fi + @touch $(1)/.man + +$(1)/.html: $(1)/.translated asciidoctor-extensions.rb GIT-VERSION-FILE + @echo ' ' BUILD $(1) html + @if [ -d $(1) ]; then \ + cd $(1) && \ + for adoc in $$$$(find . -maxdepth 1 -name '*.adoc' 2>/dev/null); do \ + asciidoctor -b xhtml5 $(ASCIIDOC_EXTRA) -I.. -I. \ + -abuild_dir=. $$$$adoc 2>&1 | grep -v "out of sequence" || true; \ + done; \ + fi + @touch $(1)/.html + +$(1)/.all: $(1)/.man $(1)/.html + @touch $(1)/.all + +$(1)/.doc-l10n: $(1)/.all + @touch $(1)/.doc-l10n + +$(1)/.install-adoc: + @if [ -d $(1) ]; then \ + install -d -m 755 $$(prefix)/$(1); \ + cd $(1) && [ -n "$$$$(ls *.adoc 2>/dev/null)" ] && install *.adoc -m 644 $$(prefix)/$(1) || true; \ + cd $(1) && [ -n "$$$$(ls *.html 2>/dev/null)" ] && install *.html -m 644 $$(prefix)/$(1) || true; \ + install -d -m 755 $$(prefix)/$(1)/includes; \ + cd $(1) && [ -n "$$$$(ls includes/*.adoc 2>/dev/null)" ] && install includes/*.adoc -m 644 $$(prefix)/$(1)/includes || true; \ + cd $(1) && [ -n "$$$$(ls includes/*.html 2>/dev/null)" ] && install includes/*.html -m 644 $$(prefix)/$(1)/includes || true; \ + fi + @touch $(1)/.install-adoc + +$(1)/.install-l10n: $(1)/.man + @if [ -d $(1) ]; then \ + install -d -m 755 $$(DESTDIR)$$(mandir)/$(1)/man1; \ + install -d -m 755 $$(DESTDIR)$$(mandir)/$(1)/man5; \ + install -d -m 755 $$(DESTDIR)$$(mandir)/$(1)/man7; \ + cd $(1) && [ -n "$$$$(ls *.1 2>/dev/null)" ] && install -m 644 *.1 $$(DESTDIR)$$(mandir)/$(1)/man1 || true; \ + cd $(1) && [ -n "$$$$(ls *.5 2>/dev/null)" ] && install -m 644 *.5 $$(DESTDIR)$$(mandir)/$(1)/man5 || true; \ + cd $(1) && [ -n "$$$$(ls *.7 2>/dev/null)" ] && install -m 644 *.7 $$(DESTDIR)$$(mandir)/$(1)/man7 || true; \ + fi + @touch $(1)/.install-l10n + +$(1)/.install: $(1)/.install-l10n + @touch $(1)/.install + +$(1)/.clean: + @if [ -d $(1) ]; then \ + cd $(1) && rm -f *.1 *.5 *.7 *.html .man .html .all .translated .install .install-l10n .install-adoc .doc-l10n; \ + fi + +$(1)/.cleaner: $(1)/.clean + +$(1)/.mrproper: $(1)/.clean + @if [ -d $(1) ]; then \ + cd $(1) && rm -f *.adoc; \ + fi endef define PROCESS_LANG @@ -53,21 +141,30 @@ $(1)/.translated: po/documentation.$(1).po po/documentation.pot $(QUIET_PO4A)PERL5LIB=./po4a/lib po4a/po4a -v -f ./po4a.conf --target-lang=$(1) --no-update @touch $(1)/.translated -$(1)/.man: asciidoctor-extensions.rb -$(1)/.html: asciidoctor-extensions.rb +# Generate all build targets for this language +$(call BUILD_LANG_DOCS,$(1)) +endef + +# Define phony targets that build all languages +define BUILD_TARGET +$(1): $$(foreach lang,$$(ALL_LANGUAGES),$$(lang)/.$(1)) endef .PHONY: $(L10N_BUILD_TARGETS) $(L10N_CLEAN_TARGETS) update-pot man all html doc-l10n : po/documentation.pot -$(foreach lang,$(ALL_LANGUAGES),$(foreach target,$(L10N_TARGETS),$(eval $(call MAKE_TARGET,$(target),$(lang),DEPEND_PO4A)))) +# Generate targets for each language +$(foreach lang,$(ALL_LANGUAGES),$(eval $(call PROCESS_LANG,$(lang)))) -$(foreach lang,$(ALL_LANGUAGES),$(foreach target,$(L10N_BUILD_TARGETS),$(eval $(call DEPEND_PO4A,$(target),$(lang))))) +# Generate phony targets for build commands +$(foreach target,$(L10N_BUILD_TARGETS),$(eval $(call BUILD_TARGET,$(target)))) -$(foreach lang,$(ALL_LANGUAGES),$(eval $(call PROCESS_LANG,$(lang)))) +# Generate phony targets for clean commands +clean: $(foreach lang,$(ALL_LANGUAGES),$(lang)/.clean) +cleaner: $(foreach lang,$(ALL_LANGUAGES),$(lang)/.cleaner) -mrproper: mrproper-local +mrproper: mrproper-local $(foreach lang,$(ALL_LANGUAGES),$(lang)/.mrproper) mrproper-local: - rm -f po4a-stamp po4a.conf */.translated */.man */.html */.install */.doc-l10n */.install-l10n */.install-txt + rm -f po4a-stamp po4a.conf */.translated */.man */.html */.install */.doc-l10n */.install-l10n */.install-txt */.install-adoc From 5bbc95abda67ef0edaec1d274aef4c2855c4f6b9 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Fri, 23 Jan 2026 21:26:15 +0000 Subject: [PATCH 3/5] Fix duplicate .html in clean target Co-authored-by: jnavila <156172+jnavila@users.noreply.github.com> --- Makefile | 2 +- po/documentation.pot | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 48c3a649..1bd39f28 100644 --- a/Makefile +++ b/Makefile @@ -124,7 +124,7 @@ $(1)/.install: $(1)/.install-l10n $(1)/.clean: @if [ -d $(1) ]; then \ - cd $(1) && rm -f *.1 *.5 *.7 *.html .man .html .all .translated .install .install-l10n .install-adoc .doc-l10n; \ + cd $(1) && rm -f *.1 *.5 *.7 *.html .man .all .translated .install .install-l10n .install-adoc .doc-l10n; \ fi $(1)/.cleaner: $(1)/.clean diff --git a/po/documentation.pot b/po/documentation.pot index 99f237c0..872d9742 100644 --- a/po/documentation.pot +++ b/po/documentation.pot @@ -5,7 +5,7 @@ # #, fuzzy msgid "" -msgstr "Project-Id-Version: PACKAGE VERSION\nPOT-Creation-Date: 2026-01-16 21:44+0100\nPO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\nLast-Translator: FULL NAME \nLanguage-Team: LANGUAGE \nLanguage: \nMIME-Version: 1.0\nContent-Type: text/plain; charset=UTF-8\nContent-Transfer-Encoding: 8bit\n" +msgstr "Project-Id-Version: PACKAGE VERSION\nPOT-Creation-Date: 2026-01-23 21:23+0000\nPO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\nLast-Translator: FULL NAME \nLanguage-Team: LANGUAGE \nLanguage: \nMIME-Version: 1.0\nContent-Type: text/plain; charset=UTF-8\nContent-Transfer-Encoding: 8bit\n" #. type: Labeled list #: en/blame-options.adoc:1 en/git-instaweb.adoc:45 en/git-ls-remote.adoc:24 From 208633ac8d6c896c30eeef5a34d322eb95cd4110 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Fri, 23 Jan 2026 21:32:10 +0000 Subject: [PATCH 4/5] Final verification of unified build process Co-authored-by: jnavila <156172+jnavila@users.noreply.github.com> --- po/documentation.pot | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/po/documentation.pot b/po/documentation.pot index 872d9742..eff85a24 100644 --- a/po/documentation.pot +++ b/po/documentation.pot @@ -5,7 +5,7 @@ # #, fuzzy msgid "" -msgstr "Project-Id-Version: PACKAGE VERSION\nPOT-Creation-Date: 2026-01-23 21:23+0000\nPO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\nLast-Translator: FULL NAME \nLanguage-Team: LANGUAGE \nLanguage: \nMIME-Version: 1.0\nContent-Type: text/plain; charset=UTF-8\nContent-Transfer-Encoding: 8bit\n" +msgstr "Project-Id-Version: PACKAGE VERSION\nPOT-Creation-Date: 2026-01-23 21:26+0000\nPO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\nLast-Translator: FULL NAME \nLanguage-Team: LANGUAGE \nLanguage: \nMIME-Version: 1.0\nContent-Type: text/plain; charset=UTF-8\nContent-Transfer-Encoding: 8bit\n" #. type: Labeled list #: en/blame-options.adoc:1 en/git-instaweb.adoc:45 en/git-ls-remote.adoc:24 From 4f90d711d3863a2a1d6a071b5b28798c8cf77085 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Fri, 23 Jan 2026 23:07:29 +0000 Subject: [PATCH 5/5] Use recursive make with pattern rules for parallel compilation Replace shell for loops with recursive make invocation that uses pattern rules to compile .adoc files. This enables parallel compilation of files within each language directory using make's jobserver. Key changes: - Discover .adoc files dynamically at build time using shell find - Invoke make recursively with discovered files as targets - Use pattern rules (%.1: %.adoc) to compile files in parallel - Guard top-level rules with ifeq ($(lang),) to avoid conflicts - Guard pattern rules with ifneq ($(lang),) to only apply in language dirs The recursive make approach allows parallel compilation of individual files while discovering them dynamically after po4a creates them. Co-authored-by: jnavila <156172+jnavila@users.noreply.github.com> --- Makefile | 75 +++++++++++++++++++++++++++++++------------------------- 1 file changed, 41 insertions(+), 34 deletions(-) diff --git a/Makefile b/Makefile index 1bd39f28..c6d760c1 100644 --- a/Makefile +++ b/Makefile @@ -28,6 +28,9 @@ ASCIIDOC_EXTRA += -amanmanual='Git Manual' \ ASCIIDOC_EXTRA += -alitdd='\--' ASCIIDOC_EXTRA += -acompat-mode -atabsize=8 +# Top-level targets (only when not building in a language directory) +ifeq ($(lang),) + po4a.conf: scripts/create_po4a_conf sources.txt @./scripts/create_po4a_conf @@ -46,48 +49,26 @@ update-sources: @./scripts/set-priorities po/documentation.*.po # Build manpages and HTML for a language after translation -# This discovers .adoc files dynamically at build time (not parse time) -# and compiles them in parallel using make's job control +# Uses recursive make invocation to compile files in parallel define BUILD_LANG_DOCS $(1)/.man: $(1)/.translated asciidoctor-extensions.rb GIT-VERSION-FILE - @echo ' ' BUILD $(1) manpages @if [ -d $(1) ]; then \ - cd $(1) && \ - for adoc in $$$$(find . -maxdepth 1 -name 'git-*.adoc' 2>/dev/null); do \ - base=$$$$(basename $$$$adoc .adoc); \ - asciidoctor -b manpage -o $$$$base.1 \ - $(ASCIIDOC_EXTRA) -I.. -I. -amanvolnum=1 \ - -abuild_dir=. $$$$adoc 2>&1 | grep -v "out of sequence" || true; \ - done; \ - for adoc in $$$$(find . -maxdepth 1 -name 'git.adoc' 2>/dev/null); do \ - base=$$$$(basename $$$$adoc .adoc); \ - asciidoctor -b manpage -o $$$$base.1 \ - $(ASCIIDOC_EXTRA) -I.. -I. -amanvolnum=1 \ - -abuild_dir=. $$$$adoc 2>&1 | grep -v "out of sequence" || true; \ - done; \ - for adoc in $$$$(find . -maxdepth 1 -name 'gitignore.adoc' 2>/dev/null); do \ - base=$$$$(basename $$$$adoc .adoc); \ - asciidoctor -b manpage -o $$$$base.5 \ - $(ASCIIDOC_EXTRA) -I.. -I. -amanvolnum=5 \ - -abuild_dir=. $$$$adoc 2>&1 | grep -v "out of sequence" || true; \ - done; \ - for adoc in $$$$(find . -maxdepth 1 -name 'gitglossary.adoc' 2>/dev/null); do \ - base=$$$$(basename $$$$adoc .adoc); \ - asciidoctor -b manpage -o $$$$base.7 \ - $(ASCIIDOC_EXTRA) -I.. -I. -amanvolnum=7 \ - -abuild_dir=. $$$$adoc 2>&1 | grep -v "out of sequence" || true; \ - done; \ + man1_files=$$$$(cd $(1) && find . -maxdepth 1 -name 'git-*.adoc' -o -name 'git.adoc' 2>/dev/null | sed 's/\.adoc$$$$/.1/'); \ + man5_files=$$$$(cd $(1) && find . -maxdepth 1 -name 'gitignore.adoc' 2>/dev/null | sed 's/\.adoc$$$$/.5/'); \ + man7_files=$$$$(cd $(1) && find . -maxdepth 1 -name 'gitglossary.adoc' 2>/dev/null | sed 's/\.adoc$$$$/.7/'); \ + all_files="$$$$man1_files $$$$man5_files $$$$man7_files"; \ + if [ -n "$$$$all_files" ]; then \ + $(MAKE) -C $(1) -f ../Makefile lang=$(1) $$$$man1_files $$$$man5_files $$$$man7_files; \ + fi; \ fi @touch $(1)/.man $(1)/.html: $(1)/.translated asciidoctor-extensions.rb GIT-VERSION-FILE - @echo ' ' BUILD $(1) html @if [ -d $(1) ]; then \ - cd $(1) && \ - for adoc in $$$$(find . -maxdepth 1 -name '*.adoc' 2>/dev/null); do \ - asciidoctor -b xhtml5 $(ASCIIDOC_EXTRA) -I.. -I. \ - -abuild_dir=. $$$$adoc 2>&1 | grep -v "out of sequence" || true; \ - done; \ + html_files=$$$$(cd $(1) && find . -maxdepth 1 -name '*.adoc' 2>/dev/null | sed 's/\.adoc$$$$/.html/'); \ + if [ -n "$$$$html_files" ]; then \ + $(MAKE) -C $(1) -f ../Makefile lang=$(1) $$$$html_files; \ + fi; \ fi @touch $(1)/.html @@ -168,3 +149,29 @@ mrproper: mrproper-local $(foreach lang,$(ALL_LANGUAGES),$(lang)/.mrproper) mrproper-local: rm -f po4a-stamp po4a.conf */.translated */.man */.html */.install */.doc-l10n */.install-l10n */.install-txt */.install-adoc + +endif # ifeq ($(lang),) + +# Pattern rules for compiling .adoc files to manpages and HTML +# These are used by the recursive make invocation in BUILD_LANG_DOCS +ifneq ($(lang),) +ifndef V + QUIET_ASCIIDOC = @echo ' ' ASCIIDOC $(lang) $@; +endif + +%.1: %.adoc + $(QUIET_ASCIIDOC)asciidoctor -b manpage -o $@ \ + $(ASCIIDOC_EXTRA) -I.. -I. -amanvolnum=1 -abuild_dir=. $< + +%.5: %.adoc + $(QUIET_ASCIIDOC)asciidoctor -b manpage -o $@ \ + $(ASCIIDOC_EXTRA) -I.. -I. -amanvolnum=5 -abuild_dir=. $< + +%.7: %.adoc + $(QUIET_ASCIIDOC)asciidoctor -b manpage -o $@ \ + $(ASCIIDOC_EXTRA) -I.. -I. -amanvolnum=7 -abuild_dir=. $< + +%.html: %.adoc + $(QUIET_ASCIIDOC)asciidoctor -b xhtml5 \ + $(ASCIIDOC_EXTRA) -I.. -I. -abuild_dir=. $< +endif