Add support for systemd.
[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 INSTALL_DIRS =
41 noinst_DATA =
42
43 @INTLTOOL_POLICY_RULE@
44
45 .PHONY: update-po
46 update-po:
47         $(MAKE) -C po update-po
48
49 DISTCHECK_CONFIGURE_FLAGS = \
50         --with-systemdsystemunitdir=$$dc_install_base/$(systemdsystemunitdir)
51
52 # ------------------------------------------------------------------------------
53
54 AM_V_XSLT   = $(AM_V_XSLT_$(V))
55 AM_V_XSLT_  = $(AM_V_XSLT_$(AM_DEFAULT_VERBOSITY))
56 AM_V_XSLT_0 = @echo "  XSLT    " $@;
57
58 # ------------------------------------------------------------------------------
59
60 dist_doc_DATA = \
61         COPYING
62
63 # ------------------------------------------------------------------------------
64
65 bin_SCRIPTS = \
66         ddns
67
68 EXTRA_DIST += \
69         ddns.in
70
71 CLEANFILES += \
72         ddns
73
74 dist_configs_DATA = \
75         ddns.conf.sample
76
77 ddns_PYTHON = \
78         src/ddns/__init__.py \
79         src/ddns/__version__.py \
80         src/ddns/database.py \
81         src/ddns/errors.py \
82         src/ddns/i18n.py \
83         src/ddns/providers.py \
84         src/ddns/system.py
85
86 ddnsdir = $(pythondir)/ddns
87
88 # ------------------------------------------------------------------------------
89
90 if ENABLE_MANPAGES
91 MANPAGES = \
92         man/ddns.1 \
93         man/ddns.conf.5
94
95 MANPAGES_XML  = $(patsubst %.1,%.xml,$(patsubst %.5,%.xml,$(MANPAGES)))
96 MANPAGES_HTML = $(patsubst %.xml,%.html,$(MANPAGES_XML))
97
98 man: $(MANPAGES) $(MANPAGES_HTML)
99
100 man_MANS = \
101         $(MANPAGES)
102
103 noinst_DATA += \
104         $(MANPAGES_HTML)
105
106 CLEANFILES += \
107         $(man_MANS) \
108         $(MANPAGES_HTML)
109
110 EXTRA_DIST += \
111         $(MANPAGES_XML) \
112         man/custom-html.xsl
113
114 XSLTPROC_FLAGS = \
115         --nonet \
116         --stringparam man.output.quietly 1 \
117         --stringparam funcsynopsis.style ansi \
118         --stringparam man.th.extra1.suppress 1 \
119         --stringparam man.authors.section.enabled 1 \
120         --stringparam man.copyright.section.enabled 1
121
122 XSLTPROC_COMMAND_MAN = \
123         $(AM_V_XSLT)$(XSLTPROC) -o $@ $(XSLTPROC_FLAGS) \
124                 http://docbook.sourceforge.net/release/xsl/current/manpages/docbook.xsl $<
125
126 XSLTPROC_COMMAND_HTML = \
127         $(AM_V_XSLT)$(XSLTPROC) -o $@ $(XSLTPROC_FLAGS) $(srcdir)/man/custom-html.xsl $<
128
129 man/%.1: man/%.xml
130         $(XSLTPROC_COMMAND_MAN)
131
132 man/%.5: man/%.xml
133         $(XSLTPROC_COMMAND_MAN)
134
135 man/%.html: man/%.xml man/custom-html.xsl
136         $(XSLTPROC_COMMAND_HTML)
137
138 endif
139
140 # ------------------------------------------------------------------------------
141
142 if HAVE_SYSTEMD
143 systemdsystemunit_DATA = \
144         src/systemd/ddns.service \
145         src/systemd/ddns.timer
146
147 CLEANFILES += \
148         $(systemdsystemunit_DATA)
149
150 INSTALL_DIRS += \
151         $(systemdsystemunitdir)
152 endif
153
154 EXTRA_DIST += \
155         src/systemd/ddns.service.in \
156         src/systemd/ddns.timer
157
158 # ------------------------------------------------------------------------------
159
160 substitutions = \
161         '|PACKAGE_NAME=$(PACKAGE_NAME)|' \
162         '|PACKAGE_VERSION=$(PACKAGE_VERSION)|' \
163         '|configsdir=$(configsdir)|' \
164         '|bindir=$(bindir)|'
165
166 SED_PROCESS = \
167         $(AM_V_GEN)$(MKDIR_P) $(dir $@) && \
168         $(SED) $(subst '|,-e 's|@,$(subst =,\@|,$(subst |',|g',$(substitutions)))) \
169                 < $< > $@
170
171 ddns: ddns.in Makefile
172         $(SED_PROCESS)
173
174 src/systemd/%: src/systemd/%.in Makefile
175         $(SED_PROCESS)