lttng-relayd: show man page with --help and remove usage
[deliverable/lttng-tools.git] / doc / man / Makefile.am
... / ...
CommitLineData
1# Man pages are only built if the --enable-build-man-pages option was passed
2# to the configure script.
3#
4# They should always be built before creating a distribution tarball.
5
6# function which adds the source directory prefix and adds a given suffix
7manaddsuffix = $(addsuffix $(1),$(addprefix $(srcdir)/,$(2)))
8
9# List only the names without the .*.txt extension here:
10MAN1_NAMES = \
11 lttng \
12 lttng-create \
13 lttng-destroy \
14 lttng-set-session \
15 lttng-save \
16 lttng-load \
17 lttng-start \
18 lttng-stop \
19 lttng-version \
20 lttng-view \
21 lttng-enable-channel \
22 lttng-disable-channel \
23 lttng-add-context \
24 lttng-list \
25 lttng-calibrate \
26 lttng-track \
27 lttng-untrack \
28 lttng-status \
29 lttng-help \
30 lttng-snapshot \
31 lttng-enable-event \
32 lttng-disable-event \
33 lttng-crash
34MAN3_NAMES =
35MAN8_NAMES = lttng-sessiond lttng-relayd
36MAN1_NO_ASCIIDOC_NAMES =
37MAN3_NO_ASCIIDOC_NAMES =
38MAN8_NO_ASCIIDOC_NAMES =
39
40# man pages destinations
41MAN1 = $(call manaddsuffix,.1,$(MAN1_NAMES))
42MAN3 = $(call manaddsuffix,.3,$(MAN3_NAMES))
43MAN8 = $(call manaddsuffix,.8,$(MAN8_NAMES))
44MAN1_NO_ASCIIDOC = $(call manaddsuffix,.1,$(MAN1_NO_ASCIIDOC_NAMES))
45MAN3_NO_ASCIIDOC = $(call manaddsuffix,.3,$(MAN3_NO_ASCIIDOC_NAMES))
46MAN8_NO_ASCIIDOC = $(call manaddsuffix,.8,$(MAN8_NO_ASCIIDOC_NAMES))
47MAN = $(MAN1) $(MAN3) $(MAN8)
48
49# those are always installed since they are written in troff
50dist_man1_MANS = $(MAN1_NO_ASCIIDOC)
51dist_man3_MANS = $(MAN3_NO_ASCIIDOC)
52dist_man8_MANS = $(MAN8_NO_ASCIIDOC)
53
54# only build man pages if it was enabled
55if BUILD_MAN_PAGES
56# dist + install
57dist_man1_MANS += $(MAN1)
58dist_man3_MANS += $(MAN3)
59dist_man8_MANS += $(MAN8)
60
61# AsciiDoc sources and outputs
62MAN1_TXT = $(call manaddsuffix,.1.txt,$(MAN1_NAMES))
63MAN3_TXT = $(call manaddsuffix,.3.txt,$(MAN3_NAMES))
64MAN8_TXT = $(call manaddsuffix,.8.txt,$(MAN8_NAMES))
65MAN_TXT = $(MAN1_TXT) $(MAN3_TXT) $(MAN8_TXT)
66MAN_XML = $(patsubst $(srcdir)/%.txt,%.xml,$(MAN_TXT))
67
68# common AsciiDoc source files
69COMMON_TXT = \
70 $(srcdir)/common-footer.txt \
71 $(srcdir)/common-cmd-footer.txt \
72 $(srcdir)/common-cmd-options-head.txt \
73 $(srcdir)/common-cmd-help-options.txt
74
75# config
76ASCIIDOC_CONF = $(srcdir)/asciidoc.conf
77XSL_FILES = \
78 manpage.xsl \
79 manpage-base.xsl \
80 manpage-bold-literal.xsl \
81 manpage-ulinks.xsl
82XSL_SRC_FILES = $(addprefix $(srcdir)/xsl/,$(XSL_FILES))
83
84# common dependencies
85COMMON_DEPS = $(ASCIIDOC_CONF) $(COMMON_TXT)
86
87# tools
88ADOC = $(ASCIIDOC) -f $(ASCIIDOC_CONF) -d manpage \
89 -a lttng_version=$(PACKAGE_VERSION)
90ADOC_DOCBOOK = $(ADOC) -b docbook
91XTO = $(XMLTO) -m $(firstword $(XSL_SRC_FILES)) man
92
93# recipes
94%.1.xml: $(srcdir)/%.1.txt $(COMMON_DEPS)
95 $(ADOC_DOCBOOK) -o $@ $<
96
97%.1: %.1.xml $(XSL_SRC_FILES)
98 $(XTO) $<
99
100%.3.xml: $(srcdir)/%.3.txt $(COMMON_DEPS)
101 $(ADOC_DOCBOOK) -o $@ $<
102
103%.3: %.3.xml $(XSL_SRC_FILES)
104 $(XTO) $<
105
106%.8.xml: $(srcdir)/%.8.txt $(COMMON_DEPS)
107 $(ADOC_DOCBOOK) -o $@ $<
108
109%.8: %.8.xml $(XSL_SRC_FILES)
110 $(XTO) $<
111
112clean-local:
113 rm -rf $(MAN_XML)
114 rm -rf $(MAN)
115else
116if IN_GIT_REPO
117# we are in the Git repo: the man pages should be built for distribution
118dist-hook:
119 @echo
120 @echo 'Error: Please build the man pages before creating a tarball.'
121 @echo
122 @false
123else
124# we are in the tarball, hence the man pages are already built
125dist_man1_MANS += $(MAN1)
126dist_man3_MANS += $(MAN3)
127dist_man8_MANS += $(MAN8)
128endif # IN_GIT_REPO
129endif # BUILD_MAN_PAGES
This page took 0.0364 seconds and 5 git commands to generate.