Add missing files to distribution
[lttng-ust.git] / doc / man / Makefile.am
CommitLineData
4ddbd0b7
PP
1# Man pages are only built if they are enabled at configure time.
2#
3# They should always be built before creating a distribution tarball.
4
5# Function which adds the source directory prefix and adds a given suffix:
6manaddsuffix = $(addsuffix $(1),$(addprefix $(srcdir)/,$(2)))
7
8# List only the names without the .*.txt extension here:
9MAN1_NAMES = \
10 lttng-gen-tp
11MAN3_NAMES = \
12 lttng-ust \
13 tracef \
14 tracelog \
15 lttng-ust-dl \
16 lttng-ust-cyg-profile
17
18# troff man pages:
19MAN3_TROFF = do_tracepoint.3 tracepoint.3 tracepoint_enabled.3
20
21# AsciiDoc sources and outputs:
22MAN1_TXT = $(call manaddsuffix,.1.txt,$(MAN1_NAMES))
23MAN3_TXT = $(call manaddsuffix,.3.txt,$(MAN3_NAMES))
24MAN_TXT = $(MAN1_TXT) $(MAN3_TXT) $(MAN8_TXT)
25MAN_XML = $(patsubst $(srcdir)/%.txt,%.xml,$(MAN_TXT))
26
27# Common AsciiDoc source files:
28COMMON_TXT = \
29 $(srcdir)/common-footer.txt \
30 $(srcdir)/common-authors.txt \
31 $(srcdir)/common-copyrights.txt \
32 $(srcdir)/log-levels.txt \
33 $(srcdir)/tracef-tracelog-limitations.txt
34
35# AsciiDoc configuration and XSL files:
36ASCIIDOC_CONF = $(srcdir)/asciidoc.conf
6bf962a4 37XSL_FILE = $(srcdir)/manpage.xsl
4ddbd0b7
PP
38
39# Common dependencies:
40COMMON_DEPS = $(ASCIIDOC_CONF) $(COMMON_TXT)
41
42# Man pages destinations:
43MAN1 = $(addsuffix .1,$(MAN1_NAMES))
44MAN3 = $(addsuffix .3,$(MAN3_NAMES))
45MAN = $(MAN1) $(MAN3)
46
47if MAN_PAGES_OPT
48# At this point, we know the user asked to build the man pages.
49if HAVE_ASCIIDOC_XMLTO
e02d8dc3
MJ
50
51asciidoc_verbose = $(asciidoc_verbose_@AM_V@)
52asciidoc_verbose_ = $(asciidoc_verbose_@AM_DEFAULT_V@)
53asciidoc_verbose_0 = @echo " ASCIIDOC " $@;
54
55xmlto_verbose = $(xmlto_verbose_@AM_V@)
56xmlto_verbose_ = $(xmlto_verbose_@AM_DEFAULT_V@)
57xmlto_verbose_0 = @echo " XMLTO " $@;
58
4ddbd0b7 59# Tools to execute:
e02d8dc3 60ADOC = $(asciidoc_verbose)$(ASCIIDOC) -f $(ASCIIDOC_CONF) -d manpage \
82f9bfc0
SM
61 -a lttng_ust_register_timeout="@LTTNG_UST_DEFAULT_CONSTRUCTOR_TIMEOUT_MS@" \
62 -a mansource="LTTng" \
63 -a manmanual="LTTng Manual" \
64 -a manversion="$(PACKAGE_VERSION)"
6f97f9c2 65
4ddbd0b7 66ADOC_DOCBOOK = $(ADOC) -b docbook
e02d8dc3 67XTO = $(xmlto_verbose)$(XMLTO) -m $(XSL_FILE) man
4ddbd0b7
PP
68
69# Recipes:
70%.1.xml: $(srcdir)/%.1.txt $(COMMON_DEPS)
71 $(ADOC_DOCBOOK) -o $@ $<
72
6bf962a4 73%.1: %.1.xml $(XSL_FILE)
e02d8dc3 74 $(XTO) $< 2>/dev/null
4ddbd0b7
PP
75
76%.3.xml: $(srcdir)/%.3.txt $(COMMON_DEPS)
77 $(ADOC_DOCBOOK) -o $@ $<
78
6bf962a4 79%.3: %.3.xml $(XSL_FILE)
e02d8dc3 80 $(XTO) $< 2>/dev/null
4ddbd0b7
PP
81
82# Only clean the generated files if we have the tools to generate them again.
83CLEANFILES = $(MAN_XML) $(MAN)
84else # HAVE_ASCIIDOC_XMLTO
85# Create man page targets used to stop the build if we want to
86# build the man pages, but we don't have the necessary tools to do so.
87ERR_MSG = "Error: Cannot build target because asciidoc or xmlto tool is missing."
88ERR_MSG += "Make sure both tools are installed and run the configure script again."
89
90%.1: $(srcdir)/%.1.txt $(COMMON_DEPS)
91 @echo $(ERR_MSG)
92 @false
93
94%.3: $(srcdir)/%.3.txt $(COMMON_DEPS)
95 @echo $(ERR_MSG)
96 @false
97endif # HAVE_ASCIIDOC_XMLTO
98endif # MAN_PAGES_OPT
99
100# Start with empty distributed/installed man pages:
101dist_man1_MANS =
102dist_man3_MANS =
103EXTRA_DIST =
104
105if MAN_PAGES_OPT
106# Building man pages: we can install and distribute them.
107dist_man1_MANS += $(MAN1)
108dist_man3_MANS += $(MAN3) $(MAN3_TROFF)
109else # MAN_PAGES_OPT
110# Those are not known by automake yet because dist_man3_MANS is empty
111# at this point, so make sure they are distributed.
112EXTRA_DIST += $(MAN3_TROFF)
113endif # MAN_PAGES_OPT
114
115if !MAN_PAGES_OPT
116dist-hook:
117 @echo "Error: Please enable the man pages before creating a distribution tarball."
118 @false
119endif # !MAN_PAGES_OPT
120
121# Always distribute the source files.
e6e508c9 122EXTRA_DIST += $(MAN_TXT) $(COMMON_TXT) $(XSL_FILE) $(ASCIIDOC_CONF) README.md
This page took 0.027869 seconds and 4 git commands to generate.