conf: Create automatically generated config snippets in build dir
authorTobias Brunner <tobias@strongswan.org>
Wed, 29 Jan 2014 13:03:16 +0000 (14:03 +0100)
committerTobias Brunner <tobias@strongswan.org>
Wed, 12 Feb 2014 13:34:34 +0000 (14:34 +0100)
conf/Makefile.am

index e802299..3fe727e 100644 (file)
@@ -100,13 +100,14 @@ CLEANFILES=$(man_MANS)
 # if the rules above did not catch it.  this requires an intermediate step that
 # generates a copy of the generic config template.
 $(plugins_install_tmp):
-       @cp $(srcdir)/default.conf $(srcdir)/$@
+       @mkdir -p $(builddir)/plugins
+       @cp $(srcdir)/default.conf $(builddir)/$@
 
 .tmp.conf:
        $(AM_V_GEN) \
        sed \
        -e "s:\@PLUGIN_NAME\@:`basename $< .tmp`:" \
-       $(srcdir)/$< > $(srcdir)/$@
+       $(builddir)/$< > $(builddir)/$@
 
 strongswan.conf.5.main: $(alloptions)
        $(AM_V_GEN) \
@@ -116,6 +117,9 @@ strongswan.conf.5: strongswan.conf.5.head strongswan.conf.5.main strongswan.conf
        $(AM_V_GEN) \
        cat $^ > $@
 
+clean-local:
+       rm -f plugins/*.conf plugins/*.tmp
+
 maintainer-clean-local:
        cd $(srcdir) && \
                rm -f $(confsnippets) default.conf plugins/*.conf plugins/*.tmp
@@ -131,5 +135,6 @@ install-data-local: $(plugins_install_src)
        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; \
+               if test -f "$$f"; then dir=; else dir="$(srcdir)/"; fi; \
+               test -f "$(DESTDIR)$(charonconfdir)/$$name" || $(INSTALL) -m 640 -t "$(DESTDIR)$(charonconfdir)" "$$dir$$f" || true; \
        done