Re: [PATCH v9 06/23] Makefile: generate doc versions via GIT-VERSION-GEN

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 25/11/24 06:56, Patrick Steinhardt wrote:
The documentation we generate embeds information for the exact Git
version used as well as the date of the commit. This information is
injected by injecting attributes into the build process via command line
argument.

Refactor the logic so that we write the information into "asciidoc.conf"
and "asciidoctor-extensions.rb" via `GIT-VERSION-GEN` for AsciiDoc and
AsciiDoctor, respectively.

Signed-off-by: Patrick Steinhardt <ps@xxxxxx>
---
  Documentation/.gitignore                            |  2 ++
  Documentation/Makefile                              | 21 ++++++++++++++-------
  Documentation/{asciidoc.conf => asciidoc.conf.in}   |  3 +++
  ...r-extensions.rb => asciidoctor-extensions.rb.in} |  8 ++------
  GIT-VERSION-GEN                                     |  2 ++
  5 files changed, 23 insertions(+), 13 deletions(-)

diff --git a/Documentation/.gitignore b/Documentation/.gitignore
index a48448de32f98b1a054b36e886ea920bccebc494..649df89474d357ccc91109b5c35fe2d0910f968a 100644
--- a/Documentation/.gitignore
+++ b/Documentation/.gitignore
@@ -15,3 +15,5 @@ tmp-doc-diff/
  GIT-ASCIIDOCFLAGS
  /.build/
  /GIT-EXCLUDED-PROGRAMS
+/asciidoc.conf
+/asciidoctor-extensions.rb
diff --git a/Documentation/Makefile b/Documentation/Makefile
index 0f55baa252fffbcd506f0c6f410b26b37f2e9b11..495c61c85ed18bc9c4643f9e5478e5146bb5f196 100644
--- a/Documentation/Makefile
+++ b/Documentation/Makefile
@@ -1,6 +1,8 @@
  # Import tree-wide shared Makefile behavior and libraries
  include ../shared.mak
+.PHONY: FORCE
+
  # Guard against environment variables
  MAN1_TXT =
  MAN5_TXT =
@@ -148,16 +150,12 @@ man5dir = $(mandir)/man5
  man7dir = $(mandir)/man7
  # DESTDIR =
-GIT_DATE := $(shell git show --quiet --pretty='%as')
-
  ASCIIDOC = asciidoc
  ASCIIDOC_EXTRA =
  ASCIIDOC_HTML = xhtml11
  ASCIIDOC_DOCBOOK = docbook
  ASCIIDOC_CONF = -f asciidoc.conf
-ASCIIDOC_COMMON = $(ASCIIDOC) $(ASCIIDOC_EXTRA) $(ASCIIDOC_CONF) \
-		-amanmanual='Git Manual' -amansource='Git $(GIT_VERSION)' \
-		-arevdate='$(GIT_DATE)'
+ASCIIDOC_COMMON = $(ASCIIDOC) $(ASCIIDOC_EXTRA) $(ASCIIDOC_CONF)
  ASCIIDOC_DEPS = asciidoc.conf GIT-ASCIIDOCFLAGS
  TXT_TO_HTML = $(ASCIIDOC_COMMON) -b $(ASCIIDOC_HTML)
  TXT_TO_XML = $(ASCIIDOC_COMMON) -b $(ASCIIDOC_DOCBOOK)
@@ -210,6 +208,14 @@ ASCIIDOC_DEPS = asciidoctor-extensions.rb GIT-ASCIIDOCFLAGS
  DBLATEX_COMMON =
  XMLTO_EXTRA += --skip-validation
  XMLTO_EXTRA += -x manpage.xsl
+
+asciidoctor-extensions.rb: asciidoctor-extensions.rb.in FORCE
+	$(QUIET_GEN)GIT_USER_AGENT="$(GIT_USER_AGENT)" $(SHELL_PATH) ../GIT-VERSION-GEN "$(shell pwd)/.." $< $@+
+	@if cmp $@+ $@ >/dev/null 2>&1; then $(RM) $@+; else mv $@+ $@; fi
+else
+asciidoc.conf: asciidoc.conf.in FORCE
+	$(QUIET_GEN)GIT_USER_AGENT="$(GIT_USER_AGENT)" $(SHELL_PATH) ../GIT-VERSION-GEN "$(shell pwd)/.." $< $@+
+	@if cmp $@+ $@ >/dev/null 2>&1; then $(RM) $@+; else mv $@+ $@; fi
  endif

Hi Patrick!

contrib/subtree/Makefile rely on asciidoc.conf or asciidoctor-extensions.rb to build, it would be nice if it could trigger the build of the appropriate file during its build.

--
Renato Botelho





[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux