Skip to contentSkip to conversation

libtracecmd: Rewrite Makefile for Documentation directory

PATCH Superseded Steven Rostedt 1 participant 1 message Mar 25, 2021 Documentation

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 libtracecmd: Rewrite Makefile for Documentation directory

From: "Steven Rostedt (VMware)" <[email protected]>

The installation for libtracecmd documents was not working properly. The libtracefs Documentation Makefile was copied over and modified for libtracecmd. It was also updated to show each file being installed, and the dependencies were fixed to not recreate the man pages every time it was built.

---
 Documentation/libtracecmd/.gitignore          |   2 +
 Documentation/libtracecmd/Makefile            | 198 ++++++++++++++++--
 Documentation/libtracecmd/asciidoc.conf       | 120 +++++++++++
 ...ecmd-files.3.txt => libtracecmd-files.txt} |   0
 ...tances.3.txt => libtracecmd-instances.txt} |   0
 ...acecmd-peer.3.txt => libtracecmd-peer.txt} |   0
 ...md-record.3.txt => libtracecmd-record.txt} |   0
 .../{libtracecmd.3.txt => libtracecmd.txt}    |   0
 Documentation/libtracecmd/manpage-1.72.xsl    |  14 ++
 Documentation/libtracecmd/manpage-base.xsl    |  35 ++++
 .../libtracecmd/manpage-bold-literal.xsl      |  17 ++
 Documentation/libtracecmd/manpage-normal.xsl  |  13 ++
 .../libtracecmd/manpage-suppress-sp.xsl       |  21 ++
 13 files changed, 402 insertions(+), 18 deletions(-)
 create mode 100644 Documentation/libtracecmd/.gitignore
 create mode 100644 Documentation/libtracecmd/asciidoc.conf
 rename Documentation/libtracecmd/{libtracecmd-files.3.txt =>

libtracecmd-files.txt} (100%) rename Documentation/libtracecmd/{libtracecmd-instances.3.txt => libtracecmd-instances.txt} (100%) rename Documentation/libtracecmd/{libtracecmd-peer.3.txt => libtracecmd-peer.txt} (100%) rename Documentation/libtracecmd/{libtracecmd-record.3.txt => libtracecmd-record.txt} (100%) rename Documentation/libtracecmd/{libtracecmd.3.txt => libtracecmd.txt} (100%) create mode 100644 Documentation/libtracecmd/manpage-1.72.xsl create mode 100644 Documentation/libtracecmd/manpage-base.xsl create mode 100644 Documentation/libtracecmd/manpage-bold-literal.xsl create mode 100644 Documentation/libtracecmd/manpage-normal.xsl create mode 100644 Documentation/libtracecmd/manpage-suppress-sp.xsl

(quoted diff) +0 -0

b/Documentation/libtracecmd/.gitignore new file mode 100644 index 00000000..89b40e42

Documentation/libtracecmd/.gitignore new file +2 -0
@@ -0,0 +1,2 @@
+*.m
+*.html
(quoted diff) +0 -0

b/Documentation/libtracecmd/Makefile index 196cac7c..840f8851 100644

Documentation/libtracecmd/Makefile +33 -11

53 lines not on this page · raw message

Manual" +ASCIIDOC_HTML = xhtml5
+endif

-$(MAN3_INSTALL): %.3.install : %.3 force
- $(Q)$(call do_install_docs,$<,$(man_dir_SQ)/man3)
+ASCIIDOC_INSTALLED := $(shell command -v $(ASCIIDOC) 2> /dev/null) +ifndef ASCIIDOC_INSTALLED
+ missing_tools += $(ASCIIDOC)
+endif

-install: $(MAN3_INSTALL)
+XMLTO=xmlto
+XMLTO_INSTALLED := $(shell command -v $(XMLTO) 2> /dev/null) +ifndef XMLTO_INSTALLED
+ missing_tools += $(XMLTO)
+endif
+
+#
+# For asciidoc ...
+# -7.1.2, no extra settings are needed.
+# 8.0-, set ASCIIDOC8.
+#
+
+#
+# For docbook-xsl ...
+# -1.68.1, set ASCIIDOC_NO_ROFF? (based on changelog from
1.73.0) +# 1.69.0, no extra settings are needed?
+# 1.69.1-1.71.0, set DOCBOOK_SUPPRESS_SP?
+# 1.71.1, no extra settings are needed?
+# 1.72.0, set DOCBOOK_XSL_172.
+# 1.73.0-, set ASCIIDOC_NO_ROFF
+#
+
+#
+# If you had been using DOCBOOK_XSL_172 in an attempt to get rid +# of 'the ".ft C" problem' in your generated manpages, and you +# instead ended up with weird characters around callouts, try +# using ASCIIDOC_NO_ROFF instead (it works fine with ASCIIDOC8). +#
+
+ifdef ASCIIDOC8
+ASCIIDOC_EXTRA += -a asciidoc7compatible
+endif
+ifdef DOCBOOK_XSL_172
+ASCIIDOC_EXTRA += -a libtracecmd-asciidoc-no-roff +MANPAGE_XSL = manpage-1.72.xsl
+else
+ ifdef ASCIIDOC_NO_ROFF
+ # docbook-xsl after 1.72 needs the regular XSL, but will not
+ # pass-thru raw roff codes from asciidoc.conf, so turn them off.
+ ASCIIDOC_EXTRA += -a libtracecmd-asciidoc-no-roff
+ endif
+endif
+ifdef MAN_BOLD_LITERAL
+XMLTO_EXTRA += -m manpage-bold-literal.xsl
+endif
+ifdef DOCBOOK_SUPPRESS_SP
+XMLTO_EXTRA += -m manpage-suppress-sp.xsl
+endif
+
+ifneq ($(findstring $(MAKEFLAGS),w),w)
+PRINT_DIR = --no-print-directory
+else # "make -w"
+NO_SUBDIR = :
+endif
+
+ifneq ($(findstring $(MAKEFLAGS),s),s)
+ifneq ($(V),1)
+ QUIET_ASCIIDOC = @echo ' ASCIIDOC '$@;
+ QUIET_XMLTO = @echo ' XMLTO '$@;
+ QUIET_SUBDIR0 = +@subdir=
+ QUIET_SUBDIR1 = ;$(NO_SUBDIR) \
+ echo ' SUBDIR ' $$subdir; \
+ $(MAKE) $(PRINT_DIR) -C $$subdir
+ export V
+endif
+endif
+
+all: check-man-tools html man
+
+man: man3
+man3: $(DOC_MAN3)
+
+html: $(MAN_HTML)
+
+$(MAN_HTML) $(DOC_MAN3): asciidoc.conf
+
+install: check-man-tools install-man install-html
+
+check-man-tools:
+ifdef missing_tools
+ $(error "You need to install $(missing_tools) for man pages")
+endif
+
+install-%.3: $(OUTPUT)%.3
+ $(Q)$(call do_install_docs,$<,$(man3dir),644);
+
+do-install-man: man $(addprefix install-,$(wildcard $(OUTPUT)*.3)) +
+install-man: man
+ $(Q)$(MAKE) -C . do-install-man
+
+install-%.txt: $(OUTPUT)%.html
+ $(Q)$(call do_install_docs,$<,$(htmldir),644);
+
+do-install-html: html $(addprefix install-,$(wildcard *.txt)) +
+install-html: html do-install-html
+
+uninstall: uninstall-man uninstall-html
+
+uninstall-man:
+ $(Q)$(RM) $(addprefix $(DESTDIR)$(man3dir)/,$(DOC_MAN3))
+
+uninstall-html:
+ $(Q)$(RM) $(addprefix $(DESTDIR)$(htmldir)/,$(MAN_HTML))
+
+ifdef missing_tools
+ DO_INSTALL_MAN = $(warning Please install $(missing_tools) to have the man pages installed) +else
+ DO_INSTALL_MAN = do-install-man
+endif
+
+CLEAN_FILES = \
+ $(MAN_XML) $(addsuffix +,$(MAN_XML)) \
+ $(MAN_HTML) $(addsuffix +,$(MAN_HTML)) \
+ $(DOC_MAN3) *.3 *.m

clean:
- $(Q)(cd $(bdir); \
- $(RM) *.xml *.xsl *.3)
+ $(Q) $(RM) $(CLEAN_FILES)
+
+ifdef USE_ASCIIDOCTOR
+$(OUTPUT)%.m : $(OUTPUT)%.txt
+ $(QUIET_ASCIIDOC)$(RM) $@+ $@ && \
+ $(ASCIIDOC) -b manpage -d manpage \
+ $(ASCIIDOC_EXTRA) -alibtracecmd_version=$(TRACEFS_VERSION)
-o $@+ $< && \
+ mv $@+ $@
+endif
+
+$(OUTPUT)%.m : $(OUTPUT)%.xml
+ $(QUIET_XMLTO)$(RM) $@ && \
+ $(XMLTO) -o $(OUTPUT). -m $(MANPAGE_XSL) $(XMLTO_EXTRA) man $<; \
+ touch $@
+
+$(OUTPUT)%.xml : %.txt
+ $(QUIET_ASCIIDOC)$(RM) $@+ $@ && \
+ $(ASCIIDOC) -b docbook -d manpage \
+ $(ASCIIDOC_EXTRA) -alibtracecmd_version=$(TRACEFS_VERSION)
-o $@+ $< && \
+ mv $@+ $@

-.PHONE: force
-force:
+$(MAN_HTML): $(OUTPUT)%.html : %.txt
+ $(QUIET_ASCIIDOC)$(RM) $@+ $@ && \
+ $(ASCIIDOC) -b $(ASCIIDOC_HTML) -d manpage \
+ $(ASCIIDOC_EXTRA) -alibtracecmd_version=$(TRACEFS_VERSION)
-o $@+ $< && \
+ mv $@+ $@

(quoted diff) +0 -0

b/Documentation/libtracecmd/asciidoc.conf new file mode 100644 index 00000000..c15aa13b

Documentation/libtracecmd/asciidoc.conf new file +7 -0
@@ -0,0 +1,120 @@
+## linktep: macro
+#
+# Usage: linktep:command[manpage-section]
+#
+# Note, {0} is the manpage section, while {target} is the command.
+#
+# Show TEP link as: <command>(<section>); if section is defined, else just

show +# the command.
+
+[macros] +(?su)[\\]?(?P<name>linktep):(?P<target>\S*?)\[(?P<attrlist>.*?)\]= +
+[attributes]
+asterisk=&#42;
+plus=&#43;
+caret=&#94;
+startsb=&#91;
+endsb=&#93;
+tilde=&#126;
+
+ifdef::backend-docbook[]
+[linktep-inlinemacro]
+{0%{target}}
+{0#<citerefentry>} +{0#<refentrytitle>{target}</refentrytitle><manvolnum>{0}</manvolnum>} +{0#</citerefentry>}
+endif::backend-docbook[]
+
+ifdef::backend-docbook[]
+ifndef::tep-asciidoc-no-roff[]
+# "unbreak" docbook-xsl v1.68 for manpages. v1.69 works with or without this. +# v1.72 breaks with this because it replaces dots not in roff requests. +[listingblock]
+<example><title>{title}</title>
+<literallayout>
+ifdef::doctype-manpage[]
+&#10;.ft C&#10;
+endif::doctype-manpage[]
+|
+ifdef::doctype-manpage[]
+&#10;.ft&#10;
+endif::doctype-manpage[]
+</literallayout>
+{title#}</example>
+endif::tep-asciidoc-no-roff[]
+
+ifdef::tep-asciidoc-no-roff[]
+ifdef::doctype-manpage[]
+# The following two small workarounds insert a simple paragraph after screen +[listingblock]
+<example><title>{title}</title>
+<literallayout>
+|
+</literallayout><simpara></simpara>
+{title#}</example>
+
+[verseblock]
+<formalpara{id? id="{id}"}><title>{title}</title><para> +{title%}<literallayout{id? id="{id}"}> +{title#}<literallayout>
+|
+</literallayout>
+{title#}</para></formalpara>
+{title%}<simpara></simpara>
+endif::doctype-manpage[]
+endif::tep-asciidoc-no-roff[]
+endif::backend-docbook[]
+
+ifdef::doctype-manpage[]
+ifdef::backend-docbook[]
+[header]
+template::[header-declarations]
+<refentry>
+<refmeta>
+<refentrytitle>{mantitle}</refentrytitle> +<manvolnum>{manvolnum}</manvolnum>
+<refmiscinfo class="source">libtracefs</refmiscinfo> +<refmiscinfo class="version">{libtracefs_version}</refmiscinfo> +<refmiscinfo class="manual">libtracefs Manual</refmiscinfo> +</refmeta>
+<refnamediv>

+  <refname>{manname1}</refname>
+  <refname>{manname2}</refname>
+  <refname>{manname3}</refname>
+  <refname>{manname4}</refname>
+  <refname>{manname5}</refname>
+  <refname>{manname6}</refname>
+  <refname>{manname7}</refname>
+  <refname>{manname8}</refname>
+  <refname>{manname9}</refname>
+  <refname>{manname10}</refname>
+  <refname>{manname11}</refname>
+  <refname>{manname12}</refname>
+  <refname>{manname13}</refname>
+  <refname>{manname14}</refname>
+  <refname>{manname15}</refname>
+  <refname>{manname16}</refname>
+  <refname>{manname17}</refname>
+  <refname>{manname18}</refname>
+  <refname>{manname19}</refname>
+  <refname>{manname20}</refname>
+  <refname>{manname21}</refname>
+  <refname>{manname22}</refname>
+  <refname>{manname23}</refname>
+  <refname>{manname24}</refname>
+  <refname>{manname25}</refname>
+  <refname>{manname26}</refname>
+  <refname>{manname27}</refname>
+  <refname>{manname28}</refname>
+  <refname>{manname29}</refname>
+  <refname>{manname30}</refname>
+  <refpurpose>{manpurpose}</refpurpose>

+</refnamediv>
+endif::backend-docbook[]
+endif::doctype-manpage[]
+
+ifdef::backend-xhtml11[]
+[linktep-inlinemacro]
+<a href="{target}.html">{target}{0?({0})}</a>
+endif::backend-xhtml11[]

(quoted diff) +0 -0

b/Documentation/libtracecmd/libtracecmd-files.txt similarity index 100% rename from Documentation/libtracecmd/libtracecmd-files.3.txt rename to Documentation/libtracecmd/libtracecmd-files.txt

(quoted diff) +0 -0

b/Documentation/libtracecmd/libtracecmd-instances.txt similarity index 100% rename from Documentation/libtracecmd/libtracecmd-instances.3.txt rename to Documentation/libtracecmd/libtracecmd-instances.txt

(quoted diff) +0 -0

b/Documentation/libtracecmd/libtracecmd-peer.txt similarity index 100% rename from Documentation/libtracecmd/libtracecmd-peer.3.txt rename to Documentation/libtracecmd/libtracecmd-peer.txt

(quoted diff) +0 -0

b/Documentation/libtracecmd/libtracecmd-record.txt similarity index 100% rename from Documentation/libtracecmd/libtracecmd-record.3.txt rename to Documentation/libtracecmd/libtracecmd-record.txt

(quoted diff) +0 -0

b/Documentation/libtracecmd/libtracecmd.txt similarity index 100% rename from Documentation/libtracecmd/libtracecmd.3.txt rename to Documentation/libtracecmd/libtracecmd.txt

(quoted diff) +0 -0

b/Documentation/libtracecmd/manpage-1.72.xsl new file mode 100644 index 00000000..b4d315cb

Documentation/libtracecmd/manpage-1.72.xsl new file +14 -0
@@ -0,0 +1,14 @@
+<!-- manpage-1.72.xsl:
+     special settings for manpages rendered from asciidoc+docbook
+     handles peculiarities in docbook-xsl 1.72.0 -->
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+		version="1.0">
+
+<xsl:import href="manpage-base.xsl"/>
+
+<!-- these are the special values for the roff control characters
+     needed for docbook-xsl 1.72.0 -->
+<xsl:param name="git.docbook.backslash">&#x2593;</xsl:param>
+<xsl:param name="git.docbook.dot"      >&#x2302;</xsl:param>
+
+</xsl:stylesheet>
(quoted diff) +0 -0

b/Documentation/libtracecmd/manpage-base.xsl new file mode 100644 index 00000000..a264fa61

Documentation/libtracecmd/manpage-base.xsl new file +35 -0
@@ -0,0 +1,35 @@
+<!-- manpage-base.xsl:
+     special formatting for manpages rendered from asciidoc+docbook -->
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+		version="1.0">
+
+<!-- these params silence some output from xmlto -->
+<xsl:param name="man.output.quietly" select="1"/>
+<xsl:param name="refentry.meta.get.quietly" select="1"/>
+
+<!-- convert asciidoc callouts to man page format;
+     git.docbook.backslash and git.docbook.dot params
+     must be supplied by another XSL file or other means -->
+<xsl:template match="co">
+	<xsl:value-of select="concat(
+			      $git.docbook.backslash,'fB(',
+			      substring-after(@id,'-'),')',
+			      $git.docbook.backslash,'fR')"/>
+</xsl:template>
+<xsl:template match="calloutlist">
+	<xsl:value-of select="$git.docbook.dot"/>
+	<xsl:text>sp&#10;</xsl:text>
+	<xsl:apply-templates/>
+	<xsl:text>&#10;</xsl:text>
+</xsl:template>
+<xsl:template match="callout">
+	<xsl:value-of select="concat(
+			      $git.docbook.backslash,'fB',
+			      substring-after(@arearefs,'-'),
+			      '. ',$git.docbook.backslash,'fR')"/>
+	<xsl:apply-templates/>
+	<xsl:value-of select="$git.docbook.dot"/>
+	<xsl:text>br&#10;</xsl:text>
+</xsl:template>
+
+</xsl:stylesheet>
(quoted diff) +0 -0

b/Documentation/libtracecmd/manpage-bold-literal.xsl new file mode 100644 index 00000000..608eb5df

Documentation/libtracecmd/manpage-bold-literal.xsl new file +17 -0
@@ -0,0 +1,17 @@
+<!-- manpage-bold-literal.xsl:
+     special formatting for manpages rendered from asciidoc+docbook -->
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+		version="1.0">
+
+<!-- render literal text as bold (instead of plain or monospace);
+     this makes literal text easier to distinguish in manpages
+     viewed on a tty -->
+<xsl:template match="literal">
+	<xsl:value-of select="$git.docbook.backslash"/>
+	<xsl:text>fB</xsl:text>
+	<xsl:apply-templates/>
+	<xsl:value-of select="$git.docbook.backslash"/>
+	<xsl:text>fR</xsl:text>
+</xsl:template>
+
+</xsl:stylesheet>
(quoted diff) +0 -0

b/Documentation/libtracecmd/manpage-normal.xsl new file mode 100644 index 00000000..a48f5b11

Documentation/libtracecmd/manpage-normal.xsl new file +13 -0
@@ -0,0 +1,13 @@
+<!-- manpage-normal.xsl:
+     special settings for manpages rendered from asciidoc+docbook
+     handles anything we want to keep away from docbook-xsl 1.72.0 -->
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+		version="1.0">
+
+<xsl:import href="manpage-base.xsl"/>
+
+<!-- these are the normal values for the roff control characters -->
+<xsl:param name="git.docbook.backslash">\</xsl:param>
+<xsl:param name="git.docbook.dot"	>.</xsl:param>
+
+</xsl:stylesheet>
(quoted diff) +0 -0

b/Documentation/libtracecmd/manpage-suppress-sp.xsl new file mode 100644 index 00000000..a63c7632

Documentation/libtracecmd/manpage-suppress-sp.xsl new file +21 -0
@@ -0,0 +1,21 @@
+<!-- manpage-suppress-sp.xsl:
+     special settings for manpages rendered from asciidoc+docbook
+     handles erroneous, inline .sp in manpage output of some
+     versions of docbook-xsl -->
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+		version="1.0">
+
+<!-- attempt to work around spurious .sp at the tail of the line
+     that some versions of docbook stylesheets seem to add -->
+<xsl:template match="simpara">
+  <xsl:variable name="content">
+    <xsl:apply-templates/>
+  </xsl:variable>
+  <xsl:value-of select="normalize-space($content)"/>
+  <xsl:if test="not(ancestor::authorblurb) and
+                not(ancestor::personblurb)">
+    <xsl:text>&#10;&#10;</xsl:text>
+  </xsl:if>
+</xsl:template>
+
+</xsl:stylesheet>
Signature · 1 line
2.29.2