conf: Only install config snippets if they don't exist yet
[strongswan.git] / conf / Makefile.am
index bdab4d3..2acea54 100644 (file)
@@ -4,10 +4,57 @@ strongswanddir = $(strongswanconfdir)/strongswan.d
 charonconfdir = $(strongswanddir)/charon
 
 options = \
-       options/charon.opt
+       options/charon.opt \
+       options/charon-logging.opt
 
 plugins = \
-       plugins/test.opt
+       plugins/android_log.opt \
+       plugins/attr.opt \
+       plugins/attr-sql.opt \
+       plugins/certexpire.opt \
+       plugins/coupling.opt \
+       plugins/dhcp.opt \
+       plugins/dnscert.opt \
+       plugins/duplicheck.opt \
+       plugins/eap-aka.opt \
+       plugins/eap-aka-3ggp2.opt \
+       plugins/eap-dynamic.opt \
+       plugins/eap-gtc.opt \
+       plugins/eap-peap.opt \
+       plugins/eap-radius.opt \
+       plugins/eap-sim.opt \
+       plugins/eap-simaka-sql.opt \
+       plugins/eap-tls.opt \
+       plugins/eap-tnc.opt \
+       plugins/eap-ttls.opt \
+       plugins/error-notify.opt \
+       plugins/gcrypt.opt \
+       plugins/ha.opt \
+       plugins/ipseckey.opt \
+       plugins/led.opt \
+       plugins/kernel-klips.opt \
+       plugins/kernel-libipsec.opt \
+       plugins/kernel-netlink.opt \
+       plugins/kernel-pfroute.opt \
+       plugins/load-tester.opt \
+       plugins/lookip.opt \
+       plugins/ntru.opt \
+       plugins/openssl.opt \
+       plugins/pkcs11.opt \
+       plugins/radattr.opt \
+       plugins/random.opt \
+       plugins/resolve.opt \
+       plugins/socket-default.opt \
+       plugins/sql.opt \
+       plugins/stroke.opt \
+       plugins/systime-fix.opt \
+       plugins/tnc-ifmap.opt \
+       plugins/tnc-pdp.opt \
+       plugins/unbound.opt \
+       plugins/updown.opt \
+       plugins/whitelist.opt \
+       plugins/xauth-eap.opt \
+       plugins/xauth-pam.opt
 
 alloptions = $(options) $(plugins)
 
@@ -17,12 +64,16 @@ confsnippets = $(alloptions:opt=conf)
 plugins_install_tmp = $(charon_plugins:%=plugins/%.tmp)
 plugins_install_src = $(charon_plugins:%=plugins/%.conf)
 
-strongswand_DATA = $(options:opt=conf)
-charonconf_DATA = $(plugins_install_src)
+options_install_src = $(options:opt=conf)
 
-BUILT_SOURCES = default.conf $(confsnippets)
+man_MANS = \
+       strongswan.conf.5
+
+BUILT_SOURCES = default.conf strongswan.conf.5.main $(confsnippets)
 EXTRA_DIST = format-options.py strongswan.conf default.opt \
-       default.conf $(alloptions) $(confsnippets)
+       default.conf strongswan.conf.5.main $(alloptions) $(confsnippets)
+
+CLEANFILES=$(man_MANS)
 
 .opt.conf:
        $(AM_V_GEN) \
@@ -50,14 +101,28 @@ $(plugins_install_tmp):
        -e "s:\@PLUGIN_NAME\@:`basename $< .tmp`:" \
        $(srcdir)/$< > $(srcdir)/$@
 
+strongswan.conf.5.main: $(alloptions)
+       $(AM_V_GEN) \
+       $(PYTHON) $(srcdir)/format-options.py -f man $^ > $@
+
+strongswan.conf.5: strongswan.conf.5.head strongswan.conf.5.main strongswan.conf.5.tail
+       $(AM_V_GEN) \
+       cat $^ > $@
+
 maintainer-clean-local:
        cd $(srcdir) && \
                rm -f $(confsnippets) default.conf plugins/*.conf plugins/*.tmp
 
-install-exec-local:
+install-data-local: $(plugins_install_src)
        test -e "$(DESTDIR)${strongswanconfdir}" || $(INSTALL) -d "$(DESTDIR)$(strongswanconfdir)"
+       test -e "$(DESTDIR)${strongswanddir}" || $(INSTALL) -d "$(DESTDIR)$(strongswanddir)"
+       test -e "$(DESTDIR)${charonconfdir}" || $(INSTALL) -d "$(DESTDIR)$(charonconfdir)"
        test -e "$(DESTDIR)$(strongswanconfdir)/strongswan.conf" || $(INSTALL) -m 640 $(srcdir)/strongswan.conf $(DESTDIR)$(strongswanconfdir)/strongswan.conf || true
-
-install-data-hook:
-       chmod 0640 $(DESTDIR)$(strongswanddir)/*.conf
-       chmod 0640 $(DESTDIR)$(charonconfdir)/*.conf
+       for f in $(options_install_src); do \
+               name=`basename $$f`; \
+               test -f "$(DESTDIR)$(strongswanddir)/$$name" || $(INSTALL) -m 640 -t "$(DESTDIR)$(strongswanddir)" $(srcdir)/$$f || true; \
+       done
+       for f in $(plugins_install_src); do \
+               name=`basename $$f`; \
+               test -f "$(DESTDIR)$(charonconfdir)/$$name" || $(INSTALL) -m 640 -t "$(DESTDIR)$(charonconfdir)" $(srcdir)/$$f || true; \
+       done