Upgrade bluez5_37 :Merge the code from private
[platform/upstream/bluez.git] / Makefile.am
1
2 AM_MAKEFLAGS = --no-print-directory
3
4 lib_LTLIBRARIES =
5
6 noinst_LIBRARIES =
7
8 noinst_LTLIBRARIES =
9
10 bin_PROGRAMS =
11
12 noinst_PROGRAMS =
13
14 dist_man_MANS =
15
16 dist_noinst_MANS =
17
18 CLEANFILES =
19
20 EXTRA_DIST =
21
22 libexecdir = @libexecdir@/bluetooth
23
24 libexec_PROGRAMS =
25
26 includedir = @includedir@/bluetooth
27
28 include_HEADERS =
29
30 AM_CFLAGS = $(WARNING_CFLAGS) $(MISC_CFLAGS)
31 AM_LDFLAGS = $(MISC_LDFLAGS)
32
33 if DATAFILES
34 dbusdir = @DBUS_CONFDIR@/dbus-1/system.d
35 dbus_DATA = src/bluetooth.conf
36
37 confdir = $(sysconfdir)/bluetooth
38 conf_DATA =
39
40 statedir = $(localstatedir)/lib/bluetooth
41 state_DATA =
42 endif
43
44 if SYSTEMD
45 systemdsystemunitdir = @SYSTEMD_SYSTEMUNITDIR@
46 systemdsystemunit_DATA = src/bluetooth.service
47
48 dbussystembusdir = @DBUS_SYSTEMBUSDIR@
49 dbussystembus_DATA = src/org.bluez.service
50 endif
51
52 EXTRA_DIST += src/bluetooth.service.in src/org.bluez.service
53
54 plugindir = $(libdir)/bluetooth/plugins
55
56 if MAINTAINER_MODE
57 build_plugindir = $(abs_top_srcdir)/plugins/.libs
58 else
59 build_plugindir = $(plugindir)
60 endif
61
62
63 plugin_LTLIBRARIES =
64
65 lib_sources = lib/bluetooth.c lib/hci.c lib/sdp.c
66 lib_headers = lib/bluetooth.h lib/hci.h lib/hci_lib.h \
67                 lib/sco.h lib/l2cap.h lib/sdp.h lib/sdp_lib.h \
68                 lib/rfcomm.h lib/bnep.h lib/cmtp.h lib/hidp.h
69
70 extra_headers = lib/mgmt.h lib/uuid.h lib/a2mp.h lib/amp.h
71 extra_sources = lib/uuid.c
72
73 local_headers = $(foreach file,$(lib_headers), lib/bluetooth/$(notdir $(file)))
74
75 BUILT_SOURCES = $(local_headers) src/builtin.h
76
77 if LIBRARY
78 include_HEADERS += $(lib_headers)
79
80 lib_LTLIBRARIES += lib/libbluetooth.la
81
82 lib_libbluetooth_la_SOURCES = $(lib_headers) $(lib_sources)
83 lib_libbluetooth_la_LDFLAGS = $(AM_LDFLAGS) -version-info 21:10:18
84 lib_libbluetooth_la_DEPENDENCIES = $(local_headers)
85 endif
86
87 noinst_LTLIBRARIES += lib/libbluetooth-internal.la
88
89 lib_libbluetooth_internal_la_SOURCES = $(lib_headers) $(lib_sources) \
90                                         $(extra_headers) $(extra_sources)
91
92 noinst_LTLIBRARIES += gdbus/libgdbus-internal.la
93
94 gdbus_libgdbus_internal_la_SOURCES = gdbus/gdbus.h \
95                                 gdbus/mainloop.c gdbus/watch.c \
96                                 gdbus/object.c gdbus/client.c gdbus/polkit.c
97
98 noinst_LTLIBRARIES += src/libshared-glib.la src/libshared-mainloop.la
99
100 shared_sources = src/shared/io.h src/shared/timeout.h \
101                         src/shared/queue.h src/shared/queue.c \
102                         src/shared/util.h src/shared/util.c \
103                         src/shared/mgmt.h src/shared/mgmt.c \
104                         src/shared/crypto.h src/shared/crypto.c \
105                         src/shared/ecc.h src/shared/ecc.c \
106                         src/shared/ringbuf.h src/shared/ringbuf.c \
107                         src/shared/tester.h src/shared/tester.c \
108                         src/shared/hci.h src/shared/hci.c \
109                         src/shared/hci-crypto.h src/shared/hci-crypto.c \
110                         src/shared/hfp.h src/shared/hfp.c \
111                         src/shared/uhid.h src/shared/uhid.c \
112                         src/shared/pcap.h src/shared/pcap.c \
113                         src/shared/btsnoop.h src/shared/btsnoop.c \
114                         src/shared/ad.h src/shared/ad.c \
115                         src/shared/att-types.h \
116                         src/shared/att.h src/shared/att.c \
117                         src/shared/gatt-helpers.h src/shared/gatt-helpers.c \
118                         src/shared/gatt-client.h src/shared/gatt-client.c \
119                         src/shared/gatt-server.h src/shared/gatt-server.c \
120                         src/shared/gatt-db.h src/shared/gatt-db.c \
121                         src/shared/gap.h src/shared/gap.c
122
123 src_libshared_glib_la_SOURCES = $(shared_sources) \
124                                 src/shared/io-glib.c \
125                                 src/shared/timeout-glib.c
126
127 src_libshared_mainloop_la_SOURCES = $(shared_sources) \
128                                 src/shared/io-mainloop.c \
129                                 src/shared/timeout-mainloop.c \
130                                 src/shared/mainloop.h src/shared/mainloop.c
131
132 attrib_sources = attrib/att.h attrib/att-database.h attrib/att.c \
133                 attrib/gatt.h attrib/gatt.c \
134                 attrib/gattrib.h attrib/gattrib.c \
135                 attrib/gatt-service.h attrib/gatt-service.c
136
137 btio_sources = btio/btio.h btio/btio.c
138
139 gobex_sources = gobex/gobex.h gobex/gobex.c \
140                         gobex/gobex-defs.h gobex/gobex-defs.c \
141                         gobex/gobex-packet.c gobex/gobex-packet.h \
142                         gobex/gobex-header.c gobex/gobex-header.h \
143                         gobex/gobex-transfer.c gobex/gobex-debug.h \
144                         gobex/gobex-apparam.c gobex/gobex-apparam.h
145
146 builtin_modules =
147 builtin_sources =
148 builtin_nodist =
149
150 include Makefile.plugins
151
152 if MAINTAINER_MODE
153 plugin_LTLIBRARIES += plugins/external-dummy.la
154 plugins_external_dummy_la_SOURCES = plugins/external-dummy.c
155 plugins_external_dummy_la_LDFLAGS = $(AM_LDFLAGS) -module -avoid-version \
156                                     -no-undefined
157 plugins_external_dummy_la_CFLAGS = $(AM_CFLAGS) -fvisibility=hidden
158 endif
159
160 libexec_PROGRAMS += src/bluetoothd
161
162 src_bluetoothd_SOURCES = $(builtin_sources) \
163                         $(attrib_sources) $(btio_sources) \
164                         src/bluetooth.ver \
165                         src/main.c src/log.h src/log.c \
166                         src/backtrace.h src/backtrace.c \
167                         src/systemd.h src/systemd.c \
168                         src/rfkill.c src/hcid.h src/sdpd.h \
169                         src/sdpd-server.c src/sdpd-request.c \
170                         src/sdpd-service.c src/sdpd-database.c \
171                         src/attrib-server.h src/attrib-server.c \
172                         src/gatt-database.h src/gatt-database.c \
173                         src/sdp-xml.h src/sdp-xml.c \
174                         src/sdp-client.h src/sdp-client.c \
175                         src/textfile.h src/textfile.c \
176                         src/uuid-helper.h src/uuid-helper.c \
177                         src/uinput.h \
178                         src/plugin.h src/plugin.c \
179                         src/storage.h src/storage.c \
180                         src/advertising.h src/advertising.c \
181                         src/agent.h src/agent.c \
182                         src/error.h src/error.c \
183                         src/adapter.h src/adapter.c \
184                         src/adapter_le_vsc_features.h src/adapter_le_vsc_features.c \
185                         src/profile.h src/profile.c \
186                         src/service.h src/service.c \
187                         src/gatt-client.h src/gatt-client.c \
188                         src/device.h src/device.c src/attio.h \
189                         src/dbus-common.c src/dbus-common.h \
190                         src/eir.h src/eir.c
191 src_bluetoothd_LDADD = lib/libbluetooth-internal.la \
192                         gdbus/libgdbus-internal.la \
193                         src/libshared-glib.la \
194                         @BACKTRACE_LIBS@ @GLIB_LIBS@ @DBUS_LIBS@ -ldl -lrt
195 src_bluetoothd_LDFLAGS = $(AM_LDFLAGS) -Wl,--export-dynamic \
196                                 -Wl,--version-script=$(srcdir)/src/bluetooth.ver
197
198 src_bluetoothd_DEPENDENCIES = lib/libbluetooth-internal.la \
199                                 gdbus/libgdbus-internal.la \
200                                 src/libshared-glib.la \
201                                 src/bluetooth.service
202
203 src_bluetoothd_CFLAGS = $(AM_CFLAGS) -DBLUETOOTH_PLUGIN_BUILTIN \
204                                         -DPLUGINDIR=\""$(build_plugindir)"\"
205 src_bluetoothd_SHORTNAME = bluetoothd
206
207 builtin_files = src/builtin.h $(builtin_nodist)
208
209 nodist_src_bluetoothd_SOURCES = $(builtin_files)
210
211 CLEANFILES += $(builtin_files) src/bluetooth.service
212
213 man_MANS = src/bluetoothd.8
214
215 if WEARABLE
216 EXTRA_DIST += src/genbuiltin src/bluetooth.conf \
217                         src/main_w.conf profiles/network/network.conf \
218                         profiles/input/input.conf profiles/proximity/proximity.conf
219 else
220 EXTRA_DIST += src/genbuiltin src/bluetooth.conf \
221                         src/main_m.conf profiles/network/network.conf \
222                         profiles/input/input.conf profiles/proximity/proximity.conf
223 endif
224
225 test_scripts =
226 unit_tests =
227
228 include Makefile.tools
229 include Makefile.obexd
230 include android/Makefile.am
231
232 if HID2HCI
233 rulesdir = @UDEV_DIR@/rules.d
234
235 rules_DATA = tools/97-hid2hci.rules
236
237 CLEANFILES += $(rules_DATA)
238 endif
239
240 EXTRA_DIST += tools/hid2hci.rules
241
242 if TEST
243 testdir = $(pkglibdir)/test
244 test_SCRIPTS = $(test_scripts)
245 endif
246
247 EXTRA_DIST += $(test_scripts)
248
249 EXTRA_DIST += doc/assigned-numbers.txt doc/supported-features.txt \
250                                 doc/test-coverage.txt \
251                                 doc/test-runner.txt \
252                                 doc/settings-storage.txt
253
254 EXTRA_DIST += doc/mgmt-api.txt \
255                 doc/adapter-api.txt doc/device-api.txt \
256                 doc/agent-api.txt doc/profile-api.txt \
257                 doc/network-api.txt doc/media-api.txt \
258                 doc/health-api.txt doc/sap-api.txt \
259                 doc/input-api.txt
260
261 EXTRA_DIST += doc/alert-api.txt \
262                 doc/proximity-api.txt doc/heartrate-api.txt \
263                 doc/thermometer-api.txt doc/cyclingspeed-api.txt \
264                 doc/gatt-api.txt doc/advertising-api.txt
265
266 EXTRA_DIST += doc/obex-api.txt doc/obex-agent-api.txt
267
268 EXTRA_DIST += doc/pics-opp.txt doc/pixit-opp.txt \
269                 doc/pts-opp.txt
270
271 EXTRA_DIST += tools/magic.btsnoop
272
273 AM_CFLAGS += @DBUS_CFLAGS@ @GLIB_CFLAGS@
274
275 AM_CPPFLAGS = -I$(builddir)/lib
276
277
278 unit_tests += unit/test-eir
279
280 unit_test_eir_SOURCES = unit/test-eir.c src/eir.c src/uuid-helper.c
281 unit_test_eir_LDADD = src/libshared-glib.la lib/libbluetooth-internal.la \
282                                                                 @GLIB_LIBS@
283
284 unit_tests += unit/test-uuid
285
286 unit_test_uuid_SOURCES = unit/test-uuid.c
287 unit_test_uuid_LDADD = src/libshared-glib.la lib/libbluetooth-internal.la \
288                                                                 @GLIB_LIBS@
289
290 unit_tests += unit/test-textfile
291
292 unit_test_textfile_SOURCES = unit/test-textfile.c src/textfile.h src/textfile.c
293 unit_test_textfile_LDADD = src/libshared-glib.la @GLIB_LIBS@
294
295 unit_tests += unit/test-crc
296
297 unit_test_crc_SOURCES = unit/test-crc.c monitor/crc.h monitor/crc.c
298 unit_test_crc_LDADD = src/libshared-glib.la @GLIB_LIBS@
299
300 unit_tests += unit/test-crypto
301
302 unit_test_crypto_SOURCES = unit/test-crypto.c
303 unit_test_crypto_LDADD = src/libshared-glib.la @GLIB_LIBS@
304
305 unit_tests += unit/test-ecc
306
307 unit_test_ecc_SOURCES = unit/test-ecc.c
308 unit_test_ecc_LDADD = src/libshared-glib.la @GLIB_LIBS@
309
310 unit_tests += unit/test-ringbuf unit/test-queue
311
312 unit_test_ringbuf_SOURCES = unit/test-ringbuf.c
313 unit_test_ringbuf_LDADD = src/libshared-glib.la @GLIB_LIBS@
314
315 unit_test_queue_SOURCES = unit/test-queue.c
316 unit_test_queue_LDADD = src/libshared-glib.la @GLIB_LIBS@
317
318 unit_tests += unit/test-mgmt
319
320 unit_test_mgmt_SOURCES = unit/test-mgmt.c
321 unit_test_mgmt_LDADD = src/libshared-glib.la @GLIB_LIBS@
322
323 unit_tests += unit/test-uhid
324
325 unit_test_uhid_SOURCES = unit/test-uhid.c
326 unit_test_uhid_LDADD = src/libshared-glib.la @GLIB_LIBS@
327
328 unit_tests += unit/test-sdp
329
330 unit_test_sdp_SOURCES = unit/test-sdp.c \
331                                 src/sdpd.h src/sdpd-database.c \
332                                 src/log.h src/log.c \
333                                 src/sdpd-service.c src/sdpd-request.c
334 unit_test_sdp_LDADD = lib/libbluetooth-internal.la \
335                                 src/libshared-glib.la @GLIB_LIBS@
336
337 unit_tests += unit/test-avdtp
338
339 unit_test_avdtp_SOURCES = unit/test-avdtp.c \
340                                 src/log.h src/log.c \
341                                 android/avdtp.c android/avdtp.h
342 unit_test_avdtp_LDADD = src/libshared-glib.la @GLIB_LIBS@
343
344 unit_tests += unit/test-avctp
345
346 unit_test_avctp_SOURCES = unit/test-avctp.c \
347                                 src/log.h src/log.c \
348                                 android/avctp.c android/avctp.h
349 unit_test_avctp_LDADD = src/libshared-glib.la @GLIB_LIBS@
350
351 unit_tests += unit/test-avrcp
352
353 unit_test_avrcp_SOURCES = unit/test-avrcp.c \
354                                 src/log.h src/log.c \
355                                 android/avctp.c android/avctp.h \
356                                 android/avrcp-lib.c android/avrcp-lib.h
357 unit_test_avrcp_LDADD = lib/libbluetooth-internal.la \
358                                 src/libshared-glib.la @GLIB_LIBS@
359
360 unit_tests += unit/test-hfp
361
362 unit_test_hfp_SOURCES = unit/test-hfp.c
363 unit_test_hfp_LDADD = src/libshared-glib.la @GLIB_LIBS@
364
365 unit_tests += unit/test-gdbus-client
366
367 unit_test_gdbus_client_SOURCES = unit/test-gdbus-client.c
368 unit_test_gdbus_client_LDADD = gdbus/libgdbus-internal.la \
369                                 src/libshared-glib.la @GLIB_LIBS@ @DBUS_LIBS@
370
371 unit_tests += unit/test-gobex-header unit/test-gobex-packet unit/test-gobex \
372                         unit/test-gobex-transfer unit/test-gobex-apparam
373
374 unit_test_gobex_SOURCES = $(gobex_sources) unit/util.c unit/util.h \
375                                                 unit/test-gobex.c
376 unit_test_gobex_LDADD = @GLIB_LIBS@
377
378 unit_test_gobex_packet_SOURCES = $(gobex_sources) unit/util.c unit/util.h \
379                                                 unit/test-gobex-packet.c
380 unit_test_gobex_packet_LDADD = @GLIB_LIBS@
381
382 unit_test_gobex_header_SOURCES = $(gobex_sources) unit/util.c unit/util.h \
383                                                 unit/test-gobex-header.c
384 unit_test_gobex_header_LDADD = @GLIB_LIBS@
385
386 unit_test_gobex_transfer_SOURCES = $(gobex_sources) unit/util.c unit/util.h \
387                                                 unit/test-gobex-transfer.c
388 unit_test_gobex_transfer_LDADD = @GLIB_LIBS@
389
390 unit_test_gobex_apparam_SOURCES = $(gobex_sources) unit/util.c unit/util.h \
391                                                 unit/test-gobex-apparam.c
392 unit_test_gobex_apparam_LDADD = @GLIB_LIBS@
393
394 unit_tests += unit/test-lib
395
396 unit_test_lib_SOURCES = unit/test-lib.c
397 unit_test_lib_LDADD = src/libshared-glib.la \
398                                 lib/libbluetooth-internal.la @GLIB_LIBS@
399
400 unit_tests += unit/test-gatt
401
402 unit_test_gatt_SOURCES = unit/test-gatt.c
403 unit_test_gatt_LDADD = src/libshared-glib.la \
404                                 lib/libbluetooth-internal.la @GLIB_LIBS@
405
406 unit_tests += unit/test-hog
407
408 unit_test_hog_SOURCES = unit/test-hog.c \
409                         $(btio_sources) \
410                         profiles/input/hog-lib.h profiles/input/hog-lib.c \
411                         profiles/scanparam/scpp.h profiles/scanparam/scpp.c \
412                         profiles/battery/bas.h profiles/battery/bas.c \
413                         profiles/deviceinfo/dis.h profiles/deviceinfo/dis.c \
414                         src/log.h src/log.c \
415                         attrib/att.h attrib/att.c \
416                         attrib/gatt.h attrib/gatt.c \
417                         attrib/gattrib.h attrib/gattrib.c
418 unit_test_hog_LDADD = src/libshared-glib.la \
419                                 lib/libbluetooth-internal.la @GLIB_LIBS@
420
421 unit_tests += unit/test-gattrib
422
423 unit_test_gattrib_SOURCES = unit/test-gattrib.c attrib/gattrib.c $(btio_sources) src/log.h src/log.c
424 unit_test_gattrib_LDADD = lib/libbluetooth-internal.la \
425                         src/libshared-glib.la \
426                         @GLIB_LIBS@ @DBUS_LIBS@ -ldl -lrt
427
428 if MAINTAINER_MODE
429 noinst_PROGRAMS += $(unit_tests)
430 endif
431
432 TESTS = $(unit_tests)
433
434 pkgconfigdir = $(libdir)/pkgconfig
435
436 if LIBRARY
437 pkgconfig_DATA = lib/bluez.pc
438 endif
439
440 manual_pages = doc/btmon.1
441
442 if MANPAGES
443 dist_noinst_MANS += $(manual_pages)
444 endif
445
446 EXTRA_DIST += $(manual_pages:.1=.txt)
447
448 DISTCHECK_CONFIGURE_FLAGS = --disable-datafiles --enable-library \
449                                         --enable-manpages \
450                                         --disable-systemd --disable-udev
451
452 DISTCLEANFILES = $(pkgconfig_DATA) $(unit_tests) $(manual_pages)
453
454 MAINTAINERCLEANFILES = Makefile.in \
455         aclocal.m4 configure config.h.in config.sub config.guess \
456         ltmain.sh depcomp compile missing install-sh mkinstalldirs test-driver
457
458 SED_PROCESS = $(AM_V_GEN)$(MKDIR_P) $(dir $@) && \
459                 $(SED) -e 's,@libexecdir\@,$(libexecdir),g' \
460                 < $< > $@
461
462 %.service: %.service.in Makefile
463         $(SED_PROCESS)
464
465 %.1: %.txt
466         $(AM_V_GEN)a2x --doctype manpage --format manpage $(srcdir)/$<
467
468 src/builtin.h: src/genbuiltin $(builtin_sources)
469         $(AM_V_GEN)$(srcdir)/src/genbuiltin $(builtin_modules) > $@
470
471 tools/%.rules:
472         $(AM_V_GEN)cp $(srcdir)/$(subst 97-,,$@) $@
473
474 $(lib_libbluetooth_la_OBJECTS): $(local_headers)
475
476 lib/bluetooth/%.h: lib/%.h
477         $(AM_V_at)$(MKDIR_P) lib/bluetooth
478         $(AM_V_GEN)$(LN_S) -f "$(abs_top_builddir)"/$< $@
479
480 if COVERAGE
481 clean-coverage:
482         @lcov --directory $(top_builddir) --zerocounters
483         $(RM) -r coverage $(top_builddir)/coverage.info
484
485 coverage: check
486         @lcov --compat-libtool --directory $(top_builddir) --capture \
487                                 --output-file $(top_builddir)/coverage.info
488         $(AM_V_at)$(MKDIR_P) coverage
489         @genhtml -o coverage/ $(top_builddir)/coverage.info
490
491 clean-local: clean-coverage
492         -find $(top_builddir) -name "*.gcno" -delete
493         -find $(top_builddir) -name "*.gcda" -delete
494         $(RM) -r lib/bluetooth
495
496 else
497 clean-local:
498         -find $(top_builddir) -name "*.gcno" -delete
499         -find $(top_builddir) -name "*.gcda" -delete
500         $(RM) -r lib/bluetooth
501 endif