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