From 6aff0514dcfdbf5a31f613f2fc6d5f19b861001b Mon Sep 17 00:00:00 2001
From: Iustin Pop <iustin@google.com>
Date: Sun, 30 Dec 2012 16:06:08 +0100
Subject: [PATCH] Remove intermediate footer.man/footer.html files

I don't remember why I introduced these when switching to pandoc, but
they are not absolutely needed. Instead of pre-generating them (which
might save some trivial cpu time), we can simply pass footer.rst as an
additional input file to pandoc.

The advantage in doing so is that semantic information is preserved;
when pre-generating and including them as-is, the entire structure is
lost, as pandoc won't reinterpret them, so things like a potential
table of contents will simply ignore the footer.

The patch also adds a new target to rebuild all man pages (both groff
and html formats), for testing changes to the pages easier.

Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: Guido Trotter <ultrotter@google.com>
---
 .gitignore  |  1 -
 Makefile.am | 24 +++++++++---------------
 2 files changed, 9 insertions(+), 16 deletions(-)

diff --git a/.gitignore b/.gitignore
index 6b11af735..c4e0cb2be 100644
--- a/.gitignore
+++ b/.gitignore
@@ -85,7 +85,6 @@
 /man/*.html
 /man/*.in
 /man/*.gen
-/man/footer.man
 
 # test/hs
 /test/hs/hail
diff --git a/Makefile.am b/Makefile.am
index aa27d76c3..fd0bd99f9 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -883,7 +883,7 @@ mangen = $(patsubst %.rst,%.gen,$(manrst))
 maninput = \
 	$(patsubst %.1,%.1.in,$(patsubst %.7,%.7.in,$(patsubst %.8,%.8.in,$(man_MANS)))) \
 	$(patsubst %.html,%.html.in,$(manhtml)) \
-	man/footer.man man/footer.html $(mangen)
+	$(mangen)
 
 TEST_FILES = \
 	test/data/htools/clean-nonzero-score.data \
@@ -1196,16 +1196,6 @@ doc/%.png: doc/%.dot
 	@test -n "$(DOT)" || { echo 'dot' not found during configure; exit 1; }
 	$(DOT) -Tpng -o $@ $<
 
-man/footer.man: man/footer.rst
-	@test -n "$(PANDOC)" || \
-	  { echo 'pandoc' not found during configure; exit 1; }
-	$(PANDOC) -f rst -t man -o $@ $<
-
-man/footer.html: man/footer.rst
-	@test -n "$(PANDOC)" || \
-	  { echo 'pandoc' not found during configure; exit 1; }
-	$(PANDOC) -f rst -t html -o $@ $<
-
 man/%.gen: man/%.rst lib/query.py lib/build/sphinx_ext.py \
 	lib/build/shell_example_lexer.py \
 	| $(RUN_IN_TEMPDIR) $(BUILT_PYTHON_SOURCES)
@@ -1219,23 +1209,23 @@ man/%.gen: man/%.rst lib/query.py lib/build/sphinx_ext.py \
 	PYTHONPATH=. $(RUN_IN_TEMPDIR) $(CURDIR)/$(DOCPP) < $< > $@ ;\
 	trap - EXIT
 
-man/%.7.in man/%.8.in man/%.1.in: man/%.gen man/footer.man
+man/%.7.in man/%.8.in man/%.1.in: man/%.gen
 	@test -n "$(PANDOC)" || \
 	  { echo 'pandoc' not found during configure; exit 1; }
 	set -o pipefail ; \
 	trap 'echo auto-removing $@; rm $@' EXIT; \
-	$(PANDOC) -s -f rst -t man -A man/footer.man $< | \
+	$(PANDOC) -s -f rst -t man $< man/footer.rst | \
 	  sed -e 's/\\@/@/g' > $@; \
 	if test -n "$(MAN_HAS_WARNINGS)"; then $(CHECK_MAN_WARNINGS) $@; fi; \
 	$(CHECK_MAN_DASHES) $@; \
 	trap - EXIT
 
 
-man/%.html.in: man/%.gen man/footer.html
+man/%.html.in: man/%.gen
 	@test -n "$(PANDOC)" || \
 	  { echo 'pandoc' not found during configure; exit 1; }
 	set -o pipefail ; \
-	$(PANDOC) -s -f rst -t html -A man/footer.html $< | \
+	$(PANDOC) -s -f rst -t html $< man/footer.rst | \
 	  sed -e 's/\\@/@/g' > $@
 
 man/%: man/%.in  $(REPLACE_VARS_SED)
@@ -1825,6 +1815,10 @@ gitignore-check:
 	  exit 1; \
 	fi
 
+# target to rebuild all man pages (both groff and html output)
+.PHONY: man
+man: $(man_MANS) $(manhtml)
+
 # Target that builds all binaries (including those that are not
 # rebuilt except when running the tests)
 .PHONY: really-all
-- 
GitLab