doc/man: create lttng-destroy(1) and update/fix content
[lttng-tools.git] / doc / man / Makefile.am
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
7 manaddsuffix = $(addsuffix $(1),$(addprefix $(srcdir)/,$(2)))
8
9 # List only the names without the .*.txt extension here:
10 MAN1_NAMES = \
11 lttng \
12 lttng-create \
13 lttng-destroy
14 MAN3_NAMES =
15 MAN8_NAMES =
16 MAN1_NO_ASCIIDOC_NAMES = lttng-crash
17 MAN3_NO_ASCIIDOC_NAMES =
18 MAN8_NO_ASCIIDOC_NAMES = lttng-relayd lttng-sessiond
19
20 # man pages destinations
21 MAN1 = $(call manaddsuffix,.1,$(MAN1_NAMES))
22 MAN3 = $(call manaddsuffix,.3,$(MAN3_NAMES))
23 MAN8 = $(call manaddsuffix,.8,$(MAN8_NAMES))
24 MAN1_NO_ASCIIDOC = $(call manaddsuffix,.1,$(MAN1_NO_ASCIIDOC_NAMES))
25 MAN3_NO_ASCIIDOC = $(call manaddsuffix,.3,$(MAN3_NO_ASCIIDOC_NAMES))
26 MAN8_NO_ASCIIDOC = $(call manaddsuffix,.8,$(MAN8_NO_ASCIIDOC_NAMES))
27 MAN = $(MAN1) $(MAN3) $(MAN8)
28
29 # those are always installed since they are written in troff
30 dist_man1_MANS = $(MAN1_NO_ASCIIDOC)
31 dist_man3_MANS = $(MAN3_NO_ASCIIDOC)
32 dist_man8_MANS = $(MAN8_NO_ASCIIDOC)
33
34 # only build man pages if it was enabled
35 if BUILD_MAN_PAGES
36 # dist + install
37 dist_man1_MANS += $(MAN1)
38 dist_man3_MANS += $(MAN3)
39 dist_man8_MANS += $(MAN8)
40
41 # AsciiDoc sources and outputs
42 MAN1_TXT = $(call manaddsuffix,.1.txt,$(MAN1_NAMES))
43 MAN3_TXT = $(call manaddsuffix,.3.txt,$(MAN3_NAMES))
44 MAN8_TXT = $(call manaddsuffix,.8.txt,$(MAN8_NAMES))
45 MAN_TXT = $(MAN1_TXT) $(MAN3_TXT) $(MAN8_TXT)
46 MAN_XML = $(patsubst $(srcdir)/%.txt,%.xml,$(MAN_TXT))
47
48 # common AsciiDoc source files
49 COMMON_TXT = \
50 $(srcdir)/common-footer.txt \
51 $(srcdir)/common-cmd-footer.txt \
52 $(srcdir)/common-cmd-options-head.txt \
53 $(srcdir)/common-cmd-help-options.txt
54
55 # config
56 ASCIIDOC_CONF = $(srcdir)/asciidoc.conf
57 XSL_FILES = \
58 manpage.xsl \
59 manpage-base.xsl \
60 manpage-bold-literal.xsl \
61 manpage-ulinks.xsl
62 XSL_SRC_FILES = $(addprefix $(srcdir)/xsl/,$(XSL_FILES))
63
64 # common dependencies
65 COMMON_DEPS = $(ASCIIDOC_CONF) $(COMMON_TXT)
66
67 # tools
68 ADOC = $(ASCIIDOC) -f $(ASCIIDOC_CONF) -d manpage \
69 -a lttng_version=$(PACKAGE_VERSION)
70 ADOC_DOCBOOK = $(ADOC) -b docbook
71 XTO = $(XMLTO) -m $(firstword $(XSL_SRC_FILES)) man
72
73 # recipes
74 %.1.xml: $(srcdir)/%.1.txt $(COMMON_DEPS)
75 $(ADOC_DOCBOOK) -o $@ $<
76
77 %.1: %.1.xml $(XSL_SRC_FILES)
78 $(XTO) $<
79
80 %.3.xml: $(srcdir)/%.3.txt $(COMMON_DEPS)
81 $(ADOC_DOCBOOK) -o $@ $<
82
83 %.3: %.3.xml $(XSL_SRC_FILES)
84 $(XTO) $<
85
86 %.8.xml: $(srcdir)/%.8.txt $(COMMON_DEPS)
87 $(ADOC_DOCBOOK) -o $@ $<
88
89 %.8: %.8.xml $(XSL_SRC_FILES)
90 $(XTO) $<
91
92 clean-local:
93 rm -rf $(MAN_XML)
94 rm -rf $(MAN)
95 else
96 if IN_GIT_REPO
97 # we are in the Git repo: the man pages should be built for distribution
98 dist-hook:
99 @echo
100 @echo 'Error: Please build the man pages before creating a tarball.'
101 @echo
102 @false
103 else
104 # we are in the tarball, hence the man pages are already built
105 dist_man1_MANS += $(MAN1)
106 dist_man3_MANS += $(MAN3)
107 dist_man8_MANS += $(MAN8)
108 endif # IN_GIT_REPO
109 endif # BUILD_MAN_PAGES
This page took 0.045091 seconds and 4 git commands to generate.