contrib/subtree: fix building docs

In a38edab7c8 (Makefile: generate doc versions via GIT-VERSION-GEN, 2024-12-06), we have refactored how we build our documentation by injecting the Git version into the Asciidoc and AsciiDoctor config files instead of doing so via arguments. As such, the original config files were removed, where the expectation is that they get generated via `GIT-VERSION-GEN` now. Whie the git-subtree(1) command part of "contrib/" also builds docs using these same config files, its Makefile wasn't adjusted accordingly and thus building the docs is broken. Fix this by using `GIT-VERSION-GEN` to generate those files. Reported-by: Renato Botelho <garga@FreeBSD.org> Signed-off-by: Patrick Steinhardt <ps@pks.im> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Patrick Steinhardt committed Jan 17, 2025 at 10:56 UTC d4cd75f6bd592e733c3e5b1607aaed991e93902f
2 files changed +17 -8
contrib/subtree/.gitignore
+2
@@ -1,4 +1,6 @@
1 *~
2 +asciidoc.conf
3 +asciidoctor-extensions.rb
4 git-subtree
5 git-subtree.1
6 git-subtree.html
contrib/subtree/Makefile
+15 -8
@@ -1,6 +1,7 @@
1 # The default target of this Makefile is...
2 all::
3
4 +-include ../../shared.mak
5 -include ../../config.mak.autogen
6 -include ../../config.mak
7
@@ -13,17 +14,16 @@ htmldir ?= $(prefix)/share/doc/git-doc
14 ../../GIT-VERSION-FILE: FORCE
15 $(MAKE) -C ../../ GIT-VERSION-FILE
16
16 --include ../../GIT-VERSION-FILE
17 -
17 # this should be set to a 'standard' bsd-type install program
18 INSTALL ?= install
19 RM ?= rm -f
20
21 ASCIIDOC = asciidoc
23 -ASCIIDOC_CONF = -f ../../Documentation/asciidoc.conf
22 +ASCIIDOC_CONF = -f asciidoc.conf
23 ASCIIDOC_HTML = xhtml11
24 ASCIIDOC_DOCBOOK = docbook
25 ASCIIDOC_EXTRA =
26 +ASCIIDOC_DEPS = asciidoc.conf
27 XMLTO = xmlto
28 XMLTO_EXTRA =
29
@@ -32,8 +32,9 @@ ASCIIDOC = asciidoctor
32 ASCIIDOC_CONF =
33 ASCIIDOC_HTML = xhtml5
34 ASCIIDOC_DOCBOOK = docbook
35 -ASCIIDOC_EXTRA += -I../../Documentation -rasciidoctor-extensions
35 +ASCIIDOC_EXTRA += -I. -rasciidoctor-extensions
36 ASCIIDOC_EXTRA += -alitdd='&\#x2d;&\#x2d;'
37 +ASCIIDOC_DEPS = asciidoctor-extensions.rb
38 XMLTO_EXTRA += --skip-validation
39 endif
40
@@ -82,13 +83,13 @@ install-html: $(GIT_SUBTREE_HTML)
83 $(GIT_SUBTREE_DOC): $(GIT_SUBTREE_XML)
84 $(XMLTO) -m $(MANPAGE_XSL) $(XMLTO_EXTRA) man $^
85
85 -$(GIT_SUBTREE_XML): $(GIT_SUBTREE_TXT)
86 +$(GIT_SUBTREE_XML): $(GIT_SUBTREE_TXT) $(ASCIIDOC_DEPS)
87 $(ASCIIDOC) -b $(ASCIIDOC_DOCBOOK) -d manpage $(ASCIIDOC_CONF) \
87 - -agit_version=$(GIT_VERSION) $(ASCIIDOC_EXTRA) $^
88 + $(ASCIIDOC_EXTRA) $<
89
89 -$(GIT_SUBTREE_HTML): $(GIT_SUBTREE_TXT)
90 +$(GIT_SUBTREE_HTML): $(GIT_SUBTREE_TXT) $(ASCIIDOC_DEPS)
91 $(ASCIIDOC) -b $(ASCIIDOC_HTML) -d manpage $(ASCIIDOC_CONF) \
91 - -agit_version=$(GIT_VERSION) $(ASCIIDOC_EXTRA) $^
92 + $(ASCIIDOC_EXTRA) $<
93
94 $(GIT_SUBTREE_TEST): $(GIT_SUBTREE)
95 cp $< $@
@@ -98,6 +99,12 @@ test: $(GIT_SUBTREE_TEST)
99
100 clean:
101 $(RM) $(GIT_SUBTREE)
102 + $(RM) asciidoc.conf asciidoctor-extensions.rb
103 $(RM) *.xml *.html *.1
104
105 +asciidoc.conf: ../../Documentation/asciidoc.conf.in ../../GIT-VERSION-FILE
106 + $(QUIET_GEN)$(call version_gen,"$(shell pwd)/../..",$<,$@)
107 +asciidoctor-extensions.rb: ../../Documentation/asciidoctor-extensions.rb.in ../../GIT-VERSION-FILE
108 + $(QUIET_GEN)$(call version_gen,"$(shell pwd)/../..",$<,$@)
109 +
110 .PHONY: FORCE