Makefile.am 18 KB

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