gatt-database: Add OCF service handling logic
[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:8: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/lc3.h src/shared/tty.h
219
220 if READLINE
221 shared_sources += src/shared/shell.c src/shared/shell.h
222 endif
223
224 if LIBSHARED_ELL
225 src_libshared_ell_la_SOURCES = $(shared_sources) \
226                                src/shared/io-ell.c \
227                                src/shared/timeout-ell.c \
228                                src/shared/mainloop.h \
229                                src/shared/mainloop-ell.c
230 src_libshared_ell_la_LDFLAGS = $(AM_LDFLAGS)
231 src_libshared_ell_la_CFLAGS = $(AM_CFLAGS)
232 endif
233
234 src_libshared_glib_la_SOURCES = $(shared_sources) \
235                                 src/shared/io-glib.c \
236                                 src/shared/timeout-glib.c \
237                                 src/shared/mainloop-glib.c \
238                                 src/shared/mainloop-notify.h \
239                                 src/shared/mainloop-notify.c
240
241 src_libshared_glib_la_LDFLAGS = $(AM_LDFLAGS)
242 src_libshared_glib_la_CFLAGS = $(AM_CFLAGS)
243
244 src_libshared_mainloop_la_SOURCES = $(shared_sources) \
245                                 src/shared/io-mainloop.c \
246                                 src/shared/timeout-mainloop.c \
247                                 src/shared/mainloop.h src/shared/mainloop.c \
248                                 src/shared/mainloop-notify.h \
249                                 src/shared/mainloop-notify.c
250 src_libshared_mainloop_la_LDFLAGS = $(AM_LDFLAGS)
251 src_libshared_mainloop_la_CFLAGS = $(AM_CFLAGS)
252
253 attrib_sources = attrib/att.h attrib/att-database.h attrib/att.c \
254                 attrib/gatt.h attrib/gatt.c \
255                 attrib/gattrib.h attrib/gattrib.c \
256                 attrib/gatt-service.h attrib/gatt-service.c
257
258 btio_sources = btio/btio.h btio/btio.c
259
260 gobex_sources = gobex/gobex.h gobex/gobex.c \
261                         gobex/gobex-defs.h gobex/gobex-defs.c \
262                         gobex/gobex-packet.c gobex/gobex-packet.h \
263                         gobex/gobex-header.c gobex/gobex-header.h \
264                         gobex/gobex-transfer.c gobex/gobex-debug.h \
265                         gobex/gobex-apparam.c gobex/gobex-apparam.h
266
267 builtin_modules =
268 builtin_sources =
269 builtin_cppflags =
270 builtin_nodist =
271 builtin_ldadd =
272
273 include Makefile.plugins
274
275 if MAINTAINER_MODE
276 plugin_LTLIBRARIES += plugins/external-dummy.la
277 plugins_external_dummy_la_SOURCES = plugins/external-dummy.c
278 plugins_external_dummy_la_LDFLAGS = $(AM_LDFLAGS) -module -avoid-version \
279                                     -no-undefined
280 plugins_external_dummy_la_CFLAGS = $(AM_CFLAGS) -fvisibility=hidden
281 endif
282
283 libexec_PROGRAMS += src/bluetoothd
284
285 src_bluetoothd_SOURCES = $(builtin_sources) \
286                         $(attrib_sources) $(btio_sources) \
287                         src/bluetooth.ver \
288                         src/main.c src/log.h src/log.c src/bluez-log.c \
289                         src/backtrace.h src/backtrace.c \
290                         src/rfkill.c src/btd.h src/sdpd.h \
291                         src/sdpd-server.c src/sdpd-request.c \
292                         src/sdpd-service.c src/sdpd-database.c \
293                         src/attrib-server.h src/attrib-server.c \
294                         src/gatt-database.h src/gatt-database.c \
295                         src/sdp-xml.h src/sdp-xml.c \
296                         src/sdp-client.h src/sdp-client.c \
297                         src/textfile.h src/textfile.c \
298                         src/uuid-helper.h src/uuid-helper.c \
299                         src/plugin.h src/plugin.c \
300                         src/storage.h src/storage.c \
301                         src/advertising.h src/advertising.c \
302                         src/agent.h src/agent.c \
303                         src/error.h src/error.c \
304                         src/adapter.h src/adapter.c \
305                         src/adapter_le_vsc_features.h src/adapter_le_vsc_features.c \
306                         src/profile.h src/profile.c \
307                         src/service.h src/service.c \
308                         src/gatt-client.h src/gatt-client.c \
309                         src/device.h src/device.c \
310                         src/dbus-common.c src/dbus-common.h \
311                         src/eir.h src/eir.c \
312                         src/adv_monitor.h src/adv_monitor.c \
313                         src/battery.h src/battery.c \
314                         src/settings.h src/settings.c
315 src_bluetoothd_LDADD = lib/libbluetooth-internal.la \
316                         gdbus/libgdbus-internal.la \
317                         src/libshared-glib.la \
318                         $(BACKTRACE_LIBS) $(GLIB_LIBS) $(DBUS_LIBS) @LIBXML_LIBS@ @INIPARSER_LIBS@ -ldl -lrt
319                         $(builtin_ldadd)
320 src_bluetoothd_LDFLAGS = $(AM_LDFLAGS) -Wl,--export-dynamic \
321                                 -Wl,--version-script=$(srcdir)/src/bluetooth.ver
322
323 src_bluetoothd_DEPENDENCIES = lib/libbluetooth-internal.la \
324                                 gdbus/libgdbus-internal.la \
325                                 src/libshared-glib.la \
326                                 src/bluetooth.service
327
328 src_bluetoothd_CPPFLAGS = $(AM_CPPFLAGS) -DBLUETOOTH_PLUGIN_BUILTIN \
329                                         -DPLUGINDIR=\""$(build_plugindir)"\" \
330                                         $(BACKTRACE_CFLAGS) $(builtin_cppflags)
331 src_bluetoothd_SHORTNAME = bluetoothd
332
333 builtin_files = src/builtin.h $(builtin_nodist)
334
335 nodist_src_bluetoothd_SOURCES = $(builtin_files)
336
337 CLEANFILES += $(builtin_files) src/bluetooth.service
338
339 if MANPAGES
340 man_MANS += src/bluetoothd.8
341 endif
342 manual_pages += src/bluetoothd.8
343
344 EXTRA_DIST += src/genbuiltin src/bluetooth.conf \
345                         src/main_m.conf src/main_w.conf profiles/network/network.conf \
346                         profiles/input/input.conf profiles/proximity/proximity.conf
347
348 test_scripts =
349 unit_tests =
350
351 include Makefile.tools
352 include Makefile.obexd
353 include android/Makefile.am
354 include Makefile.mesh
355
356 if HID2HCI
357 rulesdir = $(UDEV_DIR)/rules.d
358
359 rules_DATA = tools/97-hid2hci.rules
360
361 CLEANFILES += $(rules_DATA)
362 endif
363
364 EXTRA_DIST += tools/hid2hci.rules
365
366 if TEST
367 testdir = $(pkglibdir)/test
368 test_SCRIPTS = $(test_scripts)
369 endif
370
371 EXTRA_DIST += $(test_scripts)
372
373 EXTRA_DIST += doc/assigned-numbers.txt doc/supported-features.txt \
374                                 doc/test-coverage.txt \
375                                 doc/test-runner.txt \
376                                 doc/settings-storage.txt
377
378 EXTRA_DIST += doc/mgmt-api.txt \
379                 doc/adapter-api.txt doc/device-api.txt \
380                 doc/agent-api.txt doc/profile-api.txt \
381                 doc/network-api.txt doc/media-api.txt \
382                 doc/health-api.txt doc/sap-api.txt \
383                 doc/input-api.txt
384
385 EXTRA_DIST += doc/alert-api.txt \
386                 doc/proximity-api.txt doc/heartrate-api.txt \
387                 doc/thermometer-api.txt doc/cyclingspeed-api.txt \
388                 doc/gatt-api.txt doc/advertising-api.txt
389
390 EXTRA_DIST += doc/obex-api.txt doc/obex-agent-api.txt
391
392 EXTRA_DIST += doc/pics-opp.txt doc/pixit-opp.txt \
393                 doc/pts-opp.txt
394
395 EXTRA_DIST += doc/btsnoop.txt
396
397 EXTRA_DIST += tools/magic.btsnoop
398
399 AM_CFLAGS += @LIBXML_CFLAGS@ @INIPARSER_CFLAGS@
400
401 AM_CPPFLAGS += $(DBUS_CFLAGS) $(GLIB_CFLAGS) -I$(builddir)/lib
402
403 unit_tests += unit/test-tester
404
405 unit_test_tester_SOURCES = unit/test-tester.c
406 unit_test_tester_LDADD = src/libshared-glib.la lib/libbluetooth-internal.la \
407                                                                 $(GLIB_LIBS)
408
409 unit_tests += unit/test-eir
410
411 unit_test_eir_SOURCES = unit/test-eir.c src/eir.c src/uuid-helper.c
412 unit_test_eir_LDADD = src/libshared-glib.la lib/libbluetooth-internal.la \
413                                                                 $(GLIB_LIBS)
414
415 unit_tests += unit/test-uuid
416
417 unit_test_uuid_SOURCES = unit/test-uuid.c
418 unit_test_uuid_LDADD = src/libshared-glib.la lib/libbluetooth-internal.la \
419                                                                 $(GLIB_LIBS)
420
421 unit_tests += unit/test-textfile
422
423 unit_test_textfile_SOURCES = unit/test-textfile.c src/textfile.h src/textfile.c
424 unit_test_textfile_LDADD = src/libshared-glib.la $(GLIB_LIBS)
425
426 unit_tests += unit/test-crc
427
428 unit_test_crc_SOURCES = unit/test-crc.c monitor/crc.h monitor/crc.c
429 unit_test_crc_LDADD = src/libshared-glib.la $(GLIB_LIBS)
430
431 if TIZEN_CRYPTO_TESTS
432 unit_tests += unit/test-crypto
433
434 unit_test_crypto_SOURCES = unit/test-crypto.c
435 unit_test_crypto_LDADD = src/libshared-glib.la @GLIB_LIBS@
436 endif
437
438 unit_tests += unit/test-ecc
439
440 unit_test_ecc_SOURCES = unit/test-ecc.c
441 unit_test_ecc_LDADD = src/libshared-glib.la $(GLIB_LIBS)
442
443 unit_tests += unit/test-ringbuf unit/test-queue
444
445 unit_test_ringbuf_SOURCES = unit/test-ringbuf.c
446 unit_test_ringbuf_LDADD = src/libshared-glib.la $(GLIB_LIBS)
447
448 unit_test_queue_SOURCES = unit/test-queue.c
449 unit_test_queue_LDADD = src/libshared-glib.la $(GLIB_LIBS)
450
451 unit_tests += unit/test-mgmt
452
453 unit_test_mgmt_SOURCES = unit/test-mgmt.c
454 unit_test_mgmt_LDADD = src/libshared-glib.la $(GLIB_LIBS)
455
456 unit_tests += unit/test-uhid
457
458 unit_test_uhid_SOURCES = unit/test-uhid.c
459 unit_test_uhid_LDADD = src/libshared-glib.la $(GLIB_LIBS)
460
461 unit_tests += unit/test-sdp
462
463 unit_test_sdp_SOURCES = unit/test-sdp.c \
464                                 src/sdpd.h src/sdpd-database.c \
465                                 src/log.h src/log.c \
466                                 src/sdpd-service.c src/sdpd-request.c
467 unit_test_sdp_LDADD = lib/libbluetooth-internal.la \
468                                 src/libshared-glib.la $(GLIB_LIBS)
469
470 unit_tests += unit/test-avdtp
471
472 unit_test_avdtp_SOURCES = unit/test-avdtp.c \
473                                 src/log.h src/log.c \
474                                 android/avdtp.c android/avdtp.h
475 unit_test_avdtp_LDADD = src/libshared-glib.la $(GLIB_LIBS)
476
477 unit_tests += unit/test-avctp
478
479 unit_test_avctp_SOURCES = unit/test-avctp.c \
480                                 src/log.h src/log.c \
481                                 android/avctp.c android/avctp.h
482 unit_test_avctp_LDADD = src/libshared-glib.la $(GLIB_LIBS)
483
484 unit_tests += unit/test-avrcp
485
486 unit_test_avrcp_SOURCES = unit/test-avrcp.c \
487                                 src/log.h src/log.c \
488                                 android/avctp.c android/avctp.h \
489                                 android/avrcp-lib.c android/avrcp-lib.h
490 unit_test_avrcp_LDADD = lib/libbluetooth-internal.la \
491                                 src/libshared-glib.la $(GLIB_LIBS)
492
493 unit_tests += unit/test-hfp
494
495 unit_test_hfp_SOURCES = unit/test-hfp.c
496 unit_test_hfp_LDADD = src/libshared-glib.la $(GLIB_LIBS)
497
498 unit_tests += unit/test-gdbus-client
499
500 unit_test_gdbus_client_SOURCES = unit/test-gdbus-client.c
501 unit_test_gdbus_client_LDADD = gdbus/libgdbus-internal.la \
502                                 src/libshared-glib.la $(GLIB_LIBS) $(DBUS_LIBS)
503
504 if OBEX
505 unit_tests += unit/test-gobex-header unit/test-gobex-packet unit/test-gobex \
506                         unit/test-gobex-transfer unit/test-gobex-apparam
507
508 unit_test_gobex_SOURCES = $(gobex_sources) unit/util.c unit/util.h \
509                                                 unit/test-gobex.c
510 unit_test_gobex_LDADD = $(GLIB_LIBS)
511
512 unit_test_gobex_packet_SOURCES = $(gobex_sources) unit/util.c unit/util.h \
513                                                 unit/test-gobex-packet.c
514 unit_test_gobex_packet_LDADD = $(GLIB_LIBS)
515
516 unit_test_gobex_header_SOURCES = $(gobex_sources) unit/util.c unit/util.h \
517                                                 unit/test-gobex-header.c
518 unit_test_gobex_header_LDADD = $(GLIB_LIBS)
519
520 unit_test_gobex_transfer_SOURCES = $(gobex_sources) unit/util.c unit/util.h \
521                                                 unit/test-gobex-transfer.c
522 unit_test_gobex_transfer_LDADD = $(GLIB_LIBS)
523
524 unit_test_gobex_apparam_SOURCES = $(gobex_sources) unit/util.c unit/util.h \
525                                                 unit/test-gobex-apparam.c
526 unit_test_gobex_apparam_LDADD = $(GLIB_LIBS)
527 endif
528
529 unit_tests += unit/test-lib
530
531 unit_test_lib_SOURCES = unit/test-lib.c
532 unit_test_lib_LDADD = src/libshared-glib.la \
533                                 lib/libbluetooth-internal.la $(GLIB_LIBS)
534
535 unit_tests += unit/test-gatt
536
537 unit_test_gatt_SOURCES = unit/test-gatt.c
538 unit_test_gatt_LDADD = src/libshared-glib.la \
539                                 lib/libbluetooth-internal.la $(GLIB_LIBS)
540
541 unit_tests += unit/test-hog
542
543 unit_test_hog_SOURCES = unit/test-hog.c \
544                         $(btio_sources) \
545                         profiles/input/hog-lib.h profiles/input/hog-lib.c \
546                         profiles/scanparam/scpp.h profiles/scanparam/scpp.c \
547                         profiles/battery/bas.h profiles/battery/bas.c \
548                         profiles/deviceinfo/dis.h profiles/deviceinfo/dis.c \
549                         src/log.h src/log.c \
550                         attrib/att.h attrib/att.c \
551                         attrib/gatt.h attrib/gatt.c \
552                         attrib/gattrib.h attrib/gattrib.c
553 unit_test_hog_LDADD = src/libshared-glib.la \
554                                 lib/libbluetooth-internal.la $(GLIB_LIBS)
555
556 unit_tests += unit/test-gattrib
557
558 unit_test_gattrib_SOURCES = unit/test-gattrib.c attrib/gattrib.c \
559                                         $(btio_sources) src/log.h src/log.c src/bluez-log.c
560 unit_test_gattrib_LDADD = lib/libbluetooth-internal.la \
561                         src/libshared-glib.la \
562                         $(GLIB_LIBS) $(DBUS_LIBS) @LIBXML_LIBS@ -ldl -lrt
563
564 if MIDI
565 unit_tests += unit/test-midi
566 unit_test_midi_CPPFLAGS = $(AM_CPPFLAGS) $(ALSA_CFLAGS) -DMIDI_TEST
567 unit_test_midi_SOURCES = unit/test-midi.c \
568                         profiles/midi/libmidi.h \
569                         profiles/midi/libmidi.c
570 unit_test_midi_LDADD = src/libshared-glib.la \
571                         $(GLIB_LIBS) $(ALSA_LIBS)
572 endif
573
574 if MESH
575 unit_tests += unit/test-mesh-crypto
576 unit_test_mesh_crypto_CPPFLAGS = $(ell_cflags)
577 unit_test_mesh_crypto_SOURCES = unit/test-mesh-crypto.c \
578                                mesh/crypto.h ell/internal ell/ell.h \
579                                $(ell_sources)
580 unit_test_mesh_crypto_LDADD = src/libshared-ell.la \
581                        $(ell_ldadd)
582 endif
583
584 if MAINTAINER_MODE
585 noinst_PROGRAMS += $(unit_tests)
586 endif
587
588 TESTS = $(unit_tests)
589 AM_TESTS_ENVIRONMENT = MALLOC_CHECK_=3 MALLOC_PERTURB_=69
590
591 if DBUS_RUN_SESSION
592 AM_TESTS_ENVIRONMENT += dbus-run-session --
593 endif
594
595 if VALGRIND
596 LOG_COMPILER = valgrind --error-exitcode=1 --num-callers=30
597 LOG_FLAGS = --trace-children=yes --leak-check=full --show-reachable=no \
598                 --suppressions=$(srcdir)/tools/valgrind.supp --quiet
599 endif
600
601 pkgconfigdir = $(libdir)/pkgconfig
602
603 if LIBRARY
604 pkgconfig_DATA = lib/bluez.pc
605 endif
606
607 EXTRA_DIST += $(manual_pages) $(patsubst %.1,%.rst, \
608                                 $(patsubst %.8,%.rst,$(manual_pages)))
609
610 DISTCHECK_CONFIGURE_FLAGS = --disable-datafiles --enable-library \
611                                                 --enable-health \
612                                                 --enable-midi \
613                                                 --enable-manpages \
614                                                 --enable-android \
615                                                 --disable-systemd \
616                                                 --disable-udev
617
618 DISTCLEANFILES = $(pkgconfig_DATA) $(unit_tests) $(manual_pages)
619
620 MAINTAINERCLEANFILES = Makefile.in \
621         aclocal.m4 configure config.h.in config.sub config.guess \
622         ltmain.sh depcomp compile missing install-sh mkinstalldirs test-driver
623
624 SED_PROCESS = $(AM_V_GEN)$(MKDIR_P) $(dir $@) && \
625                 $(SED) -e 's,@pkglibexecdir\@,$(pkglibexecdir),g' \
626                 < $< > $@
627
628 if RUN_RST2MAN
629 RST2MAN_PROCESS = $(AM_V_GEN)$(MKDIR_P) $(dir $@) && \
630                         $(RST2MAN) --strict --no-raw \
631                         --no-generator --no-datestamp $< $@
632 else
633 RST2MAN_PROCESS = $(AM_V_GEN)test -f $@ || \
634                 { echo "Generated manual page $@ does not exist"; false; }
635 endif
636
637 %.service: %.service.in Makefile
638         $(SED_PROCESS)
639
640 %.1: %.rst Makefile
641         $(RST2MAN_PROCESS)
642
643 %.8: %.rst Makefile
644         $(RST2MAN_PROCESS)
645
646 src/builtin.h: src/genbuiltin $(builtin_sources)
647         $(AM_V_GEN)$(srcdir)/src/genbuiltin $(builtin_modules) > $@
648
649 tools/%.rules:
650         $(AM_V_at)$(MKDIR_P) tools
651         $(AM_V_GEN)cp $(srcdir)/$(subst 97-,,$@) $@
652
653 $(lib_libbluetooth_la_OBJECTS): $(local_headers)
654
655 lib/bluetooth/%.h: lib/%.h
656         $(AM_V_at)$(MKDIR_P) lib/bluetooth
657         $(AM_V_GEN)$(LN_S) -f $(abspath $<) $@
658
659 ell/shared: Makefile
660         $(AM_V_at)$(MKDIR_P) ell
661         $(AM_V_GEN)for f in $(ell_shared) ; do \
662                 if [ ! -f $$f ] ; then \
663                         $(LN_S) -t ell -f $(abs_srcdir)/../ell/$$f ; \
664                 fi \
665         done > $@
666
667 ell/internal: Makefile
668         $(AM_V_at)$(MKDIR_P) ell
669         $(AM_V_GEN)for f in $(ell_headers) $(ell_sources) ; do \
670         if [ ! -f $$f ] ; then \
671                 $(LN_S) -t ell -f $(abs_srcdir)/../ell/$$f ; \
672                 fi \
673         done > $@
674
675 ell/ell.h: Makefile
676         $(AM_V_at)echo -n > $@
677         $(AM_V_GEN)for f in $(ell_headers) ; do \
678                 echo "#include <$$f>" >> $@ ; \
679         done
680
681 maintainer-clean-local:
682         -rm -rf ell
683
684 if COVERAGE
685 clean-coverage:
686         @lcov --directory $(top_builddir) --zerocounters
687         $(RM) -r coverage $(top_builddir)/coverage.info
688
689 coverage: check
690         @lcov --compat-libtool --directory $(top_builddir) --capture \
691                                 --output-file $(top_builddir)/coverage.info
692         $(AM_V_at)$(MKDIR_P) coverage
693         @genhtml -o coverage/ $(top_builddir)/coverage.info
694
695 clean-local: clean-coverage
696         -find $(top_builddir) -name "*.gcno" -delete
697         -find $(top_builddir) -name "*.gcda" -delete
698         $(RM) -r lib/bluetooth
699
700 else
701 clean-local:
702         -find $(top_builddir) -name "*.gcno" -delete
703         -find $(top_builddir) -name "*.gcda" -delete
704         $(RM) -r lib/bluetooth
705 endif