sco-tester: test local and remote disconnecting simultaneously
[platform/upstream/bluez.git] / Makefile.am
1 # SPDX-License-Identifier: GPL-2.0
2 AM_MAKEFLAGS = --no-print-directory
3 AM_CPPFLAGS =
4
5 lib_LTLIBRARIES =
6
7 noinst_LIBRARIES =
8
9 noinst_LTLIBRARIES =
10
11 bin_PROGRAMS =
12
13 noinst_PROGRAMS =
14
15 CLEANFILES =
16
17 EXTRA_DIST =
18
19 libexecdir = @libexecdir@/bluetooth
20 pkglibexecdir = @libexecdir@/bluetooth
21
22 libexec_PROGRAMS =
23
24 pkgincludedir = $(includedir)/bluetooth
25
26 pkginclude_HEADERS =
27
28 AM_CFLAGS = $(MISC_CFLAGS) $(WARNING_CFLAGS) $(UDEV_CFLAGS) $(ell_cflags)
29 AM_LDFLAGS = $(MISC_LDFLAGS)
30
31 confdir = $(sysconfdir)/bluetooth
32 statedir = $(localstatedir)/lib/bluetooth
33
34 if DATAFILES
35 dbusdir = $(DBUS_CONFDIR)/dbus-1/system.d
36 dbus_DATA = src/bluetooth.conf
37
38 conf_DATA =
39 state_DATA =
40 endif
41
42 if SYSTEMD
43 systemdsystemunitdir = $(SYSTEMD_SYSTEMUNITDIR)
44 systemdsystemunit_DATA = src/bluetooth.service
45
46 dbussystembusdir = $(DBUS_SYSTEMBUSDIR)
47 dbussystembus_DATA = src/org.bluez.service
48 endif
49
50 EXTRA_DIST += src/bluetooth.service.in src/org.bluez.service
51
52 plugindir = $(libdir)/bluetooth/plugins
53
54 if MAINTAINER_MODE
55 build_plugindir = $(abs_top_srcdir)/plugins/.libs
56 else
57 build_plugindir = $(plugindir)
58 endif
59
60 if MANPAGES
61 man_MANS =
62 endif
63 manual_pages =
64
65 plugin_LTLIBRARIES =
66
67 lib_sources = lib/bluetooth.c lib/hci.c lib/sdp.c
68 lib_headers = lib/bluetooth.h lib/hci.h lib/hci_lib.h \
69                 lib/sco.h lib/l2cap.h lib/sdp.h lib/sdp_lib.h \
70                 lib/rfcomm.h lib/bnep.h lib/cmtp.h lib/hidp.h
71
72 extra_headers = lib/mgmt.h lib/uuid.h lib/a2mp.h lib/amp.h lib/iso.h
73 extra_sources = lib/uuid.c
74
75 local_headers = $(foreach file,$(lib_headers), lib/bluetooth/$(notdir $(file)))
76
77 BUILT_SOURCES = $(local_headers) $(ell_built_sources) src/builtin.h
78
79 if LIBRARY
80 pkginclude_HEADERS += $(lib_headers)
81
82 lib_LTLIBRARIES += lib/libbluetooth.la
83
84 lib_libbluetooth_la_SOURCES = $(lib_headers) $(lib_sources)
85 lib_libbluetooth_la_LDFLAGS = $(AM_LDFLAGS) -version-info 22:9:19
86 lib_libbluetooth_la_DEPENDENCIES = $(local_headers)
87 endif
88
89 noinst_LTLIBRARIES += lib/libbluetooth-internal.la
90
91 lib_libbluetooth_internal_la_SOURCES = $(lib_headers) $(lib_sources) \
92                                         $(extra_headers) $(extra_sources)
93
94 noinst_LTLIBRARIES += gdbus/libgdbus-internal.la
95
96 gdbus_libgdbus_internal_la_SOURCES = gdbus/gdbus.h \
97                                 gdbus/mainloop.c gdbus/watch.c \
98                                 gdbus/object.c gdbus/client.c gdbus/polkit.c
99
100 if EXTERNAL_ELL
101 ell_cflags = @ELL_CFLAGS@
102 ell_ldadd = @ELL_LIBS@
103 ell_dependencies =
104 ell_built_sources = ell/shared
105 else
106 ell_cflags =
107 ell_ldadd = ell/libell-internal.la
108 ell_dependencies = $(ell_ldadd)
109 ell_built_sources = ell/shared ell/internal ell/ell.h
110
111 noinst_LTLIBRARIES += ell/libell-internal.la
112
113 ell_headers = ell/util.h \
114                         ell/log.h \
115                         ell/queue.h \
116                         ell/hashmap.h \
117                         ell/random.h \
118                         ell/signal.h \
119                         ell/timeout.h \
120                         ell/cipher.h \
121                         ell/checksum.h \
122                         ell/io.h \
123                         ell/idle.h \
124                         ell/main.h \
125                         ell/settings.h \
126                         ell/strv.h \
127                         ell/string.h \
128                         ell/utf8.h \
129                         ell/dbus.h \
130                         ell/dbus-service.h \
131                         ell/dbus-client.h \
132                         ell/key.h \
133                         ell/cert.h \
134                         ell/pem.h \
135                         ell/base64.h \
136                         ell/asn1-private.h \
137                         ell/cert-private.h \
138                         ell/pem-private.h \
139                         ell/uuid.h \
140                         ell/uuid.h \
141                         ell/main-private.h
142
143 ell_sources = ell/private.h ell/missing.h \
144                         ell/util.c \
145                         ell/log.c \
146                         ell/queue.c \
147                         ell/hashmap.c \
148                         ell/random.c \
149                         ell/signal.c \
150                         ell/timeout.c \
151                         ell/io.c \
152                         ell/idle.c \
153                         ell/main.c \
154                         ell/settings.c \
155                         ell/strv.c \
156                         ell/string.c \
157                         ell/cipher.c \
158                         ell/checksum.c \
159                         ell/pem.c \
160                         ell/cert.c \
161                         ell/cert-crypto.c \
162                         ell/key.c \
163                         ell/base64.c \
164                         ell/utf8.c \
165                         ell/dbus-private.h \
166                         ell/dbus.c \
167                         ell/dbus-message.c \
168                         ell/dbus-util.c \
169                         ell/dbus-service.c \
170                         ell/dbus-client.c \
171                         ell/dbus-name-cache.c \
172                         ell/dbus-filter.c \
173                         ell/gvariant-private.h \
174                         ell/gvariant-util.c \
175                         ell/siphash-private.h \
176                         ell/siphash.c \
177                         ell/uuid.c
178
179 ell_shared = ell/useful.h
180
181 ell_libell_internal_la_SOURCES = $(ell_headers) $(ell_sources) $(ell_shared)
182 endif
183
184 CLEANFILES += $(ell_built_sources)
185
186 noinst_LTLIBRARIES += src/libshared-glib.la src/libshared-mainloop.la
187
188 if LIBSHARED_ELL
189 noinst_LTLIBRARIES += src/libshared-ell.la
190 endif
191
192 shared_sources = src/shared/io.h src/shared/timeout.h \
193                         src/shared/queue.h src/shared/queue.c \
194                         src/shared/util.h src/shared/util.c \
195                         src/shared/mgmt.h src/shared/mgmt.c \
196                         src/shared/crypto.h src/shared/crypto.c \
197                         src/shared/ecc.h src/shared/ecc.c \
198                         src/shared/ringbuf.h src/shared/ringbuf.c \
199                         src/shared/tester.h src/shared/tester.c \
200                         src/shared/hci.h src/shared/hci.c \
201                         src/shared/hci-crypto.h src/shared/hci-crypto.c \
202                         src/shared/hfp.h src/shared/hfp.c \
203                         src/shared/uhid.h src/shared/uhid.c \
204                         src/shared/pcap.h src/shared/pcap.c \
205                         src/shared/btsnoop.h src/shared/btsnoop.c \
206                         src/shared/ad.h src/shared/ad.c \
207                         src/shared/att-types.h \
208                         src/shared/att.h src/shared/att.c \
209                         src/shared/gatt-helpers.h src/shared/gatt-helpers.c \
210                         src/shared/gatt-client.h src/shared/gatt-client.c \
211                         src/shared/gatt-server.h src/shared/gatt-server.c \
212                         src/shared/gatt-db.h src/shared/gatt-db.c \
213                         src/shared/gap.h src/shared/gap.c \
214                         src/shared/log.h src/shared/log.c \
215                         src/shared/bap.h src/shared/bap.c src/shared/ascs.h \
216                         src/shared/mcs.h src/shared/mcp.h src/shared/mcp.c \
217                         src/shared/vcp.c src/shared/vcp.h \
218                         src/shared/csip.c src/shared/csip.h \
219                         src/shared/bass.h src/shared/bass.c \
220                         src/shared/lc3.h src/shared/tty.h
221
222 if READLINE
223 shared_sources += src/shared/shell.c src/shared/shell.h
224 endif
225
226 if LIBSHARED_ELL
227 src_libshared_ell_la_SOURCES = $(shared_sources) \
228                                src/shared/io-ell.c \
229                                src/shared/timeout-ell.c \
230                                src/shared/mainloop.h \
231                                src/shared/mainloop-ell.c
232 src_libshared_ell_la_LDFLAGS = $(AM_LDFLAGS)
233 src_libshared_ell_la_CFLAGS = $(AM_CFLAGS)
234 endif
235
236 src_libshared_glib_la_SOURCES = $(shared_sources) \
237                                 src/shared/io-glib.c \
238                                 src/shared/timeout-glib.c \
239                                 src/shared/mainloop-glib.c \
240                                 src/shared/mainloop-notify.h \
241                                 src/shared/mainloop-notify.c
242
243 src_libshared_glib_la_LDFLAGS = $(AM_LDFLAGS)
244 src_libshared_glib_la_CFLAGS = $(AM_CFLAGS)
245
246 src_libshared_mainloop_la_SOURCES = $(shared_sources) \
247                                 src/shared/io-mainloop.c \
248                                 src/shared/timeout-mainloop.c \
249                                 src/shared/mainloop.h src/shared/mainloop.c \
250                                 src/shared/mainloop-notify.h \
251                                 src/shared/mainloop-notify.c
252 src_libshared_mainloop_la_LDFLAGS = $(AM_LDFLAGS)
253 src_libshared_mainloop_la_CFLAGS = $(AM_CFLAGS)
254
255 attrib_sources = attrib/att.h attrib/att-database.h attrib/att.c \
256                 attrib/gatt.h attrib/gatt.c \
257                 attrib/gattrib.h attrib/gattrib.c \
258                 attrib/gatt-service.h attrib/gatt-service.c
259
260 btio_sources = btio/btio.h btio/btio.c
261
262 gobex_sources = gobex/gobex.h gobex/gobex.c \
263                         gobex/gobex-defs.h gobex/gobex-defs.c \
264                         gobex/gobex-packet.c gobex/gobex-packet.h \
265                         gobex/gobex-header.c gobex/gobex-header.h \
266                         gobex/gobex-transfer.c gobex/gobex-debug.h \
267                         gobex/gobex-apparam.c gobex/gobex-apparam.h
268
269 builtin_modules =
270 builtin_sources =
271 builtin_cppflags =
272 builtin_nodist =
273 builtin_ldadd =
274
275 include Makefile.plugins
276
277 if MAINTAINER_MODE
278 plugin_LTLIBRARIES += plugins/external-dummy.la
279 plugins_external_dummy_la_SOURCES = plugins/external-dummy.c
280 plugins_external_dummy_la_LDFLAGS = $(AM_LDFLAGS) -module -avoid-version \
281                                     -no-undefined
282 plugins_external_dummy_la_CFLAGS = $(AM_CFLAGS) -fvisibility=hidden
283 endif
284
285 libexec_PROGRAMS += src/bluetoothd
286
287 src_bluetoothd_SOURCES = $(builtin_sources) \
288                         $(attrib_sources) $(btio_sources) \
289                         src/bluetooth.ver \
290                         src/main.c src/log.h src/log.c src/bluez-log.c \
291                         src/backtrace.h src/backtrace.c \
292                         src/rfkill.c src/btd.h src/sdpd.h \
293                         src/sdpd-server.c src/sdpd-request.c \
294                         src/sdpd-service.c src/sdpd-database.c \
295                         src/attrib-server.h src/attrib-server.c \
296                         src/gatt-database.h src/gatt-database.c \
297                         src/sdp-xml.h src/sdp-xml.c \
298                         src/sdp-client.h src/sdp-client.c \
299                         src/textfile.h src/textfile.c \
300                         src/uuid-helper.h src/uuid-helper.c \
301                         src/plugin.h src/plugin.c \
302                         src/storage.h src/storage.c \
303                         src/advertising.h src/advertising.c \
304                         src/agent.h src/agent.c \
305                         src/error.h src/error.c \
306                         src/adapter.h src/adapter.c \
307                         src/adapter_le_vsc_features.h src/adapter_le_vsc_features.c \
308                         src/profile.h src/profile.c \
309                         src/service.h src/service.c \
310                         src/gatt-client.h src/gatt-client.c \
311                         src/device.h src/device.c \
312                         src/dbus-common.c src/dbus-common.h \
313                         src/eir.h src/eir.c \
314                         src/adv_monitor.h src/adv_monitor.c \
315                         src/battery.h src/battery.c \
316                         src/settings.h src/settings.c \
317                         src/set.h src/set.c
318 src_bluetoothd_LDADD = lib/libbluetooth-internal.la \
319                         gdbus/libgdbus-internal.la \
320                         src/libshared-glib.la \
321                         $(BACKTRACE_LIBS) $(GLIB_LIBS) $(DBUS_LIBS) @LIBXML_LIBS@ @INIPARSER_LIBS@ -ldl -lrt
322                         $(builtin_ldadd)
323 src_bluetoothd_LDFLAGS = $(AM_LDFLAGS) -Wl,--export-dynamic \
324                                 -Wl,--version-script=$(srcdir)/src/bluetooth.ver
325
326 src_bluetoothd_DEPENDENCIES = lib/libbluetooth-internal.la \
327                                 gdbus/libgdbus-internal.la \
328                                 src/libshared-glib.la \
329                                 src/bluetooth.service
330
331 src_bluetoothd_CPPFLAGS = $(AM_CPPFLAGS) -DBLUETOOTH_PLUGIN_BUILTIN \
332                                         -DPLUGINDIR=\""$(build_plugindir)"\" \
333                                         $(BACKTRACE_CFLAGS) $(builtin_cppflags)
334 src_bluetoothd_SHORTNAME = bluetoothd
335
336 builtin_files = src/builtin.h $(builtin_nodist)
337
338 nodist_src_bluetoothd_SOURCES = $(builtin_files)
339
340 CLEANFILES += $(builtin_files) src/bluetooth.service
341
342 if MANPAGES
343 man_MANS += src/bluetoothd.8
344 endif
345 manual_pages += src/bluetoothd.8
346
347 EXTRA_DIST += src/genbuiltin src/bluetooth.conf \
348                         src/main_m.conf src/main_w.conf profiles/network/network.conf \
349                         profiles/input/input.conf profiles/proximity/proximity.conf
350
351 test_scripts =
352 unit_tests =
353
354 include Makefile.tools
355 include Makefile.obexd
356 include android/Makefile.am
357 include Makefile.mesh
358
359 if HID2HCI
360 rulesdir = $(UDEV_DIR)/rules.d
361
362 rules_DATA = tools/97-hid2hci.rules
363
364 CLEANFILES += $(rules_DATA)
365 endif
366
367 EXTRA_DIST += tools/hid2hci.rules
368
369 if TEST
370 testdir = $(pkglibdir)/test
371 test_SCRIPTS = $(test_scripts)
372 endif
373
374 EXTRA_DIST += $(test_scripts)
375
376 EXTRA_DIST += doc/assigned-numbers.txt doc/supported-features.txt \
377                                 doc/test-coverage.txt \
378                                 doc/test-runner.txt \
379                                 doc/settings-storage.txt
380
381 EXTRA_DIST += doc/mgmt-api.txt \
382                 doc/adapter-api.txt doc/device-api.txt \
383                 doc/agent-api.txt doc/profile-api.txt \
384                 doc/network-api.txt doc/media-api.txt \
385                 doc/health-api.txt doc/sap-api.txt \
386                 doc/input-api.txt
387
388 EXTRA_DIST += doc/alert-api.txt \
389                 doc/proximity-api.txt doc/heartrate-api.txt \
390                 doc/thermometer-api.txt doc/cyclingspeed-api.txt \
391                 doc/gatt-api.txt doc/advertising-api.txt
392
393 EXTRA_DIST += doc/obex-api.txt doc/obex-agent-api.txt
394
395 EXTRA_DIST += doc/pics-opp.txt doc/pixit-opp.txt \
396                 doc/pts-opp.txt
397
398 EXTRA_DIST += doc/btsnoop.txt
399
400 EXTRA_DIST += tools/magic.btsnoop
401
402 AM_CFLAGS += @LIBXML_CFLAGS@ @INIPARSER_CFLAGS@
403
404 AM_CPPFLAGS += $(DBUS_CFLAGS) $(GLIB_CFLAGS) -I$(builddir)/lib
405
406 unit_tests += unit/test-tester
407
408 unit_test_tester_SOURCES = unit/test-tester.c
409 unit_test_tester_LDADD = src/libshared-glib.la lib/libbluetooth-internal.la \
410                                                                 $(GLIB_LIBS)
411
412 unit_tests += unit/test-eir
413
414 unit_test_eir_SOURCES = unit/test-eir.c src/eir.c src/uuid-helper.c
415 unit_test_eir_LDADD = src/libshared-glib.la lib/libbluetooth-internal.la \
416                                                                 $(GLIB_LIBS)
417
418 unit_tests += unit/test-uuid
419
420 unit_test_uuid_SOURCES = unit/test-uuid.c
421 unit_test_uuid_LDADD = src/libshared-glib.la lib/libbluetooth-internal.la \
422                                                                 $(GLIB_LIBS)
423
424 unit_tests += unit/test-textfile
425
426 unit_test_textfile_SOURCES = unit/test-textfile.c src/textfile.h src/textfile.c
427 unit_test_textfile_LDADD = src/libshared-glib.la $(GLIB_LIBS)
428
429 unit_tests += unit/test-crc
430
431 unit_test_crc_SOURCES = unit/test-crc.c monitor/crc.h monitor/crc.c
432 unit_test_crc_LDADD = src/libshared-glib.la $(GLIB_LIBS)
433
434 if TIZEN_CRYPTO_TESTS
435 unit_tests += unit/test-crypto
436
437 unit_test_crypto_SOURCES = unit/test-crypto.c
438 unit_test_crypto_LDADD = src/libshared-glib.la @GLIB_LIBS@
439 endif
440
441 unit_tests += unit/test-ecc
442
443 unit_test_ecc_SOURCES = unit/test-ecc.c
444 unit_test_ecc_LDADD = src/libshared-glib.la $(GLIB_LIBS)
445
446 unit_tests += unit/test-ringbuf unit/test-queue
447
448 unit_test_ringbuf_SOURCES = unit/test-ringbuf.c
449 unit_test_ringbuf_LDADD = src/libshared-glib.la $(GLIB_LIBS)
450
451 unit_test_queue_SOURCES = unit/test-queue.c
452 unit_test_queue_LDADD = src/libshared-glib.la $(GLIB_LIBS)
453
454 unit_tests += unit/test-mgmt
455
456 unit_test_mgmt_SOURCES = unit/test-mgmt.c
457 unit_test_mgmt_LDADD = src/libshared-glib.la $(GLIB_LIBS)
458
459 unit_tests += unit/test-uhid
460
461 unit_test_uhid_SOURCES = unit/test-uhid.c
462 unit_test_uhid_LDADD = src/libshared-glib.la $(GLIB_LIBS)
463
464 unit_tests += unit/test-sdp
465
466 unit_test_sdp_SOURCES = unit/test-sdp.c \
467                                 src/sdpd.h src/sdpd-database.c \
468                                 src/log.h src/log.c \
469                                 src/sdpd-service.c src/sdpd-request.c
470 unit_test_sdp_LDADD = lib/libbluetooth-internal.la \
471                                 src/libshared-glib.la $(GLIB_LIBS)
472
473 unit_tests += unit/test-avdtp
474
475 unit_test_avdtp_SOURCES = unit/test-avdtp.c \
476                                 src/log.h src/log.c \
477                                 android/avdtp.c android/avdtp.h
478 unit_test_avdtp_LDADD = src/libshared-glib.la $(GLIB_LIBS)
479
480 unit_tests += unit/test-avctp
481
482 unit_test_avctp_SOURCES = unit/test-avctp.c \
483                                 src/log.h src/log.c \
484                                 android/avctp.c android/avctp.h
485 unit_test_avctp_LDADD = src/libshared-glib.la $(GLIB_LIBS)
486
487 unit_tests += unit/test-avrcp
488
489 unit_test_avrcp_SOURCES = unit/test-avrcp.c \
490                                 src/log.h src/log.c \
491                                 android/avctp.c android/avctp.h \
492                                 android/avrcp-lib.c android/avrcp-lib.h
493 unit_test_avrcp_LDADD = lib/libbluetooth-internal.la \
494                                 src/libshared-glib.la $(GLIB_LIBS)
495
496 unit_tests += unit/test-hfp
497
498 unit_test_hfp_SOURCES = unit/test-hfp.c
499 unit_test_hfp_LDADD = src/libshared-glib.la $(GLIB_LIBS)
500
501 unit_tests += unit/test-gdbus-client
502
503 unit_test_gdbus_client_SOURCES = unit/test-gdbus-client.c
504 unit_test_gdbus_client_LDADD = gdbus/libgdbus-internal.la \
505                                 src/libshared-glib.la $(GLIB_LIBS) $(DBUS_LIBS)
506
507 if OBEX
508 unit_tests += unit/test-gobex-header unit/test-gobex-packet unit/test-gobex \
509                         unit/test-gobex-transfer unit/test-gobex-apparam
510
511 unit_test_gobex_SOURCES = $(gobex_sources) unit/util.c unit/util.h \
512                                                 unit/test-gobex.c
513 unit_test_gobex_LDADD = $(GLIB_LIBS)
514
515 unit_test_gobex_packet_SOURCES = $(gobex_sources) unit/util.c unit/util.h \
516                                                 unit/test-gobex-packet.c
517 unit_test_gobex_packet_LDADD = $(GLIB_LIBS)
518
519 unit_test_gobex_header_SOURCES = $(gobex_sources) unit/util.c unit/util.h \
520                                                 unit/test-gobex-header.c
521 unit_test_gobex_header_LDADD = $(GLIB_LIBS)
522
523 unit_test_gobex_transfer_SOURCES = $(gobex_sources) unit/util.c unit/util.h \
524                                                 unit/test-gobex-transfer.c
525 unit_test_gobex_transfer_LDADD = $(GLIB_LIBS)
526
527 unit_test_gobex_apparam_SOURCES = $(gobex_sources) unit/util.c unit/util.h \
528                                                 unit/test-gobex-apparam.c
529 unit_test_gobex_apparam_LDADD = $(GLIB_LIBS)
530 endif
531
532 unit_tests += unit/test-lib
533
534 unit_test_lib_SOURCES = unit/test-lib.c
535 unit_test_lib_LDADD = src/libshared-glib.la \
536                                 lib/libbluetooth-internal.la $(GLIB_LIBS)
537
538 unit_tests += unit/test-gatt
539
540 unit_test_gatt_SOURCES = unit/test-gatt.c
541 unit_test_gatt_LDADD = src/libshared-glib.la \
542                                 lib/libbluetooth-internal.la $(GLIB_LIBS)
543
544 unit_tests += unit/test-hog
545
546 unit_test_hog_SOURCES = unit/test-hog.c \
547                         $(btio_sources) \
548                         profiles/input/hog-lib.h profiles/input/hog-lib.c \
549                         profiles/scanparam/scpp.h profiles/scanparam/scpp.c \
550                         profiles/battery/bas.h profiles/battery/bas.c \
551                         profiles/deviceinfo/dis.h profiles/deviceinfo/dis.c \
552                         src/log.h src/log.c \
553                         attrib/att.h attrib/att.c \
554                         attrib/gatt.h attrib/gatt.c \
555                         attrib/gattrib.h attrib/gattrib.c
556 unit_test_hog_LDADD = src/libshared-glib.la \
557                                 lib/libbluetooth-internal.la $(GLIB_LIBS)
558
559 unit_tests += unit/test-gattrib
560
561 unit_test_gattrib_SOURCES = unit/test-gattrib.c attrib/gattrib.c \
562                                         $(btio_sources) src/log.h src/log.c src/bluez-log.c
563 unit_test_gattrib_LDADD = src/libshared-glib.la \
564                                 lib/libbluetooth-internal.la \
565                                 $(GLIB_LIBS) $(DBUS_LIBS) -ldl -lrt
566
567 unit_tests += unit/test-bap
568
569 unit_test_bap_SOURCES = unit/test-bap.c
570 unit_test_bap_LDADD = src/libshared-glib.la \
571                                 lib/libbluetooth-internal.la $(GLIB_LIBS)
572
573 unit_tests += unit/test-bass
574
575 unit_test_bass_SOURCES = unit/test-bass.c $(btio_sources)
576 unit_test_bass_LDADD = src/libshared-glib.la \
577                                 lib/libbluetooth-internal.la $(GLIB_LIBS)
578
579 if MIDI
580 unit_tests += unit/test-midi
581 unit_test_midi_CPPFLAGS = $(AM_CPPFLAGS) $(ALSA_CFLAGS) -DMIDI_TEST
582 unit_test_midi_SOURCES = unit/test-midi.c \
583                         profiles/midi/libmidi.h \
584                         profiles/midi/libmidi.c
585 unit_test_midi_LDADD = src/libshared-glib.la \
586                         $(GLIB_LIBS) $(ALSA_LIBS)
587 endif
588
589 if MESH
590 unit_tests += unit/test-mesh-crypto
591 unit_test_mesh_crypto_CPPFLAGS = $(ell_cflags)
592 unit_test_mesh_crypto_SOURCES = unit/test-mesh-crypto.c \
593                                mesh/crypto.h ell/internal ell/ell.h \
594                                $(ell_sources)
595 unit_test_mesh_crypto_LDADD = src/libshared-ell.la \
596                        $(ell_ldadd)
597 endif
598
599 if MAINTAINER_MODE
600 noinst_PROGRAMS += $(unit_tests)
601 endif
602
603 TESTS = $(unit_tests)
604 AM_TESTS_ENVIRONMENT = MALLOC_CHECK_=3 MALLOC_PERTURB_=69
605
606 if DBUS_RUN_SESSION
607 AM_TESTS_ENVIRONMENT += dbus-run-session --
608 endif
609
610 if VALGRIND
611 LOG_COMPILER = valgrind --error-exitcode=1 --num-callers=30
612 LOG_FLAGS = --trace-children=yes --leak-check=full --show-reachable=no \
613                 --suppressions=$(srcdir)/tools/valgrind.supp --quiet
614 endif
615
616 pkgconfigdir = $(libdir)/pkgconfig
617
618 if LIBRARY
619 pkgconfig_DATA = lib/bluez.pc
620 endif
621
622 EXTRA_DIST += $(manual_pages) $(patsubst %.1,%.rst, \
623                                 $(patsubst %.8,%.rst,$(manual_pages)))
624
625 DISTCHECK_CONFIGURE_FLAGS = --disable-datafiles --enable-library \
626                                                 --enable-health \
627                                                 --enable-midi \
628                                                 --enable-manpages \
629                                                 --enable-android \
630                                                 --disable-systemd \
631                                                 --disable-udev
632
633 DISTCLEANFILES = $(pkgconfig_DATA) $(unit_tests) $(manual_pages)
634
635 MAINTAINERCLEANFILES = Makefile.in \
636         aclocal.m4 configure config.h.in config.sub config.guess \
637         ltmain.sh depcomp compile missing install-sh mkinstalldirs test-driver
638
639 SED_PROCESS = $(AM_V_GEN)$(MKDIR_P) $(dir $@) && \
640                 $(SED) -e 's,@pkglibexecdir\@,$(pkglibexecdir),g' \
641                 < $< > $@
642
643 if RUN_RST2MAN
644 RST2MAN_PROCESS = $(AM_V_GEN)$(MKDIR_P) $(dir $@) && \
645                         $(RST2MAN) --strict --no-raw \
646                         --no-generator --no-datestamp $< $@
647 else
648 RST2MAN_PROCESS = $(AM_V_GEN)test -f $@ || \
649                 { echo "Generated manual page $@ does not exist"; false; }
650 endif
651
652 %.service: %.service.in Makefile
653         $(SED_PROCESS)
654
655 %.1: %.rst Makefile
656         $(RST2MAN_PROCESS)
657
658 %.8: %.rst Makefile
659         $(RST2MAN_PROCESS)
660
661 src/builtin.h: src/genbuiltin $(builtin_sources)
662         $(AM_V_GEN)$(srcdir)/src/genbuiltin $(builtin_modules) > $@
663
664 tools/%.rules:
665         $(AM_V_at)$(MKDIR_P) tools
666         $(AM_V_GEN)cp $(srcdir)/$(subst 97-,,$@) $@
667
668 $(lib_libbluetooth_la_OBJECTS): $(local_headers)
669
670 lib/bluetooth/%.h: lib/%.h
671         $(AM_V_at)$(MKDIR_P) lib/bluetooth
672         $(AM_V_GEN)$(LN_S) -f $(abspath $<) $@
673
674 ell/shared: Makefile
675         $(AM_V_at)$(MKDIR_P) ell
676         $(AM_V_GEN)for f in $(ell_shared) ; do \
677                 if [ ! -f $$f ] ; then \
678                         $(LN_S) -t ell -f $(abs_srcdir)/../ell/$$f ; \
679                 fi \
680         done > $@
681
682 ell/internal: Makefile
683         $(AM_V_at)$(MKDIR_P) ell
684         $(AM_V_GEN)for f in $(ell_headers) $(ell_sources) ; do \
685         if [ ! -f $$f ] ; then \
686                 $(LN_S) -t ell -f $(abs_srcdir)/../ell/$$f ; \
687                 fi \
688         done > $@
689
690 ell/ell.h: Makefile
691         $(AM_V_at)echo -n > $@
692         $(AM_V_GEN)for f in $(ell_headers) ; do \
693                 echo "#include <$$f>" >> $@ ; \
694         done
695
696 maintainer-clean-local:
697         -rm -rf ell
698
699 if COVERAGE
700 clean-coverage:
701         @lcov --directory $(top_builddir) --zerocounters
702         $(RM) -r coverage $(top_builddir)/coverage.info
703
704 coverage: check
705         @lcov --compat-libtool --directory $(top_builddir) --capture \
706                                 --output-file $(top_builddir)/coverage.info
707         $(AM_V_at)$(MKDIR_P) coverage
708         @genhtml -o coverage/ $(top_builddir)/coverage.info
709
710 clean-local: clean-coverage
711         -find $(top_builddir) -name "*.gcno" -delete
712         -find $(top_builddir) -name "*.gcda" -delete
713         $(RM) -r lib/bluetooth
714
715 else
716 clean-local:
717         -find $(top_builddir) -name "*.gcno" -delete
718         -find $(top_builddir) -name "*.gcda" -delete
719         $(RM) -r lib/bluetooth
720 endif