Add support for systemd.
[oddments/ddns.git] / Makefile.am
index a783064..7201a93 100644 (file)
@@ -37,6 +37,7 @@ configsdir = $(sysconfdir)/ddns
 CLEANFILES =
 DISTCLEANFILES =
 EXTRA_DIST =
+INSTALL_DIRS =
 noinst_DATA =
 
 @INTLTOOL_POLICY_RULE@
@@ -45,6 +46,9 @@ noinst_DATA =
 update-po:
        $(MAKE) -C po update-po
 
+DISTCHECK_CONFIGURE_FLAGS = \
+       --with-systemdsystemunitdir=$$dc_install_base/$(systemdsystemunitdir)
+
 # ------------------------------------------------------------------------------
 
 AM_V_XSLT   = $(AM_V_XSLT_$(V))
@@ -135,10 +139,29 @@ endif
 
 # ------------------------------------------------------------------------------
 
+if HAVE_SYSTEMD
+systemdsystemunit_DATA = \
+       src/systemd/ddns.service \
+       src/systemd/ddns.timer
+
+CLEANFILES += \
+       $(systemdsystemunit_DATA)
+
+INSTALL_DIRS += \
+       $(systemdsystemunitdir)
+endif
+
+EXTRA_DIST += \
+       src/systemd/ddns.service.in \
+       src/systemd/ddns.timer
+
+# ------------------------------------------------------------------------------
+
 substitutions = \
        '|PACKAGE_NAME=$(PACKAGE_NAME)|' \
        '|PACKAGE_VERSION=$(PACKAGE_VERSION)|' \
-       '|configsdir=$(configsdir)|'
+       '|configsdir=$(configsdir)|' \
+       '|bindir=$(bindir)|'
 
 SED_PROCESS = \
        $(AM_V_GEN)$(MKDIR_P) $(dir $@) && \
@@ -147,3 +170,6 @@ SED_PROCESS = \
 
 ddns: ddns.in Makefile
        $(SED_PROCESS)
+
+src/systemd/%: src/systemd/%.in Makefile
+       $(SED_PROCESS)