on-demand connman-vpnd start
[platform/upstream/connman.git] / Makefile.am
1
2 AM_MAKEFLAGS = --no-print-directory
3
4 noinst_LTLIBRARIES =
5
6 includedir = @includedir@/connman
7
8 include_HEADERS = include/log.h include/plugin.h \
9                         include/notifier.h include/service.h \
10                         include/resolver.h include/ipconfig.h \
11                         include/device.h include/network.h include/inet.h \
12                         include/storage.h include/provision.h \
13                         include/session.h include/ipaddress.h include/agent.h \
14                         include/inotify.h include/peer.h include/machine.h
15
16 nodist_include_HEADERS = include/version.h
17
18 noinst_HEADERS = include/rtnl.h include/task.h \
19                         include/dbus.h include/option.h \
20                         include/provider.h include/vpn-dbus.h \
21                         include/utsname.h include/timeserver.h include/proxy.h \
22                         include/technology.h include/setting.h
23
24 local_headers = $(foreach file,$(include_HEADERS) $(nodist_include_HEADERS) \
25                         $(noinst_HEADERS), include/connman/$(notdir $(file)))
26
27
28 noinst_LTLIBRARIES += gdbus/libgdbus-internal.la
29
30 gdbus_libgdbus_internal_la_SOURCES = gdbus/gdbus.h \
31                                 gdbus/mainloop.c gdbus/watch.c \
32                                 gdbus/object.c gdbus/client.c gdbus/polkit.c
33
34 gdhcp_sources = gdhcp/gdhcp.h gdhcp/common.h gdhcp/common.c gdhcp/client.c \
35                 gdhcp/server.c gdhcp/ipv4ll.h gdhcp/ipv4ll.c gdhcp/unaligned.h
36
37 gweb_sources = gweb/gweb.h gweb/gweb.c gweb/gresolv.h gweb/gresolv.c
38
39 if WISPR
40 gweb_sources += gweb/giognutls.h gweb/giognutls.c
41 else
42 gweb_sources += gweb/giognutls.h gweb/gionotls.c
43 endif
44
45 shared_sources = src/shared/util.h src/shared/util.c \
46                 src/shared/netlink.h src/shared/netlink.c
47
48 if DATAFILES
49
50 if NMCOMPAT
51 nmcompat_conf = plugins/connman-nmcompat.conf
52 endif
53
54 dbusconfdir = @DBUS_CONFDIR@
55
56 dbusconf_DATA = src/connman.conf $(nmcompat_conf)
57
58 if VPN
59 dbusconf_DATA += vpn/connman-vpn-dbus.conf
60 dbusservicedir = @DBUS_DATADIR@
61 dbusservice_DATA = vpn/net.connman.vpn.service
62 endif
63
64 if SYSTEMD
65 systemdunitdir = @SYSTEMD_UNITDIR@
66
67 systemdunit_DATA = src/connman.service
68
69 endif
70 endif
71
72 service_files_sources = src/connman.service.in src/net.connman.service.in \
73                                 vpn/net.connman.vpn.service.in
74 service_files = src/connman.service src/net.connman.service \
75                                 vpn/net.connman.vpn.service
76
77 plugin_LTLIBRARIES =
78
79 plugin_objects =
80
81 builtin_modules =
82 builtin_sources =
83 builtin_libadd =
84 builtin_cflags =
85
86 noinst_PROGRAMS =
87 bin_PROGRAMS =
88
89 unit_objects =
90
91 MANUAL_PAGES =
92
93 sbin_PROGRAMS = src/connmand
94
95 src_connmand_SOURCES = $(gdhcp_sources) $(gweb_sources) \
96                         $(builtin_sources) $(shared_sources) src/connman.ver \
97                         src/main.c src/connman.h src/log.c \
98                         src/error.c src/plugin.c src/task.c \
99                         src/device.c src/network.c src/connection.c \
100                         src/manager.c src/service.c \
101                         src/clock.c src/timezone.c src/agent-connman.c \
102                         src/agent.c src/notifier.c src/provider.c \
103                         src/resolver.c src/ipconfig.c src/detect.c src/inet.c \
104                         src/dhcp.c src/dhcpv6.c src/rtnl.c src/proxy.c \
105                         src/utsname.c src/timeserver.c src/rfkill.c \
106                         src/storage.c src/dbus.c src/config.c \
107                         src/technology.c src/counter.c src/ntp.c \
108                         src/session.c src/tethering.c src/wpad.c src/wispr.c \
109                         src/stats.c src/iptables.c src/dnsproxy.c src/6to4.c \
110                         src/ippool.c src/bridge.c src/nat.c src/ipaddress.c \
111                         src/inotify.c src/firewall.c src/ipv6pd.c src/peer.c \
112                         src/peer_service.c src/machine.c src/util.c
113
114 src_connmand_LDADD = gdbus/libgdbus-internal.la $(builtin_libadd) \
115                         @GLIB_LIBS@ @DBUS_LIBS@ @XTABLES_LIBS@ @GNUTLS_LIBS@ \
116                         @TPKP_GNUTLS_LIBS@ \
117                         -lresolv -ldl -lrt
118
119 src_connmand_LDFLAGS = -Wl,--export-dynamic \
120                                 -Wl,--version-script=$(srcdir)/src/connman.ver
121
122 if VPN
123 vpn_plugin_LTLIBRARIES =
124
125 vpn_plugin_objects =
126
127 builtin_vpn_modules =
128 builtin_vpn_sources =
129 builtin_vpn_libadd =
130 builtin_vpn_cflags =
131
132 sbin_PROGRAMS += vpn/connman-vpnd
133
134 vpn_connman_vpnd_SOURCES = $(gdhcp_sources) $(builtin_vpn_sources) \
135                         $(gweb_sources) vpn/vpn.ver vpn/main.c vpn/vpn.h \
136                         vpn/vpn-manager.c vpn/vpn-provider.c \
137                         vpn/vpn-provider.h vpn/vpn-rtnl.h \
138                         vpn/vpn-ipconfig.c src/inet.c vpn/vpn-rtnl.c \
139                         src/log.c src/error.c src/plugin.c src/task.c \
140                         src/device.c src/network.c src/connection.c \
141                         src/manager.c src/service.c \
142                         src/clock.c src/timezone.c src/agent-connman.c \
143                         src/agent.c src/notifier.c src/provider.c \
144                         src/resolver.c src/ipconfig.c src/detect.c \
145                         src/dhcp.c src/dhcpv6.c src/rtnl.c src/proxy.c \
146                         src/utsname.c src/timeserver.c src/rfkill.c \
147                         src/storage.c src/dbus.c src/config.c \
148                         src/technology.c src/counter.c src/ntp.c \
149                         src/session.c src/tethering.c src/wpad.c src/wispr.c \
150                         src/stats.c src/iptables.c src/dnsproxy.c src/6to4.c \
151                         src/ippool.c src/bridge.c src/nat.c src/ipaddress.c \
152                         src/inotify.c src/firewall.c src/ipv6pd.c src/peer.c \
153                         src/peer_service.c src/machine.c src/util.c \
154                         vpn/vpn-agent.c vpn/vpn-agent.h \
155                         vpn/vpn-config.c
156
157 vpn_connman_vpnd_LDADD = gdbus/libgdbus-internal.la $(builtin_vpn_libadd) \
158                                 @GLIB_LIBS@ @DBUS_LIBS@ @XTABLES_LIBS@ @GNUTLS_LIBS@ \
159                                 @TPKP_GNUTLS_LIBS@ \
160                                 -lresolv -ldl
161
162 vpn_connman_vpnd_LDFLAGS = -Wl,--export-dynamic \
163                                 -Wl,--version-script=$(srcdir)/vpn/vpn.ver
164 endif
165
166 BUILT_SOURCES = $(local_headers) src/builtin.h $(service_files) scripts/connman
167
168 if VPN
169 BUILT_SOURCES += vpn/builtin.h
170 endif
171
172 CLEANFILES = src/connman.conf $(BUILT_SOURCES) $(service_files)
173
174 statedir = $(localstatedir)/run/connman
175 vpn_statedir = $(localstatedir)/run/connman-vpn
176
177 if VPN
178 vpn_plugindir = $(libdir)/connman/plugins-vpn
179 endif
180
181 plugindir = $(libdir)/connman/plugins
182
183 scriptdir = $(libdir)/connman/scripts
184
185 storagedir = $(localstatedir)/lib/connman
186 vpn_storagedir = $(localstatedir)/lib/connman-vpn
187
188 configdir = ${sysconfdir}/connman
189
190 if MAINTAINER_MODE
191 if VPN
192 build_vpn_plugindir = $(abs_top_srcdir)/vpn/plugins/.libs
193 endif
194 build_plugindir = $(abs_top_srcdir)/plugins/.libs
195 build_scriptdir = $(abs_top_srcdir)/scripts
196 else
197 build_plugindir = $(plugindir)
198 build_scriptdir = $(scriptdir)
199 if VPN
200 build_vpn_plugindir = $(vpn_plugindir)
201 endif
202 endif
203
204 AM_CFLAGS = @DBUS_CFLAGS@ @GLIB_CFLAGS@ @XTABLES_CFLAGS@ \
205                                 @GNUTLS_CFLAGS@ @TPKP_GNUTLS_CFLAGS@ $(builtin_cflags) \
206                                 -DCONNMAN_PLUGIN_BUILTIN \
207                                 -DSTATEDIR=\""$(statedir)"\" \
208                                 -DVPN_STATEDIR=\""$(vpn_statedir)"\" \
209                                 -DPLUGINDIR=\""$(build_plugindir)"\" \
210                                 -DSCRIPTDIR=\""$(build_scriptdir)"\" \
211                                 -DSTORAGEDIR=\""$(storagedir)\"" \
212                                 -DVPN_STORAGEDIR=\""$(vpn_storagedir)\"" \
213                                 -DCONFIGDIR=\""$(configdir)\""
214
215 if VPN
216 AM_CPPFLAGS = @TPKP_GNUTLS_CFLAGS@ -I$(builddir)/include -I$(srcdir)/gdbus
217 else
218 AM_CPPFLAGS = @TPKP_GNUTLS_CFLAGS@ -I$(builddir)/include -I$(builddir)/src -I$(srcdir)/gdbus
219 endif
220
221 src_connmand_CFLAGS = @DBUS_CFLAGS@ @GLIB_CFLAGS@ @XTABLES_CFLAGS@ \
222                                 @GNUTLS_CFLAGS@ @TPKP_GNUTLS_CFLAGS@ $(builtin_cflags) \
223                                 -DCONNMAN_PLUGIN_BUILTIN \
224                                 -DSTATEDIR=\""$(statedir)"\" \
225                                 -DPLUGINDIR=\""$(build_plugindir)"\" \
226                                 -DSCRIPTDIR=\""$(build_scriptdir)"\" \
227                                 -DSTORAGEDIR=\""$(storagedir)\"" \
228                                 -DVPN_STORAGEDIR=\""$(vpn_storagedir)\"" \
229                                 -DCONFIGDIR=\""$(configdir)\"" \
230                                 -I$(builddir)/src
231
232 EXTRA_DIST = src/genbuiltin src/connman-dbus.conf src/connman-polkit.conf \
233                                 plugins/connman-nmcompat.conf \
234                                 $(service_files_sources) scripts/connman.in
235
236 if VPN
237 vpn_connman_vpnd_CFLAGS = @DBUS_CFLAGS@ @GLIB_CFLAGS@ @XTABLES_CFLAGS@ \
238                                 $(builtin_vpn_cflags) \
239                                 -DCONNMAN_PLUGIN_BUILTIN \
240                                 -DVPN_STATEDIR=\""$(vpn_statedir)"\" \
241                                 -DPLUGINDIR=\""$(build_vpn_plugindir)"\" \
242                                 -DSCRIPTDIR=\""$(build_scriptdir)"\" \
243                                 -DSTORAGEDIR=\""$(storagedir)\"" \
244                                 -DVPN_STORAGEDIR=\""$(vpn_storagedir)\"" \
245                                 -DCONFIGDIR=\""$(configdir)\"" \
246                                 -I$(builddir)/vpn
247
248 endif
249
250 EXTRA_DIST += vpn/vpn-dbus.conf vpn/vpn-polkit.conf
251
252 script_DATA =
253 script_PROGRAMS =
254 script_LTLIBRARIES =
255
256 include Makefile.plugins
257
258 if CLIENT
259 bin_PROGRAMS += client/connmanctl
260
261 MANUAL_PAGES = doc/connmanctl.1
262
263 client_connmanctl_SOURCES = client/dbus_helpers.h client/dbus_helpers.c \
264                         client/services.h client/services.c \
265                         client/commands.h client/commands.c \
266                         client/input.h client/input.c \
267                         client/agent.h client/agent.c \
268                         client/peers.h client/peers.c \
269                         client/vpnconnections.h client/vpnconnections.c \
270                         client/main.c
271
272 client_connmanctl_LDADD = gdbus/libgdbus-internal.la @DBUS_LIBS@ @GLIB_LIBS@ \
273                                 -lreadline -ldl -lncurses
274 endif
275
276 noinst_PROGRAMS += unit/test-ippool
277
278 unit_test_ippool_SOURCES = src/log.c src/dbus.c src/error.c \
279                                         src/ippool.c unit/test-ippool.c
280 unit_test_ippool_LDADD = gdbus/libgdbus-internal.la \
281                                 @GLIB_LIBS@ @DBUS_LIBS@ -ldl
282
283 TESTS = unit/test-ippool
284
285 if WISPR
286 noinst_PROGRAMS += tools/wispr
287
288 tools_wispr_SOURCES = $(gweb_sources) tools/wispr.c
289 tools_wispr_LDADD = @GLIB_LIBS@ @GNUTLS_LIBS@ @TPKP_GNUTLS_LIBS@ -lresolv
290 endif
291
292 if TOOLS
293 noinst_PROGRAMS += tools/supplicant-test \
294                         tools/dhcp-test tools/dhcp-server-test \
295                         tools/addr-test tools/web-test tools/resolv-test \
296                         tools/dbus-test tools/polkit-test \
297                         tools/iptables-test tools/tap-test tools/wpad-test \
298                         tools/stats-tool tools/private-network-test \
299                         tools/session-test tools/iptables-unit \
300                         tools/dnsproxy-test tools/netlink-test
301
302 tools_supplicant_test_SOURCES = tools/supplicant-test.c \
303                         tools/supplicant-dbus.h tools/supplicant-dbus.c \
304                         tools/supplicant.h tools/supplicant.c
305 tools_supplicant_test_LDADD = gdbus/libgdbus-internal.la \
306                                 @GLIB_LIBS@ @DBUS_LIBS@
307
308 tools_web_test_SOURCES = $(gweb_sources) tools/web-test.c
309 tools_web_test_LDADD = @GLIB_LIBS@ @GNUTLS_LIBS@ @TPKP_GNUTLS_LIBS@ -lresolv
310
311 tools_resolv_test_SOURCES = gweb/gresolv.h gweb/gresolv.c tools/resolv-test.c
312 tools_resolv_test_LDADD = @GLIB_LIBS@ -lresolv
313
314 tools_wpad_test_SOURCES = gweb/gresolv.h gweb/gresolv.c tools/wpad-test.c
315 tools_wpad_test_LDADD = @GLIB_LIBS@ -lresolv
316
317 tools_stats_tool_LDADD = @GLIB_LIBS@
318
319 tools_dhcp_test_SOURCES = $(gdhcp_sources) tools/dhcp-test.c
320 tools_dhcp_test_LDADD = @GLIB_LIBS@
321
322 tools_dhcp_server_test_SOURCES = $(gdhcp_sources) tools/dhcp-server-test.c
323 tools_dhcp_server_test_LDADD = @GLIB_LIBS@
324
325 tools_dbus_test_SOURCES = tools/dbus-test.c
326 tools_dbus_test_LDADD = gdbus/libgdbus-internal.la @GLIB_LIBS@ @DBUS_LIBS@
327
328 tools_polkit_test_LDADD = @DBUS_LIBS@
329
330 tools_iptables_test_SOURCES = src/log.c src/iptables.c tools/iptables-test.c
331 tools_iptables_test_LDADD = @GLIB_LIBS@ @XTABLES_LIBS@ -ldl
332
333 tools_private_network_test_LDADD = @GLIB_LIBS@ @DBUS_LIBS@
334
335 tools_session_test_SOURCES = src/log.c src/dbus.c src/error.c \
336                 tools/session-test.c tools/session-utils.c tools/manager-api.c \
337                 tools/session-api.c tools/session-test.h
338 tools_session_test_LDADD = gdbus/libgdbus-internal.la \
339                                 @GLIB_LIBS@ @DBUS_LIBS@ -ldl
340
341 tools_iptables_unit_CFLAGS = @DBUS_CFLAGS@ @GLIB_CFLAGS@ @XTABLES_CFLAGS@ \
342                 -DIPTABLES_SAVE=\""${IPTABLES_SAVE}"\"
343 tools_iptables_unit_SOURCES = src/log.c \
344                  src/iptables.c src/firewall.c src/nat.c tools/iptables-unit.c
345 tools_iptables_unit_LDADD = gdbus/libgdbus-internal.la \
346                                 @GLIB_LIBS@ @DBUS_LIBS@ @XTABLES_LIBS@ -ldl
347
348 tools_dnsproxy_test_SOURCES = tools/dnsproxy-test.c
349 tools_dnsproxy_test_LDADD = @GLIB_LIBS@
350
351 tools_netlink_test_SOURCES =$(shared_sources) tools/netlink-test.c
352 tools_netlink_test_LDADD = @GLIB_LIBS@
353
354 endif
355
356 test_scripts = test/get-state test/list-services \
357                 test/monitor-services test/test-clock \
358                 test/simple-agent test/show-introspection test/test-compat \
359                 test/test-manager test/test-connman test/monitor-connman \
360                 test/connect-provider test/remove-provider \
361                 test/test-counter test/set-ipv4-method test/set-ipv6-method \
362                 test/get-services test/get-proxy-autoconfig test/set-proxy \
363                 test/enable-tethering test/disable-tethering test/backtrace \
364                 test/test-session test/p2p-on-supplicant \
365                 test/test-new-supplicant test/service-move-before \
366                 test/set-global-timeservers test/get-global-timeservers \
367                 test/set-nameservers test/set-domains test/set-timeservers \
368                 test/set-clock
369
370 test_scripts += test/vpn-connect test/vpn-disconnect test/vpn-get \
371                 test/monitor-vpn test/vpn-property
372
373 if TEST
374 testdir = $(pkglibdir)/test
375 test_SCRIPTS = $(test_scripts)
376 endif
377
378 EXTRA_DIST += $(test_scripts)
379
380 EXTRA_DIST += doc/overview-api.txt doc/behavior-api.txt \
381                                 doc/coding-style.txt doc/wifi-p2p-overview.txt \
382                                 doc/vpn-agent-api.txt doc/peer-api.txt \
383                                 doc/ipconfig-api.txt doc/plugin-api.txt \
384                                 doc/manager-api.txt doc/agent-api.txt \
385                                 doc/service-api.txt doc/technology-api.txt \
386                                 doc/counter-api.txt doc/config-format.txt \
387                                 doc/clock-api.txt doc/session-api.txt \
388                                 doc/session-overview.txt doc/backtrace.txt \
389                                 doc/advanced-configuration.txt \
390                                 doc/vpn-config-format.txt \
391                                 doc/vpn-connection-api.txt \
392                                 doc/vpn-manager-api.txt doc/vpn-overview.txt \
393                                 doc/session-policy-format.txt
394
395 EXTRA_DIST += src/main.conf \
396                 src/eduroam.config
397
398 MANUAL_PAGES += doc/connman.8 doc/connman.conf.5
399
400 dist_man_MANS = $(MANUAL_PAGES)
401
402 pkgconfigdir = $(libdir)/pkgconfig
403
404 pkgconfig_DATA = connman.pc
405
406 DISTCHECK_CONFIGURE_FLAGS = --disable-datafiles \
407                                 --enable-hh2serial-gps \
408                                 --enable-openconnect \
409                                 --enable-openvpn \
410                                 --enable-vpnc \
411                                 --enable-session-policy-local \
412                                 --enable-nmcompat \
413                                 --enable-polkit
414
415 DISTCLEANFILES = $(pkgconfig_DATA)
416
417 MAINTAINERCLEANFILES = Makefile.in \
418         aclocal.m4 configure config.h.in config.sub config.guess \
419         ltmain.sh depcomp compile missing install-sh mkinstalldirs test-driver
420
421
422 src/builtin.h: src/genbuiltin $(builtin_sources)
423         $(AM_V_GEN)$(srcdir)/src/genbuiltin $(builtin_modules) > $@
424
425 vpn/builtin.h: src/genbuiltin $(builtin_vpn_sources)
426         $(AM_V_GEN)$(srcdir)/src/genbuiltin $(builtin_vpn_modules) > $@
427
428 src/connman.conf: src/connman-dbus.conf src/connman-polkit.conf
429 if POLKIT
430         $(AM_V_GEN)cp $(srcdir)/src/connman-polkit.conf $@
431 else
432         $(AM_V_GEN)cp $(srcdir)/src/connman-dbus.conf $@
433 endif
434
435 if VPN
436 vpn/connman-vpn-dbus.conf: vpn/vpn-dbus.conf vpn/vpn-polkit.conf
437 if POLKIT
438         $(AM_V_GEN)cp $(srcdir)/vpn/vpn-polkit.conf $@
439 else
440         $(AM_V_GEN)cp $(srcdir)/vpn/vpn-dbus.conf $@
441 endif
442 endif
443
444 if SELINUX
445 if VPN
446 EXTRA_DIST += connman-task.pp
447 CLEANFILES += connman-task.pp
448 endif
449
450 connman-task.pp: vpn/connman-task.te
451         make -f /usr/share/selinux/devel/Makefile
452 endif
453
454 EXTRA_DIST += vpn/connman-task.te
455
456 do_subst = $(AM_V_GEN)$(SED) \
457                 -e 's,[@]prefix[@],$(prefix),g' \
458                 -e 's,[@]sbindir[@],$(sbindir),g' \
459                 -e 's,[@]sysconfdir[@],$(sysconfdir),g'
460
461 %.service: %.service.in Makefile
462         $(do_subst) < $< > $@
463
464 scripts/connman: scripts/connman.in Makefile
465         $(do_subst) < $< > $@
466
467 include/connman/version.h: include/version.h
468         $(AM_V_at)$(MKDIR_P) include/connman
469         $(AM_V_GEN)$(LN_S) $(abs_top_builddir)/$< $@
470
471 include/connman/%.h: $(abs_top_srcdir)/include/%.h
472         $(AM_V_at)$(MKDIR_P) include/connman
473         $(AM_V_GEN)$(LN_S) $< $@
474
475 clean-local:
476         @$(RM) -rf include/connman