Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .gitignore

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The changes to this file is not related to the main PR.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reverted the .gitignore changes in commit 4f90d71.

Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ Gemfile.lock
po/*.mo
po4a/
.weblate
/cs/
/de/
/es/
/es_MX/
Expand All @@ -22,6 +23,7 @@ po4a/
/ja/
/ko/
/mr/
/my/
/nb_NO/
/nl/
/pl/
Expand All @@ -30,8 +32,11 @@ po4a/
/ro/
/ru/
/sk/
/sv/
/tr/
/uk/
/vi/
/zh_HANS-CN/
/zh_HANT/
vendor/
.bundle/
142 changes: 123 additions & 19 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,25 @@ 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

# 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

Expand All @@ -33,18 +48,72 @@ 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
# Uses recursive make invocation to compile files in parallel
define BUILD_LANG_DOCS
$(1)/.man: $(1)/.translated asciidoctor-extensions.rb GIT-VERSION-FILE
@if [ -d $(1) ]; then \
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
@if [ -d $(1) ]; then \
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

$(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 .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
Expand All @@ -53,21 +122,56 @@ $(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

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
2 changes: 1 addition & 1 deletion po/documentation.pot
Original file line number Diff line number Diff line change
Expand Up @@ -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 <EMAIL@ADDRESS>\nLanguage-Team: LANGUAGE <LL@li.org>\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 <EMAIL@ADDRESS>\nLanguage-Team: LANGUAGE <LL@li.org>\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
Expand Down