summaryrefslogtreecommitdiff
path: root/conf/Makefile.am
blob: 7cee0cbd6f680a4125ab10c402e83ed55bcedfeb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
# make this relative to the location of strongswan.conf
strongswanconfdir = `dirname $(strongswan_conf)`
strongswanddir = $(strongswanconfdir)/strongswan.d
charonconfdir = $(strongswanddir)/charon
# copy these files also to /usr/share
templatesdir = $(pkgdatadir)/templates/config
optionstemplatedir = $(templatesdir)/strongswan.d
pluginstemplatedir = $(templatesdir)/plugins

options = \
	options/aikgen.opt \
	options/attest.opt \
	options/charon.opt \
	options/charon-logging.opt \
	options/charon-systemd.opt \
	options/imcv.opt \
	options/imv_policy_manager.opt \
	options/manager.opt \
	options/medsrv.opt \
	options/pacman.opt \
	options/pki.opt \
	options/pool.opt \
	options/scepclient.opt \
	options/starter.opt \
	options/swanctl.opt \
	options/tnc.opt

plugins = \
	plugins/android_log.opt \
	plugins/attr.opt \
	plugins/attr-sql.opt \
	plugins/bliss.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/ext-auth.opt \
	plugins/forecast.opt \
	plugins/gcrypt.opt \
	plugins/ha.opt \
	plugins/imc-attestation.opt \
	plugins/imc-os.opt \
	plugins/imc-scanner.opt \
	plugins/imc-swid.opt \
	plugins/imc-test.opt \
	plugins/imv-attestation.opt \
	plugins/imv-os.opt \
	plugins/imv-scanner.opt \
	plugins/imv-swid.opt \
	plugins/imv-test.opt \
	plugins/ipseckey.opt \
	plugins/led.opt \
	plugins/kernel-libipsec.opt \
	plugins/kernel-netlink.opt \
	plugins/kernel-pfkey.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-imc.opt \
	plugins/tnc-imv.opt \
	plugins/tnc-pdp.opt \
	plugins/tnccs-11.opt \
	plugins/tnccs-20.opt \
	plugins/unbound.opt \
	plugins/updown.opt \
	plugins/vici.opt \
	plugins/whitelist.opt \
	plugins/xauth-eap.opt \
	plugins/xauth-pam.opt

alloptions = $(options) $(plugins)

confsnippets = $(alloptions:opt=conf)

# we only install snippets for enabled plugins
plugins_install_tmp = $(charon_plugins:%=plugins/%.tmp)
plugins_install_src = $(charon_plugins:%=plugins/%.conf)
# only install snippets for enabled components
# has to be defined via autoconf as we can't do it with automake conditionals
options_install_src = $(strongswan_options:%=options/%.conf)

templates_DATA = strongswan.conf
optionstemplate_DATA = $(options_install_src)
pluginstemplate_DATA = $(plugins_install_src)
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 strongswan.conf.5.main $(alloptions) $(confsnippets)

CLEANFILES=$(man_MANS)

.opt.conf:
	$(AM_V_GEN) \
	case "$<" in \
	*plugins/*) \
		sed \
		-e "s:\@PLUGIN_NAME\@:`basename $< .opt`:" \
		$(srcdir)/default.opt | cat - $< | \
		$(PYTHON) $(srcdir)/format-options.py -f conf -r charon.plugins > $(srcdir)/$@ \
		;; \
	*) \
		$(PYTHON) $(srcdir)/format-options.py -f conf -r charon.plugins $< > $(srcdir)/$@ \
		;; \
	esac

# we need another implicit rule to generate files from the generic template only
# 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):
	@mkdir -p $(builddir)/plugins
	@cp $(srcdir)/default.conf $(builddir)/$@

.tmp.conf:
	$(AM_V_GEN) \
	sed \
	-e "s:\@PLUGIN_NAME\@:`basename $< .tmp`:" \
	$(builddir)/$< > $(builddir)/$@

strongswan.conf.5.main: $(alloptions)
	$(AM_V_GEN) \
	cd $(srcdir) && $(PYTHON) format-options.py -f man $(alloptions) > $@

strongswan.conf.5: strongswan.conf.5.head strongswan.conf.5.main strongswan.conf.5.tail
	$(AM_V_GEN) \
	cat strongswan.conf.5.head $(srcdir)/strongswan.conf.5.main strongswan.conf.5.tail > $@

clean-local:
	rm -f plugins/*.conf plugins/*.tmp

maintainer-clean-local:
	cd $(srcdir) && \
		rm -f $(confsnippets) default.conf plugins/*.conf plugins/*.tmp

install-data-local: $(plugins_install_src)
	test -e "$(DESTDIR)${strongswanconfdir}" || $(INSTALL) -d "$(DESTDIR)$(strongswanconfdir)" || true
	test -e "$(DESTDIR)${strongswanddir}" || $(INSTALL) -d "$(DESTDIR)$(strongswanddir)" || true
	test -e "$(DESTDIR)${charonconfdir}" || $(INSTALL) -d "$(DESTDIR)$(charonconfdir)" || true
	test -e "$(DESTDIR)$(strongswanconfdir)/strongswan.conf" || $(INSTALL) -m 644 $(srcdir)/strongswan.conf $(DESTDIR)$(strongswanconfdir)/strongswan.conf || true
	for f in $(options_install_src); do \
		name=`basename $$f`; \
		test -f "$(DESTDIR)$(strongswanddir)/$$name" || $(INSTALL) -m 644 "$(srcdir)/$$f" "$(DESTDIR)$(strongswanddir)/$$name" || true; \
	done
	for f in $(plugins_install_src); do \
		name=`basename $$f`; \
		if test -f "$$f"; then dir=; else dir="$(srcdir)/"; fi; \
		test -f "$(DESTDIR)$(charonconfdir)/$$name" || $(INSTALL) -m 644 "$$dir$$f" "$(DESTDIR)$(charonconfdir)/$$name" || true; \
	done