Add support for generating manpages.
[oddments/ddns.git] / Makefile.am
1 ###############################################################################
2 #                                                                             #
3 # Pakfire - The IPFire package management system                              #
4 # Copyright (C) 2013 Pakfire development team                                 #
5 #                                                                             #
6 # This program is free software: you can redistribute it and/or modify        #
7 # it under the terms of the GNU General Public License as published by        #
8 # the Free Software Foundation, either version 3 of the License, or           #
9 # (at your option) any later version.                                         #
10 #                                                                             #
11 # This program is distributed in the hope that it will be useful,             #
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of              #
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the               #
14 # GNU General Public License for more details.                                #
15 #                                                                             #
16 # You should have received a copy of the GNU General Public License           #
17 # along with this program.  If not, see <http://www.gnu.org/licenses/>.       #
18 #                                                                             #
19 ###############################################################################
20
21 ACLOCAL_AMFLAGS = -I m4 ${ACLOCAL_FLAGS}
22 AM_MAKEFLAGS = --no-print-directory
23 AUTOMAKE_OPTIONS = color-tests
24
25 # remove target it the command fails
26 .DELETE_ON_ERROR:
27
28 # keep itermediate files
29 .SECONDARY:
30
31 SUBDIRS = . po
32
33 pythondir  = $(pyexecdir)
34
35 configsdir = $(sysconfdir)/ddns
36
37 CLEANFILES =
38 DISTCLEANFILES =
39 EXTRA_DIST =
40 noinst_DATA =
41
42 @INTLTOOL_POLICY_RULE@
43
44 .PHONY: update-po
45 update-po:
46         $(MAKE) -C po update-po
47
48 # ------------------------------------------------------------------------------
49
50 AM_V_XSLT   = $(AM_V_XSLT_$(V))
51 AM_V_XSLT_  = $(AM_V_XSLT_$(AM_DEFAULT_VERBOSITY))
52 AM_V_XSLT_0 = @echo "  XSLT    " $@;
53
54 # ------------------------------------------------------------------------------
55
56 dist_doc_DATA = \
57         COPYING
58
59 # ------------------------------------------------------------------------------
60
61 bin_SCRIPTS = \
62         ddns
63
64 EXTRA_DIST += \
65         ddns.in
66
67 CLEANFILES += \
68         ddns
69
70 dist_configs_DATA = \
71         ddns.conf.sample
72
73 ddns_PYTHON = \
74         src/ddns/__init__.py \
75         src/ddns/__version__.py \
76         src/ddns/errors.py \
77         src/ddns/i18n.py \
78         src/ddns/providers.py \
79         src/ddns/system.py
80
81 ddnsdir = $(pythondir)/ddns
82
83 # ------------------------------------------------------------------------------
84
85 if ENABLE_MANPAGES
86 MANPAGES = \
87         man/ddns.1 \
88         man/ddns.conf.5
89
90 MANPAGES_XML  = $(patsubst %.1,%.xml,$(patsubst %.5,%.xml,$(MANPAGES)))
91 MANPAGES_HTML = $(patsubst %.xml,%.html,$(MANPAGES_XML))
92
93 man: $(MANPAGES) $(MANPAGES_HTML)
94
95 man_MANS = \
96         $(MANPAGES)
97
98 noinst_DATA += \
99         $(MANPAGES_HTML)
100
101 CLEANFILES += \
102         $(man_MANS) \
103         $(MANPAGES_HTML)
104
105 EXTRA_DIST += \
106         $(MANPAGES_XML) \
107         man/custom-html.xsl
108
109 XSLTPROC_FLAGS = \
110         --nonet \
111         --stringparam man.output.quietly 1 \
112         --stringparam funcsynopsis.style ansi \
113         --stringparam man.th.extra1.suppress 1 \
114         --stringparam man.authors.section.enabled 1 \
115         --stringparam man.copyright.section.enabled 1
116
117 XSLTPROC_COMMAND_MAN = \
118         $(AM_V_XSLT)$(XSLTPROC) -o $@ $(XSLTPROC_FLAGS) \
119                 http://docbook.sourceforge.net/release/xsl/current/manpages/docbook.xsl $<
120
121 XSLTPROC_COMMAND_HTML = \
122         $(AM_V_XSLT)$(XSLTPROC) -o $@ $(XSLTPROC_FLAGS) $(srcdir)/man/custom-html.xsl $<
123
124 man/%.1: man/%.xml
125         $(XSLTPROC_COMMAND_MAN)
126
127 man/%.5: man/%.xml
128         $(XSLTPROC_COMMAND_MAN)
129
130 man/%.html: man/%.xml man/custom-html.xsl
131         $(XSLTPROC_COMMAND_HTML)
132
133 endif
134
135 # ------------------------------------------------------------------------------
136
137 substitutions = \
138         '|PACKAGE_NAME=$(PACKAGE_NAME)|' \
139         '|PACKAGE_VERSION=$(PACKAGE_VERSION)|' \
140         '|configsdir=$(configsdir)|'
141
142 SED_PROCESS = \
143         $(AM_V_GEN)$(MKDIR_P) $(dir $@) && \
144         $(SED) $(subst '|,-e 's|@,$(subst =,\@|,$(subst |',|g',$(substitutions)))) \
145                 < $< > $@
146
147 ddns: ddns.in Makefile
148         $(SED_PROCESS)