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