Linux-Bluetooth Archive on lore.kernel.org
 help / Atom feed
* [PATCH bluez] build system refresh
@ 2018-11-18 16:07 Jan Engelhardt
  2018-11-18 16:07 ` [PATCH 1/8] build: rename libexecdir to pkglibexecdir Jan Engelhardt
                   ` (7 more replies)
  0 siblings, 8 replies; 35+ messages in thread
From: Jan Engelhardt @ 2018-11-18 16:07 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: jengelh


The following changes since commit 3ef0ce954b66fdf45538a6cdc629f3dac6642832:

  bluetooth.conf: remove deprecated at_console statement (2018-11-07 13:30:28 +0200)

are available in the Git repository at:

  git://github.com/jengelh/bluez 

for you to fetch changes up to b489fd9a11f7d03ec3125297ee71e9f4135e9eda:

  build: add missing BACKTRACE_CFLAGS (2018-11-18 13:28:27 +0100)

----------------------------------------------------------------
Jan Engelhardt (8):
      build: rename libexecdir to pkglibexecdir
      build: change @foo@ to $(foo) in automake makefiles
      build: -l arguments to belong into LDADD/LIBADD not LDFLAGS
      build: -D/-I arguments go into CPPFLAGS
      build: add missing ELL_CFLAGS
      build: add missing UDEV_CFLAGS
      build: add missing ALSA_CFLAGS
      build: add missing BACKTRACE_CFLAGS

 Makefile.am                       | 82 ++++++++++++++++++++++++++++++++++++++++++----------------------------------------
 Makefile.mesh                     |  8 ++++++--
 Makefile.obexd                    | 15 ++++++++-------
 Makefile.plugins                  |  9 ++++++---
 Makefile.tools                    | 66 +++++++++++++++++++++++++++++++++++-------------------------------
 android/Makefile.am               | 41 +++++++++++++++++++++--------------------
 obexd/src/obex.service.in         |  2 +-
 src/bluetooth.service.in          |  2 +-
 tools/bluetooth-logger.service.in |  2 +-
 9 files changed, 121 insertions(+), 106 deletions(-)


^ permalink raw reply	[flat|nested] 35+ messages in thread

* [PATCH 1/8] build: rename libexecdir to pkglibexecdir
  2018-11-18 16:07 [PATCH bluez] build system refresh Jan Engelhardt
@ 2018-11-18 16:07 ` Jan Engelhardt
  2018-11-21 11:29   ` Luiz Augusto von Dentz
  2018-11-18 16:07 ` [PATCH 2/8] build: change @foo@ to $(foo) in automake makefiles Jan Engelhardt
                   ` (6 subsequent siblings)
  7 siblings, 1 reply; 35+ messages in thread
From: Jan Engelhardt @ 2018-11-18 16:07 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: jengelh

When files are to be placed not in libexecdir but a subdirectory of
it, automake has a variable name reserved for exactly that purpose
(and a default value, which Makefile.am will override), called
pkglibexecdir. Let's use it.
---
 Makefile.am                       | 4 ++--
 obexd/src/obex.service.in         | 2 +-
 src/bluetooth.service.in          | 2 +-
 tools/bluetooth-logger.service.in | 2 +-
 4 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/Makefile.am b/Makefile.am
index 0ccf393c6..eee70b88b 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -19,7 +19,7 @@ CLEANFILES =
 
 EXTRA_DIST =
 
-libexecdir = @libexecdir@/bluetooth
+pkglibexecdir = @libexecdir@/bluetooth
 
 libexec_PROGRAMS =
 
@@ -489,7 +489,7 @@ MAINTAINERCLEANFILES = Makefile.in \
 	ltmain.sh depcomp compile missing install-sh mkinstalldirs test-driver
 
 SED_PROCESS = $(AM_V_GEN)$(MKDIR_P) $(dir $@) && \
-		$(SED) -e 's,@libexecdir\@,$(libexecdir),g' \
+		$(SED) -e 's,@pkglibexecdir\@,$(pkglibexecdir),g' \
 		< $< > $@
 
 %.service: %.service.in Makefile
diff --git a/obexd/src/obex.service.in b/obexd/src/obex.service.in
index bca3aef66..fc0dce993 100644
--- a/obexd/src/obex.service.in
+++ b/obexd/src/obex.service.in
@@ -4,7 +4,7 @@ Description=Bluetooth OBEX service
 [Service]
 Type=dbus
 BusName=org.bluez.obex
-ExecStart=@libexecdir@/obexd
+ExecStart=@pkglibexecdir@/obexd
 
 [Install]
 Alias=dbus-org.bluez.obex.service
diff --git a/src/bluetooth.service.in b/src/bluetooth.service.in
index f799f65f0..f9faaa452 100644
--- a/src/bluetooth.service.in
+++ b/src/bluetooth.service.in
@@ -6,7 +6,7 @@ ConditionPathIsDirectory=/sys/class/bluetooth
 [Service]
 Type=dbus
 BusName=org.bluez
-ExecStart=@libexecdir@/bluetoothd
+ExecStart=@pkglibexecdir@/bluetoothd
 NotifyAccess=main
 #WatchdogSec=10
 #Restart=on-failure
diff --git a/tools/bluetooth-logger.service.in b/tools/bluetooth-logger.service.in
index 026a2f130..009002731 100644
--- a/tools/bluetooth-logger.service.in
+++ b/tools/bluetooth-logger.service.in
@@ -4,7 +4,7 @@ ConditionPathIsDirectory=/sys/class/bluetooth
 
 [Service]
 Type=simple
-ExecStart=@libexecdir@/btmon-logger -p -b /var/log/bluetooth/hci.log
+ExecStart=@pkglibexecdir@/btmon-logger -p -b /var/log/bluetooth/hci.log
 NotifyAccess=main
 CapabilityBoundingSet=CAP_NET_RAW
 LimitNPROC=1
-- 
2.19.1


^ permalink raw reply	[flat|nested] 35+ messages in thread

* [PATCH 2/8] build: change @foo@ to $(foo) in automake makefiles
  2018-11-18 16:07 [PATCH bluez] build system refresh Jan Engelhardt
  2018-11-18 16:07 ` [PATCH 1/8] build: rename libexecdir to pkglibexecdir Jan Engelhardt
@ 2018-11-18 16:07 ` Jan Engelhardt
  2018-11-18 16:07 ` [PATCH 3/8] build: -l arguments to belong into LDADD/LIBADD not LDFLAGS Jan Engelhardt
                   ` (5 subsequent siblings)
  7 siblings, 0 replies; 35+ messages in thread
From: Jan Engelhardt @ 2018-11-18 16:07 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: jengelh

When using automake, all AC_SUBSTed variables are made available as
make variables, so that they can also be set at make time. Therefore,
they need not use the @harcoded@ style.
---
 Makefile.am         | 70 ++++++++++++++++++++++-----------------------
 Makefile.mesh       |  4 +--
 Makefile.obexd      | 10 +++----
 Makefile.plugins    |  6 ++--
 Makefile.tools      | 62 +++++++++++++++++++--------------------
 android/Makefile.am | 18 ++++++------
 6 files changed, 85 insertions(+), 85 deletions(-)

diff --git a/Makefile.am b/Makefile.am
index eee70b88b..33f4f3b98 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -19,11 +19,11 @@ CLEANFILES =
 
 EXTRA_DIST =
 
-pkglibexecdir = @libexecdir@/bluetooth
+pkglibexecdir = $(libexecdir)/bluetooth
 
 libexec_PROGRAMS =
 
-includedir = @includedir@/bluetooth
+includedir = $(includedir)/bluetooth
 
 include_HEADERS =
 
@@ -31,7 +31,7 @@ AM_CFLAGS = $(WARNING_CFLAGS) $(MISC_CFLAGS)
 AM_LDFLAGS = $(MISC_LDFLAGS)
 
 if DATAFILES
-dbusdir = @DBUS_CONFDIR@/dbus-1/system.d
+dbusdir = $(DBUS_CONFDIR)/dbus-1/system.d
 dbus_DATA = src/bluetooth.conf
 
 confdir = $(sysconfdir)/bluetooth
@@ -42,10 +42,10 @@ state_DATA =
 endif
 
 if SYSTEMD
-systemdsystemunitdir = @SYSTEMD_SYSTEMUNITDIR@
+systemdsystemunitdir = $(SYSTEMD_SYSTEMUNITDIR)
 systemdsystemunit_DATA = src/bluetooth.service
 
-dbussystembusdir = @DBUS_SYSTEMBUSDIR@
+dbussystembusdir = $(DBUS_SYSTEMBUSDIR)
 dbussystembus_DATA = src/org.bluez.service
 endif
 
@@ -203,7 +203,7 @@ src_bluetoothd_SOURCES = $(builtin_sources) \
 src_bluetoothd_LDADD = lib/libbluetooth-internal.la \
 			gdbus/libgdbus-internal.la \
 			src/libshared-glib.la \
-			@BACKTRACE_LIBS@ @GLIB_LIBS@ @DBUS_LIBS@ -ldl -lrt \
+			$(BACKTRACE_LIBS) $(GLIB_LIBS) $(DBUS_LIBS) -ldl -lrt \
 			$(builtin_ldadd)
 src_bluetoothd_LDFLAGS = $(AM_LDFLAGS) -Wl,--export-dynamic \
 				-Wl,--version-script=$(srcdir)/src/bluetooth.ver
@@ -238,7 +238,7 @@ include android/Makefile.am
 include Makefile.mesh
 
 if HID2HCI
-rulesdir = @UDEV_DIR@/rules.d
+rulesdir = $(UDEV_DIR)/rules.d
 
 rules_DATA = tools/97-hid2hci.rules
 
@@ -277,7 +277,7 @@ EXTRA_DIST += doc/btsnoop.txt
 
 EXTRA_DIST += tools/magic.btsnoop
 
-AM_CFLAGS += @DBUS_CFLAGS@ @GLIB_CFLAGS@
+AM_CFLAGS += $(DBUS_CFLAGS) $(GLIB_CFLAGS)
 
 AM_CPPFLAGS = -I$(builddir)/lib
 
@@ -286,51 +286,51 @@ unit_tests += unit/test-eir
 
 unit_test_eir_SOURCES = unit/test-eir.c src/eir.c src/uuid-helper.c
 unit_test_eir_LDADD = src/libshared-glib.la lib/libbluetooth-internal.la \
-								@GLIB_LIBS@
+								$(GLIB_LIBS)
 
 unit_tests += unit/test-uuid
 
 unit_test_uuid_SOURCES = unit/test-uuid.c
 unit_test_uuid_LDADD = src/libshared-glib.la lib/libbluetooth-internal.la \
-								@GLIB_LIBS@
+								$(GLIB_LIBS)
 
 unit_tests += unit/test-textfile
 
 unit_test_textfile_SOURCES = unit/test-textfile.c src/textfile.h src/textfile.c
-unit_test_textfile_LDADD = src/libshared-glib.la @GLIB_LIBS@
+unit_test_textfile_LDADD = src/libshared-glib.la $(GLIB_LIBS)
 
 unit_tests += unit/test-crc
 
 unit_test_crc_SOURCES = unit/test-crc.c monitor/crc.h monitor/crc.c
-unit_test_crc_LDADD = src/libshared-glib.la @GLIB_LIBS@
+unit_test_crc_LDADD = src/libshared-glib.la $(GLIB_LIBS)
 
 unit_tests += unit/test-crypto
 
 unit_test_crypto_SOURCES = unit/test-crypto.c
-unit_test_crypto_LDADD = src/libshared-glib.la @GLIB_LIBS@
+unit_test_crypto_LDADD = src/libshared-glib.la $(GLIB_LIBS)
 
 unit_tests += unit/test-ecc
 
 unit_test_ecc_SOURCES = unit/test-ecc.c
-unit_test_ecc_LDADD = src/libshared-glib.la @GLIB_LIBS@
+unit_test_ecc_LDADD = src/libshared-glib.la $(GLIB_LIBS)
 
 unit_tests += unit/test-ringbuf unit/test-queue
 
 unit_test_ringbuf_SOURCES = unit/test-ringbuf.c
-unit_test_ringbuf_LDADD = src/libshared-glib.la @GLIB_LIBS@
+unit_test_ringbuf_LDADD = src/libshared-glib.la $(GLIB_LIBS)
 
 unit_test_queue_SOURCES = unit/test-queue.c
-unit_test_queue_LDADD = src/libshared-glib.la @GLIB_LIBS@
+unit_test_queue_LDADD = src/libshared-glib.la $(GLIB_LIBS)
 
 unit_tests += unit/test-mgmt
 
 unit_test_mgmt_SOURCES = unit/test-mgmt.c
-unit_test_mgmt_LDADD = src/libshared-glib.la @GLIB_LIBS@
+unit_test_mgmt_LDADD = src/libshared-glib.la $(GLIB_LIBS)
 
 unit_tests += unit/test-uhid
 
 unit_test_uhid_SOURCES = unit/test-uhid.c
-unit_test_uhid_LDADD = src/libshared-glib.la @GLIB_LIBS@
+unit_test_uhid_LDADD = src/libshared-glib.la $(GLIB_LIBS)
 
 unit_tests += unit/test-sdp
 
@@ -339,21 +339,21 @@ unit_test_sdp_SOURCES = unit/test-sdp.c \
 				src/log.h src/log.c \
 				src/sdpd-service.c src/sdpd-request.c
 unit_test_sdp_LDADD = lib/libbluetooth-internal.la \
-				src/libshared-glib.la @GLIB_LIBS@
+				src/libshared-glib.la $(GLIB_LIBS)
 
 unit_tests += unit/test-avdtp
 
 unit_test_avdtp_SOURCES = unit/test-avdtp.c \
 				src/log.h src/log.c \
 				android/avdtp.c android/avdtp.h
-unit_test_avdtp_LDADD = src/libshared-glib.la @GLIB_LIBS@
+unit_test_avdtp_LDADD = src/libshared-glib.la $(GLIB_LIBS)
 
 unit_tests += unit/test-avctp
 
 unit_test_avctp_SOURCES = unit/test-avctp.c \
 				src/log.h src/log.c \
 				android/avctp.c android/avctp.h
-unit_test_avctp_LDADD = src/libshared-glib.la @GLIB_LIBS@
+unit_test_avctp_LDADD = src/libshared-glib.la $(GLIB_LIBS)
 
 unit_tests += unit/test-avrcp
 
@@ -362,53 +362,53 @@ unit_test_avrcp_SOURCES = unit/test-avrcp.c \
 				android/avctp.c android/avctp.h \
 				android/avrcp-lib.c android/avrcp-lib.h
 unit_test_avrcp_LDADD = lib/libbluetooth-internal.la \
-				src/libshared-glib.la @GLIB_LIBS@
+				src/libshared-glib.la $(GLIB_LIBS)
 
 unit_tests += unit/test-hfp
 
 unit_test_hfp_SOURCES = unit/test-hfp.c
-unit_test_hfp_LDADD = src/libshared-glib.la @GLIB_LIBS@
+unit_test_hfp_LDADD = src/libshared-glib.la $(GLIB_LIBS)
 
 unit_tests += unit/test-gdbus-client
 
 unit_test_gdbus_client_SOURCES = unit/test-gdbus-client.c
 unit_test_gdbus_client_LDADD = gdbus/libgdbus-internal.la \
-				src/libshared-glib.la @GLIB_LIBS@ @DBUS_LIBS@
+				src/libshared-glib.la $(GLIB_LIBS) $(DBUS_LIBS)
 
 unit_tests += unit/test-gobex-header unit/test-gobex-packet unit/test-gobex \
 			unit/test-gobex-transfer unit/test-gobex-apparam
 
 unit_test_gobex_SOURCES = $(gobex_sources) unit/util.c unit/util.h \
 						unit/test-gobex.c
-unit_test_gobex_LDADD = @GLIB_LIBS@
+unit_test_gobex_LDADD = $(GLIB_LIBS)
 
 unit_test_gobex_packet_SOURCES = $(gobex_sources) unit/util.c unit/util.h \
 						unit/test-gobex-packet.c
-unit_test_gobex_packet_LDADD = @GLIB_LIBS@
+unit_test_gobex_packet_LDADD = $(GLIB_LIBS)
 
 unit_test_gobex_header_SOURCES = $(gobex_sources) unit/util.c unit/util.h \
 						unit/test-gobex-header.c
-unit_test_gobex_header_LDADD = @GLIB_LIBS@
+unit_test_gobex_header_LDADD = $(GLIB_LIBS)
 
 unit_test_gobex_transfer_SOURCES = $(gobex_sources) unit/util.c unit/util.h \
 						unit/test-gobex-transfer.c
-unit_test_gobex_transfer_LDADD = @GLIB_LIBS@
+unit_test_gobex_transfer_LDADD = $(GLIB_LIBS)
 
 unit_test_gobex_apparam_SOURCES = $(gobex_sources) unit/util.c unit/util.h \
 						unit/test-gobex-apparam.c
-unit_test_gobex_apparam_LDADD = @GLIB_LIBS@
+unit_test_gobex_apparam_LDADD = $(GLIB_LIBS)
 
 unit_tests += unit/test-lib
 
 unit_test_lib_SOURCES = unit/test-lib.c
 unit_test_lib_LDADD = src/libshared-glib.la \
-				lib/libbluetooth-internal.la @GLIB_LIBS@
+				lib/libbluetooth-internal.la $(GLIB_LIBS)
 
 unit_tests += unit/test-gatt
 
 unit_test_gatt_SOURCES = unit/test-gatt.c
 unit_test_gatt_LDADD = src/libshared-glib.la \
-				lib/libbluetooth-internal.la @GLIB_LIBS@
+				lib/libbluetooth-internal.la $(GLIB_LIBS)
 
 unit_tests += unit/test-hog
 
@@ -423,7 +423,7 @@ unit_test_hog_SOURCES = unit/test-hog.c \
 			attrib/gatt.h attrib/gatt.c \
 			attrib/gattrib.h attrib/gattrib.c
 unit_test_hog_LDADD = src/libshared-glib.la \
-				lib/libbluetooth-internal.la @GLIB_LIBS@
+				lib/libbluetooth-internal.la $(GLIB_LIBS)
 
 unit_tests += unit/test-gattrib
 
@@ -431,16 +431,16 @@ unit_test_gattrib_SOURCES = unit/test-gattrib.c attrib/gattrib.c \
 					$(btio_sources) src/log.h src/log.c
 unit_test_gattrib_LDADD = lib/libbluetooth-internal.la \
 			src/libshared-glib.la \
-			@GLIB_LIBS@ @DBUS_LIBS@ -ldl -lrt
+			$(GLIB_LIBS) $(DBUS_LIBS) -ldl -lrt
 
 if MIDI
 unit_tests += unit/test-midi
-unit_test_midi_CFLAGS = $(AM_CFLAGS) @ALSA_CFLAGS@ -DMIDI_TEST
+unit_test_midi_CFLAGS = $(AM_CFLAGS) $(ALSA_CFLAGS) -DMIDI_TEST
 unit_test_midi_SOURCES = unit/test-midi.c \
 			profiles/midi/libmidi.h \
 			profiles/midi/libmidi.c
 unit_test_midi_LDADD = src/libshared-glib.la \
-			@GLIB_LIBS@ @ALSA_LIBS@
+			$(GLIB_LIBS) $(ALSA_LIBS)
 endif
 
 if MAINTAINER_MODE
diff --git a/Makefile.mesh b/Makefile.mesh
index 0df7db2be..50bcc19ad 100644
--- a/Makefile.mesh
+++ b/Makefile.mesh
@@ -25,7 +25,7 @@ mesh_meshd_SOURCES = $(mesh_sources) mesh/main.c
 
 mesh_meshd_LDADD = src/shared/ecc.lo src/shared/queue.lo src/shared/io-ell.lo \
 				src/shared/util.lo src/shared/hci.lo src/shared/mgmt.lo \
-				@DBUS_LIBS@ @ELL_LIBS@ -ljson-c
+				$(DBUS_LIBS) $(ELL_LIBS) -ljson-c
 
 noinst_PROGRAMS += mesh/btmesh
 
@@ -37,6 +37,6 @@ mesh_btmesh_SOURCES = $(mesh_sources) \
 mesh_btmesh_LDADD = src/shared/ecc.lo src/shared/queue.lo src/shared/io-ell.lo \
 				src/shared/util.lo src/shared/hci.lo src/shared/mgmt.lo \
 				src/libshared-mainloop.la \
-				-lreadline @ELL_LIBS@ -ljson-c
+				-lreadline $(ELL_LIBS) -ljson-c
 
 endif
diff --git a/Makefile.obexd b/Makefile.obexd
index cd3ace425..9180d7eea 100644
--- a/Makefile.obexd
+++ b/Makefile.obexd
@@ -1,8 +1,8 @@
 if SYSTEMD
-systemduserunitdir = @SYSTEMD_USERUNITDIR@
+systemduserunitdir = $(SYSTEMD_USERUNITDIR)
 systemduserunit_DATA = obexd/src/obex.service
 
-dbussessionbusdir = @DBUS_SESSIONBUSDIR@
+dbussessionbusdir = $(DBUS_SESSIONBUSDIR)
 dbussessionbus_DATA = obexd/src/org.bluez.obex.service
 endif
 
@@ -79,12 +79,12 @@ obexd_src_obexd_SOURCES = $(btio_sources) $(gobex_sources) \
 			obexd/src/map_ap.h
 obexd_src_obexd_LDADD = lib/libbluetooth-internal.la \
 			gdbus/libgdbus-internal.la \
-			@ICAL_LIBS@ @DBUS_LIBS@ @GLIB_LIBS@ -ldl
+			$(ICAL_LIBS) $(DBUS_LIBS) $(GLIB_LIBS) -ldl
 
 obexd_src_obexd_LDFLAGS = -Wl,--export-dynamic
 
-obexd_src_obexd_CFLAGS = $(AM_CFLAGS) @GLIB_CFLAGS@ @DBUS_CFLAGS@ \
-				@ICAL_CFLAGS@ -DOBEX_PLUGIN_BUILTIN \
+obexd_src_obexd_CFLAGS = $(AM_CFLAGS) $(GLIB_CFLAGS) $(DBUS_CFLAGS) \
+				$(ICAL_CFLAGS) -DOBEX_PLUGIN_BUILTIN \
 				-DPLUGINDIR=\""$(obex_plugindir)"\" \
 				-fPIC -D_FILE_OFFSET_BITS=64
 
diff --git a/Makefile.plugins b/Makefile.plugins
index 3ab7c1c18..1c9919d71 100644
--- a/Makefile.plugins
+++ b/Makefile.plugins
@@ -97,7 +97,7 @@ builtin_modules += midi
 builtin_sources += profiles/midi/midi.c \
 			profiles/midi/libmidi.h \
 			profiles/midi/libmidi.c
-builtin_ldadd += @ALSA_LIBS@
+builtin_ldadd += $(ALSA_LIBS)
 endif
 
 builtin_modules += battery
@@ -107,6 +107,6 @@ if SIXAXIS
 plugin_LTLIBRARIES += plugins/sixaxis.la
 plugins_sixaxis_la_SOURCES = plugins/sixaxis.c
 plugins_sixaxis_la_LDFLAGS = $(AM_LDFLAGS) -module -avoid-version \
-						-no-undefined @UDEV_LIBS@
-plugins_sixaxis_la_CFLAGS = $(AM_CFLAGS) -fvisibility=hidden @UDEV_CFLAGS@
+						-no-undefined $(UDEV_LIBS)
+plugins_sixaxis_la_CFLAGS = $(AM_CFLAGS) -fvisibility=hidden $(UDEV_CFLAGS)
 endif
diff --git a/Makefile.tools b/Makefile.tools
index f81fd0a4c..aadb4c8c0 100644
--- a/Makefile.tools
+++ b/Makefile.tools
@@ -9,7 +9,7 @@ client_bluetoothctl_SOURCES = client/main.c \
 					client/advertising.c \
 					client/gatt.h client/gatt.c
 client_bluetoothctl_LDADD = gdbus/libgdbus-internal.la src/libshared-glib.la \
-				@GLIB_LIBS@ @DBUS_LIBS@ -lreadline
+				$(GLIB_LIBS) $(DBUS_LIBS) -lreadline
 endif
 
 if MONITOR
@@ -39,7 +39,7 @@ monitor_btmon_SOURCES = monitor/main.c monitor/bt.h \
 				monitor/broadcom.h monitor/broadcom.c \
 				monitor/tty.h
 monitor_btmon_LDADD = lib/libbluetooth-internal.la \
-				src/libshared-mainloop.la @UDEV_LIBS@
+				src/libshared-mainloop.la $(UDEV_LIBS)
 endif
 
 if LOGGER
@@ -103,7 +103,7 @@ tools_mgmt_tester_SOURCES = tools/mgmt-tester.c monitor/bt.h \
 				emulator/bthost.h emulator/bthost.c \
 				emulator/smp.c
 tools_mgmt_tester_LDADD = lib/libbluetooth-internal.la \
-				src/libshared-glib.la @GLIB_LIBS@
+				src/libshared-glib.la $(GLIB_LIBS)
 
 tools_l2cap_tester_SOURCES = tools/l2cap-tester.c monitor/bt.h \
 				emulator/hciemu.h emulator/hciemu.c \
@@ -111,7 +111,7 @@ tools_l2cap_tester_SOURCES = tools/l2cap-tester.c monitor/bt.h \
 				emulator/bthost.h emulator/bthost.c \
 				emulator/smp.c
 tools_l2cap_tester_LDADD = lib/libbluetooth-internal.la \
-				src/libshared-glib.la @GLIB_LIBS@
+				src/libshared-glib.la $(GLIB_LIBS)
 
 tools_rfcomm_tester_SOURCES = tools/rfcomm-tester.c monitor/bt.h \
 				emulator/hciemu.h emulator/hciemu.c \
@@ -119,7 +119,7 @@ tools_rfcomm_tester_SOURCES = tools/rfcomm-tester.c monitor/bt.h \
 				emulator/bthost.h emulator/bthost.c \
 				emulator/smp.c
 tools_rfcomm_tester_LDADD = lib/libbluetooth-internal.la \
-				src/libshared-glib.la @GLIB_LIBS@
+				src/libshared-glib.la $(GLIB_LIBS)
 
 tools_bnep_tester_SOURCES = tools/bnep-tester.c monitor/bt.h \
 				emulator/hciemu.h emulator/hciemu.c \
@@ -127,7 +127,7 @@ tools_bnep_tester_SOURCES = tools/bnep-tester.c monitor/bt.h \
 				emulator/bthost.h emulator/bthost.c \
 				emulator/smp.c
 tools_bnep_tester_LDADD = lib/libbluetooth-internal.la \
-				src/libshared-glib.la @GLIB_LIBS@
+				src/libshared-glib.la $(GLIB_LIBS)
 
 tools_smp_tester_SOURCES = tools/smp-tester.c monitor/bt.h \
 				emulator/hciemu.h emulator/hciemu.c \
@@ -135,7 +135,7 @@ tools_smp_tester_SOURCES = tools/smp-tester.c monitor/bt.h \
 				emulator/bthost.h emulator/bthost.c \
 				emulator/smp.c
 tools_smp_tester_LDADD = lib/libbluetooth-internal.la \
-				src/libshared-glib.la @GLIB_LIBS@
+				src/libshared-glib.la $(GLIB_LIBS)
 
 tools_gap_tester_SOURCES = tools/gap-tester.c monitor/bt.h \
 				emulator/hciemu.h emulator/hciemu.c \
@@ -145,7 +145,7 @@ tools_gap_tester_SOURCES = tools/gap-tester.c monitor/bt.h \
 tools_gap_tester_LDADD =  lib/libbluetooth-internal.la \
 				gdbus/libgdbus-internal.la \
 				src/libshared-glib.la \
-				@GLIB_LIBS@ @DBUS_LIBS@
+				$(GLIB_LIBS) $(DBUS_LIBS)
 
 tools_sco_tester_SOURCES = tools/sco-tester.c monitor/bt.h \
 				emulator/hciemu.h emulator/hciemu.c \
@@ -153,10 +153,10 @@ tools_sco_tester_SOURCES = tools/sco-tester.c monitor/bt.h \
 				emulator/bthost.h emulator/bthost.c \
 				emulator/smp.c
 tools_sco_tester_LDADD = lib/libbluetooth-internal.la \
-				src/libshared-glib.la @GLIB_LIBS@
+				src/libshared-glib.la $(GLIB_LIBS)
 
 tools_hci_tester_SOURCES = tools/hci-tester.c monitor/bt.h
-tools_hci_tester_LDADD = src/libshared-glib.la @GLIB_LIBS@
+tools_hci_tester_LDADD = src/libshared-glib.la $(GLIB_LIBS)
 
 tools_userchan_tester_SOURCES = tools/userchan-tester.c monitor/bt.h \
 				emulator/hciemu.h emulator/hciemu.c \
@@ -164,7 +164,7 @@ tools_userchan_tester_SOURCES = tools/userchan-tester.c monitor/bt.h \
 				emulator/bthost.h emulator/bthost.c \
 				emulator/smp.c
 tools_userchan_tester_LDADD = lib/libbluetooth-internal.la \
-				src/libshared-glib.la @GLIB_LIBS@
+				src/libshared-glib.la $(GLIB_LIBS)
 endif
 
 if TOOLS
@@ -187,7 +187,7 @@ noinst_PROGRAMS += tools/bdaddr tools/avinfo tools/avtest \
 			tools/gatt-service profiles/iap/iapd
 
 tools_bdaddr_SOURCES = tools/bdaddr.c src/oui.h src/oui.c
-tools_bdaddr_LDADD = lib/libbluetooth-internal.la @UDEV_LIBS@
+tools_bdaddr_LDADD = lib/libbluetooth-internal.la $(UDEV_LIBS)
 
 tools_avinfo_LDADD = lib/libbluetooth-internal.la
 
@@ -217,19 +217,19 @@ tools_btproxy_SOURCES = tools/btproxy.c monitor/bt.h
 tools_btproxy_LDADD = src/libshared-mainloop.la
 
 tools_btiotest_SOURCES = tools/btiotest.c btio/btio.h btio/btio.c
-tools_btiotest_LDADD = lib/libbluetooth-internal.la @GLIB_LIBS@
+tools_btiotest_LDADD = lib/libbluetooth-internal.la $(GLIB_LIBS)
 
 tools_mcaptest_SOURCES = tools/mcaptest.c \
 				btio/btio.h btio/btio.c \
 				src/log.c src/log.h \
 				profiles/health/mcap.h profiles/health/mcap.c
-tools_mcaptest_LDADD = lib/libbluetooth-internal.la @GLIB_LIBS@ -lrt
+tools_mcaptest_LDADD = lib/libbluetooth-internal.la $(GLIB_LIBS) -lrt
 
 tools_bneptest_SOURCES = tools/bneptest.c \
 				btio/btio.h btio/btio.c \
 				src/log.h src/log.c \
 				profiles/network/bnep.h profiles/network/bnep.c
-tools_bneptest_LDADD = lib/libbluetooth-internal.la @GLIB_LIBS@
+tools_bneptest_LDADD = lib/libbluetooth-internal.la $(GLIB_LIBS)
 
 tools_cltest_SOURCES = tools/cltest.c
 tools_cltest_LDADD = lib/libbluetooth-internal.la src/libshared-mainloop.la
@@ -280,13 +280,13 @@ tools_bluemoon_LDADD = src/libshared-mainloop.la
 tools_hex2hcd_SOURCES = tools/hex2hcd.c
 
 tools_mpris_proxy_SOURCES = tools/mpris-proxy.c
-tools_mpris_proxy_LDADD = gdbus/libgdbus-internal.la @GLIB_LIBS@ @DBUS_LIBS@
+tools_mpris_proxy_LDADD = gdbus/libgdbus-internal.la $(GLIB_LIBS) $(DBUS_LIBS)
 
 tools_gatt_service_SOURCES = tools/gatt-service.c
-tools_gatt_service_LDADD = @GLIB_LIBS@ @DBUS_LIBS@ gdbus/libgdbus-internal.la
+tools_gatt_service_LDADD = $(GLIB_LIBS) $(DBUS_LIBS) gdbus/libgdbus-internal.la
 
 profiles_iap_iapd_SOURCES = profiles/iap/main.c
-profiles_iap_iapd_LDADD = gdbus/libgdbus-internal.la @GLIB_LIBS@ @DBUS_LIBS@
+profiles_iap_iapd_LDADD = gdbus/libgdbus-internal.la $(GLIB_LIBS) $(DBUS_LIBS)
 
 dist_man_MANS += tools/rctest.1 tools/l2ping.1 tools/bccmd.1 tools/btattach.1
 
@@ -311,7 +311,7 @@ tools_meshctl_SOURCES = tools/meshctl.c \
 				tools/mesh/onoff-model.h tools/mesh/onoff-model.c
 tools_meshctl_LDADD = gdbus/libgdbus-internal.la src/libshared-glib.la \
 				lib/libbluetooth-internal.la \
-				@GLIB_LIBS@ @DBUS_LIBS@ -ljson-c -lreadline
+				$(GLIB_LIBS) $(DBUS_LIBS) -ljson-c -lreadline
 endif
 
 EXTRA_DIST += tools/mesh/local_node.json tools/mesh/prov_db.json
@@ -334,7 +334,7 @@ tools_hciconfig_SOURCES = tools/hciconfig.c tools/csr.h tools/csr.c
 tools_hciconfig_LDADD = lib/libbluetooth-internal.la
 
 tools_hcitool_SOURCES = tools/hcitool.c src/oui.h src/oui.c
-tools_hcitool_LDADD = lib/libbluetooth-internal.la @UDEV_LIBS@
+tools_hcitool_LDADD = lib/libbluetooth-internal.la $(UDEV_LIBS)
 
 tools_hcidump_SOURCES = tools/hcidump.c \
 				tools/parser/parser.h tools/parser/parser.c \
@@ -363,7 +363,7 @@ tools_hcidump_SOURCES = tools/hcidump.c \
 				tools/parser/bpa.c
 
 tools_sdptool_SOURCES = tools/sdptool.c src/sdp-xml.h src/sdp-xml.c
-tools_sdptool_LDADD = lib/libbluetooth-internal.la @GLIB_LIBS@
+tools_sdptool_LDADD = lib/libbluetooth-internal.la $(GLIB_LIBS)
 
 tools_ciptool_LDADD = lib/libbluetooth-internal.la
 tools_hcidump_LDADD = lib/libbluetooth-internal.la
@@ -383,11 +383,11 @@ EXTRA_DIST += tools/rctest.1 tools/l2ping.1 tools/bccmd.1 tools/btattach.1
 endif
 
 if HID2HCI
-udevdir = @UDEV_DIR@
+udevdir = $(UDEV_DIR)
 
 udev_PROGRAMS = tools/hid2hci
 
-tools_hid2hci_LDADD = @UDEV_LIBS@
+tools_hid2hci_LDADD = $(UDEV_LIBS)
 
 dist_man_MANS += tools/hid2hci.1
 else
@@ -401,20 +401,20 @@ noinst_PROGRAMS += tools/btmgmt tools/obex-client-tool tools/obex-server-tool \
 tools_obex_client_tool_SOURCES = $(gobex_sources) $(btio_sources) \
 						tools/obex-client-tool.c
 tools_obex_client_tool_LDADD = lib/libbluetooth-internal.la \
-						@GLIB_LIBS@ -lreadline
+						$(GLIB_LIBS) -lreadline
 
 tools_obex_server_tool_SOURCES = $(gobex_sources) $(btio_sources) \
 						tools/obex-server-tool.c
-tools_obex_server_tool_LDADD = lib/libbluetooth-internal.la @GLIB_LIBS@
+tools_obex_server_tool_LDADD = lib/libbluetooth-internal.la $(GLIB_LIBS)
 
 tools_bluetooth_player_SOURCES = tools/bluetooth-player.c
 tools_bluetooth_player_LDADD = gdbus/libgdbus-internal.la \
 				src/libshared-glib.la \
-				@GLIB_LIBS@ @DBUS_LIBS@ -lreadline
+				$(GLIB_LIBS) $(DBUS_LIBS) -lreadline
 
 tools_obexctl_SOURCES = tools/obexctl.c
 tools_obexctl_LDADD = gdbus/libgdbus-internal.la src/libshared-glib.la \
-				@GLIB_LIBS@ @DBUS_LIBS@ -lreadline
+				$(GLIB_LIBS) $(DBUS_LIBS) -lreadline
 
 tools_btmgmt_SOURCES = tools/btmgmt.c src/uuid-helper.c client/display.c
 tools_btmgmt_LDADD = lib/libbluetooth-internal.la src/libshared-mainloop.la \
@@ -428,7 +428,7 @@ attrib_gatttool_SOURCES = attrib/gatttool.c attrib/att.c attrib/gatt.c \
 				attrib/utils.c src/log.c client/display.c \
 				client/display.h
 attrib_gatttool_LDADD = lib/libbluetooth-internal.la \
-			src/libshared-glib.la @GLIB_LIBS@ -lreadline
+			src/libshared-glib.la $(GLIB_LIBS) -lreadline
 
 endif
 endif
@@ -444,7 +444,7 @@ profiles_cups_bluetooth_SOURCES = profiles/cups/main.c \
 					profiles/cups/spp.c \
 					profiles/cups/hcrp.c
 
-profiles_cups_bluetooth_LDADD = @GLIB_LIBS@ @DBUS_LIBS@ \
+profiles_cups_bluetooth_LDADD = $(GLIB_LIBS) $(DBUS_LIBS) \
 				lib/libbluetooth-internal.la \
 				gdbus/libgdbus-internal.la
 endif
@@ -467,6 +467,6 @@ if BTPCLIENT
 noinst_PROGRAMS += tools/btpclient
 
 tools_btpclient_SOURCES = tools/btpclient.c src/shared/btp.c src/shared/btp.h
-tools_btpclient_CFLAGS = $(AM_CFLAGS) @ELL_CFLAGS@
-tools_btpclient_LDADD = @ELL_LIBS@ lib/libbluetooth-internal.la
+tools_btpclient_CFLAGS = $(AM_CFLAGS) $(ELL_CFLAGS)
+tools_btpclient_LDADD = $(ELL_LIBS) lib/libbluetooth-internal.la
 endif
diff --git a/android/Makefile.am b/android/Makefile.am
index 154f8db56..37a196acf 100644
--- a/android/Makefile.am
+++ b/android/Makefile.am
@@ -12,7 +12,7 @@ android_system_emulator_LDADD = src/libshared-mainloop.la
 noinst_PROGRAMS += android/bluetoothd-snoop
 
 android_bluetoothd_snoop_SOURCES = android/bluetoothd-snoop.c src/log.c
-android_bluetoothd_snoop_LDADD = src/libshared-mainloop.la @GLIB_LIBS@
+android_bluetoothd_snoop_LDADD = src/libshared-mainloop.la $(GLIB_LIBS)
 
 noinst_PROGRAMS += android/bluetoothd
 
@@ -59,7 +59,7 @@ android_bluetoothd_SOURCES = android/main.c \
 				src/sdp-client.h src/sdp-client.c \
 				profiles/network/bnep.h profiles/network/bnep.c
 android_bluetoothd_LDADD = lib/libbluetooth-internal.la \
-				src/libshared-glib.la @GLIB_LIBS@
+				src/libshared-glib.la $(GLIB_LIBS)
 
 plugin_LTLIBRARIES += android/bluetooth.default.la
 
@@ -109,7 +109,7 @@ android_avdtptest_SOURCES = android/avdtptest.c \
 				src/shared/queue.h src/shared/queue.c \
 				android/avdtp.h android/avdtp.c
 android_avdtptest_CFLAGS = $(AM_CFLAGS)
-android_avdtptest_LDADD = lib/libbluetooth-internal.la @GLIB_LIBS@
+android_avdtptest_LDADD = lib/libbluetooth-internal.la $(GLIB_LIBS)
 
 noinst_PROGRAMS += android/haltest
 
@@ -164,7 +164,7 @@ android_android_tester_SOURCES = emulator/hciemu.h emulator/hciemu.c \
 android_android_tester_CFLAGS = $(AM_CFLAGS) -I$(srcdir)/android \
 				-DPLUGINDIR=\""$(android_plugindir)"\"
 android_android_tester_LDADD = lib/libbluetooth-internal.la \
-				src/libshared-glib.la @GLIB_LIBS@
+				src/libshared-glib.la $(GLIB_LIBS)
 android_android_tester_LDFLAGS = -pthread -ldl
 
 noinst_PROGRAMS += android/ipc-tester
@@ -177,7 +177,7 @@ android_ipc_tester_SOURCES = emulator/hciemu.h emulator/hciemu.c \
 				android/ipc-common.h android/ipc-tester.c
 android_ipc_tester_CFLAGS = $(AM_CFLAGS) -I$(srcdir)/android
 android_ipc_tester_LDADD = lib/libbluetooth-internal.la \
-				src/libshared-glib.la @GLIB_LIBS@
+				src/libshared-glib.la $(GLIB_LIBS)
 
 plugin_LTLIBRARIES += android/audio.a2dp.default.la
 
@@ -192,8 +192,8 @@ android_audio_a2dp_default_la_SOURCES = android/audio-msg.h \
 					android/hardware/hardware.h \
 					android/system/audio.h
 android_audio_a2dp_default_la_CFLAGS = $(AM_CFLAGS) -I$(srcdir)/android \
-					@SBC_CFLAGS@
-android_audio_a2dp_default_la_LIBADD = @SBC_LIBS@
+					$(SBC_CFLAGS)
+android_audio_a2dp_default_la_LIBADD = $(SBC_LIBS)
 android_audio_a2dp_default_la_LDFLAGS = $(AM_LDFLAGS) -module -avoid-version \
 					-no-undefined -pthread -lrt
 
@@ -209,7 +209,7 @@ android_audio_sco_default_la_SOURCES = android/hal-log.h \
 					android/audio_utils/resampler.h \
 					android/system/audio.h
 android_audio_sco_default_la_CFLAGS = $(AM_CFLAGS) -I$(srcdir)/android
-android_audio_sco_default_la_LIBADD = @SPEEXDSP_LIBS@
+android_audio_sco_default_la_LIBADD = $(SPEEXDSP_LIBS)
 android_audio_sco_default_la_LDFLAGS = $(AM_LDFLAGS) -module -avoid-version \
 					-no-undefined -lrt
 unit_tests += android/test-ipc
@@ -218,7 +218,7 @@ android_test_ipc_SOURCES = android/test-ipc.c \
 				src/log.h src/log.c \
 				android/ipc-common.h \
 				android/ipc.c android/ipc.h
-android_test_ipc_LDADD = src/libshared-glib.la @GLIB_LIBS@
+android_test_ipc_LDADD = src/libshared-glib.la $(GLIB_LIBS)
 
 endif
 
-- 
2.19.1


^ permalink raw reply	[flat|nested] 35+ messages in thread

* [PATCH 3/8] build: -l arguments to belong into LDADD/LIBADD not LDFLAGS
  2018-11-18 16:07 [PATCH bluez] build system refresh Jan Engelhardt
  2018-11-18 16:07 ` [PATCH 1/8] build: rename libexecdir to pkglibexecdir Jan Engelhardt
  2018-11-18 16:07 ` [PATCH 2/8] build: change @foo@ to $(foo) in automake makefiles Jan Engelhardt
@ 2018-11-18 16:07 ` Jan Engelhardt
  2018-11-18 16:07 ` [PATCH 4/8] build: -D/-I arguments go into CPPFLAGS Jan Engelhardt
                   ` (4 subsequent siblings)
  7 siblings, 0 replies; 35+ messages in thread
From: Jan Engelhardt @ 2018-11-18 16:07 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: jengelh

It is an error to put -l arguments into LDFLAGS, because the linker
command line is order-sensitive and libs must appear in certain
places. For this, automake has the LDADD/LIBADD.
---
 Makefile.plugins    |  3 ++-
 android/Makefile.am | 15 ++++++++-------
 2 files changed, 10 insertions(+), 8 deletions(-)

diff --git a/Makefile.plugins b/Makefile.plugins
index 1c9919d71..d3cf5cab8 100644
--- a/Makefile.plugins
+++ b/Makefile.plugins
@@ -107,6 +107,7 @@ if SIXAXIS
 plugin_LTLIBRARIES += plugins/sixaxis.la
 plugins_sixaxis_la_SOURCES = plugins/sixaxis.c
 plugins_sixaxis_la_LDFLAGS = $(AM_LDFLAGS) -module -avoid-version \
-						-no-undefined $(UDEV_LIBS)
+						-no-undefined
+plugins_sixaxis_la_LIBADD = $(UDEV_LIBS)
 plugins_sixaxis_la_CFLAGS = $(AM_CFLAGS) -fvisibility=hidden $(UDEV_CFLAGS)
 endif
diff --git a/android/Makefile.am b/android/Makefile.am
index 37a196acf..dbf7e4408 100644
--- a/android/Makefile.am
+++ b/android/Makefile.am
@@ -141,7 +141,8 @@ android_haltest_SOURCES = android/client/haltest.c \
 				android/hal-utils.h android/hal-utils.c
 android_haltest_CFLAGS = $(AM_CFLAGS) -I$(srcdir)/android \
 				-DPLUGINDIR=\""$(android_plugindir)"\"
-android_haltest_LDFLAGS = -pthread -ldl -lm
+android_haltest_LDFLAGS = -pthread
+android_haltest_LIBS = -ldl -lm
 
 noinst_PROGRAMS += android/android-tester
 
@@ -164,8 +165,8 @@ android_android_tester_SOURCES = emulator/hciemu.h emulator/hciemu.c \
 android_android_tester_CFLAGS = $(AM_CFLAGS) -I$(srcdir)/android \
 				-DPLUGINDIR=\""$(android_plugindir)"\"
 android_android_tester_LDADD = lib/libbluetooth-internal.la \
-				src/libshared-glib.la $(GLIB_LIBS)
-android_android_tester_LDFLAGS = -pthread -ldl
+				src/libshared-glib.la $(GLIB_LIBS) -ldl
+android_android_tester_LDFLAGS = -pthread
 
 noinst_PROGRAMS += android/ipc-tester
 
@@ -193,9 +194,9 @@ android_audio_a2dp_default_la_SOURCES = android/audio-msg.h \
 					android/system/audio.h
 android_audio_a2dp_default_la_CFLAGS = $(AM_CFLAGS) -I$(srcdir)/android \
 					$(SBC_CFLAGS)
-android_audio_a2dp_default_la_LIBADD = $(SBC_LIBS)
+android_audio_a2dp_default_la_LIBADD = $(SBC_LIBS) -lrt
 android_audio_a2dp_default_la_LDFLAGS = $(AM_LDFLAGS) -module -avoid-version \
-					-no-undefined -pthread -lrt
+					-no-undefined -pthread
 
 plugin_LTLIBRARIES += android/audio.sco.default.la
 
@@ -209,9 +210,9 @@ android_audio_sco_default_la_SOURCES = android/hal-log.h \
 					android/audio_utils/resampler.h \
 					android/system/audio.h
 android_audio_sco_default_la_CFLAGS = $(AM_CFLAGS) -I$(srcdir)/android
-android_audio_sco_default_la_LIBADD = $(SPEEXDSP_LIBS)
+android_audio_sco_default_la_LIBADD = $(SPEEXDSP_LIBS) -lrt
 android_audio_sco_default_la_LDFLAGS = $(AM_LDFLAGS) -module -avoid-version \
-					-no-undefined -lrt
+					-no-undefined
 unit_tests += android/test-ipc
 
 android_test_ipc_SOURCES = android/test-ipc.c \
-- 
2.19.1


^ permalink raw reply	[flat|nested] 35+ messages in thread

* [PATCH 4/8] build: -D/-I arguments go into CPPFLAGS
  2018-11-18 16:07 [PATCH bluez] build system refresh Jan Engelhardt
                   ` (2 preceding siblings ...)
  2018-11-18 16:07 ` [PATCH 3/8] build: -l arguments to belong into LDADD/LIBADD not LDFLAGS Jan Engelhardt
@ 2018-11-18 16:07 ` Jan Engelhardt
  2018-11-18 16:07 ` [PATCH 5/8] build: add missing ELL_CFLAGS Jan Engelhardt
                   ` (3 subsequent siblings)
  7 siblings, 0 replies; 35+ messages in thread
From: Jan Engelhardt @ 2018-11-18 16:07 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: jengelh

-D and -I are preprocessor directives, they are therefore to appear
in CPPFLAGS, not CFLAGS. (It is unfortunate that pkg-config does not
make the distinction / or it was misnamed, because only -D/-I make
sense to be emitted by pkg-config in the first place — anything else
(-f/-m) has the potential to mess up someone's compilation. So
pkg-config's Cflags is actually used to convery Cppflags.)
---
 Makefile.am         |  9 ++++-----
 Makefile.obexd      |  7 ++++---
 Makefile.plugins    |  3 ++-
 Makefile.tools      |  2 +-
 android/Makefile.am | 14 +++++++-------
 5 files changed, 18 insertions(+), 17 deletions(-)

diff --git a/Makefile.am b/Makefile.am
index 33f4f3b98..4e320602c 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -1,5 +1,6 @@
 
 AM_MAKEFLAGS = --no-print-directory
+AM_CPPFLAGS =
 
 lib_LTLIBRARIES =
 
@@ -213,7 +214,7 @@ src_bluetoothd_DEPENDENCIES = lib/libbluetooth-internal.la \
 				src/libshared-glib.la \
 				src/bluetooth.service
 
-src_bluetoothd_CFLAGS = $(AM_CFLAGS) -DBLUETOOTH_PLUGIN_BUILTIN \
+src_bluetoothd_CPPFLAGS = $(AM_CPPFLAGS) -DBLUETOOTH_PLUGIN_BUILTIN \
 					-DPLUGINDIR=\""$(build_plugindir)"\"
 src_bluetoothd_SHORTNAME = bluetoothd
 
@@ -277,9 +278,7 @@ EXTRA_DIST += doc/btsnoop.txt
 
 EXTRA_DIST += tools/magic.btsnoop
 
-AM_CFLAGS += $(DBUS_CFLAGS) $(GLIB_CFLAGS)
-
-AM_CPPFLAGS = -I$(builddir)/lib
+AM_CPPFLAGS += $(DBUS_CFLAGS) $(GLIB_CFLAGS) -I$(builddir)/lib
 
 
 unit_tests += unit/test-eir
@@ -435,7 +434,7 @@ unit_test_gattrib_LDADD = lib/libbluetooth-internal.la \
 
 if MIDI
 unit_tests += unit/test-midi
-unit_test_midi_CFLAGS = $(AM_CFLAGS) $(ALSA_CFLAGS) -DMIDI_TEST
+unit_test_midi_CPPFLAGS = $(AM_CPPFLAGS) $(ALSA_CFLAGS) -DMIDI_TEST
 unit_test_midi_SOURCES = unit/test-midi.c \
 			profiles/midi/libmidi.h \
 			profiles/midi/libmidi.c
diff --git a/Makefile.obexd b/Makefile.obexd
index 9180d7eea..22a4977ef 100644
--- a/Makefile.obexd
+++ b/Makefile.obexd
@@ -83,12 +83,13 @@ obexd_src_obexd_LDADD = lib/libbluetooth-internal.la \
 
 obexd_src_obexd_LDFLAGS = -Wl,--export-dynamic
 
-obexd_src_obexd_CFLAGS = $(AM_CFLAGS) $(GLIB_CFLAGS) $(DBUS_CFLAGS) \
+obexd_src_obexd_CPPFLAGS = $(AM_CFLAGS) $(GLIB_CFLAGS) $(DBUS_CFLAGS) \
 				$(ICAL_CFLAGS) -DOBEX_PLUGIN_BUILTIN \
 				-DPLUGINDIR=\""$(obex_plugindir)"\" \
-				-fPIC -D_FILE_OFFSET_BITS=64
+				-D_FILE_OFFSET_BITS=64 \
+				-I$(builddir)/lib -I$(builddir)/obexd/src
 
-obexd_src_obexd_CPPFLAGS = -I$(builddir)/lib -I$(builddir)/obexd/src
+obexd_src_obexd_CFLAGS = -fPIC
 
 endif
 
diff --git a/Makefile.plugins b/Makefile.plugins
index d3cf5cab8..2aaeb7450 100644
--- a/Makefile.plugins
+++ b/Makefile.plugins
@@ -109,5 +109,6 @@ plugins_sixaxis_la_SOURCES = plugins/sixaxis.c
 plugins_sixaxis_la_LDFLAGS = $(AM_LDFLAGS) -module -avoid-version \
 						-no-undefined
 plugins_sixaxis_la_LIBADD = $(UDEV_LIBS)
-plugins_sixaxis_la_CFLAGS = $(AM_CFLAGS) -fvisibility=hidden $(UDEV_CFLAGS)
+plugins_sixaxis_la_CPPFLAGS = $(AM_CPPFLAGS) $(UDEV_CFLAGS)
+plugins_sixaxis_la_CFLAGS = $(AM_CFLAGS) -fvisibility=hidden
 endif
diff --git a/Makefile.tools b/Makefile.tools
index aadb4c8c0..cb43a92b2 100644
--- a/Makefile.tools
+++ b/Makefile.tools
@@ -467,6 +467,6 @@ if BTPCLIENT
 noinst_PROGRAMS += tools/btpclient
 
 tools_btpclient_SOURCES = tools/btpclient.c src/shared/btp.c src/shared/btp.h
-tools_btpclient_CFLAGS = $(AM_CFLAGS) $(ELL_CFLAGS)
+tools_btpclient_CPPFLAGS = $(AM_CPPFLAGS) $(ELL_CFLAGS)
 tools_btpclient_LDADD = $(ELL_LIBS) lib/libbluetooth-internal.la
 endif
diff --git a/android/Makefile.am b/android/Makefile.am
index dbf7e4408..dded113e2 100644
--- a/android/Makefile.am
+++ b/android/Makefile.am
@@ -1,6 +1,6 @@
 if ANDROID
 
-AM_CFLAGS += -DANDROID_VERSION=0x050100
+AM_CPPFLAGS += -DANDROID_VERSION=0x050100
 
 android_plugindir = $(abs_top_srcdir)/android/.libs
 
@@ -96,7 +96,7 @@ android_bluetooth_default_la_SOURCES = android/hal.h android/hal-bluetooth.c \
 					android/hal-log.h \
 					android/hal-ipc.h android/hal-ipc.c \
 					android/hal-utils.h android/hal-utils.c
-android_bluetooth_default_la_CFLAGS = $(AM_CFLAGS) -I$(srcdir)/android
+android_bluetooth_default_la_CPPFLAGS = $(AM_CPPFLAGS) -I$(srcdir)/android
 android_bluetooth_default_la_LDFLAGS = $(AM_LDFLAGS) -module -avoid-version \
 					-no-undefined
 
@@ -139,7 +139,7 @@ android_haltest_SOURCES = android/client/haltest.c \
 				android/client/if-mce.c \
 				android/hardware/hardware.c \
 				android/hal-utils.h android/hal-utils.c
-android_haltest_CFLAGS = $(AM_CFLAGS) -I$(srcdir)/android \
+android_haltest_CPPFLAGS = $(AM_CPPFLAGS) -I$(srcdir)/android \
 				-DPLUGINDIR=\""$(android_plugindir)"\"
 android_haltest_LDFLAGS = -pthread
 android_haltest_LIBS = -ldl -lm
@@ -162,7 +162,7 @@ android_android_tester_SOURCES = emulator/hciemu.h emulator/hciemu.c \
 				android/tester-gatt.c \
 				android/tester-map-client.c \
 				android/tester-main.h android/tester-main.c
-android_android_tester_CFLAGS = $(AM_CFLAGS) -I$(srcdir)/android \
+android_android_tester_CPPFLAGS = $(AM_CPPFLAGS) -I$(srcdir)/android \
 				-DPLUGINDIR=\""$(android_plugindir)"\"
 android_android_tester_LDADD = lib/libbluetooth-internal.la \
 				src/libshared-glib.la $(GLIB_LIBS) -ldl
@@ -176,7 +176,7 @@ android_ipc_tester_SOURCES = emulator/hciemu.h emulator/hciemu.c \
 				emulator/smp.c \
 				android/hal-utils.h android/hal-utils.c \
 				android/ipc-common.h android/ipc-tester.c
-android_ipc_tester_CFLAGS = $(AM_CFLAGS) -I$(srcdir)/android
+android_ipc_tester_CPPFLAGS = $(AM_CPPFLAGS) -I$(srcdir)/android
 android_ipc_tester_LDADD = lib/libbluetooth-internal.la \
 				src/libshared-glib.la $(GLIB_LIBS)
 
@@ -192,7 +192,7 @@ android_audio_a2dp_default_la_SOURCES = android/audio-msg.h \
 					android/hardware/audio_effect.h \
 					android/hardware/hardware.h \
 					android/system/audio.h
-android_audio_a2dp_default_la_CFLAGS = $(AM_CFLAGS) -I$(srcdir)/android \
+android_audio_a2dp_default_la_CPPFLAGS = $(AM_CPPFLAGS) -I$(srcdir)/android \
 					$(SBC_CFLAGS)
 android_audio_a2dp_default_la_LIBADD = $(SBC_LIBS) -lrt
 android_audio_a2dp_default_la_LDFLAGS = $(AM_LDFLAGS) -module -avoid-version \
@@ -209,7 +209,7 @@ android_audio_sco_default_la_SOURCES = android/hal-log.h \
 					android/audio_utils/resampler.c \
 					android/audio_utils/resampler.h \
 					android/system/audio.h
-android_audio_sco_default_la_CFLAGS = $(AM_CFLAGS) -I$(srcdir)/android
+android_audio_sco_default_la_CPPFLAGS = $(AM_CPPFLAGS) -I$(srcdir)/android
 android_audio_sco_default_la_LIBADD = $(SPEEXDSP_LIBS) -lrt
 android_audio_sco_default_la_LDFLAGS = $(AM_LDFLAGS) -module -avoid-version \
 					-no-undefined
-- 
2.19.1


^ permalink raw reply	[flat|nested] 35+ messages in thread

* [PATCH 5/8] build: add missing ELL_CFLAGS
  2018-11-18 16:07 [PATCH bluez] build system refresh Jan Engelhardt
                   ` (3 preceding siblings ...)
  2018-11-18 16:07 ` [PATCH 4/8] build: -D/-I arguments go into CPPFLAGS Jan Engelhardt
@ 2018-11-18 16:07 ` Jan Engelhardt
  2018-11-18 16:08 ` [PATCH 6/8] build: add missing UDEV_CFLAGS Jan Engelhardt
                   ` (2 subsequent siblings)
  7 siblings, 0 replies; 35+ messages in thread
From: Jan Engelhardt @ 2018-11-18 16:07 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: jengelh

Some targets link ELL_LIBS, which means they also need ELL_CFLAGS
in their (or the global) CPPFLAGS.
---
 Makefile.am   | 1 +
 Makefile.mesh | 4 ++++
 2 files changed, 5 insertions(+)

diff --git a/Makefile.am b/Makefile.am
index 4e320602c..e5d19682b 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -139,6 +139,7 @@ src_libshared_mainloop_la_SOURCES = $(shared_sources) \
 if ELL
 src_libshared_ell_la_SOURCES = $(shared_sources) \
 				src/shared/io-ell.c
+src_libshared_ell_la_CPPFLAGS = $(AM_CPPFLAGS) $(ELL_CFLAGS)
 noinst_LTLIBRARIES += src/libshared-ell.la
 endif
 
diff --git a/Makefile.mesh b/Makefile.mesh
index 50bcc19ad..4de22ba8c 100644
--- a/Makefile.mesh
+++ b/Makefile.mesh
@@ -21,6 +21,8 @@ mesh_sources = mesh/mesh.h mesh/mesh.c \
 				mesh/mesh-defs.h
 libexec_PROGRAMS += mesh/meshd
 
+mesh_meshd_CPPFLAGS = $(AM_CPPFLAGS) $(ELL_CFLAGS)
+
 mesh_meshd_SOURCES = $(mesh_sources) mesh/main.c
 
 mesh_meshd_LDADD = src/shared/ecc.lo src/shared/queue.lo src/shared/io-ell.lo \
@@ -34,6 +36,8 @@ mesh_btmesh_SOURCES = $(mesh_sources) \
 						mesh/agent.c \
 						mesh/btmesh.c
 
+mesh_btmesh_CPPFLAGS = $(AM_CPPFLAGS) $(ELL_CFLAGS)
+
 mesh_btmesh_LDADD = src/shared/ecc.lo src/shared/queue.lo src/shared/io-ell.lo \
 				src/shared/util.lo src/shared/hci.lo src/shared/mgmt.lo \
 				src/libshared-mainloop.la \
-- 
2.19.1


^ permalink raw reply	[flat|nested] 35+ messages in thread

* [PATCH 6/8] build: add missing UDEV_CFLAGS
  2018-11-18 16:07 [PATCH bluez] build system refresh Jan Engelhardt
                   ` (4 preceding siblings ...)
  2018-11-18 16:07 ` [PATCH 5/8] build: add missing ELL_CFLAGS Jan Engelhardt
@ 2018-11-18 16:08 ` Jan Engelhardt
  2018-11-18 16:08 ` [PATCH 7/8] build: add missing ALSA_CFLAGS Jan Engelhardt
  2018-11-18 16:08 ` [PATCH 8/8] build: add missing BACKTRACE_CFLAGS Jan Engelhardt
  7 siblings, 0 replies; 35+ messages in thread
From: Jan Engelhardt @ 2018-11-18 16:08 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: jengelh

Some targets link UDEV_LIBS, which means they also need UDEV_CFLAGS
in their (or the global) CPPFLAGS.
---
 Makefile.tools | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/Makefile.tools b/Makefile.tools
index cb43a92b2..a5e2dde45 100644
--- a/Makefile.tools
+++ b/Makefile.tools
@@ -38,6 +38,7 @@ monitor_btmon_SOURCES = monitor/main.c monitor/bt.h \
 				monitor/intel.h monitor/intel.c \
 				monitor/broadcom.h monitor/broadcom.c \
 				monitor/tty.h
+monitor_btmon_CPPFLAGS = $(AM_CPPFLAGS) $(UDEV_CFLAGS)
 monitor_btmon_LDADD = lib/libbluetooth-internal.la \
 				src/libshared-mainloop.la $(UDEV_LIBS)
 endif
@@ -187,6 +188,7 @@ noinst_PROGRAMS += tools/bdaddr tools/avinfo tools/avtest \
 			tools/gatt-service profiles/iap/iapd
 
 tools_bdaddr_SOURCES = tools/bdaddr.c src/oui.h src/oui.c
+tools_bdaddr_CPPFLAGS = $(AM_CPPFLAGS) $(UDEV_CFLAGS)
 tools_bdaddr_LDADD = lib/libbluetooth-internal.la $(UDEV_LIBS)
 
 tools_avinfo_LDADD = lib/libbluetooth-internal.la
@@ -334,6 +336,7 @@ tools_hciconfig_SOURCES = tools/hciconfig.c tools/csr.h tools/csr.c
 tools_hciconfig_LDADD = lib/libbluetooth-internal.la
 
 tools_hcitool_SOURCES = tools/hcitool.c src/oui.h src/oui.c
+tools_hcitool_CPPFLAGS = $(AM_CPPFLAGS) $(UDEV_CFLAGS)
 tools_hcitool_LDADD = lib/libbluetooth-internal.la $(UDEV_LIBS)
 
 tools_hcidump_SOURCES = tools/hcidump.c \
@@ -387,6 +390,7 @@ udevdir = $(UDEV_DIR)
 
 udev_PROGRAMS = tools/hid2hci
 
+tools_hid2hci_CPPFLAGS = $(AM_CPPFLAGS) $(UDEV_CFLAGS)
 tools_hid2hci_LDADD = $(UDEV_LIBS)
 
 dist_man_MANS += tools/hid2hci.1
-- 
2.19.1


^ permalink raw reply	[flat|nested] 35+ messages in thread

* [PATCH 7/8] build: add missing ALSA_CFLAGS
  2018-11-18 16:07 [PATCH bluez] build system refresh Jan Engelhardt
                   ` (5 preceding siblings ...)
  2018-11-18 16:08 ` [PATCH 6/8] build: add missing UDEV_CFLAGS Jan Engelhardt
@ 2018-11-18 16:08 ` Jan Engelhardt
  2018-11-18 16:08 ` [PATCH 8/8] build: add missing BACKTRACE_CFLAGS Jan Engelhardt
  7 siblings, 0 replies; 35+ messages in thread
From: Jan Engelhardt @ 2018-11-18 16:08 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: jengelh

Some targets use ALSA_LIBS, hence need ALSA_CFLAGS.
---
 Makefile.am      | 4 +++-
 Makefile.plugins | 1 +
 2 files changed, 4 insertions(+), 1 deletion(-)

diff --git a/Makefile.am b/Makefile.am
index e5d19682b..d9f42f2d2 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -159,6 +159,7 @@ gobex_sources = gobex/gobex.h gobex/gobex.c \
 
 builtin_modules =
 builtin_sources =
+builtin_cppflags =
 builtin_nodist =
 builtin_ldadd =
 
@@ -216,7 +217,8 @@ src_bluetoothd_DEPENDENCIES = lib/libbluetooth-internal.la \
 				src/bluetooth.service
 
 src_bluetoothd_CPPFLAGS = $(AM_CPPFLAGS) -DBLUETOOTH_PLUGIN_BUILTIN \
-					-DPLUGINDIR=\""$(build_plugindir)"\"
+					-DPLUGINDIR=\""$(build_plugindir)"\" \
+					$(builtin_cppflags)
 src_bluetoothd_SHORTNAME = bluetoothd
 
 builtin_files = src/builtin.h $(builtin_nodist)
diff --git a/Makefile.plugins b/Makefile.plugins
index 2aaeb7450..47bf317cb 100644
--- a/Makefile.plugins
+++ b/Makefile.plugins
@@ -97,6 +97,7 @@ builtin_modules += midi
 builtin_sources += profiles/midi/midi.c \
 			profiles/midi/libmidi.h \
 			profiles/midi/libmidi.c
+builtin_cppflags += $(ALSA_CFLAGS)
 builtin_ldadd += $(ALSA_LIBS)
 endif
 
-- 
2.19.1


^ permalink raw reply	[flat|nested] 35+ messages in thread

* [PATCH 8/8] build: add missing BACKTRACE_CFLAGS
  2018-11-18 16:07 [PATCH bluez] build system refresh Jan Engelhardt
                   ` (6 preceding siblings ...)
  2018-11-18 16:08 ` [PATCH 7/8] build: add missing ALSA_CFLAGS Jan Engelhardt
@ 2018-11-18 16:08 ` Jan Engelhardt
  7 siblings, 0 replies; 35+ messages in thread
From: Jan Engelhardt @ 2018-11-18 16:08 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: jengelh

Some targets use BACKTRACE_LIBS, hence need BACKTRACE_CFLAGS.
---
 Makefile.am | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/Makefile.am b/Makefile.am
index d9f42f2d2..a573b1041 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -218,7 +218,7 @@ src_bluetoothd_DEPENDENCIES = lib/libbluetooth-internal.la \
 
 src_bluetoothd_CPPFLAGS = $(AM_CPPFLAGS) -DBLUETOOTH_PLUGIN_BUILTIN \
 					-DPLUGINDIR=\""$(build_plugindir)"\" \
-					$(builtin_cppflags)
+					$(BACKTRACE_CFLAGS) $(builtin_cppflags)
 src_bluetoothd_SHORTNAME = bluetoothd
 
 builtin_files = src/builtin.h $(builtin_nodist)
-- 
2.19.1


^ permalink raw reply	[flat|nested] 35+ messages in thread

* Re: [PATCH 1/8] build: rename libexecdir to pkglibexecdir
  2018-11-18 16:07 ` [PATCH 1/8] build: rename libexecdir to pkglibexecdir Jan Engelhardt
@ 2018-11-21 11:29   ` Luiz Augusto von Dentz
  2018-11-21 12:57     ` Jan Engelhardt
  0 siblings, 1 reply; 35+ messages in thread
From: Luiz Augusto von Dentz @ 2018-11-21 11:29 UTC (permalink / raw)
  To: jengelh; +Cc: linux-bluetooth

Hi Jan,
On Sun, Nov 18, 2018 at 6:17 PM Jan Engelhardt <jengelh@inai.de> wrote:
>
> When files are to be placed not in libexecdir but a subdirectory of
> it, automake has a variable name reserved for exactly that purpose
> (and a default value, which Makefile.am will override), called
> pkglibexecdir. Let's use it.
> ---
>  Makefile.am                       | 4 ++--
>  obexd/src/obex.service.in         | 2 +-
>  src/bluetooth.service.in          | 2 +-
>  tools/bluetooth-logger.service.in | 2 +-
>  4 files changed, 5 insertions(+), 5 deletions(-)
>
> diff --git a/Makefile.am b/Makefile.am
> index 0ccf393c6..eee70b88b 100644
> --- a/Makefile.am
> +++ b/Makefile.am
> @@ -19,7 +19,7 @@ CLEANFILES =
>
>  EXTRA_DIST =
>
> -libexecdir = @libexecdir@/bluetooth
> +pkglibexecdir = @libexecdir@/bluetooth
>
>  libexec_PROGRAMS =
>
> @@ -489,7 +489,7 @@ MAINTAINERCLEANFILES = Makefile.in \
>         ltmain.sh depcomp compile missing install-sh mkinstalldirs test-driver
>
>  SED_PROCESS = $(AM_V_GEN)$(MKDIR_P) $(dir $@) && \
> -               $(SED) -e 's,@libexecdir\@,$(libexecdir),g' \
> +               $(SED) -e 's,@pkglibexecdir\@,$(pkglibexecdir),g' \
>                 < $< > $@
>
>  %.service: %.service.in Makefile
> diff --git a/obexd/src/obex.service.in b/obexd/src/obex.service.in
> index bca3aef66..fc0dce993 100644
> --- a/obexd/src/obex.service.in
> +++ b/obexd/src/obex.service.in
> @@ -4,7 +4,7 @@ Description=Bluetooth OBEX service
>  [Service]
>  Type=dbus
>  BusName=org.bluez.obex
> -ExecStart=@libexecdir@/obexd
> +ExecStart=@pkglibexecdir@/obexd
>
>  [Install]
>  Alias=dbus-org.bluez.obex.service
> diff --git a/src/bluetooth.service.in b/src/bluetooth.service.in
> index f799f65f0..f9faaa452 100644
> --- a/src/bluetooth.service.in
> +++ b/src/bluetooth.service.in
> @@ -6,7 +6,7 @@ ConditionPathIsDirectory=/sys/class/bluetooth
>  [Service]
>  Type=dbus
>  BusName=org.bluez
> -ExecStart=@libexecdir@/bluetoothd
> +ExecStart=@pkglibexecdir@/bluetoothd
>  NotifyAccess=main
>  #WatchdogSec=10
>  #Restart=on-failure
> diff --git a/tools/bluetooth-logger.service.in b/tools/bluetooth-logger.service.in
> index 026a2f130..009002731 100644
> --- a/tools/bluetooth-logger.service.in
> +++ b/tools/bluetooth-logger.service.in
> @@ -4,7 +4,7 @@ ConditionPathIsDirectory=/sys/class/bluetooth
>
>  [Service]
>  Type=simple
> -ExecStart=@libexecdir@/btmon-logger -p -b /var/log/bluetooth/hci.log
> +ExecStart=@pkglibexecdir@/btmon-logger -p -b /var/log/bluetooth/hci.log
>  NotifyAccess=main
>  CapabilityBoundingSet=CAP_NET_RAW
>  LimitNPROC=1
> --
> 2.19.1

Applied this one, 2/8 doesn't applies so you need to do a rebase and
send a v2 before we continue.

-- 
Luiz Augusto von Dentz

^ permalink raw reply	[flat|nested] 35+ messages in thread

* Re: [PATCH 1/8] build: rename libexecdir to pkglibexecdir
  2018-11-21 11:29   ` Luiz Augusto von Dentz
@ 2018-11-21 12:57     ` Jan Engelhardt
  2018-11-21 12:57       ` [PATCH 1/7] build: change @foo@ to $(foo) in automake makefiles Jan Engelhardt
                         ` (6 more replies)
  0 siblings, 7 replies; 35+ messages in thread
From: Jan Engelhardt @ 2018-11-21 12:57 UTC (permalink / raw)
  To: luiz.dentz; +Cc: linux-bluetooth, jengelh


The following changes since commit 78bce480093799c287ac8561b9407fa48796a130:

  build: rename libexecdir to pkglibexecdir (2018-11-21 13:22:33 +0200)

are available in the Git repository at:

  https://github.com/jengelh/bluez master

for you to fetch changes up to 485987a00ef172e2598ae7e3d545a266f934c1d1:

  build: add missing BACKTRACE_CFLAGS (2018-11-21 13:54:37 +0100)

----------------------------------------------------------------
Jan Engelhardt (7):
      build: change @foo@ to $(foo) in automake makefiles
      build: -l arguments to belong into LDADD/LIBADD not LDFLAGS
      build: -D/-I arguments go into CPPFLAGS
      build: add missing ELL_CFLAGS
      build: add missing UDEV_CFLAGS
      build: add missing ALSA_CFLAGS
      build: add missing BACKTRACE_CFLAGS

 Makefile.am         | 80 +++++++++++++++++++++++++++--------------------------
 Makefile.mesh       |  8 ++++--
 Makefile.obexd      | 15 +++++-----
 Makefile.plugins    |  9 ++++--
 Makefile.tools      | 66 ++++++++++++++++++++++---------------------
 android/Makefile.am | 41 +++++++++++++--------------
 6 files changed, 117 insertions(+), 102 deletions(-)


^ permalink raw reply	[flat|nested] 35+ messages in thread

* [PATCH 1/7] build: change @foo@ to $(foo) in automake makefiles
  2018-11-21 12:57     ` Jan Engelhardt
@ 2018-11-21 12:57       ` Jan Engelhardt
  2018-11-22  9:47         ` Luiz Augusto von Dentz
  2018-11-21 12:57       ` [PATCH 2/7] build: -l arguments to belong into LDADD/LIBADD not LDFLAGS Jan Engelhardt
                         ` (5 subsequent siblings)
  6 siblings, 1 reply; 35+ messages in thread
From: Jan Engelhardt @ 2018-11-21 12:57 UTC (permalink / raw)
  To: luiz.dentz; +Cc: linux-bluetooth, jengelh

When using automake, all AC_SUBSTed variables are made available as
make variables, so that they can also be set at make time. Therefore,
they need not use the @harcoded@ style.
---
 Makefile.am         | 70 ++++++++++++++++++++++-----------------------
 Makefile.mesh       |  4 +--
 Makefile.obexd      | 10 +++----
 Makefile.plugins    |  6 ++--
 Makefile.tools      | 62 +++++++++++++++++++--------------------
 android/Makefile.am | 18 ++++++------
 6 files changed, 85 insertions(+), 85 deletions(-)

diff --git a/Makefile.am b/Makefile.am
index d4f4572d5..1905a74b6 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -19,11 +19,11 @@ CLEANFILES =
 
 EXTRA_DIST =
 
-pkglibexecdir = @libexecdir@/bluetooth
+pkglibexecdir = $(libexecdir)/bluetooth
 
 libexec_PROGRAMS =
 
-includedir = @includedir@/bluetooth
+includedir = $(includedir)/bluetooth
 
 include_HEADERS =
 
@@ -31,7 +31,7 @@ AM_CFLAGS = $(WARNING_CFLAGS) $(MISC_CFLAGS)
 AM_LDFLAGS = $(MISC_LDFLAGS)
 
 if DATAFILES
-dbusdir = @DBUS_CONFDIR@/dbus-1/system.d
+dbusdir = $(DBUS_CONFDIR)/dbus-1/system.d
 dbus_DATA = src/bluetooth.conf
 
 confdir = $(sysconfdir)/bluetooth
@@ -42,10 +42,10 @@ state_DATA =
 endif
 
 if SYSTEMD
-systemdsystemunitdir = @SYSTEMD_SYSTEMUNITDIR@
+systemdsystemunitdir = $(SYSTEMD_SYSTEMUNITDIR)
 systemdsystemunit_DATA = src/bluetooth.service
 
-dbussystembusdir = @DBUS_SYSTEMBUSDIR@
+dbussystembusdir = $(DBUS_SYSTEMBUSDIR)
 dbussystembus_DATA = src/org.bluez.service
 endif
 
@@ -204,7 +204,7 @@ src_bluetoothd_SOURCES = $(builtin_sources) \
 src_bluetoothd_LDADD = lib/libbluetooth-internal.la \
 			gdbus/libgdbus-internal.la \
 			src/libshared-glib.la \
-			@BACKTRACE_LIBS@ @GLIB_LIBS@ @DBUS_LIBS@ -ldl -lrt \
+			$(BACKTRACE_LIBS) $(GLIB_LIBS) $(DBUS_LIBS) -ldl -lrt \
 			$(builtin_ldadd)
 src_bluetoothd_LDFLAGS = $(AM_LDFLAGS) -Wl,--export-dynamic \
 				-Wl,--version-script=$(srcdir)/src/bluetooth.ver
@@ -239,7 +239,7 @@ include android/Makefile.am
 include Makefile.mesh
 
 if HID2HCI
-rulesdir = @UDEV_DIR@/rules.d
+rulesdir = $(UDEV_DIR)/rules.d
 
 rules_DATA = tools/97-hid2hci.rules
 
@@ -278,7 +278,7 @@ EXTRA_DIST += doc/btsnoop.txt
 
 EXTRA_DIST += tools/magic.btsnoop
 
-AM_CFLAGS += @DBUS_CFLAGS@ @GLIB_CFLAGS@
+AM_CFLAGS += $(DBUS_CFLAGS) $(GLIB_CFLAGS)
 
 AM_CPPFLAGS = -I$(builddir)/lib
 
@@ -287,51 +287,51 @@ unit_tests += unit/test-eir
 
 unit_test_eir_SOURCES = unit/test-eir.c src/eir.c src/uuid-helper.c
 unit_test_eir_LDADD = src/libshared-glib.la lib/libbluetooth-internal.la \
-								@GLIB_LIBS@
+								$(GLIB_LIBS)
 
 unit_tests += unit/test-uuid
 
 unit_test_uuid_SOURCES = unit/test-uuid.c
 unit_test_uuid_LDADD = src/libshared-glib.la lib/libbluetooth-internal.la \
-								@GLIB_LIBS@
+								$(GLIB_LIBS)
 
 unit_tests += unit/test-textfile
 
 unit_test_textfile_SOURCES = unit/test-textfile.c src/textfile.h src/textfile.c
-unit_test_textfile_LDADD = src/libshared-glib.la @GLIB_LIBS@
+unit_test_textfile_LDADD = src/libshared-glib.la $(GLIB_LIBS)
 
 unit_tests += unit/test-crc
 
 unit_test_crc_SOURCES = unit/test-crc.c monitor/crc.h monitor/crc.c
-unit_test_crc_LDADD = src/libshared-glib.la @GLIB_LIBS@
+unit_test_crc_LDADD = src/libshared-glib.la $(GLIB_LIBS)
 
 unit_tests += unit/test-crypto
 
 unit_test_crypto_SOURCES = unit/test-crypto.c
-unit_test_crypto_LDADD = src/libshared-glib.la @GLIB_LIBS@
+unit_test_crypto_LDADD = src/libshared-glib.la $(GLIB_LIBS)
 
 unit_tests += unit/test-ecc
 
 unit_test_ecc_SOURCES = unit/test-ecc.c
-unit_test_ecc_LDADD = src/libshared-glib.la @GLIB_LIBS@
+unit_test_ecc_LDADD = src/libshared-glib.la $(GLIB_LIBS)
 
 unit_tests += unit/test-ringbuf unit/test-queue
 
 unit_test_ringbuf_SOURCES = unit/test-ringbuf.c
-unit_test_ringbuf_LDADD = src/libshared-glib.la @GLIB_LIBS@
+unit_test_ringbuf_LDADD = src/libshared-glib.la $(GLIB_LIBS)
 
 unit_test_queue_SOURCES = unit/test-queue.c
-unit_test_queue_LDADD = src/libshared-glib.la @GLIB_LIBS@
+unit_test_queue_LDADD = src/libshared-glib.la $(GLIB_LIBS)
 
 unit_tests += unit/test-mgmt
 
 unit_test_mgmt_SOURCES = unit/test-mgmt.c
-unit_test_mgmt_LDADD = src/libshared-glib.la @GLIB_LIBS@
+unit_test_mgmt_LDADD = src/libshared-glib.la $(GLIB_LIBS)
 
 unit_tests += unit/test-uhid
 
 unit_test_uhid_SOURCES = unit/test-uhid.c
-unit_test_uhid_LDADD = src/libshared-glib.la @GLIB_LIBS@
+unit_test_uhid_LDADD = src/libshared-glib.la $(GLIB_LIBS)
 
 unit_tests += unit/test-sdp
 
@@ -340,21 +340,21 @@ unit_test_sdp_SOURCES = unit/test-sdp.c \
 				src/log.h src/log.c \
 				src/sdpd-service.c src/sdpd-request.c
 unit_test_sdp_LDADD = lib/libbluetooth-internal.la \
-				src/libshared-glib.la @GLIB_LIBS@
+				src/libshared-glib.la $(GLIB_LIBS)
 
 unit_tests += unit/test-avdtp
 
 unit_test_avdtp_SOURCES = unit/test-avdtp.c \
 				src/log.h src/log.c \
 				android/avdtp.c android/avdtp.h
-unit_test_avdtp_LDADD = src/libshared-glib.la @GLIB_LIBS@
+unit_test_avdtp_LDADD = src/libshared-glib.la $(GLIB_LIBS)
 
 unit_tests += unit/test-avctp
 
 unit_test_avctp_SOURCES = unit/test-avctp.c \
 				src/log.h src/log.c \
 				android/avctp.c android/avctp.h
-unit_test_avctp_LDADD = src/libshared-glib.la @GLIB_LIBS@
+unit_test_avctp_LDADD = src/libshared-glib.la $(GLIB_LIBS)
 
 unit_tests += unit/test-avrcp
 
@@ -363,53 +363,53 @@ unit_test_avrcp_SOURCES = unit/test-avrcp.c \
 				android/avctp.c android/avctp.h \
 				android/avrcp-lib.c android/avrcp-lib.h
 unit_test_avrcp_LDADD = lib/libbluetooth-internal.la \
-				src/libshared-glib.la @GLIB_LIBS@
+				src/libshared-glib.la $(GLIB_LIBS)
 
 unit_tests += unit/test-hfp
 
 unit_test_hfp_SOURCES = unit/test-hfp.c
-unit_test_hfp_LDADD = src/libshared-glib.la @GLIB_LIBS@
+unit_test_hfp_LDADD = src/libshared-glib.la $(GLIB_LIBS)
 
 unit_tests += unit/test-gdbus-client
 
 unit_test_gdbus_client_SOURCES = unit/test-gdbus-client.c
 unit_test_gdbus_client_LDADD = gdbus/libgdbus-internal.la \
-				src/libshared-glib.la @GLIB_LIBS@ @DBUS_LIBS@
+				src/libshared-glib.la $(GLIB_LIBS) $(DBUS_LIBS)
 
 unit_tests += unit/test-gobex-header unit/test-gobex-packet unit/test-gobex \
 			unit/test-gobex-transfer unit/test-gobex-apparam
 
 unit_test_gobex_SOURCES = $(gobex_sources) unit/util.c unit/util.h \
 						unit/test-gobex.c
-unit_test_gobex_LDADD = @GLIB_LIBS@
+unit_test_gobex_LDADD = $(GLIB_LIBS)
 
 unit_test_gobex_packet_SOURCES = $(gobex_sources) unit/util.c unit/util.h \
 						unit/test-gobex-packet.c
-unit_test_gobex_packet_LDADD = @GLIB_LIBS@
+unit_test_gobex_packet_LDADD = $(GLIB_LIBS)
 
 unit_test_gobex_header_SOURCES = $(gobex_sources) unit/util.c unit/util.h \
 						unit/test-gobex-header.c
-unit_test_gobex_header_LDADD = @GLIB_LIBS@
+unit_test_gobex_header_LDADD = $(GLIB_LIBS)
 
 unit_test_gobex_transfer_SOURCES = $(gobex_sources) unit/util.c unit/util.h \
 						unit/test-gobex-transfer.c
-unit_test_gobex_transfer_LDADD = @GLIB_LIBS@
+unit_test_gobex_transfer_LDADD = $(GLIB_LIBS)
 
 unit_test_gobex_apparam_SOURCES = $(gobex_sources) unit/util.c unit/util.h \
 						unit/test-gobex-apparam.c
-unit_test_gobex_apparam_LDADD = @GLIB_LIBS@
+unit_test_gobex_apparam_LDADD = $(GLIB_LIBS)
 
 unit_tests += unit/test-lib
 
 unit_test_lib_SOURCES = unit/test-lib.c
 unit_test_lib_LDADD = src/libshared-glib.la \
-				lib/libbluetooth-internal.la @GLIB_LIBS@
+				lib/libbluetooth-internal.la $(GLIB_LIBS)
 
 unit_tests += unit/test-gatt
 
 unit_test_gatt_SOURCES = unit/test-gatt.c
 unit_test_gatt_LDADD = src/libshared-glib.la \
-				lib/libbluetooth-internal.la @GLIB_LIBS@
+				lib/libbluetooth-internal.la $(GLIB_LIBS)
 
 unit_tests += unit/test-hog
 
@@ -424,7 +424,7 @@ unit_test_hog_SOURCES = unit/test-hog.c \
 			attrib/gatt.h attrib/gatt.c \
 			attrib/gattrib.h attrib/gattrib.c
 unit_test_hog_LDADD = src/libshared-glib.la \
-				lib/libbluetooth-internal.la @GLIB_LIBS@
+				lib/libbluetooth-internal.la $(GLIB_LIBS)
 
 unit_tests += unit/test-gattrib
 
@@ -432,16 +432,16 @@ unit_test_gattrib_SOURCES = unit/test-gattrib.c attrib/gattrib.c \
 					$(btio_sources) src/log.h src/log.c
 unit_test_gattrib_LDADD = lib/libbluetooth-internal.la \
 			src/libshared-glib.la \
-			@GLIB_LIBS@ @DBUS_LIBS@ -ldl -lrt
+			$(GLIB_LIBS) $(DBUS_LIBS) -ldl -lrt
 
 if MIDI
 unit_tests += unit/test-midi
-unit_test_midi_CFLAGS = $(AM_CFLAGS) @ALSA_CFLAGS@ -DMIDI_TEST
+unit_test_midi_CFLAGS = $(AM_CFLAGS) $(ALSA_CFLAGS) -DMIDI_TEST
 unit_test_midi_SOURCES = unit/test-midi.c \
 			profiles/midi/libmidi.h \
 			profiles/midi/libmidi.c
 unit_test_midi_LDADD = src/libshared-glib.la \
-			@GLIB_LIBS@ @ALSA_LIBS@
+			$(GLIB_LIBS) $(ALSA_LIBS)
 endif
 
 if MAINTAINER_MODE
diff --git a/Makefile.mesh b/Makefile.mesh
index 0df7db2be..50bcc19ad 100644
--- a/Makefile.mesh
+++ b/Makefile.mesh
@@ -25,7 +25,7 @@ mesh_meshd_SOURCES = $(mesh_sources) mesh/main.c
 
 mesh_meshd_LDADD = src/shared/ecc.lo src/shared/queue.lo src/shared/io-ell.lo \
 				src/shared/util.lo src/shared/hci.lo src/shared/mgmt.lo \
-				@DBUS_LIBS@ @ELL_LIBS@ -ljson-c
+				$(DBUS_LIBS) $(ELL_LIBS) -ljson-c
 
 noinst_PROGRAMS += mesh/btmesh
 
@@ -37,6 +37,6 @@ mesh_btmesh_SOURCES = $(mesh_sources) \
 mesh_btmesh_LDADD = src/shared/ecc.lo src/shared/queue.lo src/shared/io-ell.lo \
 				src/shared/util.lo src/shared/hci.lo src/shared/mgmt.lo \
 				src/libshared-mainloop.la \
-				-lreadline @ELL_LIBS@ -ljson-c
+				-lreadline $(ELL_LIBS) -ljson-c
 
 endif
diff --git a/Makefile.obexd b/Makefile.obexd
index cd3ace425..9180d7eea 100644
--- a/Makefile.obexd
+++ b/Makefile.obexd
@@ -1,8 +1,8 @@
 if SYSTEMD
-systemduserunitdir = @SYSTEMD_USERUNITDIR@
+systemduserunitdir = $(SYSTEMD_USERUNITDIR)
 systemduserunit_DATA = obexd/src/obex.service
 
-dbussessionbusdir = @DBUS_SESSIONBUSDIR@
+dbussessionbusdir = $(DBUS_SESSIONBUSDIR)
 dbussessionbus_DATA = obexd/src/org.bluez.obex.service
 endif
 
@@ -79,12 +79,12 @@ obexd_src_obexd_SOURCES = $(btio_sources) $(gobex_sources) \
 			obexd/src/map_ap.h
 obexd_src_obexd_LDADD = lib/libbluetooth-internal.la \
 			gdbus/libgdbus-internal.la \
-			@ICAL_LIBS@ @DBUS_LIBS@ @GLIB_LIBS@ -ldl
+			$(ICAL_LIBS) $(DBUS_LIBS) $(GLIB_LIBS) -ldl
 
 obexd_src_obexd_LDFLAGS = -Wl,--export-dynamic
 
-obexd_src_obexd_CFLAGS = $(AM_CFLAGS) @GLIB_CFLAGS@ @DBUS_CFLAGS@ \
-				@ICAL_CFLAGS@ -DOBEX_PLUGIN_BUILTIN \
+obexd_src_obexd_CFLAGS = $(AM_CFLAGS) $(GLIB_CFLAGS) $(DBUS_CFLAGS) \
+				$(ICAL_CFLAGS) -DOBEX_PLUGIN_BUILTIN \
 				-DPLUGINDIR=\""$(obex_plugindir)"\" \
 				-fPIC -D_FILE_OFFSET_BITS=64
 
diff --git a/Makefile.plugins b/Makefile.plugins
index 3ab7c1c18..1c9919d71 100644
--- a/Makefile.plugins
+++ b/Makefile.plugins
@@ -97,7 +97,7 @@ builtin_modules += midi
 builtin_sources += profiles/midi/midi.c \
 			profiles/midi/libmidi.h \
 			profiles/midi/libmidi.c
-builtin_ldadd += @ALSA_LIBS@
+builtin_ldadd += $(ALSA_LIBS)
 endif
 
 builtin_modules += battery
@@ -107,6 +107,6 @@ if SIXAXIS
 plugin_LTLIBRARIES += plugins/sixaxis.la
 plugins_sixaxis_la_SOURCES = plugins/sixaxis.c
 plugins_sixaxis_la_LDFLAGS = $(AM_LDFLAGS) -module -avoid-version \
-						-no-undefined @UDEV_LIBS@
-plugins_sixaxis_la_CFLAGS = $(AM_CFLAGS) -fvisibility=hidden @UDEV_CFLAGS@
+						-no-undefined $(UDEV_LIBS)
+plugins_sixaxis_la_CFLAGS = $(AM_CFLAGS) -fvisibility=hidden $(UDEV_CFLAGS)
 endif
diff --git a/Makefile.tools b/Makefile.tools
index 231a4b09b..cdfaaf906 100644
--- a/Makefile.tools
+++ b/Makefile.tools
@@ -9,7 +9,7 @@ client_bluetoothctl_SOURCES = client/main.c \
 					client/advertising.c \
 					client/gatt.h client/gatt.c
 client_bluetoothctl_LDADD = gdbus/libgdbus-internal.la src/libshared-glib.la \
-				@GLIB_LIBS@ @DBUS_LIBS@ -lreadline
+				$(GLIB_LIBS) $(DBUS_LIBS) -lreadline
 endif
 
 if MONITOR
@@ -39,7 +39,7 @@ monitor_btmon_SOURCES = monitor/main.c monitor/bt.h \
 				monitor/broadcom.h monitor/broadcom.c \
 				monitor/tty.h
 monitor_btmon_LDADD = lib/libbluetooth-internal.la \
-				src/libshared-mainloop.la @UDEV_LIBS@
+				src/libshared-mainloop.la $(UDEV_LIBS)
 endif
 
 if LOGGER
@@ -103,7 +103,7 @@ tools_mgmt_tester_SOURCES = tools/mgmt-tester.c monitor/bt.h \
 				emulator/bthost.h emulator/bthost.c \
 				emulator/smp.c
 tools_mgmt_tester_LDADD = lib/libbluetooth-internal.la \
-				src/libshared-glib.la @GLIB_LIBS@
+				src/libshared-glib.la $(GLIB_LIBS)
 
 tools_l2cap_tester_SOURCES = tools/l2cap-tester.c monitor/bt.h \
 				emulator/hciemu.h emulator/hciemu.c \
@@ -111,7 +111,7 @@ tools_l2cap_tester_SOURCES = tools/l2cap-tester.c monitor/bt.h \
 				emulator/bthost.h emulator/bthost.c \
 				emulator/smp.c
 tools_l2cap_tester_LDADD = lib/libbluetooth-internal.la \
-				src/libshared-glib.la @GLIB_LIBS@
+				src/libshared-glib.la $(GLIB_LIBS)
 
 tools_rfcomm_tester_SOURCES = tools/rfcomm-tester.c monitor/bt.h \
 				emulator/hciemu.h emulator/hciemu.c \
@@ -119,7 +119,7 @@ tools_rfcomm_tester_SOURCES = tools/rfcomm-tester.c monitor/bt.h \
 				emulator/bthost.h emulator/bthost.c \
 				emulator/smp.c
 tools_rfcomm_tester_LDADD = lib/libbluetooth-internal.la \
-				src/libshared-glib.la @GLIB_LIBS@
+				src/libshared-glib.la $(GLIB_LIBS)
 
 tools_bnep_tester_SOURCES = tools/bnep-tester.c monitor/bt.h \
 				emulator/hciemu.h emulator/hciemu.c \
@@ -127,7 +127,7 @@ tools_bnep_tester_SOURCES = tools/bnep-tester.c monitor/bt.h \
 				emulator/bthost.h emulator/bthost.c \
 				emulator/smp.c
 tools_bnep_tester_LDADD = lib/libbluetooth-internal.la \
-				src/libshared-glib.la @GLIB_LIBS@
+				src/libshared-glib.la $(GLIB_LIBS)
 
 tools_smp_tester_SOURCES = tools/smp-tester.c monitor/bt.h \
 				emulator/hciemu.h emulator/hciemu.c \
@@ -135,7 +135,7 @@ tools_smp_tester_SOURCES = tools/smp-tester.c monitor/bt.h \
 				emulator/bthost.h emulator/bthost.c \
 				emulator/smp.c
 tools_smp_tester_LDADD = lib/libbluetooth-internal.la \
-				src/libshared-glib.la @GLIB_LIBS@
+				src/libshared-glib.la $(GLIB_LIBS)
 
 tools_gap_tester_SOURCES = tools/gap-tester.c monitor/bt.h \
 				emulator/hciemu.h emulator/hciemu.c \
@@ -145,7 +145,7 @@ tools_gap_tester_SOURCES = tools/gap-tester.c monitor/bt.h \
 tools_gap_tester_LDADD =  lib/libbluetooth-internal.la \
 				gdbus/libgdbus-internal.la \
 				src/libshared-glib.la \
-				@GLIB_LIBS@ @DBUS_LIBS@
+				$(GLIB_LIBS) $(DBUS_LIBS)
 
 tools_sco_tester_SOURCES = tools/sco-tester.c monitor/bt.h \
 				emulator/hciemu.h emulator/hciemu.c \
@@ -153,10 +153,10 @@ tools_sco_tester_SOURCES = tools/sco-tester.c monitor/bt.h \
 				emulator/bthost.h emulator/bthost.c \
 				emulator/smp.c
 tools_sco_tester_LDADD = lib/libbluetooth-internal.la \
-				src/libshared-glib.la @GLIB_LIBS@
+				src/libshared-glib.la $(GLIB_LIBS)
 
 tools_hci_tester_SOURCES = tools/hci-tester.c monitor/bt.h
-tools_hci_tester_LDADD = src/libshared-glib.la @GLIB_LIBS@
+tools_hci_tester_LDADD = src/libshared-glib.la $(GLIB_LIBS)
 
 tools_userchan_tester_SOURCES = tools/userchan-tester.c monitor/bt.h \
 				emulator/hciemu.h emulator/hciemu.c \
@@ -164,7 +164,7 @@ tools_userchan_tester_SOURCES = tools/userchan-tester.c monitor/bt.h \
 				emulator/bthost.h emulator/bthost.c \
 				emulator/smp.c
 tools_userchan_tester_LDADD = lib/libbluetooth-internal.la \
-				src/libshared-glib.la @GLIB_LIBS@
+				src/libshared-glib.la $(GLIB_LIBS)
 endif
 
 if TOOLS
@@ -187,7 +187,7 @@ noinst_PROGRAMS += tools/bdaddr tools/avinfo tools/avtest \
 			tools/gatt-service profiles/iap/iapd
 
 tools_bdaddr_SOURCES = tools/bdaddr.c src/oui.h src/oui.c
-tools_bdaddr_LDADD = lib/libbluetooth-internal.la @UDEV_LIBS@
+tools_bdaddr_LDADD = lib/libbluetooth-internal.la $(UDEV_LIBS)
 
 tools_avinfo_LDADD = lib/libbluetooth-internal.la
 
@@ -217,20 +217,20 @@ tools_btproxy_SOURCES = tools/btproxy.c monitor/bt.h
 tools_btproxy_LDADD = src/libshared-mainloop.la
 
 tools_btiotest_SOURCES = tools/btiotest.c btio/btio.h btio/btio.c
-tools_btiotest_LDADD = lib/libbluetooth-internal.la @GLIB_LIBS@
+tools_btiotest_LDADD = lib/libbluetooth-internal.la $(GLIB_LIBS)
 
 tools_mcaptest_SOURCES = tools/mcaptest.c \
 				btio/btio.h btio/btio.c \
 				src/log.c src/log.h \
 				profiles/health/mcap.h profiles/health/mcap.c
-tools_mcaptest_LDADD = lib/libbluetooth-internal.la @GLIB_LIBS@ \
+tools_mcaptest_LDADD = lib/libbluetooth-internal.la $(GLIB_LIBS) \
 				src/libshared-mainloop.la -lrt
 
 tools_bneptest_SOURCES = tools/bneptest.c \
 				btio/btio.h btio/btio.c \
 				src/log.h src/log.c \
 				profiles/network/bnep.h profiles/network/bnep.c
-tools_bneptest_LDADD = lib/libbluetooth-internal.la @GLIB_LIBS@ \
+tools_bneptest_LDADD = lib/libbluetooth-internal.la $(GLIB_LIBS) \
 				src/libshared-mainloop.la
 
 tools_cltest_SOURCES = tools/cltest.c
@@ -282,13 +282,13 @@ tools_bluemoon_LDADD = src/libshared-mainloop.la
 tools_hex2hcd_SOURCES = tools/hex2hcd.c
 
 tools_mpris_proxy_SOURCES = tools/mpris-proxy.c
-tools_mpris_proxy_LDADD = gdbus/libgdbus-internal.la @GLIB_LIBS@ @DBUS_LIBS@
+tools_mpris_proxy_LDADD = gdbus/libgdbus-internal.la $(GLIB_LIBS) $(DBUS_LIBS)
 
 tools_gatt_service_SOURCES = tools/gatt-service.c
-tools_gatt_service_LDADD = @GLIB_LIBS@ @DBUS_LIBS@ gdbus/libgdbus-internal.la
+tools_gatt_service_LDADD = $(GLIB_LIBS) $(DBUS_LIBS) gdbus/libgdbus-internal.la
 
 profiles_iap_iapd_SOURCES = profiles/iap/main.c
-profiles_iap_iapd_LDADD = gdbus/libgdbus-internal.la @GLIB_LIBS@ @DBUS_LIBS@
+profiles_iap_iapd_LDADD = gdbus/libgdbus-internal.la $(GLIB_LIBS) $(DBUS_LIBS)
 
 dist_man_MANS += tools/rctest.1 tools/l2ping.1 tools/bccmd.1 tools/btattach.1
 
@@ -313,7 +313,7 @@ tools_meshctl_SOURCES = tools/meshctl.c \
 				tools/mesh/onoff-model.h tools/mesh/onoff-model.c
 tools_meshctl_LDADD = gdbus/libgdbus-internal.la src/libshared-glib.la \
 				lib/libbluetooth-internal.la \
-				@GLIB_LIBS@ @DBUS_LIBS@ -ljson-c -lreadline
+				$(GLIB_LIBS) $(DBUS_LIBS) -ljson-c -lreadline
 endif
 
 EXTRA_DIST += tools/mesh/local_node.json tools/mesh/prov_db.json
@@ -336,7 +336,7 @@ tools_hciconfig_SOURCES = tools/hciconfig.c tools/csr.h tools/csr.c
 tools_hciconfig_LDADD = lib/libbluetooth-internal.la
 
 tools_hcitool_SOURCES = tools/hcitool.c src/oui.h src/oui.c
-tools_hcitool_LDADD = lib/libbluetooth-internal.la @UDEV_LIBS@
+tools_hcitool_LDADD = lib/libbluetooth-internal.la $(UDEV_LIBS)
 
 tools_hcidump_SOURCES = tools/hcidump.c \
 				tools/parser/parser.h tools/parser/parser.c \
@@ -365,7 +365,7 @@ tools_hcidump_SOURCES = tools/hcidump.c \
 				tools/parser/bpa.c
 
 tools_sdptool_SOURCES = tools/sdptool.c src/sdp-xml.h src/sdp-xml.c
-tools_sdptool_LDADD = lib/libbluetooth-internal.la @GLIB_LIBS@
+tools_sdptool_LDADD = lib/libbluetooth-internal.la $(GLIB_LIBS)
 
 tools_ciptool_LDADD = lib/libbluetooth-internal.la
 tools_hcidump_LDADD = lib/libbluetooth-internal.la
@@ -385,11 +385,11 @@ EXTRA_DIST += tools/rctest.1 tools/l2ping.1 tools/bccmd.1 tools/btattach.1
 endif
 
 if HID2HCI
-udevdir = @UDEV_DIR@
+udevdir = $(UDEV_DIR)
 
 udev_PROGRAMS = tools/hid2hci
 
-tools_hid2hci_LDADD = @UDEV_LIBS@
+tools_hid2hci_LDADD = $(UDEV_LIBS)
 
 dist_man_MANS += tools/hid2hci.1
 else
@@ -403,20 +403,20 @@ noinst_PROGRAMS += tools/btmgmt tools/obex-client-tool tools/obex-server-tool \
 tools_obex_client_tool_SOURCES = $(gobex_sources) $(btio_sources) \
 						tools/obex-client-tool.c
 tools_obex_client_tool_LDADD = lib/libbluetooth-internal.la \
-						@GLIB_LIBS@ -lreadline
+						$(GLIB_LIBS) -lreadline
 
 tools_obex_server_tool_SOURCES = $(gobex_sources) $(btio_sources) \
 						tools/obex-server-tool.c
-tools_obex_server_tool_LDADD = lib/libbluetooth-internal.la @GLIB_LIBS@
+tools_obex_server_tool_LDADD = lib/libbluetooth-internal.la $(GLIB_LIBS)
 
 tools_bluetooth_player_SOURCES = tools/bluetooth-player.c
 tools_bluetooth_player_LDADD = gdbus/libgdbus-internal.la \
 				src/libshared-glib.la \
-				@GLIB_LIBS@ @DBUS_LIBS@ -lreadline
+				$(GLIB_LIBS) $(DBUS_LIBS) -lreadline
 
 tools_obexctl_SOURCES = tools/obexctl.c
 tools_obexctl_LDADD = gdbus/libgdbus-internal.la src/libshared-glib.la \
-				@GLIB_LIBS@ @DBUS_LIBS@ -lreadline
+				$(GLIB_LIBS) $(DBUS_LIBS) -lreadline
 
 tools_btmgmt_SOURCES = tools/btmgmt.c src/uuid-helper.c client/display.c
 tools_btmgmt_LDADD = lib/libbluetooth-internal.la src/libshared-mainloop.la \
@@ -430,7 +430,7 @@ attrib_gatttool_SOURCES = attrib/gatttool.c attrib/att.c attrib/gatt.c \
 				attrib/utils.c src/log.c client/display.c \
 				client/display.h
 attrib_gatttool_LDADD = lib/libbluetooth-internal.la \
-			src/libshared-glib.la @GLIB_LIBS@ -lreadline
+			src/libshared-glib.la $(GLIB_LIBS) -lreadline
 
 endif
 endif
@@ -446,7 +446,7 @@ profiles_cups_bluetooth_SOURCES = profiles/cups/main.c \
 					profiles/cups/spp.c \
 					profiles/cups/hcrp.c
 
-profiles_cups_bluetooth_LDADD = @GLIB_LIBS@ @DBUS_LIBS@ \
+profiles_cups_bluetooth_LDADD = $(GLIB_LIBS) $(DBUS_LIBS) \
 				lib/libbluetooth-internal.la \
 				gdbus/libgdbus-internal.la
 endif
@@ -469,6 +469,6 @@ if BTPCLIENT
 noinst_PROGRAMS += tools/btpclient
 
 tools_btpclient_SOURCES = tools/btpclient.c src/shared/btp.c src/shared/btp.h
-tools_btpclient_CFLAGS = $(AM_CFLAGS) @ELL_CFLAGS@
-tools_btpclient_LDADD = @ELL_LIBS@ lib/libbluetooth-internal.la
+tools_btpclient_CFLAGS = $(AM_CFLAGS) $(ELL_CFLAGS)
+tools_btpclient_LDADD = $(ELL_LIBS) lib/libbluetooth-internal.la
 endif
diff --git a/android/Makefile.am b/android/Makefile.am
index d665d1e14..d09a52d69 100644
--- a/android/Makefile.am
+++ b/android/Makefile.am
@@ -12,7 +12,7 @@ android_system_emulator_LDADD = src/libshared-mainloop.la
 noinst_PROGRAMS += android/bluetoothd-snoop
 
 android_bluetoothd_snoop_SOURCES = android/bluetoothd-snoop.c src/log.c
-android_bluetoothd_snoop_LDADD = src/libshared-mainloop.la @GLIB_LIBS@
+android_bluetoothd_snoop_LDADD = src/libshared-mainloop.la $(GLIB_LIBS)
 
 noinst_PROGRAMS += android/bluetoothd
 
@@ -59,7 +59,7 @@ android_bluetoothd_SOURCES = android/main.c \
 				src/sdp-client.h src/sdp-client.c \
 				profiles/network/bnep.h profiles/network/bnep.c
 android_bluetoothd_LDADD = lib/libbluetooth-internal.la \
-				src/libshared-glib.la @GLIB_LIBS@
+				src/libshared-glib.la $(GLIB_LIBS)
 
 plugin_LTLIBRARIES += android/bluetooth.default.la
 
@@ -110,7 +110,7 @@ android_avdtptest_SOURCES = android/avdtptest.c \
 				src/shared/log.h src/shared/log.c \
 				android/avdtp.h android/avdtp.c
 android_avdtptest_CFLAGS = $(AM_CFLAGS)
-android_avdtptest_LDADD = lib/libbluetooth-internal.la @GLIB_LIBS@
+android_avdtptest_LDADD = lib/libbluetooth-internal.la $(GLIB_LIBS)
 
 noinst_PROGRAMS += android/haltest
 
@@ -165,7 +165,7 @@ android_android_tester_SOURCES = emulator/hciemu.h emulator/hciemu.c \
 android_android_tester_CFLAGS = $(AM_CFLAGS) -I$(srcdir)/android \
 				-DPLUGINDIR=\""$(android_plugindir)"\"
 android_android_tester_LDADD = lib/libbluetooth-internal.la \
-				src/libshared-glib.la @GLIB_LIBS@
+				src/libshared-glib.la $(GLIB_LIBS)
 android_android_tester_LDFLAGS = -pthread -ldl
 
 noinst_PROGRAMS += android/ipc-tester
@@ -178,7 +178,7 @@ android_ipc_tester_SOURCES = emulator/hciemu.h emulator/hciemu.c \
 				android/ipc-common.h android/ipc-tester.c
 android_ipc_tester_CFLAGS = $(AM_CFLAGS) -I$(srcdir)/android
 android_ipc_tester_LDADD = lib/libbluetooth-internal.la \
-				src/libshared-glib.la @GLIB_LIBS@
+				src/libshared-glib.la $(GLIB_LIBS)
 
 plugin_LTLIBRARIES += android/audio.a2dp.default.la
 
@@ -193,8 +193,8 @@ android_audio_a2dp_default_la_SOURCES = android/audio-msg.h \
 					android/hardware/hardware.h \
 					android/system/audio.h
 android_audio_a2dp_default_la_CFLAGS = $(AM_CFLAGS) -I$(srcdir)/android \
-					@SBC_CFLAGS@
-android_audio_a2dp_default_la_LIBADD = @SBC_LIBS@
+					$(SBC_CFLAGS)
+android_audio_a2dp_default_la_LIBADD = $(SBC_LIBS)
 android_audio_a2dp_default_la_LDFLAGS = $(AM_LDFLAGS) -module -avoid-version \
 					-no-undefined -pthread -lrt
 
@@ -210,7 +210,7 @@ android_audio_sco_default_la_SOURCES = android/hal-log.h \
 					android/audio_utils/resampler.h \
 					android/system/audio.h
 android_audio_sco_default_la_CFLAGS = $(AM_CFLAGS) -I$(srcdir)/android
-android_audio_sco_default_la_LIBADD = @SPEEXDSP_LIBS@
+android_audio_sco_default_la_LIBADD = $(SPEEXDSP_LIBS)
 android_audio_sco_default_la_LDFLAGS = $(AM_LDFLAGS) -module -avoid-version \
 					-no-undefined -lrt
 unit_tests += android/test-ipc
@@ -219,7 +219,7 @@ android_test_ipc_SOURCES = android/test-ipc.c \
 				src/log.h src/log.c \
 				android/ipc-common.h \
 				android/ipc.c android/ipc.h
-android_test_ipc_LDADD = src/libshared-glib.la @GLIB_LIBS@
+android_test_ipc_LDADD = src/libshared-glib.la $(GLIB_LIBS)
 
 endif
 
-- 
2.19.1


^ permalink raw reply	[flat|nested] 35+ messages in thread

* [PATCH 2/7] build: -l arguments to belong into LDADD/LIBADD not LDFLAGS
  2018-11-21 12:57     ` Jan Engelhardt
  2018-11-21 12:57       ` [PATCH 1/7] build: change @foo@ to $(foo) in automake makefiles Jan Engelhardt
@ 2018-11-21 12:57       ` Jan Engelhardt
  2018-11-21 12:57       ` [PATCH 3/7] build: -D/-I arguments go into CPPFLAGS Jan Engelhardt
                         ` (4 subsequent siblings)
  6 siblings, 0 replies; 35+ messages in thread
From: Jan Engelhardt @ 2018-11-21 12:57 UTC (permalink / raw)
  To: luiz.dentz; +Cc: linux-bluetooth, jengelh

It is an error to put -l arguments into LDFLAGS, because the linker
command line is order-sensitive and libs must appear in certain
places. For this, automake has the LDADD/LIBADD.
---
 Makefile.plugins    |  3 ++-
 android/Makefile.am | 15 ++++++++-------
 2 files changed, 10 insertions(+), 8 deletions(-)

diff --git a/Makefile.plugins b/Makefile.plugins
index 1c9919d71..d3cf5cab8 100644
--- a/Makefile.plugins
+++ b/Makefile.plugins
@@ -107,6 +107,7 @@ if SIXAXIS
 plugin_LTLIBRARIES += plugins/sixaxis.la
 plugins_sixaxis_la_SOURCES = plugins/sixaxis.c
 plugins_sixaxis_la_LDFLAGS = $(AM_LDFLAGS) -module -avoid-version \
-						-no-undefined $(UDEV_LIBS)
+						-no-undefined
+plugins_sixaxis_la_LIBADD = $(UDEV_LIBS)
 plugins_sixaxis_la_CFLAGS = $(AM_CFLAGS) -fvisibility=hidden $(UDEV_CFLAGS)
 endif
diff --git a/android/Makefile.am b/android/Makefile.am
index d09a52d69..282bc0e7c 100644
--- a/android/Makefile.am
+++ b/android/Makefile.am
@@ -142,7 +142,8 @@ android_haltest_SOURCES = android/client/haltest.c \
 				android/hal-utils.h android/hal-utils.c
 android_haltest_CFLAGS = $(AM_CFLAGS) -I$(srcdir)/android \
 				-DPLUGINDIR=\""$(android_plugindir)"\"
-android_haltest_LDFLAGS = -pthread -ldl -lm
+android_haltest_LDFLAGS = -pthread
+android_haltest_LIBS = -ldl -lm
 
 noinst_PROGRAMS += android/android-tester
 
@@ -165,8 +166,8 @@ android_android_tester_SOURCES = emulator/hciemu.h emulator/hciemu.c \
 android_android_tester_CFLAGS = $(AM_CFLAGS) -I$(srcdir)/android \
 				-DPLUGINDIR=\""$(android_plugindir)"\"
 android_android_tester_LDADD = lib/libbluetooth-internal.la \
-				src/libshared-glib.la $(GLIB_LIBS)
-android_android_tester_LDFLAGS = -pthread -ldl
+				src/libshared-glib.la $(GLIB_LIBS) -ldl
+android_android_tester_LDFLAGS = -pthread
 
 noinst_PROGRAMS += android/ipc-tester
 
@@ -194,9 +195,9 @@ android_audio_a2dp_default_la_SOURCES = android/audio-msg.h \
 					android/system/audio.h
 android_audio_a2dp_default_la_CFLAGS = $(AM_CFLAGS) -I$(srcdir)/android \
 					$(SBC_CFLAGS)
-android_audio_a2dp_default_la_LIBADD = $(SBC_LIBS)
+android_audio_a2dp_default_la_LIBADD = $(SBC_LIBS) -lrt
 android_audio_a2dp_default_la_LDFLAGS = $(AM_LDFLAGS) -module -avoid-version \
-					-no-undefined -pthread -lrt
+					-no-undefined -pthread
 
 plugin_LTLIBRARIES += android/audio.sco.default.la
 
@@ -210,9 +211,9 @@ android_audio_sco_default_la_SOURCES = android/hal-log.h \
 					android/audio_utils/resampler.h \
 					android/system/audio.h
 android_audio_sco_default_la_CFLAGS = $(AM_CFLAGS) -I$(srcdir)/android
-android_audio_sco_default_la_LIBADD = $(SPEEXDSP_LIBS)
+android_audio_sco_default_la_LIBADD = $(SPEEXDSP_LIBS) -lrt
 android_audio_sco_default_la_LDFLAGS = $(AM_LDFLAGS) -module -avoid-version \
-					-no-undefined -lrt
+					-no-undefined
 unit_tests += android/test-ipc
 
 android_test_ipc_SOURCES = android/test-ipc.c \
-- 
2.19.1


^ permalink raw reply	[flat|nested] 35+ messages in thread

* [PATCH 3/7] build: -D/-I arguments go into CPPFLAGS
  2018-11-21 12:57     ` Jan Engelhardt
  2018-11-21 12:57       ` [PATCH 1/7] build: change @foo@ to $(foo) in automake makefiles Jan Engelhardt
  2018-11-21 12:57       ` [PATCH 2/7] build: -l arguments to belong into LDADD/LIBADD not LDFLAGS Jan Engelhardt
@ 2018-11-21 12:57       ` Jan Engelhardt
  2018-11-21 12:57       ` [PATCH 4/7] build: add missing ELL_CFLAGS Jan Engelhardt
                         ` (3 subsequent siblings)
  6 siblings, 0 replies; 35+ messages in thread
From: Jan Engelhardt @ 2018-11-21 12:57 UTC (permalink / raw)
  To: luiz.dentz; +Cc: linux-bluetooth, jengelh

-D and -I are preprocessor directives, they are therefore to appear
in CPPFLAGS, not CFLAGS. (It is unfortunate that pkg-config does not
make the distinction / or it was misnamed, because only -D/-I make
sense to be emitted by pkg-config in the first place — anything else
(-f/-m) has the potential to mess up someone's compilation. So
pkg-config's Cflags is actually used to convery Cppflags.)
---
 Makefile.am         |  9 ++++-----
 Makefile.obexd      |  7 ++++---
 Makefile.plugins    |  3 ++-
 Makefile.tools      |  2 +-
 android/Makefile.am | 14 +++++++-------
 5 files changed, 18 insertions(+), 17 deletions(-)

diff --git a/Makefile.am b/Makefile.am
index 1905a74b6..e913f3c42 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -1,5 +1,6 @@
 
 AM_MAKEFLAGS = --no-print-directory
+AM_CPPFLAGS =
 
 lib_LTLIBRARIES =
 
@@ -214,7 +215,7 @@ src_bluetoothd_DEPENDENCIES = lib/libbluetooth-internal.la \
 				src/libshared-glib.la \
 				src/bluetooth.service
 
-src_bluetoothd_CFLAGS = $(AM_CFLAGS) -DBLUETOOTH_PLUGIN_BUILTIN \
+src_bluetoothd_CPPFLAGS = $(AM_CPPFLAGS) -DBLUETOOTH_PLUGIN_BUILTIN \
 					-DPLUGINDIR=\""$(build_plugindir)"\"
 src_bluetoothd_SHORTNAME = bluetoothd
 
@@ -278,9 +279,7 @@ EXTRA_DIST += doc/btsnoop.txt
 
 EXTRA_DIST += tools/magic.btsnoop
 
-AM_CFLAGS += $(DBUS_CFLAGS) $(GLIB_CFLAGS)
-
-AM_CPPFLAGS = -I$(builddir)/lib
+AM_CPPFLAGS += $(DBUS_CFLAGS) $(GLIB_CFLAGS) -I$(builddir)/lib
 
 
 unit_tests += unit/test-eir
@@ -436,7 +435,7 @@ unit_test_gattrib_LDADD = lib/libbluetooth-internal.la \
 
 if MIDI
 unit_tests += unit/test-midi
-unit_test_midi_CFLAGS = $(AM_CFLAGS) $(ALSA_CFLAGS) -DMIDI_TEST
+unit_test_midi_CPPFLAGS = $(AM_CPPFLAGS) $(ALSA_CFLAGS) -DMIDI_TEST
 unit_test_midi_SOURCES = unit/test-midi.c \
 			profiles/midi/libmidi.h \
 			profiles/midi/libmidi.c
diff --git a/Makefile.obexd b/Makefile.obexd
index 9180d7eea..22a4977ef 100644
--- a/Makefile.obexd
+++ b/Makefile.obexd
@@ -83,12 +83,13 @@ obexd_src_obexd_LDADD = lib/libbluetooth-internal.la \
 
 obexd_src_obexd_LDFLAGS = -Wl,--export-dynamic
 
-obexd_src_obexd_CFLAGS = $(AM_CFLAGS) $(GLIB_CFLAGS) $(DBUS_CFLAGS) \
+obexd_src_obexd_CPPFLAGS = $(AM_CFLAGS) $(GLIB_CFLAGS) $(DBUS_CFLAGS) \
 				$(ICAL_CFLAGS) -DOBEX_PLUGIN_BUILTIN \
 				-DPLUGINDIR=\""$(obex_plugindir)"\" \
-				-fPIC -D_FILE_OFFSET_BITS=64
+				-D_FILE_OFFSET_BITS=64 \
+				-I$(builddir)/lib -I$(builddir)/obexd/src
 
-obexd_src_obexd_CPPFLAGS = -I$(builddir)/lib -I$(builddir)/obexd/src
+obexd_src_obexd_CFLAGS = -fPIC
 
 endif
 
diff --git a/Makefile.plugins b/Makefile.plugins
index d3cf5cab8..2aaeb7450 100644
--- a/Makefile.plugins
+++ b/Makefile.plugins
@@ -109,5 +109,6 @@ plugins_sixaxis_la_SOURCES = plugins/sixaxis.c
 plugins_sixaxis_la_LDFLAGS = $(AM_LDFLAGS) -module -avoid-version \
 						-no-undefined
 plugins_sixaxis_la_LIBADD = $(UDEV_LIBS)
-plugins_sixaxis_la_CFLAGS = $(AM_CFLAGS) -fvisibility=hidden $(UDEV_CFLAGS)
+plugins_sixaxis_la_CPPFLAGS = $(AM_CPPFLAGS) $(UDEV_CFLAGS)
+plugins_sixaxis_la_CFLAGS = $(AM_CFLAGS) -fvisibility=hidden
 endif
diff --git a/Makefile.tools b/Makefile.tools
index cdfaaf906..55e769d8c 100644
--- a/Makefile.tools
+++ b/Makefile.tools
@@ -469,6 +469,6 @@ if BTPCLIENT
 noinst_PROGRAMS += tools/btpclient
 
 tools_btpclient_SOURCES = tools/btpclient.c src/shared/btp.c src/shared/btp.h
-tools_btpclient_CFLAGS = $(AM_CFLAGS) $(ELL_CFLAGS)
+tools_btpclient_CPPFLAGS = $(AM_CPPFLAGS) $(ELL_CFLAGS)
 tools_btpclient_LDADD = $(ELL_LIBS) lib/libbluetooth-internal.la
 endif
diff --git a/android/Makefile.am b/android/Makefile.am
index 282bc0e7c..9f83743e2 100644
--- a/android/Makefile.am
+++ b/android/Makefile.am
@@ -1,6 +1,6 @@
 if ANDROID
 
-AM_CFLAGS += -DANDROID_VERSION=0x050100
+AM_CPPFLAGS += -DANDROID_VERSION=0x050100
 
 android_plugindir = $(abs_top_srcdir)/android/.libs
 
@@ -96,7 +96,7 @@ android_bluetooth_default_la_SOURCES = android/hal.h android/hal-bluetooth.c \
 					android/hal-log.h \
 					android/hal-ipc.h android/hal-ipc.c \
 					android/hal-utils.h android/hal-utils.c
-android_bluetooth_default_la_CFLAGS = $(AM_CFLAGS) -I$(srcdir)/android
+android_bluetooth_default_la_CPPFLAGS = $(AM_CPPFLAGS) -I$(srcdir)/android
 android_bluetooth_default_la_LDFLAGS = $(AM_LDFLAGS) -module -avoid-version \
 					-no-undefined
 
@@ -140,7 +140,7 @@ android_haltest_SOURCES = android/client/haltest.c \
 				android/client/if-mce.c \
 				android/hardware/hardware.c \
 				android/hal-utils.h android/hal-utils.c
-android_haltest_CFLAGS = $(AM_CFLAGS) -I$(srcdir)/android \
+android_haltest_CPPFLAGS = $(AM_CPPFLAGS) -I$(srcdir)/android \
 				-DPLUGINDIR=\""$(android_plugindir)"\"
 android_haltest_LDFLAGS = -pthread
 android_haltest_LIBS = -ldl -lm
@@ -163,7 +163,7 @@ android_android_tester_SOURCES = emulator/hciemu.h emulator/hciemu.c \
 				android/tester-gatt.c \
 				android/tester-map-client.c \
 				android/tester-main.h android/tester-main.c
-android_android_tester_CFLAGS = $(AM_CFLAGS) -I$(srcdir)/android \
+android_android_tester_CPPFLAGS = $(AM_CPPFLAGS) -I$(srcdir)/android \
 				-DPLUGINDIR=\""$(android_plugindir)"\"
 android_android_tester_LDADD = lib/libbluetooth-internal.la \
 				src/libshared-glib.la $(GLIB_LIBS) -ldl
@@ -177,7 +177,7 @@ android_ipc_tester_SOURCES = emulator/hciemu.h emulator/hciemu.c \
 				emulator/smp.c \
 				android/hal-utils.h android/hal-utils.c \
 				android/ipc-common.h android/ipc-tester.c
-android_ipc_tester_CFLAGS = $(AM_CFLAGS) -I$(srcdir)/android
+android_ipc_tester_CPPFLAGS = $(AM_CPPFLAGS) -I$(srcdir)/android
 android_ipc_tester_LDADD = lib/libbluetooth-internal.la \
 				src/libshared-glib.la $(GLIB_LIBS)
 
@@ -193,7 +193,7 @@ android_audio_a2dp_default_la_SOURCES = android/audio-msg.h \
 					android/hardware/audio_effect.h \
 					android/hardware/hardware.h \
 					android/system/audio.h
-android_audio_a2dp_default_la_CFLAGS = $(AM_CFLAGS) -I$(srcdir)/android \
+android_audio_a2dp_default_la_CPPFLAGS = $(AM_CPPFLAGS) -I$(srcdir)/android \
 					$(SBC_CFLAGS)
 android_audio_a2dp_default_la_LIBADD = $(SBC_LIBS) -lrt
 android_audio_a2dp_default_la_LDFLAGS = $(AM_LDFLAGS) -module -avoid-version \
@@ -210,7 +210,7 @@ android_audio_sco_default_la_SOURCES = android/hal-log.h \
 					android/audio_utils/resampler.c \
 					android/audio_utils/resampler.h \
 					android/system/audio.h
-android_audio_sco_default_la_CFLAGS = $(AM_CFLAGS) -I$(srcdir)/android
+android_audio_sco_default_la_CPPFLAGS = $(AM_CPPFLAGS) -I$(srcdir)/android
 android_audio_sco_default_la_LIBADD = $(SPEEXDSP_LIBS) -lrt
 android_audio_sco_default_la_LDFLAGS = $(AM_LDFLAGS) -module -avoid-version \
 					-no-undefined
-- 
2.19.1


^ permalink raw reply	[flat|nested] 35+ messages in thread

* [PATCH 4/7] build: add missing ELL_CFLAGS
  2018-11-21 12:57     ` Jan Engelhardt
                         ` (2 preceding siblings ...)
  2018-11-21 12:57       ` [PATCH 3/7] build: -D/-I arguments go into CPPFLAGS Jan Engelhardt
@ 2018-11-21 12:57       ` Jan Engelhardt
  2018-11-21 12:57       ` [PATCH 5/7] build: add missing UDEV_CFLAGS Jan Engelhardt
                         ` (2 subsequent siblings)
  6 siblings, 0 replies; 35+ messages in thread
From: Jan Engelhardt @ 2018-11-21 12:57 UTC (permalink / raw)
  To: luiz.dentz; +Cc: linux-bluetooth, jengelh

Some targets link ELL_LIBS, which means they also need ELL_CFLAGS
in their (or the global) CPPFLAGS.
---
 Makefile.am   | 1 +
 Makefile.mesh | 4 ++++
 2 files changed, 5 insertions(+)

diff --git a/Makefile.am b/Makefile.am
index e913f3c42..727a63ea5 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -140,6 +140,7 @@ src_libshared_mainloop_la_SOURCES = $(shared_sources) \
 if ELL
 src_libshared_ell_la_SOURCES = $(shared_sources) \
 				src/shared/io-ell.c
+src_libshared_ell_la_CPPFLAGS = $(AM_CPPFLAGS) $(ELL_CFLAGS)
 noinst_LTLIBRARIES += src/libshared-ell.la
 endif
 
diff --git a/Makefile.mesh b/Makefile.mesh
index 50bcc19ad..4de22ba8c 100644
--- a/Makefile.mesh
+++ b/Makefile.mesh
@@ -21,6 +21,8 @@ mesh_sources = mesh/mesh.h mesh/mesh.c \
 				mesh/mesh-defs.h
 libexec_PROGRAMS += mesh/meshd
 
+mesh_meshd_CPPFLAGS = $(AM_CPPFLAGS) $(ELL_CFLAGS)
+
 mesh_meshd_SOURCES = $(mesh_sources) mesh/main.c
 
 mesh_meshd_LDADD = src/shared/ecc.lo src/shared/queue.lo src/shared/io-ell.lo \
@@ -34,6 +36,8 @@ mesh_btmesh_SOURCES = $(mesh_sources) \
 						mesh/agent.c \
 						mesh/btmesh.c
 
+mesh_btmesh_CPPFLAGS = $(AM_CPPFLAGS) $(ELL_CFLAGS)
+
 mesh_btmesh_LDADD = src/shared/ecc.lo src/shared/queue.lo src/shared/io-ell.lo \
 				src/shared/util.lo src/shared/hci.lo src/shared/mgmt.lo \
 				src/libshared-mainloop.la \
-- 
2.19.1


^ permalink raw reply	[flat|nested] 35+ messages in thread

* [PATCH 5/7] build: add missing UDEV_CFLAGS
  2018-11-21 12:57     ` Jan Engelhardt
                         ` (3 preceding siblings ...)
  2018-11-21 12:57       ` [PATCH 4/7] build: add missing ELL_CFLAGS Jan Engelhardt
@ 2018-11-21 12:57       ` Jan Engelhardt
  2018-11-21 12:57       ` [PATCH 6/7] build: add missing ALSA_CFLAGS Jan Engelhardt
  2018-11-21 12:57       ` [PATCH 7/7] build: add missing BACKTRACE_CFLAGS Jan Engelhardt
  6 siblings, 0 replies; 35+ messages in thread
From: Jan Engelhardt @ 2018-11-21 12:57 UTC (permalink / raw)
  To: luiz.dentz; +Cc: linux-bluetooth, jengelh

Some targets link UDEV_LIBS, which means they also need UDEV_CFLAGS
in their (or the global) CPPFLAGS.
---
 Makefile.tools | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/Makefile.tools b/Makefile.tools
index 55e769d8c..35412ca61 100644
--- a/Makefile.tools
+++ b/Makefile.tools
@@ -38,6 +38,7 @@ monitor_btmon_SOURCES = monitor/main.c monitor/bt.h \
 				monitor/intel.h monitor/intel.c \
 				monitor/broadcom.h monitor/broadcom.c \
 				monitor/tty.h
+monitor_btmon_CPPFLAGS = $(AM_CPPFLAGS) $(UDEV_CFLAGS)
 monitor_btmon_LDADD = lib/libbluetooth-internal.la \
 				src/libshared-mainloop.la $(UDEV_LIBS)
 endif
@@ -187,6 +188,7 @@ noinst_PROGRAMS += tools/bdaddr tools/avinfo tools/avtest \
 			tools/gatt-service profiles/iap/iapd
 
 tools_bdaddr_SOURCES = tools/bdaddr.c src/oui.h src/oui.c
+tools_bdaddr_CPPFLAGS = $(AM_CPPFLAGS) $(UDEV_CFLAGS)
 tools_bdaddr_LDADD = lib/libbluetooth-internal.la $(UDEV_LIBS)
 
 tools_avinfo_LDADD = lib/libbluetooth-internal.la
@@ -336,6 +338,7 @@ tools_hciconfig_SOURCES = tools/hciconfig.c tools/csr.h tools/csr.c
 tools_hciconfig_LDADD = lib/libbluetooth-internal.la
 
 tools_hcitool_SOURCES = tools/hcitool.c src/oui.h src/oui.c
+tools_hcitool_CPPFLAGS = $(AM_CPPFLAGS) $(UDEV_CFLAGS)
 tools_hcitool_LDADD = lib/libbluetooth-internal.la $(UDEV_LIBS)
 
 tools_hcidump_SOURCES = tools/hcidump.c \
@@ -389,6 +392,7 @@ udevdir = $(UDEV_DIR)
 
 udev_PROGRAMS = tools/hid2hci
 
+tools_hid2hci_CPPFLAGS = $(AM_CPPFLAGS) $(UDEV_CFLAGS)
 tools_hid2hci_LDADD = $(UDEV_LIBS)
 
 dist_man_MANS += tools/hid2hci.1
-- 
2.19.1


^ permalink raw reply	[flat|nested] 35+ messages in thread

* [PATCH 6/7] build: add missing ALSA_CFLAGS
  2018-11-21 12:57     ` Jan Engelhardt
                         ` (4 preceding siblings ...)
  2018-11-21 12:57       ` [PATCH 5/7] build: add missing UDEV_CFLAGS Jan Engelhardt
@ 2018-11-21 12:57       ` Jan Engelhardt
  2018-11-21 12:57       ` [PATCH 7/7] build: add missing BACKTRACE_CFLAGS Jan Engelhardt
  6 siblings, 0 replies; 35+ messages in thread
From: Jan Engelhardt @ 2018-11-21 12:57 UTC (permalink / raw)
  To: luiz.dentz; +Cc: linux-bluetooth, jengelh

Some targets use ALSA_LIBS, hence need ALSA_CFLAGS.
---
 Makefile.am      | 4 +++-
 Makefile.plugins | 1 +
 2 files changed, 4 insertions(+), 1 deletion(-)

diff --git a/Makefile.am b/Makefile.am
index 727a63ea5..3af43e118 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -160,6 +160,7 @@ gobex_sources = gobex/gobex.h gobex/gobex.c \
 
 builtin_modules =
 builtin_sources =
+builtin_cppflags =
 builtin_nodist =
 builtin_ldadd =
 
@@ -217,7 +218,8 @@ src_bluetoothd_DEPENDENCIES = lib/libbluetooth-internal.la \
 				src/bluetooth.service
 
 src_bluetoothd_CPPFLAGS = $(AM_CPPFLAGS) -DBLUETOOTH_PLUGIN_BUILTIN \
-					-DPLUGINDIR=\""$(build_plugindir)"\"
+					-DPLUGINDIR=\""$(build_plugindir)"\" \
+					$(builtin_cppflags)
 src_bluetoothd_SHORTNAME = bluetoothd
 
 builtin_files = src/builtin.h $(builtin_nodist)
diff --git a/Makefile.plugins b/Makefile.plugins
index 2aaeb7450..47bf317cb 100644
--- a/Makefile.plugins
+++ b/Makefile.plugins
@@ -97,6 +97,7 @@ builtin_modules += midi
 builtin_sources += profiles/midi/midi.c \
 			profiles/midi/libmidi.h \
 			profiles/midi/libmidi.c
+builtin_cppflags += $(ALSA_CFLAGS)
 builtin_ldadd += $(ALSA_LIBS)
 endif
 
-- 
2.19.1


^ permalink raw reply	[flat|nested] 35+ messages in thread

* [PATCH 7/7] build: add missing BACKTRACE_CFLAGS
  2018-11-21 12:57     ` Jan Engelhardt
                         ` (5 preceding siblings ...)
  2018-11-21 12:57       ` [PATCH 6/7] build: add missing ALSA_CFLAGS Jan Engelhardt
@ 2018-11-21 12:57       ` Jan Engelhardt
  6 siblings, 0 replies; 35+ messages in thread
From: Jan Engelhardt @ 2018-11-21 12:57 UTC (permalink / raw)
  To: luiz.dentz; +Cc: linux-bluetooth, jengelh

Some targets use BACKTRACE_LIBS, hence need BACKTRACE_CFLAGS.
---
 Makefile.am | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/Makefile.am b/Makefile.am
index 3af43e118..057dab7f8 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -219,7 +219,7 @@ src_bluetoothd_DEPENDENCIES = lib/libbluetooth-internal.la \
 
 src_bluetoothd_CPPFLAGS = $(AM_CPPFLAGS) -DBLUETOOTH_PLUGIN_BUILTIN \
 					-DPLUGINDIR=\""$(build_plugindir)"\" \
-					$(builtin_cppflags)
+					$(BACKTRACE_CFLAGS) $(builtin_cppflags)
 src_bluetoothd_SHORTNAME = bluetoothd
 
 builtin_files = src/builtin.h $(builtin_nodist)
-- 
2.19.1


^ permalink raw reply	[flat|nested] 35+ messages in thread

* Re: [PATCH 1/7] build: change @foo@ to $(foo) in automake makefiles
  2018-11-21 12:57       ` [PATCH 1/7] build: change @foo@ to $(foo) in automake makefiles Jan Engelhardt
@ 2018-11-22  9:47         ` Luiz Augusto von Dentz
  2018-11-24 13:27           ` Jan Engelhardt
  2018-11-25  9:20           ` [PATCH bluez] build system refresh (take 3) Jan Engelhardt
  0 siblings, 2 replies; 35+ messages in thread
From: Luiz Augusto von Dentz @ 2018-11-22  9:47 UTC (permalink / raw)
  To: jengelh; +Cc: linux-bluetooth

Hi Jan,
On Wed, Nov 21, 2018 at 2:58 PM Jan Engelhardt <jengelh@inai.de> wrote:
>
> When using automake, all AC_SUBSTed variables are made available as
> make variables, so that they can also be set at make time. Therefore,
> they need not use the @harcoded@ style.
> ---
>  Makefile.am         | 70 ++++++++++++++++++++++-----------------------
>  Makefile.mesh       |  4 +--
>  Makefile.obexd      | 10 +++----
>  Makefile.plugins    |  6 ++--
>  Makefile.tools      | 62 +++++++++++++++++++--------------------
>  android/Makefile.am | 18 ++++++------
>  6 files changed, 85 insertions(+), 85 deletions(-)
>
> diff --git a/Makefile.am b/Makefile.am
> index d4f4572d5..1905a74b6 100644
> --- a/Makefile.am
> +++ b/Makefile.am
> @@ -19,11 +19,11 @@ CLEANFILES =
>
>  EXTRA_DIST =
>
> -pkglibexecdir = @libexecdir@/bluetooth
> +pkglibexecdir = $(libexecdir)/bluetooth
>
>  libexec_PROGRAMS =
>
> -includedir = @includedir@/bluetooth
> +includedir = $(includedir)/bluetooth
>
>  include_HEADERS =
>
> @@ -31,7 +31,7 @@ AM_CFLAGS = $(WARNING_CFLAGS) $(MISC_CFLAGS)
>  AM_LDFLAGS = $(MISC_LDFLAGS)
>
>  if DATAFILES
> -dbusdir = @DBUS_CONFDIR@/dbus-1/system.d
> +dbusdir = $(DBUS_CONFDIR)/dbus-1/system.d
>  dbus_DATA = src/bluetooth.conf
>
>  confdir = $(sysconfdir)/bluetooth
> @@ -42,10 +42,10 @@ state_DATA =
>  endif
>
>  if SYSTEMD
> -systemdsystemunitdir = @SYSTEMD_SYSTEMUNITDIR@
> +systemdsystemunitdir = $(SYSTEMD_SYSTEMUNITDIR)
>  systemdsystemunit_DATA = src/bluetooth.service
>
> -dbussystembusdir = @DBUS_SYSTEMBUSDIR@
> +dbussystembusdir = $(DBUS_SYSTEMBUSDIR)
>  dbussystembus_DATA = src/org.bluez.service
>  endif
>
> @@ -204,7 +204,7 @@ src_bluetoothd_SOURCES = $(builtin_sources) \
>  src_bluetoothd_LDADD = lib/libbluetooth-internal.la \
>                         gdbus/libgdbus-internal.la \
>                         src/libshared-glib.la \
> -                       @BACKTRACE_LIBS@ @GLIB_LIBS@ @DBUS_LIBS@ -ldl -lrt \
> +                       $(BACKTRACE_LIBS) $(GLIB_LIBS) $(DBUS_LIBS) -ldl -lrt \
>                         $(builtin_ldadd)
>  src_bluetoothd_LDFLAGS = $(AM_LDFLAGS) -Wl,--export-dynamic \
>                                 -Wl,--version-script=$(srcdir)/src/bluetooth.ver
> @@ -239,7 +239,7 @@ include android/Makefile.am
>  include Makefile.mesh
>
>  if HID2HCI
> -rulesdir = @UDEV_DIR@/rules.d
> +rulesdir = $(UDEV_DIR)/rules.d
>
>  rules_DATA = tools/97-hid2hci.rules
>
> @@ -278,7 +278,7 @@ EXTRA_DIST += doc/btsnoop.txt
>
>  EXTRA_DIST += tools/magic.btsnoop
>
> -AM_CFLAGS += @DBUS_CFLAGS@ @GLIB_CFLAGS@
> +AM_CFLAGS += $(DBUS_CFLAGS) $(GLIB_CFLAGS)
>
>  AM_CPPFLAGS = -I$(builddir)/lib
>
> @@ -287,51 +287,51 @@ unit_tests += unit/test-eir
>
>  unit_test_eir_SOURCES = unit/test-eir.c src/eir.c src/uuid-helper.c
>  unit_test_eir_LDADD = src/libshared-glib.la lib/libbluetooth-internal.la \
> -                                                               @GLIB_LIBS@
> +                                                               $(GLIB_LIBS)
>
>  unit_tests += unit/test-uuid
>
>  unit_test_uuid_SOURCES = unit/test-uuid.c
>  unit_test_uuid_LDADD = src/libshared-glib.la lib/libbluetooth-internal.la \
> -                                                               @GLIB_LIBS@
> +                                                               $(GLIB_LIBS)
>
>  unit_tests += unit/test-textfile
>
>  unit_test_textfile_SOURCES = unit/test-textfile.c src/textfile.h src/textfile.c
> -unit_test_textfile_LDADD = src/libshared-glib.la @GLIB_LIBS@
> +unit_test_textfile_LDADD = src/libshared-glib.la $(GLIB_LIBS)
>
>  unit_tests += unit/test-crc
>
>  unit_test_crc_SOURCES = unit/test-crc.c monitor/crc.h monitor/crc.c
> -unit_test_crc_LDADD = src/libshared-glib.la @GLIB_LIBS@
> +unit_test_crc_LDADD = src/libshared-glib.la $(GLIB_LIBS)
>
>  unit_tests += unit/test-crypto
>
>  unit_test_crypto_SOURCES = unit/test-crypto.c
> -unit_test_crypto_LDADD = src/libshared-glib.la @GLIB_LIBS@
> +unit_test_crypto_LDADD = src/libshared-glib.la $(GLIB_LIBS)
>
>  unit_tests += unit/test-ecc
>
>  unit_test_ecc_SOURCES = unit/test-ecc.c
> -unit_test_ecc_LDADD = src/libshared-glib.la @GLIB_LIBS@
> +unit_test_ecc_LDADD = src/libshared-glib.la $(GLIB_LIBS)
>
>  unit_tests += unit/test-ringbuf unit/test-queue
>
>  unit_test_ringbuf_SOURCES = unit/test-ringbuf.c
> -unit_test_ringbuf_LDADD = src/libshared-glib.la @GLIB_LIBS@
> +unit_test_ringbuf_LDADD = src/libshared-glib.la $(GLIB_LIBS)
>
>  unit_test_queue_SOURCES = unit/test-queue.c
> -unit_test_queue_LDADD = src/libshared-glib.la @GLIB_LIBS@
> +unit_test_queue_LDADD = src/libshared-glib.la $(GLIB_LIBS)
>
>  unit_tests += unit/test-mgmt
>
>  unit_test_mgmt_SOURCES = unit/test-mgmt.c
> -unit_test_mgmt_LDADD = src/libshared-glib.la @GLIB_LIBS@
> +unit_test_mgmt_LDADD = src/libshared-glib.la $(GLIB_LIBS)
>
>  unit_tests += unit/test-uhid
>
>  unit_test_uhid_SOURCES = unit/test-uhid.c
> -unit_test_uhid_LDADD = src/libshared-glib.la @GLIB_LIBS@
> +unit_test_uhid_LDADD = src/libshared-glib.la $(GLIB_LIBS)
>
>  unit_tests += unit/test-sdp
>
> @@ -340,21 +340,21 @@ unit_test_sdp_SOURCES = unit/test-sdp.c \
>                                 src/log.h src/log.c \
>                                 src/sdpd-service.c src/sdpd-request.c
>  unit_test_sdp_LDADD = lib/libbluetooth-internal.la \
> -                               src/libshared-glib.la @GLIB_LIBS@
> +                               src/libshared-glib.la $(GLIB_LIBS)
>
>  unit_tests += unit/test-avdtp
>
>  unit_test_avdtp_SOURCES = unit/test-avdtp.c \
>                                 src/log.h src/log.c \
>                                 android/avdtp.c android/avdtp.h
> -unit_test_avdtp_LDADD = src/libshared-glib.la @GLIB_LIBS@
> +unit_test_avdtp_LDADD = src/libshared-glib.la $(GLIB_LIBS)
>
>  unit_tests += unit/test-avctp
>
>  unit_test_avctp_SOURCES = unit/test-avctp.c \
>                                 src/log.h src/log.c \
>                                 android/avctp.c android/avctp.h
> -unit_test_avctp_LDADD = src/libshared-glib.la @GLIB_LIBS@
> +unit_test_avctp_LDADD = src/libshared-glib.la $(GLIB_LIBS)
>
>  unit_tests += unit/test-avrcp
>
> @@ -363,53 +363,53 @@ unit_test_avrcp_SOURCES = unit/test-avrcp.c \
>                                 android/avctp.c android/avctp.h \
>                                 android/avrcp-lib.c android/avrcp-lib.h
>  unit_test_avrcp_LDADD = lib/libbluetooth-internal.la \
> -                               src/libshared-glib.la @GLIB_LIBS@
> +                               src/libshared-glib.la $(GLIB_LIBS)
>
>  unit_tests += unit/test-hfp
>
>  unit_test_hfp_SOURCES = unit/test-hfp.c
> -unit_test_hfp_LDADD = src/libshared-glib.la @GLIB_LIBS@
> +unit_test_hfp_LDADD = src/libshared-glib.la $(GLIB_LIBS)
>
>  unit_tests += unit/test-gdbus-client
>
>  unit_test_gdbus_client_SOURCES = unit/test-gdbus-client.c
>  unit_test_gdbus_client_LDADD = gdbus/libgdbus-internal.la \
> -                               src/libshared-glib.la @GLIB_LIBS@ @DBUS_LIBS@
> +                               src/libshared-glib.la $(GLIB_LIBS) $(DBUS_LIBS)
>
>  unit_tests += unit/test-gobex-header unit/test-gobex-packet unit/test-gobex \
>                         unit/test-gobex-transfer unit/test-gobex-apparam
>
>  unit_test_gobex_SOURCES = $(gobex_sources) unit/util.c unit/util.h \
>                                                 unit/test-gobex.c
> -unit_test_gobex_LDADD = @GLIB_LIBS@
> +unit_test_gobex_LDADD = $(GLIB_LIBS)
>
>  unit_test_gobex_packet_SOURCES = $(gobex_sources) unit/util.c unit/util.h \
>                                                 unit/test-gobex-packet.c
> -unit_test_gobex_packet_LDADD = @GLIB_LIBS@
> +unit_test_gobex_packet_LDADD = $(GLIB_LIBS)
>
>  unit_test_gobex_header_SOURCES = $(gobex_sources) unit/util.c unit/util.h \
>                                                 unit/test-gobex-header.c
> -unit_test_gobex_header_LDADD = @GLIB_LIBS@
> +unit_test_gobex_header_LDADD = $(GLIB_LIBS)
>
>  unit_test_gobex_transfer_SOURCES = $(gobex_sources) unit/util.c unit/util.h \
>                                                 unit/test-gobex-transfer.c
> -unit_test_gobex_transfer_LDADD = @GLIB_LIBS@
> +unit_test_gobex_transfer_LDADD = $(GLIB_LIBS)
>
>  unit_test_gobex_apparam_SOURCES = $(gobex_sources) unit/util.c unit/util.h \
>                                                 unit/test-gobex-apparam.c
> -unit_test_gobex_apparam_LDADD = @GLIB_LIBS@
> +unit_test_gobex_apparam_LDADD = $(GLIB_LIBS)
>
>  unit_tests += unit/test-lib
>
>  unit_test_lib_SOURCES = unit/test-lib.c
>  unit_test_lib_LDADD = src/libshared-glib.la \
> -                               lib/libbluetooth-internal.la @GLIB_LIBS@
> +                               lib/libbluetooth-internal.la $(GLIB_LIBS)
>
>  unit_tests += unit/test-gatt
>
>  unit_test_gatt_SOURCES = unit/test-gatt.c
>  unit_test_gatt_LDADD = src/libshared-glib.la \
> -                               lib/libbluetooth-internal.la @GLIB_LIBS@
> +                               lib/libbluetooth-internal.la $(GLIB_LIBS)
>
>  unit_tests += unit/test-hog
>
> @@ -424,7 +424,7 @@ unit_test_hog_SOURCES = unit/test-hog.c \
>                         attrib/gatt.h attrib/gatt.c \
>                         attrib/gattrib.h attrib/gattrib.c
>  unit_test_hog_LDADD = src/libshared-glib.la \
> -                               lib/libbluetooth-internal.la @GLIB_LIBS@
> +                               lib/libbluetooth-internal.la $(GLIB_LIBS)
>
>  unit_tests += unit/test-gattrib
>
> @@ -432,16 +432,16 @@ unit_test_gattrib_SOURCES = unit/test-gattrib.c attrib/gattrib.c \
>                                         $(btio_sources) src/log.h src/log.c
>  unit_test_gattrib_LDADD = lib/libbluetooth-internal.la \
>                         src/libshared-glib.la \
> -                       @GLIB_LIBS@ @DBUS_LIBS@ -ldl -lrt
> +                       $(GLIB_LIBS) $(DBUS_LIBS) -ldl -lrt
>
>  if MIDI
>  unit_tests += unit/test-midi
> -unit_test_midi_CFLAGS = $(AM_CFLAGS) @ALSA_CFLAGS@ -DMIDI_TEST
> +unit_test_midi_CFLAGS = $(AM_CFLAGS) $(ALSA_CFLAGS) -DMIDI_TEST
>  unit_test_midi_SOURCES = unit/test-midi.c \
>                         profiles/midi/libmidi.h \
>                         profiles/midi/libmidi.c
>  unit_test_midi_LDADD = src/libshared-glib.la \
> -                       @GLIB_LIBS@ @ALSA_LIBS@
> +                       $(GLIB_LIBS) $(ALSA_LIBS)
>  endif
>
>  if MAINTAINER_MODE
> diff --git a/Makefile.mesh b/Makefile.mesh
> index 0df7db2be..50bcc19ad 100644
> --- a/Makefile.mesh
> +++ b/Makefile.mesh
> @@ -25,7 +25,7 @@ mesh_meshd_SOURCES = $(mesh_sources) mesh/main.c
>
>  mesh_meshd_LDADD = src/shared/ecc.lo src/shared/queue.lo src/shared/io-ell.lo \
>                                 src/shared/util.lo src/shared/hci.lo src/shared/mgmt.lo \
> -                               @DBUS_LIBS@ @ELL_LIBS@ -ljson-c
> +                               $(DBUS_LIBS) $(ELL_LIBS) -ljson-c
>
>  noinst_PROGRAMS += mesh/btmesh
>
> @@ -37,6 +37,6 @@ mesh_btmesh_SOURCES = $(mesh_sources) \
>  mesh_btmesh_LDADD = src/shared/ecc.lo src/shared/queue.lo src/shared/io-ell.lo \
>                                 src/shared/util.lo src/shared/hci.lo src/shared/mgmt.lo \
>                                 src/libshared-mainloop.la \
> -                               -lreadline @ELL_LIBS@ -ljson-c
> +                               -lreadline $(ELL_LIBS) -ljson-c
>
>  endif
> diff --git a/Makefile.obexd b/Makefile.obexd
> index cd3ace425..9180d7eea 100644
> --- a/Makefile.obexd
> +++ b/Makefile.obexd
> @@ -1,8 +1,8 @@
>  if SYSTEMD
> -systemduserunitdir = @SYSTEMD_USERUNITDIR@
> +systemduserunitdir = $(SYSTEMD_USERUNITDIR)
>  systemduserunit_DATA = obexd/src/obex.service
>
> -dbussessionbusdir = @DBUS_SESSIONBUSDIR@
> +dbussessionbusdir = $(DBUS_SESSIONBUSDIR)
>  dbussessionbus_DATA = obexd/src/org.bluez.obex.service
>  endif
>
> @@ -79,12 +79,12 @@ obexd_src_obexd_SOURCES = $(btio_sources) $(gobex_sources) \
>                         obexd/src/map_ap.h
>  obexd_src_obexd_LDADD = lib/libbluetooth-internal.la \
>                         gdbus/libgdbus-internal.la \
> -                       @ICAL_LIBS@ @DBUS_LIBS@ @GLIB_LIBS@ -ldl
> +                       $(ICAL_LIBS) $(DBUS_LIBS) $(GLIB_LIBS) -ldl
>
>  obexd_src_obexd_LDFLAGS = -Wl,--export-dynamic
>
> -obexd_src_obexd_CFLAGS = $(AM_CFLAGS) @GLIB_CFLAGS@ @DBUS_CFLAGS@ \
> -                               @ICAL_CFLAGS@ -DOBEX_PLUGIN_BUILTIN \
> +obexd_src_obexd_CFLAGS = $(AM_CFLAGS) $(GLIB_CFLAGS) $(DBUS_CFLAGS) \
> +                               $(ICAL_CFLAGS) -DOBEX_PLUGIN_BUILTIN \
>                                 -DPLUGINDIR=\""$(obex_plugindir)"\" \
>                                 -fPIC -D_FILE_OFFSET_BITS=64
>
> diff --git a/Makefile.plugins b/Makefile.plugins
> index 3ab7c1c18..1c9919d71 100644
> --- a/Makefile.plugins
> +++ b/Makefile.plugins
> @@ -97,7 +97,7 @@ builtin_modules += midi
>  builtin_sources += profiles/midi/midi.c \
>                         profiles/midi/libmidi.h \
>                         profiles/midi/libmidi.c
> -builtin_ldadd += @ALSA_LIBS@
> +builtin_ldadd += $(ALSA_LIBS)
>  endif
>
>  builtin_modules += battery
> @@ -107,6 +107,6 @@ if SIXAXIS
>  plugin_LTLIBRARIES += plugins/sixaxis.la
>  plugins_sixaxis_la_SOURCES = plugins/sixaxis.c
>  plugins_sixaxis_la_LDFLAGS = $(AM_LDFLAGS) -module -avoid-version \
> -                                               -no-undefined @UDEV_LIBS@
> -plugins_sixaxis_la_CFLAGS = $(AM_CFLAGS) -fvisibility=hidden @UDEV_CFLAGS@
> +                                               -no-undefined $(UDEV_LIBS)
> +plugins_sixaxis_la_CFLAGS = $(AM_CFLAGS) -fvisibility=hidden $(UDEV_CFLAGS)
>  endif
> diff --git a/Makefile.tools b/Makefile.tools
> index 231a4b09b..cdfaaf906 100644
> --- a/Makefile.tools
> +++ b/Makefile.tools
> @@ -9,7 +9,7 @@ client_bluetoothctl_SOURCES = client/main.c \
>                                         client/advertising.c \
>                                         client/gatt.h client/gatt.c
>  client_bluetoothctl_LDADD = gdbus/libgdbus-internal.la src/libshared-glib.la \
> -                               @GLIB_LIBS@ @DBUS_LIBS@ -lreadline
> +                               $(GLIB_LIBS) $(DBUS_LIBS) -lreadline
>  endif
>
>  if MONITOR
> @@ -39,7 +39,7 @@ monitor_btmon_SOURCES = monitor/main.c monitor/bt.h \
>                                 monitor/broadcom.h monitor/broadcom.c \
>                                 monitor/tty.h
>  monitor_btmon_LDADD = lib/libbluetooth-internal.la \
> -                               src/libshared-mainloop.la @UDEV_LIBS@
> +                               src/libshared-mainloop.la $(UDEV_LIBS)
>  endif
>
>  if LOGGER
> @@ -103,7 +103,7 @@ tools_mgmt_tester_SOURCES = tools/mgmt-tester.c monitor/bt.h \
>                                 emulator/bthost.h emulator/bthost.c \
>                                 emulator/smp.c
>  tools_mgmt_tester_LDADD = lib/libbluetooth-internal.la \
> -                               src/libshared-glib.la @GLIB_LIBS@
> +                               src/libshared-glib.la $(GLIB_LIBS)
>
>  tools_l2cap_tester_SOURCES = tools/l2cap-tester.c monitor/bt.h \
>                                 emulator/hciemu.h emulator/hciemu.c \
> @@ -111,7 +111,7 @@ tools_l2cap_tester_SOURCES = tools/l2cap-tester.c monitor/bt.h \
>                                 emulator/bthost.h emulator/bthost.c \
>                                 emulator/smp.c
>  tools_l2cap_tester_LDADD = lib/libbluetooth-internal.la \
> -                               src/libshared-glib.la @GLIB_LIBS@
> +                               src/libshared-glib.la $(GLIB_LIBS)
>
>  tools_rfcomm_tester_SOURCES = tools/rfcomm-tester.c monitor/bt.h \
>                                 emulator/hciemu.h emulator/hciemu.c \
> @@ -119,7 +119,7 @@ tools_rfcomm_tester_SOURCES = tools/rfcomm-tester.c monitor/bt.h \
>                                 emulator/bthost.h emulator/bthost.c \
>                                 emulator/smp.c
>  tools_rfcomm_tester_LDADD = lib/libbluetooth-internal.la \
> -                               src/libshared-glib.la @GLIB_LIBS@
> +                               src/libshared-glib.la $(GLIB_LIBS)
>
>  tools_bnep_tester_SOURCES = tools/bnep-tester.c monitor/bt.h \
>                                 emulator/hciemu.h emulator/hciemu.c \
> @@ -127,7 +127,7 @@ tools_bnep_tester_SOURCES = tools/bnep-tester.c monitor/bt.h \
>                                 emulator/bthost.h emulator/bthost.c \
>                                 emulator/smp.c
>  tools_bnep_tester_LDADD = lib/libbluetooth-internal.la \
> -                               src/libshared-glib.la @GLIB_LIBS@
> +                               src/libshared-glib.la $(GLIB_LIBS)
>
>  tools_smp_tester_SOURCES = tools/smp-tester.c monitor/bt.h \
>                                 emulator/hciemu.h emulator/hciemu.c \
> @@ -135,7 +135,7 @@ tools_smp_tester_SOURCES = tools/smp-tester.c monitor/bt.h \
>                                 emulator/bthost.h emulator/bthost.c \
>                                 emulator/smp.c
>  tools_smp_tester_LDADD = lib/libbluetooth-internal.la \
> -                               src/libshared-glib.la @GLIB_LIBS@
> +                               src/libshared-glib.la $(GLIB_LIBS)
>
>  tools_gap_tester_SOURCES = tools/gap-tester.c monitor/bt.h \
>                                 emulator/hciemu.h emulator/hciemu.c \
> @@ -145,7 +145,7 @@ tools_gap_tester_SOURCES = tools/gap-tester.c monitor/bt.h \
>  tools_gap_tester_LDADD =  lib/libbluetooth-internal.la \
>                                 gdbus/libgdbus-internal.la \
>                                 src/libshared-glib.la \
> -                               @GLIB_LIBS@ @DBUS_LIBS@
> +                               $(GLIB_LIBS) $(DBUS_LIBS)
>
>  tools_sco_tester_SOURCES = tools/sco-tester.c monitor/bt.h \
>                                 emulator/hciemu.h emulator/hciemu.c \
> @@ -153,10 +153,10 @@ tools_sco_tester_SOURCES = tools/sco-tester.c monitor/bt.h \
>                                 emulator/bthost.h emulator/bthost.c \
>                                 emulator/smp.c
>  tools_sco_tester_LDADD = lib/libbluetooth-internal.la \
> -                               src/libshared-glib.la @GLIB_LIBS@
> +                               src/libshared-glib.la $(GLIB_LIBS)
>
>  tools_hci_tester_SOURCES = tools/hci-tester.c monitor/bt.h
> -tools_hci_tester_LDADD = src/libshared-glib.la @GLIB_LIBS@
> +tools_hci_tester_LDADD = src/libshared-glib.la $(GLIB_LIBS)
>
>  tools_userchan_tester_SOURCES = tools/userchan-tester.c monitor/bt.h \
>                                 emulator/hciemu.h emulator/hciemu.c \
> @@ -164,7 +164,7 @@ tools_userchan_tester_SOURCES = tools/userchan-tester.c monitor/bt.h \
>                                 emulator/bthost.h emulator/bthost.c \
>                                 emulator/smp.c
>  tools_userchan_tester_LDADD = lib/libbluetooth-internal.la \
> -                               src/libshared-glib.la @GLIB_LIBS@
> +                               src/libshared-glib.la $(GLIB_LIBS)
>  endif
>
>  if TOOLS
> @@ -187,7 +187,7 @@ noinst_PROGRAMS += tools/bdaddr tools/avinfo tools/avtest \
>                         tools/gatt-service profiles/iap/iapd
>
>  tools_bdaddr_SOURCES = tools/bdaddr.c src/oui.h src/oui.c
> -tools_bdaddr_LDADD = lib/libbluetooth-internal.la @UDEV_LIBS@
> +tools_bdaddr_LDADD = lib/libbluetooth-internal.la $(UDEV_LIBS)
>
>  tools_avinfo_LDADD = lib/libbluetooth-internal.la
>
> @@ -217,20 +217,20 @@ tools_btproxy_SOURCES = tools/btproxy.c monitor/bt.h
>  tools_btproxy_LDADD = src/libshared-mainloop.la
>
>  tools_btiotest_SOURCES = tools/btiotest.c btio/btio.h btio/btio.c
> -tools_btiotest_LDADD = lib/libbluetooth-internal.la @GLIB_LIBS@
> +tools_btiotest_LDADD = lib/libbluetooth-internal.la $(GLIB_LIBS)
>
>  tools_mcaptest_SOURCES = tools/mcaptest.c \
>                                 btio/btio.h btio/btio.c \
>                                 src/log.c src/log.h \
>                                 profiles/health/mcap.h profiles/health/mcap.c
> -tools_mcaptest_LDADD = lib/libbluetooth-internal.la @GLIB_LIBS@ \
> +tools_mcaptest_LDADD = lib/libbluetooth-internal.la $(GLIB_LIBS) \
>                                 src/libshared-mainloop.la -lrt
>
>  tools_bneptest_SOURCES = tools/bneptest.c \
>                                 btio/btio.h btio/btio.c \
>                                 src/log.h src/log.c \
>                                 profiles/network/bnep.h profiles/network/bnep.c
> -tools_bneptest_LDADD = lib/libbluetooth-internal.la @GLIB_LIBS@ \
> +tools_bneptest_LDADD = lib/libbluetooth-internal.la $(GLIB_LIBS) \
>                                 src/libshared-mainloop.la
>
>  tools_cltest_SOURCES = tools/cltest.c
> @@ -282,13 +282,13 @@ tools_bluemoon_LDADD = src/libshared-mainloop.la
>  tools_hex2hcd_SOURCES = tools/hex2hcd.c
>
>  tools_mpris_proxy_SOURCES = tools/mpris-proxy.c
> -tools_mpris_proxy_LDADD = gdbus/libgdbus-internal.la @GLIB_LIBS@ @DBUS_LIBS@
> +tools_mpris_proxy_LDADD = gdbus/libgdbus-internal.la $(GLIB_LIBS) $(DBUS_LIBS)
>
>  tools_gatt_service_SOURCES = tools/gatt-service.c
> -tools_gatt_service_LDADD = @GLIB_LIBS@ @DBUS_LIBS@ gdbus/libgdbus-internal.la
> +tools_gatt_service_LDADD = $(GLIB_LIBS) $(DBUS_LIBS) gdbus/libgdbus-internal.la
>
>  profiles_iap_iapd_SOURCES = profiles/iap/main.c
> -profiles_iap_iapd_LDADD = gdbus/libgdbus-internal.la @GLIB_LIBS@ @DBUS_LIBS@
> +profiles_iap_iapd_LDADD = gdbus/libgdbus-internal.la $(GLIB_LIBS) $(DBUS_LIBS)
>
>  dist_man_MANS += tools/rctest.1 tools/l2ping.1 tools/bccmd.1 tools/btattach.1
>
> @@ -313,7 +313,7 @@ tools_meshctl_SOURCES = tools/meshctl.c \
>                                 tools/mesh/onoff-model.h tools/mesh/onoff-model.c
>  tools_meshctl_LDADD = gdbus/libgdbus-internal.la src/libshared-glib.la \
>                                 lib/libbluetooth-internal.la \
> -                               @GLIB_LIBS@ @DBUS_LIBS@ -ljson-c -lreadline
> +                               $(GLIB_LIBS) $(DBUS_LIBS) -ljson-c -lreadline
>  endif
>
>  EXTRA_DIST += tools/mesh/local_node.json tools/mesh/prov_db.json
> @@ -336,7 +336,7 @@ tools_hciconfig_SOURCES = tools/hciconfig.c tools/csr.h tools/csr.c
>  tools_hciconfig_LDADD = lib/libbluetooth-internal.la
>
>  tools_hcitool_SOURCES = tools/hcitool.c src/oui.h src/oui.c
> -tools_hcitool_LDADD = lib/libbluetooth-internal.la @UDEV_LIBS@
> +tools_hcitool_LDADD = lib/libbluetooth-internal.la $(UDEV_LIBS)
>
>  tools_hcidump_SOURCES = tools/hcidump.c \
>                                 tools/parser/parser.h tools/parser/parser.c \
> @@ -365,7 +365,7 @@ tools_hcidump_SOURCES = tools/hcidump.c \
>                                 tools/parser/bpa.c
>
>  tools_sdptool_SOURCES = tools/sdptool.c src/sdp-xml.h src/sdp-xml.c
> -tools_sdptool_LDADD = lib/libbluetooth-internal.la @GLIB_LIBS@
> +tools_sdptool_LDADD = lib/libbluetooth-internal.la $(GLIB_LIBS)
>
>  tools_ciptool_LDADD = lib/libbluetooth-internal.la
>  tools_hcidump_LDADD = lib/libbluetooth-internal.la
> @@ -385,11 +385,11 @@ EXTRA_DIST += tools/rctest.1 tools/l2ping.1 tools/bccmd.1 tools/btattach.1
>  endif
>
>  if HID2HCI
> -udevdir = @UDEV_DIR@
> +udevdir = $(UDEV_DIR)
>
>  udev_PROGRAMS = tools/hid2hci
>
> -tools_hid2hci_LDADD = @UDEV_LIBS@
> +tools_hid2hci_LDADD = $(UDEV_LIBS)
>
>  dist_man_MANS += tools/hid2hci.1
>  else
> @@ -403,20 +403,20 @@ noinst_PROGRAMS += tools/btmgmt tools/obex-client-tool tools/obex-server-tool \
>  tools_obex_client_tool_SOURCES = $(gobex_sources) $(btio_sources) \
>                                                 tools/obex-client-tool.c
>  tools_obex_client_tool_LDADD = lib/libbluetooth-internal.la \
> -                                               @GLIB_LIBS@ -lreadline
> +                                               $(GLIB_LIBS) -lreadline
>
>  tools_obex_server_tool_SOURCES = $(gobex_sources) $(btio_sources) \
>                                                 tools/obex-server-tool.c
> -tools_obex_server_tool_LDADD = lib/libbluetooth-internal.la @GLIB_LIBS@
> +tools_obex_server_tool_LDADD = lib/libbluetooth-internal.la $(GLIB_LIBS)
>
>  tools_bluetooth_player_SOURCES = tools/bluetooth-player.c
>  tools_bluetooth_player_LDADD = gdbus/libgdbus-internal.la \
>                                 src/libshared-glib.la \
> -                               @GLIB_LIBS@ @DBUS_LIBS@ -lreadline
> +                               $(GLIB_LIBS) $(DBUS_LIBS) -lreadline
>
>  tools_obexctl_SOURCES = tools/obexctl.c
>  tools_obexctl_LDADD = gdbus/libgdbus-internal.la src/libshared-glib.la \
> -                               @GLIB_LIBS@ @DBUS_LIBS@ -lreadline
> +                               $(GLIB_LIBS) $(DBUS_LIBS) -lreadline
>
>  tools_btmgmt_SOURCES = tools/btmgmt.c src/uuid-helper.c client/display.c
>  tools_btmgmt_LDADD = lib/libbluetooth-internal.la src/libshared-mainloop.la \
> @@ -430,7 +430,7 @@ attrib_gatttool_SOURCES = attrib/gatttool.c attrib/att.c attrib/gatt.c \
>                                 attrib/utils.c src/log.c client/display.c \
>                                 client/display.h
>  attrib_gatttool_LDADD = lib/libbluetooth-internal.la \
> -                       src/libshared-glib.la @GLIB_LIBS@ -lreadline
> +                       src/libshared-glib.la $(GLIB_LIBS) -lreadline
>
>  endif
>  endif
> @@ -446,7 +446,7 @@ profiles_cups_bluetooth_SOURCES = profiles/cups/main.c \
>                                         profiles/cups/spp.c \
>                                         profiles/cups/hcrp.c
>
> -profiles_cups_bluetooth_LDADD = @GLIB_LIBS@ @DBUS_LIBS@ \
> +profiles_cups_bluetooth_LDADD = $(GLIB_LIBS) $(DBUS_LIBS) \
>                                 lib/libbluetooth-internal.la \
>                                 gdbus/libgdbus-internal.la
>  endif
> @@ -469,6 +469,6 @@ if BTPCLIENT
>  noinst_PROGRAMS += tools/btpclient
>
>  tools_btpclient_SOURCES = tools/btpclient.c src/shared/btp.c src/shared/btp.h
> -tools_btpclient_CFLAGS = $(AM_CFLAGS) @ELL_CFLAGS@
> -tools_btpclient_LDADD = @ELL_LIBS@ lib/libbluetooth-internal.la
> +tools_btpclient_CFLAGS = $(AM_CFLAGS) $(ELL_CFLAGS)
> +tools_btpclient_LDADD = $(ELL_LIBS) lib/libbluetooth-internal.la
>  endif
> diff --git a/android/Makefile.am b/android/Makefile.am
> index d665d1e14..d09a52d69 100644
> --- a/android/Makefile.am
> +++ b/android/Makefile.am
> @@ -12,7 +12,7 @@ android_system_emulator_LDADD = src/libshared-mainloop.la
>  noinst_PROGRAMS += android/bluetoothd-snoop
>
>  android_bluetoothd_snoop_SOURCES = android/bluetoothd-snoop.c src/log.c
> -android_bluetoothd_snoop_LDADD = src/libshared-mainloop.la @GLIB_LIBS@
> +android_bluetoothd_snoop_LDADD = src/libshared-mainloop.la $(GLIB_LIBS)
>
>  noinst_PROGRAMS += android/bluetoothd
>
> @@ -59,7 +59,7 @@ android_bluetoothd_SOURCES = android/main.c \
>                                 src/sdp-client.h src/sdp-client.c \
>                                 profiles/network/bnep.h profiles/network/bnep.c
>  android_bluetoothd_LDADD = lib/libbluetooth-internal.la \
> -                               src/libshared-glib.la @GLIB_LIBS@
> +                               src/libshared-glib.la $(GLIB_LIBS)
>
>  plugin_LTLIBRARIES += android/bluetooth.default.la
>
> @@ -110,7 +110,7 @@ android_avdtptest_SOURCES = android/avdtptest.c \
>                                 src/shared/log.h src/shared/log.c \
>                                 android/avdtp.h android/avdtp.c
>  android_avdtptest_CFLAGS = $(AM_CFLAGS)
> -android_avdtptest_LDADD = lib/libbluetooth-internal.la @GLIB_LIBS@
> +android_avdtptest_LDADD = lib/libbluetooth-internal.la $(GLIB_LIBS)
>
>  noinst_PROGRAMS += android/haltest
>
> @@ -165,7 +165,7 @@ android_android_tester_SOURCES = emulator/hciemu.h emulator/hciemu.c \
>  android_android_tester_CFLAGS = $(AM_CFLAGS) -I$(srcdir)/android \
>                                 -DPLUGINDIR=\""$(android_plugindir)"\"
>  android_android_tester_LDADD = lib/libbluetooth-internal.la \
> -                               src/libshared-glib.la @GLIB_LIBS@
> +                               src/libshared-glib.la $(GLIB_LIBS)
>  android_android_tester_LDFLAGS = -pthread -ldl
>
>  noinst_PROGRAMS += android/ipc-tester
> @@ -178,7 +178,7 @@ android_ipc_tester_SOURCES = emulator/hciemu.h emulator/hciemu.c \
>                                 android/ipc-common.h android/ipc-tester.c
>  android_ipc_tester_CFLAGS = $(AM_CFLAGS) -I$(srcdir)/android
>  android_ipc_tester_LDADD = lib/libbluetooth-internal.la \
> -                               src/libshared-glib.la @GLIB_LIBS@
> +                               src/libshared-glib.la $(GLIB_LIBS)
>
>  plugin_LTLIBRARIES += android/audio.a2dp.default.la
>
> @@ -193,8 +193,8 @@ android_audio_a2dp_default_la_SOURCES = android/audio-msg.h \
>                                         android/hardware/hardware.h \
>                                         android/system/audio.h
>  android_audio_a2dp_default_la_CFLAGS = $(AM_CFLAGS) -I$(srcdir)/android \
> -                                       @SBC_CFLAGS@
> -android_audio_a2dp_default_la_LIBADD = @SBC_LIBS@
> +                                       $(SBC_CFLAGS)
> +android_audio_a2dp_default_la_LIBADD = $(SBC_LIBS)
>  android_audio_a2dp_default_la_LDFLAGS = $(AM_LDFLAGS) -module -avoid-version \
>                                         -no-undefined -pthread -lrt
>
> @@ -210,7 +210,7 @@ android_audio_sco_default_la_SOURCES = android/hal-log.h \
>                                         android/audio_utils/resampler.h \
>                                         android/system/audio.h
>  android_audio_sco_default_la_CFLAGS = $(AM_CFLAGS) -I$(srcdir)/android
> -android_audio_sco_default_la_LIBADD = @SPEEXDSP_LIBS@
> +android_audio_sco_default_la_LIBADD = $(SPEEXDSP_LIBS)
>  android_audio_sco_default_la_LDFLAGS = $(AM_LDFLAGS) -module -avoid-version \
>                                         -no-undefined -lrt
>  unit_tests += android/test-ipc
> @@ -219,7 +219,7 @@ android_test_ipc_SOURCES = android/test-ipc.c \
>                                 src/log.h src/log.c \
>                                 android/ipc-common.h \
>                                 android/ipc.c android/ipc.h
> -android_test_ipc_LDADD = src/libshared-glib.la @GLIB_LIBS@
> +android_test_ipc_LDADD = src/libshared-glib.la $(GLIB_LIBS)
>
>  endif
>
> --
> 2.19.1

Makefile:2392: *** Recursive variable 'includedir' references itself
(eventually).  Stop.
make[3]: *** Waiting for unfinished jobs....
make[2]: *** [Makefile:9544: install-am] Error 2
make[1]: *** [Makefile:9538: install] Error 2
make: *** [Makefile:9449: distcheck] Error 1
warning: execution failed: make distcheck
You can fix the problem, and then run

Ive also got other problems when doing make distcheck with all patches
applied so Id recommend you do:

git rebase -i origin/master --exec "make distcheck"



-- 
Luiz Augusto von Dentz

^ permalink raw reply	[flat|nested] 35+ messages in thread

* Re: [PATCH 1/7] build: change @foo@ to $(foo) in automake makefiles
  2018-11-22  9:47         ` Luiz Augusto von Dentz
@ 2018-11-24 13:27           ` Jan Engelhardt
  2018-11-25  9:20           ` [PATCH bluez] build system refresh (take 3) Jan Engelhardt
  1 sibling, 0 replies; 35+ messages in thread
From: Jan Engelhardt @ 2018-11-24 13:27 UTC (permalink / raw)
  To: Luiz Augusto von Dentz; +Cc: linux-bluetooth

On Thursday 2018-11-22 10:47, Luiz Augusto von Dentz wrote:

>Hi Jan,
>> When using automake, all AC_SUBSTed variables are made available as
>> make variables, so that they can also be set at make time. Therefore,
>> they need not use the @harcoded@ style.
>>
>> -pkglibexecdir = @libexecdir@/bluetooth
>> +pkglibexecdir = $(libexecdir)/bluetooth
>> -includedir = @includedir@/bluetooth
>> +includedir = $(includedir)/bluetooth
>
>Makefile:2392: *** Recursive variable 'includedir' references itself
>(eventually).  Stop.

Thank you. Not sure why my system does not give the recursive warning here (it
*did* for libexecdir though, which is what brought commit 78bce48009 forth).
I'll do the distcheck too (apparently that --enables-android, which I missed).

^ permalink raw reply	[flat|nested] 35+ messages in thread

* [PATCH bluez] build system refresh (take 3)
  2018-11-22  9:47         ` Luiz Augusto von Dentz
  2018-11-24 13:27           ` Jan Engelhardt
@ 2018-11-25  9:20           ` Jan Engelhardt
  2018-11-25  9:20             ` [PATCH 1/8] build: rename includedir to pkgincludedir Jan Engelhardt
                               ` (8 more replies)
  1 sibling, 9 replies; 35+ messages in thread
From: Jan Engelhardt @ 2018-11-25  9:20 UTC (permalink / raw)
  To: luiz.dentz; +Cc: linux-bluetooth


The following changes since commit 9568f4439efdf5daa2f941f544d8a84a2eee5cac:

  doc: Initial Bluetooth Mesh API (2018-11-22 11:15:45 -0800)

are available in the Git repository at:

  git://github.com/jengelh/bluez

for you to fetch changes up to 97561f245b7609e4c041b4083a7922817acc3ae7:

  build: add missing BACKTRACE_CFLAGS (2018-11-24 20:09:10 +0100)

----------------------------------------------------------------
Jan Engelhardt (8):
      build: rename includedir to pkgincludedir
      build: change @foo@ to $(foo) in automake makefiles
      build: -l arguments to belong into LDADD/LIBADD not LDFLAGS
      build: -D/-I arguments go into CPPFLAGS
      build: add missing ELL_CFLAGS
      build: add missing UDEV_CFLAGS
      build: add missing ALSA_CFLAGS
      build: add missing BACKTRACE_CFLAGS

 Makefile.am         | 84 +++++++++++++++++++++++++++++++++++++++++++-----------------------------------------
 Makefile.mesh       |  8 ++++++--
 Makefile.obexd      | 15 ++++++++-------
 Makefile.plugins    |  9 ++++++---
 Makefile.tools      | 66 +++++++++++++++++++++++++++++++++++-------------------------------
 android/Makefile.am | 41 +++++++++++++++++++++--------------------
 6 files changed, 119 insertions(+), 104 deletions(-)


^ permalink raw reply	[flat|nested] 35+ messages in thread

* [PATCH 1/8] build: rename includedir to pkgincludedir
  2018-11-25  9:20           ` [PATCH bluez] build system refresh (take 3) Jan Engelhardt
@ 2018-11-25  9:20             ` Jan Engelhardt
  2018-11-25  9:20             ` [PATCH 2/8] build: change @foo@ to $(foo) in automake makefiles Jan Engelhardt
                               ` (7 subsequent siblings)
  8 siblings, 0 replies; 35+ messages in thread
From: Jan Engelhardt @ 2018-11-25  9:20 UTC (permalink / raw)
  To: luiz.dentz; +Cc: linux-bluetooth

This change is similar to commit 5.50-130-g78bce4800 and does the
same, but for includedir.
---
 Makefile.am | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/Makefile.am b/Makefile.am
index d4f4572d5..e63c72def 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -23,9 +23,9 @@ pkglibexecdir = @libexecdir@/bluetooth
 
 libexec_PROGRAMS =
 
-includedir = @includedir@/bluetooth
+pkgincludedir = @includedir@/bluetooth
 
-include_HEADERS =
+pkginclude_HEADERS =
 
 AM_CFLAGS = $(WARNING_CFLAGS) $(MISC_CFLAGS)
 AM_LDFLAGS = $(MISC_LDFLAGS)
@@ -75,7 +75,7 @@ local_headers = $(foreach file,$(lib_headers), lib/bluetooth/$(notdir $(file)))
 BUILT_SOURCES = $(local_headers) src/builtin.h
 
 if LIBRARY
-include_HEADERS += $(lib_headers)
+pkginclude_HEADERS += $(lib_headers)
 
 lib_LTLIBRARIES += lib/libbluetooth.la
 
-- 
2.19.1


^ permalink raw reply	[flat|nested] 35+ messages in thread

* [PATCH 2/8] build: change @foo@ to $(foo) in automake makefiles
  2018-11-25  9:20           ` [PATCH bluez] build system refresh (take 3) Jan Engelhardt
  2018-11-25  9:20             ` [PATCH 1/8] build: rename includedir to pkgincludedir Jan Engelhardt
@ 2018-11-25  9:20             ` Jan Engelhardt
  2018-11-25  9:20             ` [PATCH 3/8] build: -l arguments to belong into LDADD/LIBADD not LDFLAGS Jan Engelhardt
                               ` (6 subsequent siblings)
  8 siblings, 0 replies; 35+ messages in thread
From: Jan Engelhardt @ 2018-11-25  9:20 UTC (permalink / raw)
  To: luiz.dentz; +Cc: linux-bluetooth

When using automake, all AC_SUBSTed variables are made available as
make variables, so that they can also be set at make time. Therefore,
they need not use the @harcoded@ style.
---
 Makefile.am         | 70 ++++++++++++++++++++++-----------------------
 Makefile.mesh       |  4 +--
 Makefile.obexd      | 10 +++----
 Makefile.plugins    |  6 ++--
 Makefile.tools      | 62 +++++++++++++++++++--------------------
 android/Makefile.am | 18 ++++++------
 6 files changed, 85 insertions(+), 85 deletions(-)

diff --git a/Makefile.am b/Makefile.am
index e63c72def..dec0dc516 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -19,11 +19,11 @@ CLEANFILES =
 
 EXTRA_DIST =
 
-pkglibexecdir = @libexecdir@/bluetooth
+pkglibexecdir = $(libexecdir)/bluetooth
 
 libexec_PROGRAMS =
 
-pkgincludedir = @includedir@/bluetooth
+pkgincludedir = $(includedir)/bluetooth
 
 pkginclude_HEADERS =
 
@@ -31,7 +31,7 @@ AM_CFLAGS = $(WARNING_CFLAGS) $(MISC_CFLAGS)
 AM_LDFLAGS = $(MISC_LDFLAGS)
 
 if DATAFILES
-dbusdir = @DBUS_CONFDIR@/dbus-1/system.d
+dbusdir = $(DBUS_CONFDIR)/dbus-1/system.d
 dbus_DATA = src/bluetooth.conf
 
 confdir = $(sysconfdir)/bluetooth
@@ -42,10 +42,10 @@ state_DATA =
 endif
 
 if SYSTEMD
-systemdsystemunitdir = @SYSTEMD_SYSTEMUNITDIR@
+systemdsystemunitdir = $(SYSTEMD_SYSTEMUNITDIR)
 systemdsystemunit_DATA = src/bluetooth.service
 
-dbussystembusdir = @DBUS_SYSTEMBUSDIR@
+dbussystembusdir = $(DBUS_SYSTEMBUSDIR)
 dbussystembus_DATA = src/org.bluez.service
 endif
 
@@ -204,7 +204,7 @@ src_bluetoothd_SOURCES = $(builtin_sources) \
 src_bluetoothd_LDADD = lib/libbluetooth-internal.la \
 			gdbus/libgdbus-internal.la \
 			src/libshared-glib.la \
-			@BACKTRACE_LIBS@ @GLIB_LIBS@ @DBUS_LIBS@ -ldl -lrt \
+			$(BACKTRACE_LIBS) $(GLIB_LIBS) $(DBUS_LIBS) -ldl -lrt \
 			$(builtin_ldadd)
 src_bluetoothd_LDFLAGS = $(AM_LDFLAGS) -Wl,--export-dynamic \
 				-Wl,--version-script=$(srcdir)/src/bluetooth.ver
@@ -239,7 +239,7 @@ include android/Makefile.am
 include Makefile.mesh
 
 if HID2HCI
-rulesdir = @UDEV_DIR@/rules.d
+rulesdir = $(UDEV_DIR)/rules.d
 
 rules_DATA = tools/97-hid2hci.rules
 
@@ -278,7 +278,7 @@ EXTRA_DIST += doc/btsnoop.txt
 
 EXTRA_DIST += tools/magic.btsnoop
 
-AM_CFLAGS += @DBUS_CFLAGS@ @GLIB_CFLAGS@
+AM_CFLAGS += $(DBUS_CFLAGS) $(GLIB_CFLAGS)
 
 AM_CPPFLAGS = -I$(builddir)/lib
 
@@ -287,51 +287,51 @@ unit_tests += unit/test-eir
 
 unit_test_eir_SOURCES = unit/test-eir.c src/eir.c src/uuid-helper.c
 unit_test_eir_LDADD = src/libshared-glib.la lib/libbluetooth-internal.la \
-								@GLIB_LIBS@
+								$(GLIB_LIBS)
 
 unit_tests += unit/test-uuid
 
 unit_test_uuid_SOURCES = unit/test-uuid.c
 unit_test_uuid_LDADD = src/libshared-glib.la lib/libbluetooth-internal.la \
-								@GLIB_LIBS@
+								$(GLIB_LIBS)
 
 unit_tests += unit/test-textfile
 
 unit_test_textfile_SOURCES = unit/test-textfile.c src/textfile.h src/textfile.c
-unit_test_textfile_LDADD = src/libshared-glib.la @GLIB_LIBS@
+unit_test_textfile_LDADD = src/libshared-glib.la $(GLIB_LIBS)
 
 unit_tests += unit/test-crc
 
 unit_test_crc_SOURCES = unit/test-crc.c monitor/crc.h monitor/crc.c
-unit_test_crc_LDADD = src/libshared-glib.la @GLIB_LIBS@
+unit_test_crc_LDADD = src/libshared-glib.la $(GLIB_LIBS)
 
 unit_tests += unit/test-crypto
 
 unit_test_crypto_SOURCES = unit/test-crypto.c
-unit_test_crypto_LDADD = src/libshared-glib.la @GLIB_LIBS@
+unit_test_crypto_LDADD = src/libshared-glib.la $(GLIB_LIBS)
 
 unit_tests += unit/test-ecc
 
 unit_test_ecc_SOURCES = unit/test-ecc.c
-unit_test_ecc_LDADD = src/libshared-glib.la @GLIB_LIBS@
+unit_test_ecc_LDADD = src/libshared-glib.la $(GLIB_LIBS)
 
 unit_tests += unit/test-ringbuf unit/test-queue
 
 unit_test_ringbuf_SOURCES = unit/test-ringbuf.c
-unit_test_ringbuf_LDADD = src/libshared-glib.la @GLIB_LIBS@
+unit_test_ringbuf_LDADD = src/libshared-glib.la $(GLIB_LIBS)
 
 unit_test_queue_SOURCES = unit/test-queue.c
-unit_test_queue_LDADD = src/libshared-glib.la @GLIB_LIBS@
+unit_test_queue_LDADD = src/libshared-glib.la $(GLIB_LIBS)
 
 unit_tests += unit/test-mgmt
 
 unit_test_mgmt_SOURCES = unit/test-mgmt.c
-unit_test_mgmt_LDADD = src/libshared-glib.la @GLIB_LIBS@
+unit_test_mgmt_LDADD = src/libshared-glib.la $(GLIB_LIBS)
 
 unit_tests += unit/test-uhid
 
 unit_test_uhid_SOURCES = unit/test-uhid.c
-unit_test_uhid_LDADD = src/libshared-glib.la @GLIB_LIBS@
+unit_test_uhid_LDADD = src/libshared-glib.la $(GLIB_LIBS)
 
 unit_tests += unit/test-sdp
 
@@ -340,21 +340,21 @@ unit_test_sdp_SOURCES = unit/test-sdp.c \
 				src/log.h src/log.c \
 				src/sdpd-service.c src/sdpd-request.c
 unit_test_sdp_LDADD = lib/libbluetooth-internal.la \
-				src/libshared-glib.la @GLIB_LIBS@
+				src/libshared-glib.la $(GLIB_LIBS)
 
 unit_tests += unit/test-avdtp
 
 unit_test_avdtp_SOURCES = unit/test-avdtp.c \
 				src/log.h src/log.c \
 				android/avdtp.c android/avdtp.h
-unit_test_avdtp_LDADD = src/libshared-glib.la @GLIB_LIBS@
+unit_test_avdtp_LDADD = src/libshared-glib.la $(GLIB_LIBS)
 
 unit_tests += unit/test-avctp
 
 unit_test_avctp_SOURCES = unit/test-avctp.c \
 				src/log.h src/log.c \
 				android/avctp.c android/avctp.h
-unit_test_avctp_LDADD = src/libshared-glib.la @GLIB_LIBS@
+unit_test_avctp_LDADD = src/libshared-glib.la $(GLIB_LIBS)
 
 unit_tests += unit/test-avrcp
 
@@ -363,53 +363,53 @@ unit_test_avrcp_SOURCES = unit/test-avrcp.c \
 				android/avctp.c android/avctp.h \
 				android/avrcp-lib.c android/avrcp-lib.h
 unit_test_avrcp_LDADD = lib/libbluetooth-internal.la \
-				src/libshared-glib.la @GLIB_LIBS@
+				src/libshared-glib.la $(GLIB_LIBS)
 
 unit_tests += unit/test-hfp
 
 unit_test_hfp_SOURCES = unit/test-hfp.c
-unit_test_hfp_LDADD = src/libshared-glib.la @GLIB_LIBS@
+unit_test_hfp_LDADD = src/libshared-glib.la $(GLIB_LIBS)
 
 unit_tests += unit/test-gdbus-client
 
 unit_test_gdbus_client_SOURCES = unit/test-gdbus-client.c
 unit_test_gdbus_client_LDADD = gdbus/libgdbus-internal.la \
-				src/libshared-glib.la @GLIB_LIBS@ @DBUS_LIBS@
+				src/libshared-glib.la $(GLIB_LIBS) $(DBUS_LIBS)
 
 unit_tests += unit/test-gobex-header unit/test-gobex-packet unit/test-gobex \
 			unit/test-gobex-transfer unit/test-gobex-apparam
 
 unit_test_gobex_SOURCES = $(gobex_sources) unit/util.c unit/util.h \
 						unit/test-gobex.c
-unit_test_gobex_LDADD = @GLIB_LIBS@
+unit_test_gobex_LDADD = $(GLIB_LIBS)
 
 unit_test_gobex_packet_SOURCES = $(gobex_sources) unit/util.c unit/util.h \
 						unit/test-gobex-packet.c
-unit_test_gobex_packet_LDADD = @GLIB_LIBS@
+unit_test_gobex_packet_LDADD = $(GLIB_LIBS)
 
 unit_test_gobex_header_SOURCES = $(gobex_sources) unit/util.c unit/util.h \
 						unit/test-gobex-header.c
-unit_test_gobex_header_LDADD = @GLIB_LIBS@
+unit_test_gobex_header_LDADD = $(GLIB_LIBS)
 
 unit_test_gobex_transfer_SOURCES = $(gobex_sources) unit/util.c unit/util.h \
 						unit/test-gobex-transfer.c
-unit_test_gobex_transfer_LDADD = @GLIB_LIBS@
+unit_test_gobex_transfer_LDADD = $(GLIB_LIBS)
 
 unit_test_gobex_apparam_SOURCES = $(gobex_sources) unit/util.c unit/util.h \
 						unit/test-gobex-apparam.c
-unit_test_gobex_apparam_LDADD = @GLIB_LIBS@
+unit_test_gobex_apparam_LDADD = $(GLIB_LIBS)
 
 unit_tests += unit/test-lib
 
 unit_test_lib_SOURCES = unit/test-lib.c
 unit_test_lib_LDADD = src/libshared-glib.la \
-				lib/libbluetooth-internal.la @GLIB_LIBS@
+				lib/libbluetooth-internal.la $(GLIB_LIBS)
 
 unit_tests += unit/test-gatt
 
 unit_test_gatt_SOURCES = unit/test-gatt.c
 unit_test_gatt_LDADD = src/libshared-glib.la \
-				lib/libbluetooth-internal.la @GLIB_LIBS@
+				lib/libbluetooth-internal.la $(GLIB_LIBS)
 
 unit_tests += unit/test-hog
 
@@ -424,7 +424,7 @@ unit_test_hog_SOURCES = unit/test-hog.c \
 			attrib/gatt.h attrib/gatt.c \
 			attrib/gattrib.h attrib/gattrib.c
 unit_test_hog_LDADD = src/libshared-glib.la \
-				lib/libbluetooth-internal.la @GLIB_LIBS@
+				lib/libbluetooth-internal.la $(GLIB_LIBS)
 
 unit_tests += unit/test-gattrib
 
@@ -432,16 +432,16 @@ unit_test_gattrib_SOURCES = unit/test-gattrib.c attrib/gattrib.c \
 					$(btio_sources) src/log.h src/log.c
 unit_test_gattrib_LDADD = lib/libbluetooth-internal.la \
 			src/libshared-glib.la \
-			@GLIB_LIBS@ @DBUS_LIBS@ -ldl -lrt
+			$(GLIB_LIBS) $(DBUS_LIBS) -ldl -lrt
 
 if MIDI
 unit_tests += unit/test-midi
-unit_test_midi_CFLAGS = $(AM_CFLAGS) @ALSA_CFLAGS@ -DMIDI_TEST
+unit_test_midi_CFLAGS = $(AM_CFLAGS) $(ALSA_CFLAGS) -DMIDI_TEST
 unit_test_midi_SOURCES = unit/test-midi.c \
 			profiles/midi/libmidi.h \
 			profiles/midi/libmidi.c
 unit_test_midi_LDADD = src/libshared-glib.la \
-			@GLIB_LIBS@ @ALSA_LIBS@
+			$(GLIB_LIBS) $(ALSA_LIBS)
 endif
 
 if MAINTAINER_MODE
diff --git a/Makefile.mesh b/Makefile.mesh
index 0df7db2be..50bcc19ad 100644
--- a/Makefile.mesh
+++ b/Makefile.mesh
@@ -25,7 +25,7 @@ mesh_meshd_SOURCES = $(mesh_sources) mesh/main.c
 
 mesh_meshd_LDADD = src/shared/ecc.lo src/shared/queue.lo src/shared/io-ell.lo \
 				src/shared/util.lo src/shared/hci.lo src/shared/mgmt.lo \
-				@DBUS_LIBS@ @ELL_LIBS@ -ljson-c
+				$(DBUS_LIBS) $(ELL_LIBS) -ljson-c
 
 noinst_PROGRAMS += mesh/btmesh
 
@@ -37,6 +37,6 @@ mesh_btmesh_SOURCES = $(mesh_sources) \
 mesh_btmesh_LDADD = src/shared/ecc.lo src/shared/queue.lo src/shared/io-ell.lo \
 				src/shared/util.lo src/shared/hci.lo src/shared/mgmt.lo \
 				src/libshared-mainloop.la \
-				-lreadline @ELL_LIBS@ -ljson-c
+				-lreadline $(ELL_LIBS) -ljson-c
 
 endif
diff --git a/Makefile.obexd b/Makefile.obexd
index cd3ace425..9180d7eea 100644
--- a/Makefile.obexd
+++ b/Makefile.obexd
@@ -1,8 +1,8 @@
 if SYSTEMD
-systemduserunitdir = @SYSTEMD_USERUNITDIR@
+systemduserunitdir = $(SYSTEMD_USERUNITDIR)
 systemduserunit_DATA = obexd/src/obex.service
 
-dbussessionbusdir = @DBUS_SESSIONBUSDIR@
+dbussessionbusdir = $(DBUS_SESSIONBUSDIR)
 dbussessionbus_DATA = obexd/src/org.bluez.obex.service
 endif
 
@@ -79,12 +79,12 @@ obexd_src_obexd_SOURCES = $(btio_sources) $(gobex_sources) \
 			obexd/src/map_ap.h
 obexd_src_obexd_LDADD = lib/libbluetooth-internal.la \
 			gdbus/libgdbus-internal.la \
-			@ICAL_LIBS@ @DBUS_LIBS@ @GLIB_LIBS@ -ldl
+			$(ICAL_LIBS) $(DBUS_LIBS) $(GLIB_LIBS) -ldl
 
 obexd_src_obexd_LDFLAGS = -Wl,--export-dynamic
 
-obexd_src_obexd_CFLAGS = $(AM_CFLAGS) @GLIB_CFLAGS@ @DBUS_CFLAGS@ \
-				@ICAL_CFLAGS@ -DOBEX_PLUGIN_BUILTIN \
+obexd_src_obexd_CFLAGS = $(AM_CFLAGS) $(GLIB_CFLAGS) $(DBUS_CFLAGS) \
+				$(ICAL_CFLAGS) -DOBEX_PLUGIN_BUILTIN \
 				-DPLUGINDIR=\""$(obex_plugindir)"\" \
 				-fPIC -D_FILE_OFFSET_BITS=64
 
diff --git a/Makefile.plugins b/Makefile.plugins
index 3ab7c1c18..1c9919d71 100644
--- a/Makefile.plugins
+++ b/Makefile.plugins
@@ -97,7 +97,7 @@ builtin_modules += midi
 builtin_sources += profiles/midi/midi.c \
 			profiles/midi/libmidi.h \
 			profiles/midi/libmidi.c
-builtin_ldadd += @ALSA_LIBS@
+builtin_ldadd += $(ALSA_LIBS)
 endif
 
 builtin_modules += battery
@@ -107,6 +107,6 @@ if SIXAXIS
 plugin_LTLIBRARIES += plugins/sixaxis.la
 plugins_sixaxis_la_SOURCES = plugins/sixaxis.c
 plugins_sixaxis_la_LDFLAGS = $(AM_LDFLAGS) -module -avoid-version \
-						-no-undefined @UDEV_LIBS@
-plugins_sixaxis_la_CFLAGS = $(AM_CFLAGS) -fvisibility=hidden @UDEV_CFLAGS@
+						-no-undefined $(UDEV_LIBS)
+plugins_sixaxis_la_CFLAGS = $(AM_CFLAGS) -fvisibility=hidden $(UDEV_CFLAGS)
 endif
diff --git a/Makefile.tools b/Makefile.tools
index 231a4b09b..cdfaaf906 100644
--- a/Makefile.tools
+++ b/Makefile.tools
@@ -9,7 +9,7 @@ client_bluetoothctl_SOURCES = client/main.c \
 					client/advertising.c \
 					client/gatt.h client/gatt.c
 client_bluetoothctl_LDADD = gdbus/libgdbus-internal.la src/libshared-glib.la \
-				@GLIB_LIBS@ @DBUS_LIBS@ -lreadline
+				$(GLIB_LIBS) $(DBUS_LIBS) -lreadline
 endif
 
 if MONITOR
@@ -39,7 +39,7 @@ monitor_btmon_SOURCES = monitor/main.c monitor/bt.h \
 				monitor/broadcom.h monitor/broadcom.c \
 				monitor/tty.h
 monitor_btmon_LDADD = lib/libbluetooth-internal.la \
-				src/libshared-mainloop.la @UDEV_LIBS@
+				src/libshared-mainloop.la $(UDEV_LIBS)
 endif
 
 if LOGGER
@@ -103,7 +103,7 @@ tools_mgmt_tester_SOURCES = tools/mgmt-tester.c monitor/bt.h \
 				emulator/bthost.h emulator/bthost.c \
 				emulator/smp.c
 tools_mgmt_tester_LDADD = lib/libbluetooth-internal.la \
-				src/libshared-glib.la @GLIB_LIBS@
+				src/libshared-glib.la $(GLIB_LIBS)
 
 tools_l2cap_tester_SOURCES = tools/l2cap-tester.c monitor/bt.h \
 				emulator/hciemu.h emulator/hciemu.c \
@@ -111,7 +111,7 @@ tools_l2cap_tester_SOURCES = tools/l2cap-tester.c monitor/bt.h \
 				emulator/bthost.h emulator/bthost.c \
 				emulator/smp.c
 tools_l2cap_tester_LDADD = lib/libbluetooth-internal.la \
-				src/libshared-glib.la @GLIB_LIBS@
+				src/libshared-glib.la $(GLIB_LIBS)
 
 tools_rfcomm_tester_SOURCES = tools/rfcomm-tester.c monitor/bt.h \
 				emulator/hciemu.h emulator/hciemu.c \
@@ -119,7 +119,7 @@ tools_rfcomm_tester_SOURCES = tools/rfcomm-tester.c monitor/bt.h \
 				emulator/bthost.h emulator/bthost.c \
 				emulator/smp.c
 tools_rfcomm_tester_LDADD = lib/libbluetooth-internal.la \
-				src/libshared-glib.la @GLIB_LIBS@
+				src/libshared-glib.la $(GLIB_LIBS)
 
 tools_bnep_tester_SOURCES = tools/bnep-tester.c monitor/bt.h \
 				emulator/hciemu.h emulator/hciemu.c \
@@ -127,7 +127,7 @@ tools_bnep_tester_SOURCES = tools/bnep-tester.c monitor/bt.h \
 				emulator/bthost.h emulator/bthost.c \
 				emulator/smp.c
 tools_bnep_tester_LDADD = lib/libbluetooth-internal.la \
-				src/libshared-glib.la @GLIB_LIBS@
+				src/libshared-glib.la $(GLIB_LIBS)
 
 tools_smp_tester_SOURCES = tools/smp-tester.c monitor/bt.h \
 				emulator/hciemu.h emulator/hciemu.c \
@@ -135,7 +135,7 @@ tools_smp_tester_SOURCES = tools/smp-tester.c monitor/bt.h \
 				emulator/bthost.h emulator/bthost.c \
 				emulator/smp.c
 tools_smp_tester_LDADD = lib/libbluetooth-internal.la \
-				src/libshared-glib.la @GLIB_LIBS@
+				src/libshared-glib.la $(GLIB_LIBS)
 
 tools_gap_tester_SOURCES = tools/gap-tester.c monitor/bt.h \
 				emulator/hciemu.h emulator/hciemu.c \
@@ -145,7 +145,7 @@ tools_gap_tester_SOURCES = tools/gap-tester.c monitor/bt.h \
 tools_gap_tester_LDADD =  lib/libbluetooth-internal.la \
 				gdbus/libgdbus-internal.la \
 				src/libshared-glib.la \
-				@GLIB_LIBS@ @DBUS_LIBS@
+				$(GLIB_LIBS) $(DBUS_LIBS)
 
 tools_sco_tester_SOURCES = tools/sco-tester.c monitor/bt.h \
 				emulator/hciemu.h emulator/hciemu.c \
@@ -153,10 +153,10 @@ tools_sco_tester_SOURCES = tools/sco-tester.c monitor/bt.h \
 				emulator/bthost.h emulator/bthost.c \
 				emulator/smp.c
 tools_sco_tester_LDADD = lib/libbluetooth-internal.la \
-				src/libshared-glib.la @GLIB_LIBS@
+				src/libshared-glib.la $(GLIB_LIBS)
 
 tools_hci_tester_SOURCES = tools/hci-tester.c monitor/bt.h
-tools_hci_tester_LDADD = src/libshared-glib.la @GLIB_LIBS@
+tools_hci_tester_LDADD = src/libshared-glib.la $(GLIB_LIBS)
 
 tools_userchan_tester_SOURCES = tools/userchan-tester.c monitor/bt.h \
 				emulator/hciemu.h emulator/hciemu.c \
@@ -164,7 +164,7 @@ tools_userchan_tester_SOURCES = tools/userchan-tester.c monitor/bt.h \
 				emulator/bthost.h emulator/bthost.c \
 				emulator/smp.c
 tools_userchan_tester_LDADD = lib/libbluetooth-internal.la \
-				src/libshared-glib.la @GLIB_LIBS@
+				src/libshared-glib.la $(GLIB_LIBS)
 endif
 
 if TOOLS
@@ -187,7 +187,7 @@ noinst_PROGRAMS += tools/bdaddr tools/avinfo tools/avtest \
 			tools/gatt-service profiles/iap/iapd
 
 tools_bdaddr_SOURCES = tools/bdaddr.c src/oui.h src/oui.c
-tools_bdaddr_LDADD = lib/libbluetooth-internal.la @UDEV_LIBS@
+tools_bdaddr_LDADD = lib/libbluetooth-internal.la $(UDEV_LIBS)
 
 tools_avinfo_LDADD = lib/libbluetooth-internal.la
 
@@ -217,20 +217,20 @@ tools_btproxy_SOURCES = tools/btproxy.c monitor/bt.h
 tools_btproxy_LDADD = src/libshared-mainloop.la
 
 tools_btiotest_SOURCES = tools/btiotest.c btio/btio.h btio/btio.c
-tools_btiotest_LDADD = lib/libbluetooth-internal.la @GLIB_LIBS@
+tools_btiotest_LDADD = lib/libbluetooth-internal.la $(GLIB_LIBS)
 
 tools_mcaptest_SOURCES = tools/mcaptest.c \
 				btio/btio.h btio/btio.c \
 				src/log.c src/log.h \
 				profiles/health/mcap.h profiles/health/mcap.c
-tools_mcaptest_LDADD = lib/libbluetooth-internal.la @GLIB_LIBS@ \
+tools_mcaptest_LDADD = lib/libbluetooth-internal.la $(GLIB_LIBS) \
 				src/libshared-mainloop.la -lrt
 
 tools_bneptest_SOURCES = tools/bneptest.c \
 				btio/btio.h btio/btio.c \
 				src/log.h src/log.c \
 				profiles/network/bnep.h profiles/network/bnep.c
-tools_bneptest_LDADD = lib/libbluetooth-internal.la @GLIB_LIBS@ \
+tools_bneptest_LDADD = lib/libbluetooth-internal.la $(GLIB_LIBS) \
 				src/libshared-mainloop.la
 
 tools_cltest_SOURCES = tools/cltest.c
@@ -282,13 +282,13 @@ tools_bluemoon_LDADD = src/libshared-mainloop.la
 tools_hex2hcd_SOURCES = tools/hex2hcd.c
 
 tools_mpris_proxy_SOURCES = tools/mpris-proxy.c
-tools_mpris_proxy_LDADD = gdbus/libgdbus-internal.la @GLIB_LIBS@ @DBUS_LIBS@
+tools_mpris_proxy_LDADD = gdbus/libgdbus-internal.la $(GLIB_LIBS) $(DBUS_LIBS)
 
 tools_gatt_service_SOURCES = tools/gatt-service.c
-tools_gatt_service_LDADD = @GLIB_LIBS@ @DBUS_LIBS@ gdbus/libgdbus-internal.la
+tools_gatt_service_LDADD = $(GLIB_LIBS) $(DBUS_LIBS) gdbus/libgdbus-internal.la
 
 profiles_iap_iapd_SOURCES = profiles/iap/main.c
-profiles_iap_iapd_LDADD = gdbus/libgdbus-internal.la @GLIB_LIBS@ @DBUS_LIBS@
+profiles_iap_iapd_LDADD = gdbus/libgdbus-internal.la $(GLIB_LIBS) $(DBUS_LIBS)
 
 dist_man_MANS += tools/rctest.1 tools/l2ping.1 tools/bccmd.1 tools/btattach.1
 
@@ -313,7 +313,7 @@ tools_meshctl_SOURCES = tools/meshctl.c \
 				tools/mesh/onoff-model.h tools/mesh/onoff-model.c
 tools_meshctl_LDADD = gdbus/libgdbus-internal.la src/libshared-glib.la \
 				lib/libbluetooth-internal.la \
-				@GLIB_LIBS@ @DBUS_LIBS@ -ljson-c -lreadline
+				$(GLIB_LIBS) $(DBUS_LIBS) -ljson-c -lreadline
 endif
 
 EXTRA_DIST += tools/mesh/local_node.json tools/mesh/prov_db.json
@@ -336,7 +336,7 @@ tools_hciconfig_SOURCES = tools/hciconfig.c tools/csr.h tools/csr.c
 tools_hciconfig_LDADD = lib/libbluetooth-internal.la
 
 tools_hcitool_SOURCES = tools/hcitool.c src/oui.h src/oui.c
-tools_hcitool_LDADD = lib/libbluetooth-internal.la @UDEV_LIBS@
+tools_hcitool_LDADD = lib/libbluetooth-internal.la $(UDEV_LIBS)
 
 tools_hcidump_SOURCES = tools/hcidump.c \
 				tools/parser/parser.h tools/parser/parser.c \
@@ -365,7 +365,7 @@ tools_hcidump_SOURCES = tools/hcidump.c \
 				tools/parser/bpa.c
 
 tools_sdptool_SOURCES = tools/sdptool.c src/sdp-xml.h src/sdp-xml.c
-tools_sdptool_LDADD = lib/libbluetooth-internal.la @GLIB_LIBS@
+tools_sdptool_LDADD = lib/libbluetooth-internal.la $(GLIB_LIBS)
 
 tools_ciptool_LDADD = lib/libbluetooth-internal.la
 tools_hcidump_LDADD = lib/libbluetooth-internal.la
@@ -385,11 +385,11 @@ EXTRA_DIST += tools/rctest.1 tools/l2ping.1 tools/bccmd.1 tools/btattach.1
 endif
 
 if HID2HCI
-udevdir = @UDEV_DIR@
+udevdir = $(UDEV_DIR)
 
 udev_PROGRAMS = tools/hid2hci
 
-tools_hid2hci_LDADD = @UDEV_LIBS@
+tools_hid2hci_LDADD = $(UDEV_LIBS)
 
 dist_man_MANS += tools/hid2hci.1
 else
@@ -403,20 +403,20 @@ noinst_PROGRAMS += tools/btmgmt tools/obex-client-tool tools/obex-server-tool \
 tools_obex_client_tool_SOURCES = $(gobex_sources) $(btio_sources) \
 						tools/obex-client-tool.c
 tools_obex_client_tool_LDADD = lib/libbluetooth-internal.la \
-						@GLIB_LIBS@ -lreadline
+						$(GLIB_LIBS) -lreadline
 
 tools_obex_server_tool_SOURCES = $(gobex_sources) $(btio_sources) \
 						tools/obex-server-tool.c
-tools_obex_server_tool_LDADD = lib/libbluetooth-internal.la @GLIB_LIBS@
+tools_obex_server_tool_LDADD = lib/libbluetooth-internal.la $(GLIB_LIBS)
 
 tools_bluetooth_player_SOURCES = tools/bluetooth-player.c
 tools_bluetooth_player_LDADD = gdbus/libgdbus-internal.la \
 				src/libshared-glib.la \
-				@GLIB_LIBS@ @DBUS_LIBS@ -lreadline
+				$(GLIB_LIBS) $(DBUS_LIBS) -lreadline
 
 tools_obexctl_SOURCES = tools/obexctl.c
 tools_obexctl_LDADD = gdbus/libgdbus-internal.la src/libshared-glib.la \
-				@GLIB_LIBS@ @DBUS_LIBS@ -lreadline
+				$(GLIB_LIBS) $(DBUS_LIBS) -lreadline
 
 tools_btmgmt_SOURCES = tools/btmgmt.c src/uuid-helper.c client/display.c
 tools_btmgmt_LDADD = lib/libbluetooth-internal.la src/libshared-mainloop.la \
@@ -430,7 +430,7 @@ attrib_gatttool_SOURCES = attrib/gatttool.c attrib/att.c attrib/gatt.c \
 				attrib/utils.c src/log.c client/display.c \
 				client/display.h
 attrib_gatttool_LDADD = lib/libbluetooth-internal.la \
-			src/libshared-glib.la @GLIB_LIBS@ -lreadline
+			src/libshared-glib.la $(GLIB_LIBS) -lreadline
 
 endif
 endif
@@ -446,7 +446,7 @@ profiles_cups_bluetooth_SOURCES = profiles/cups/main.c \
 					profiles/cups/spp.c \
 					profiles/cups/hcrp.c
 
-profiles_cups_bluetooth_LDADD = @GLIB_LIBS@ @DBUS_LIBS@ \
+profiles_cups_bluetooth_LDADD = $(GLIB_LIBS) $(DBUS_LIBS) \
 				lib/libbluetooth-internal.la \
 				gdbus/libgdbus-internal.la
 endif
@@ -469,6 +469,6 @@ if BTPCLIENT
 noinst_PROGRAMS += tools/btpclient
 
 tools_btpclient_SOURCES = tools/btpclient.c src/shared/btp.c src/shared/btp.h
-tools_btpclient_CFLAGS = $(AM_CFLAGS) @ELL_CFLAGS@
-tools_btpclient_LDADD = @ELL_LIBS@ lib/libbluetooth-internal.la
+tools_btpclient_CFLAGS = $(AM_CFLAGS) $(ELL_CFLAGS)
+tools_btpclient_LDADD = $(ELL_LIBS) lib/libbluetooth-internal.la
 endif
diff --git a/android/Makefile.am b/android/Makefile.am
index d665d1e14..d09a52d69 100644
--- a/android/Makefile.am
+++ b/android/Makefile.am
@@ -12,7 +12,7 @@ android_system_emulator_LDADD = src/libshared-mainloop.la
 noinst_PROGRAMS += android/bluetoothd-snoop
 
 android_bluetoothd_snoop_SOURCES = android/bluetoothd-snoop.c src/log.c
-android_bluetoothd_snoop_LDADD = src/libshared-mainloop.la @GLIB_LIBS@
+android_bluetoothd_snoop_LDADD = src/libshared-mainloop.la $(GLIB_LIBS)
 
 noinst_PROGRAMS += android/bluetoothd
 
@@ -59,7 +59,7 @@ android_bluetoothd_SOURCES = android/main.c \
 				src/sdp-client.h src/sdp-client.c \
 				profiles/network/bnep.h profiles/network/bnep.c
 android_bluetoothd_LDADD = lib/libbluetooth-internal.la \
-				src/libshared-glib.la @GLIB_LIBS@
+				src/libshared-glib.la $(GLIB_LIBS)
 
 plugin_LTLIBRARIES += android/bluetooth.default.la
 
@@ -110,7 +110,7 @@ android_avdtptest_SOURCES = android/avdtptest.c \
 				src/shared/log.h src/shared/log.c \
 				android/avdtp.h android/avdtp.c
 android_avdtptest_CFLAGS = $(AM_CFLAGS)
-android_avdtptest_LDADD = lib/libbluetooth-internal.la @GLIB_LIBS@
+android_avdtptest_LDADD = lib/libbluetooth-internal.la $(GLIB_LIBS)
 
 noinst_PROGRAMS += android/haltest
 
@@ -165,7 +165,7 @@ android_android_tester_SOURCES = emulator/hciemu.h emulator/hciemu.c \
 android_android_tester_CFLAGS = $(AM_CFLAGS) -I$(srcdir)/android \
 				-DPLUGINDIR=\""$(android_plugindir)"\"
 android_android_tester_LDADD = lib/libbluetooth-internal.la \
-				src/libshared-glib.la @GLIB_LIBS@
+				src/libshared-glib.la $(GLIB_LIBS)
 android_android_tester_LDFLAGS = -pthread -ldl
 
 noinst_PROGRAMS += android/ipc-tester
@@ -178,7 +178,7 @@ android_ipc_tester_SOURCES = emulator/hciemu.h emulator/hciemu.c \
 				android/ipc-common.h android/ipc-tester.c
 android_ipc_tester_CFLAGS = $(AM_CFLAGS) -I$(srcdir)/android
 android_ipc_tester_LDADD = lib/libbluetooth-internal.la \
-				src/libshared-glib.la @GLIB_LIBS@
+				src/libshared-glib.la $(GLIB_LIBS)
 
 plugin_LTLIBRARIES += android/audio.a2dp.default.la
 
@@ -193,8 +193,8 @@ android_audio_a2dp_default_la_SOURCES = android/audio-msg.h \
 					android/hardware/hardware.h \
 					android/system/audio.h
 android_audio_a2dp_default_la_CFLAGS = $(AM_CFLAGS) -I$(srcdir)/android \
-					@SBC_CFLAGS@
-android_audio_a2dp_default_la_LIBADD = @SBC_LIBS@
+					$(SBC_CFLAGS)
+android_audio_a2dp_default_la_LIBADD = $(SBC_LIBS)
 android_audio_a2dp_default_la_LDFLAGS = $(AM_LDFLAGS) -module -avoid-version \
 					-no-undefined -pthread -lrt
 
@@ -210,7 +210,7 @@ android_audio_sco_default_la_SOURCES = android/hal-log.h \
 					android/audio_utils/resampler.h \
 					android/system/audio.h
 android_audio_sco_default_la_CFLAGS = $(AM_CFLAGS) -I$(srcdir)/android
-android_audio_sco_default_la_LIBADD = @SPEEXDSP_LIBS@
+android_audio_sco_default_la_LIBADD = $(SPEEXDSP_LIBS)
 android_audio_sco_default_la_LDFLAGS = $(AM_LDFLAGS) -module -avoid-version \
 					-no-undefined -lrt
 unit_tests += android/test-ipc
@@ -219,7 +219,7 @@ android_test_ipc_SOURCES = android/test-ipc.c \
 				src/log.h src/log.c \
 				android/ipc-common.h \
 				android/ipc.c android/ipc.h
-android_test_ipc_LDADD = src/libshared-glib.la @GLIB_LIBS@
+android_test_ipc_LDADD = src/libshared-glib.la $(GLIB_LIBS)
 
 endif
 
-- 
2.19.1


^ permalink raw reply	[flat|nested] 35+ messages in thread

* [PATCH 3/8] build: -l arguments to belong into LDADD/LIBADD not LDFLAGS
  2018-11-25  9:20           ` [PATCH bluez] build system refresh (take 3) Jan Engelhardt
  2018-11-25  9:20             ` [PATCH 1/8] build: rename includedir to pkgincludedir Jan Engelhardt
  2018-11-25  9:20             ` [PATCH 2/8] build: change @foo@ to $(foo) in automake makefiles Jan Engelhardt
@ 2018-11-25  9:20             ` Jan Engelhardt
  2018-11-25  9:20             ` [PATCH 4/8] build: -D/-I arguments go into CPPFLAGS Jan Engelhardt
                               ` (5 subsequent siblings)
  8 siblings, 0 replies; 35+ messages in thread
From: Jan Engelhardt @ 2018-11-25  9:20 UTC (permalink / raw)
  To: luiz.dentz; +Cc: linux-bluetooth

It is an error to put -l arguments into LDFLAGS, because the linker
command line is order-sensitive and libs must appear in certain
places. For this, automake has the LDADD/LIBADD.
---
 Makefile.plugins    |  3 ++-
 android/Makefile.am | 15 ++++++++-------
 2 files changed, 10 insertions(+), 8 deletions(-)

diff --git a/Makefile.plugins b/Makefile.plugins
index 1c9919d71..d3cf5cab8 100644
--- a/Makefile.plugins
+++ b/Makefile.plugins
@@ -107,6 +107,7 @@ if SIXAXIS
 plugin_LTLIBRARIES += plugins/sixaxis.la
 plugins_sixaxis_la_SOURCES = plugins/sixaxis.c
 plugins_sixaxis_la_LDFLAGS = $(AM_LDFLAGS) -module -avoid-version \
-						-no-undefined $(UDEV_LIBS)
+						-no-undefined
+plugins_sixaxis_la_LIBADD = $(UDEV_LIBS)
 plugins_sixaxis_la_CFLAGS = $(AM_CFLAGS) -fvisibility=hidden $(UDEV_CFLAGS)
 endif
diff --git a/android/Makefile.am b/android/Makefile.am
index d09a52d69..0f04b6a05 100644
--- a/android/Makefile.am
+++ b/android/Makefile.am
@@ -142,7 +142,8 @@ android_haltest_SOURCES = android/client/haltest.c \
 				android/hal-utils.h android/hal-utils.c
 android_haltest_CFLAGS = $(AM_CFLAGS) -I$(srcdir)/android \
 				-DPLUGINDIR=\""$(android_plugindir)"\"
-android_haltest_LDFLAGS = -pthread -ldl -lm
+android_haltest_LDFLAGS = -pthread
+android_haltest_LDADD = -ldl -lm
 
 noinst_PROGRAMS += android/android-tester
 
@@ -165,8 +166,8 @@ android_android_tester_SOURCES = emulator/hciemu.h emulator/hciemu.c \
 android_android_tester_CFLAGS = $(AM_CFLAGS) -I$(srcdir)/android \
 				-DPLUGINDIR=\""$(android_plugindir)"\"
 android_android_tester_LDADD = lib/libbluetooth-internal.la \
-				src/libshared-glib.la $(GLIB_LIBS)
-android_android_tester_LDFLAGS = -pthread -ldl
+				src/libshared-glib.la $(GLIB_LIBS) -ldl
+android_android_tester_LDFLAGS = -pthread
 
 noinst_PROGRAMS += android/ipc-tester
 
@@ -194,9 +195,9 @@ android_audio_a2dp_default_la_SOURCES = android/audio-msg.h \
 					android/system/audio.h
 android_audio_a2dp_default_la_CFLAGS = $(AM_CFLAGS) -I$(srcdir)/android \
 					$(SBC_CFLAGS)
-android_audio_a2dp_default_la_LIBADD = $(SBC_LIBS)
+android_audio_a2dp_default_la_LIBADD = $(SBC_LIBS) -lrt
 android_audio_a2dp_default_la_LDFLAGS = $(AM_LDFLAGS) -module -avoid-version \
-					-no-undefined -pthread -lrt
+					-no-undefined -pthread
 
 plugin_LTLIBRARIES += android/audio.sco.default.la
 
@@ -210,9 +211,9 @@ android_audio_sco_default_la_SOURCES = android/hal-log.h \
 					android/audio_utils/resampler.h \
 					android/system/audio.h
 android_audio_sco_default_la_CFLAGS = $(AM_CFLAGS) -I$(srcdir)/android
-android_audio_sco_default_la_LIBADD = $(SPEEXDSP_LIBS)
+android_audio_sco_default_la_LIBADD = $(SPEEXDSP_LIBS) -lrt
 android_audio_sco_default_la_LDFLAGS = $(AM_LDFLAGS) -module -avoid-version \
-					-no-undefined -lrt
+					-no-undefined
 unit_tests += android/test-ipc
 
 android_test_ipc_SOURCES = android/test-ipc.c \
-- 
2.19.1


^ permalink raw reply	[flat|nested] 35+ messages in thread

* [PATCH 4/8] build: -D/-I arguments go into CPPFLAGS
  2018-11-25  9:20           ` [PATCH bluez] build system refresh (take 3) Jan Engelhardt
                               ` (2 preceding siblings ...)
  2018-11-25  9:20             ` [PATCH 3/8] build: -l arguments to belong into LDADD/LIBADD not LDFLAGS Jan Engelhardt
@ 2018-11-25  9:20             ` Jan Engelhardt
  2018-11-25  9:20             ` [PATCH 5/8] build: add missing ELL_CFLAGS Jan Engelhardt
                               ` (4 subsequent siblings)
  8 siblings, 0 replies; 35+ messages in thread
From: Jan Engelhardt @ 2018-11-25  9:20 UTC (permalink / raw)
  To: luiz.dentz; +Cc: linux-bluetooth

-D and -I are preprocessor directives, they are therefore to appear
in CPPFLAGS, not CFLAGS. (It is unfortunate that pkg-config does not
make the distinction / or it was misnamed, because only -D/-I make
sense to be emitted by pkg-config in the first place — anything else
(-f/-m) has the potential to mess up someone's compilation. So
pkg-config's Cflags is actually used to convery Cppflags.)
---
 Makefile.am         |  9 ++++-----
 Makefile.obexd      |  7 ++++---
 Makefile.plugins    |  3 ++-
 Makefile.tools      |  2 +-
 android/Makefile.am | 14 +++++++-------
 5 files changed, 18 insertions(+), 17 deletions(-)

diff --git a/Makefile.am b/Makefile.am
index dec0dc516..00490d1c3 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -1,5 +1,6 @@
 
 AM_MAKEFLAGS = --no-print-directory
+AM_CPPFLAGS =
 
 lib_LTLIBRARIES =
 
@@ -214,7 +215,7 @@ src_bluetoothd_DEPENDENCIES = lib/libbluetooth-internal.la \
 				src/libshared-glib.la \
 				src/bluetooth.service
 
-src_bluetoothd_CFLAGS = $(AM_CFLAGS) -DBLUETOOTH_PLUGIN_BUILTIN \
+src_bluetoothd_CPPFLAGS = $(AM_CPPFLAGS) -DBLUETOOTH_PLUGIN_BUILTIN \
 					-DPLUGINDIR=\""$(build_plugindir)"\"
 src_bluetoothd_SHORTNAME = bluetoothd
 
@@ -278,9 +279,7 @@ EXTRA_DIST += doc/btsnoop.txt
 
 EXTRA_DIST += tools/magic.btsnoop
 
-AM_CFLAGS += $(DBUS_CFLAGS) $(GLIB_CFLAGS)
-
-AM_CPPFLAGS = -I$(builddir)/lib
+AM_CPPFLAGS += $(DBUS_CFLAGS) $(GLIB_CFLAGS) -I$(builddir)/lib
 
 
 unit_tests += unit/test-eir
@@ -436,7 +435,7 @@ unit_test_gattrib_LDADD = lib/libbluetooth-internal.la \
 
 if MIDI
 unit_tests += unit/test-midi
-unit_test_midi_CFLAGS = $(AM_CFLAGS) $(ALSA_CFLAGS) -DMIDI_TEST
+unit_test_midi_CPPFLAGS = $(AM_CPPFLAGS) $(ALSA_CFLAGS) -DMIDI_TEST
 unit_test_midi_SOURCES = unit/test-midi.c \
 			profiles/midi/libmidi.h \
 			profiles/midi/libmidi.c
diff --git a/Makefile.obexd b/Makefile.obexd
index 9180d7eea..22a4977ef 100644
--- a/Makefile.obexd
+++ b/Makefile.obexd
@@ -83,12 +83,13 @@ obexd_src_obexd_LDADD = lib/libbluetooth-internal.la \
 
 obexd_src_obexd_LDFLAGS = -Wl,--export-dynamic
 
-obexd_src_obexd_CFLAGS = $(AM_CFLAGS) $(GLIB_CFLAGS) $(DBUS_CFLAGS) \
+obexd_src_obexd_CPPFLAGS = $(AM_CFLAGS) $(GLIB_CFLAGS) $(DBUS_CFLAGS) \
 				$(ICAL_CFLAGS) -DOBEX_PLUGIN_BUILTIN \
 				-DPLUGINDIR=\""$(obex_plugindir)"\" \
-				-fPIC -D_FILE_OFFSET_BITS=64
+				-D_FILE_OFFSET_BITS=64 \
+				-I$(builddir)/lib -I$(builddir)/obexd/src
 
-obexd_src_obexd_CPPFLAGS = -I$(builddir)/lib -I$(builddir)/obexd/src
+obexd_src_obexd_CFLAGS = -fPIC
 
 endif
 
diff --git a/Makefile.plugins b/Makefile.plugins
index d3cf5cab8..2aaeb7450 100644
--- a/Makefile.plugins
+++ b/Makefile.plugins
@@ -109,5 +109,6 @@ plugins_sixaxis_la_SOURCES = plugins/sixaxis.c
 plugins_sixaxis_la_LDFLAGS = $(AM_LDFLAGS) -module -avoid-version \
 						-no-undefined
 plugins_sixaxis_la_LIBADD = $(UDEV_LIBS)
-plugins_sixaxis_la_CFLAGS = $(AM_CFLAGS) -fvisibility=hidden $(UDEV_CFLAGS)
+plugins_sixaxis_la_CPPFLAGS = $(AM_CPPFLAGS) $(UDEV_CFLAGS)
+plugins_sixaxis_la_CFLAGS = $(AM_CFLAGS) -fvisibility=hidden
 endif
diff --git a/Makefile.tools b/Makefile.tools
index cdfaaf906..55e769d8c 100644
--- a/Makefile.tools
+++ b/Makefile.tools
@@ -469,6 +469,6 @@ if BTPCLIENT
 noinst_PROGRAMS += tools/btpclient
 
 tools_btpclient_SOURCES = tools/btpclient.c src/shared/btp.c src/shared/btp.h
-tools_btpclient_CFLAGS = $(AM_CFLAGS) $(ELL_CFLAGS)
+tools_btpclient_CPPFLAGS = $(AM_CPPFLAGS) $(ELL_CFLAGS)
 tools_btpclient_LDADD = $(ELL_LIBS) lib/libbluetooth-internal.la
 endif
diff --git a/android/Makefile.am b/android/Makefile.am
index 0f04b6a05..5dd1adf9d 100644
--- a/android/Makefile.am
+++ b/android/Makefile.am
@@ -1,6 +1,6 @@
 if ANDROID
 
-AM_CFLAGS += -DANDROID_VERSION=0x050100
+AM_CPPFLAGS += -DANDROID_VERSION=0x050100
 
 android_plugindir = $(abs_top_srcdir)/android/.libs
 
@@ -96,7 +96,7 @@ android_bluetooth_default_la_SOURCES = android/hal.h android/hal-bluetooth.c \
 					android/hal-log.h \
 					android/hal-ipc.h android/hal-ipc.c \
 					android/hal-utils.h android/hal-utils.c
-android_bluetooth_default_la_CFLAGS = $(AM_CFLAGS) -I$(srcdir)/android
+android_bluetooth_default_la_CPPFLAGS = $(AM_CPPFLAGS) -I$(srcdir)/android
 android_bluetooth_default_la_LDFLAGS = $(AM_LDFLAGS) -module -avoid-version \
 					-no-undefined
 
@@ -140,7 +140,7 @@ android_haltest_SOURCES = android/client/haltest.c \
 				android/client/if-mce.c \
 				android/hardware/hardware.c \
 				android/hal-utils.h android/hal-utils.c
-android_haltest_CFLAGS = $(AM_CFLAGS) -I$(srcdir)/android \
+android_haltest_CPPFLAGS = $(AM_CPPFLAGS) -I$(srcdir)/android \
 				-DPLUGINDIR=\""$(android_plugindir)"\"
 android_haltest_LDFLAGS = -pthread
 android_haltest_LDADD = -ldl -lm
@@ -163,7 +163,7 @@ android_android_tester_SOURCES = emulator/hciemu.h emulator/hciemu.c \
 				android/tester-gatt.c \
 				android/tester-map-client.c \
 				android/tester-main.h android/tester-main.c
-android_android_tester_CFLAGS = $(AM_CFLAGS) -I$(srcdir)/android \
+android_android_tester_CPPFLAGS = $(AM_CPPFLAGS) -I$(srcdir)/android \
 				-DPLUGINDIR=\""$(android_plugindir)"\"
 android_android_tester_LDADD = lib/libbluetooth-internal.la \
 				src/libshared-glib.la $(GLIB_LIBS) -ldl
@@ -177,7 +177,7 @@ android_ipc_tester_SOURCES = emulator/hciemu.h emulator/hciemu.c \
 				emulator/smp.c \
 				android/hal-utils.h android/hal-utils.c \
 				android/ipc-common.h android/ipc-tester.c
-android_ipc_tester_CFLAGS = $(AM_CFLAGS) -I$(srcdir)/android
+android_ipc_tester_CPPFLAGS = $(AM_CPPFLAGS) -I$(srcdir)/android
 android_ipc_tester_LDADD = lib/libbluetooth-internal.la \
 				src/libshared-glib.la $(GLIB_LIBS)
 
@@ -193,7 +193,7 @@ android_audio_a2dp_default_la_SOURCES = android/audio-msg.h \
 					android/hardware/audio_effect.h \
 					android/hardware/hardware.h \
 					android/system/audio.h
-android_audio_a2dp_default_la_CFLAGS = $(AM_CFLAGS) -I$(srcdir)/android \
+android_audio_a2dp_default_la_CPPFLAGS = $(AM_CPPFLAGS) -I$(srcdir)/android \
 					$(SBC_CFLAGS)
 android_audio_a2dp_default_la_LIBADD = $(SBC_LIBS) -lrt
 android_audio_a2dp_default_la_LDFLAGS = $(AM_LDFLAGS) -module -avoid-version \
@@ -210,7 +210,7 @@ android_audio_sco_default_la_SOURCES = android/hal-log.h \
 					android/audio_utils/resampler.c \
 					android/audio_utils/resampler.h \
 					android/system/audio.h
-android_audio_sco_default_la_CFLAGS = $(AM_CFLAGS) -I$(srcdir)/android
+android_audio_sco_default_la_CPPFLAGS = $(AM_CPPFLAGS) -I$(srcdir)/android
 android_audio_sco_default_la_LIBADD = $(SPEEXDSP_LIBS) -lrt
 android_audio_sco_default_la_LDFLAGS = $(AM_LDFLAGS) -module -avoid-version \
 					-no-undefined
-- 
2.19.1


^ permalink raw reply	[flat|nested] 35+ messages in thread

* [PATCH 5/8] build: add missing ELL_CFLAGS
  2018-11-25  9:20           ` [PATCH bluez] build system refresh (take 3) Jan Engelhardt
                               ` (3 preceding siblings ...)
  2018-11-25  9:20             ` [PATCH 4/8] build: -D/-I arguments go into CPPFLAGS Jan Engelhardt
@ 2018-11-25  9:20             ` Jan Engelhardt
  2018-11-25  9:20             ` [PATCH 6/8] build: add missing UDEV_CFLAGS Jan Engelhardt
                               ` (3 subsequent siblings)
  8 siblings, 0 replies; 35+ messages in thread
From: Jan Engelhardt @ 2018-11-25  9:20 UTC (permalink / raw)
  To: luiz.dentz; +Cc: linux-bluetooth

Some targets link ELL_LIBS, which means they also need ELL_CFLAGS
in their (or the global) CPPFLAGS.
---
 Makefile.am   | 1 +
 Makefile.mesh | 4 ++++
 2 files changed, 5 insertions(+)

diff --git a/Makefile.am b/Makefile.am
index 00490d1c3..5d7bc06b9 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -140,6 +140,7 @@ src_libshared_mainloop_la_SOURCES = $(shared_sources) \
 if ELL
 src_libshared_ell_la_SOURCES = $(shared_sources) \
 				src/shared/io-ell.c
+src_libshared_ell_la_CPPFLAGS = $(AM_CPPFLAGS) $(ELL_CFLAGS)
 noinst_LTLIBRARIES += src/libshared-ell.la
 endif
 
diff --git a/Makefile.mesh b/Makefile.mesh
index 50bcc19ad..4de22ba8c 100644
--- a/Makefile.mesh
+++ b/Makefile.mesh
@@ -21,6 +21,8 @@ mesh_sources = mesh/mesh.h mesh/mesh.c \
 				mesh/mesh-defs.h
 libexec_PROGRAMS += mesh/meshd
 
+mesh_meshd_CPPFLAGS = $(AM_CPPFLAGS) $(ELL_CFLAGS)
+
 mesh_meshd_SOURCES = $(mesh_sources) mesh/main.c
 
 mesh_meshd_LDADD = src/shared/ecc.lo src/shared/queue.lo src/shared/io-ell.lo \
@@ -34,6 +36,8 @@ mesh_btmesh_SOURCES = $(mesh_sources) \
 						mesh/agent.c \
 						mesh/btmesh.c
 
+mesh_btmesh_CPPFLAGS = $(AM_CPPFLAGS) $(ELL_CFLAGS)
+
 mesh_btmesh_LDADD = src/shared/ecc.lo src/shared/queue.lo src/shared/io-ell.lo \
 				src/shared/util.lo src/shared/hci.lo src/shared/mgmt.lo \
 				src/libshared-mainloop.la \
-- 
2.19.1


^ permalink raw reply	[flat|nested] 35+ messages in thread

* [PATCH 6/8] build: add missing UDEV_CFLAGS
  2018-11-25  9:20           ` [PATCH bluez] build system refresh (take 3) Jan Engelhardt
                               ` (4 preceding siblings ...)
  2018-11-25  9:20             ` [PATCH 5/8] build: add missing ELL_CFLAGS Jan Engelhardt
@ 2018-11-25  9:20             ` Jan Engelhardt
  2018-11-25  9:20             ` [PATCH 7/8] build: add missing ALSA_CFLAGS Jan Engelhardt
                               ` (2 subsequent siblings)
  8 siblings, 0 replies; 35+ messages in thread
From: Jan Engelhardt @ 2018-11-25  9:20 UTC (permalink / raw)
  To: luiz.dentz; +Cc: linux-bluetooth

Some targets link UDEV_LIBS, which means they also need UDEV_CFLAGS
in their (or the global) CPPFLAGS.
---
 Makefile.tools | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/Makefile.tools b/Makefile.tools
index 55e769d8c..35412ca61 100644
--- a/Makefile.tools
+++ b/Makefile.tools
@@ -38,6 +38,7 @@ monitor_btmon_SOURCES = monitor/main.c monitor/bt.h \
 				monitor/intel.h monitor/intel.c \
 				monitor/broadcom.h monitor/broadcom.c \
 				monitor/tty.h
+monitor_btmon_CPPFLAGS = $(AM_CPPFLAGS) $(UDEV_CFLAGS)
 monitor_btmon_LDADD = lib/libbluetooth-internal.la \
 				src/libshared-mainloop.la $(UDEV_LIBS)
 endif
@@ -187,6 +188,7 @@ noinst_PROGRAMS += tools/bdaddr tools/avinfo tools/avtest \
 			tools/gatt-service profiles/iap/iapd
 
 tools_bdaddr_SOURCES = tools/bdaddr.c src/oui.h src/oui.c
+tools_bdaddr_CPPFLAGS = $(AM_CPPFLAGS) $(UDEV_CFLAGS)
 tools_bdaddr_LDADD = lib/libbluetooth-internal.la $(UDEV_LIBS)
 
 tools_avinfo_LDADD = lib/libbluetooth-internal.la
@@ -336,6 +338,7 @@ tools_hciconfig_SOURCES = tools/hciconfig.c tools/csr.h tools/csr.c
 tools_hciconfig_LDADD = lib/libbluetooth-internal.la
 
 tools_hcitool_SOURCES = tools/hcitool.c src/oui.h src/oui.c
+tools_hcitool_CPPFLAGS = $(AM_CPPFLAGS) $(UDEV_CFLAGS)
 tools_hcitool_LDADD = lib/libbluetooth-internal.la $(UDEV_LIBS)
 
 tools_hcidump_SOURCES = tools/hcidump.c \
@@ -389,6 +392,7 @@ udevdir = $(UDEV_DIR)
 
 udev_PROGRAMS = tools/hid2hci
 
+tools_hid2hci_CPPFLAGS = $(AM_CPPFLAGS) $(UDEV_CFLAGS)
 tools_hid2hci_LDADD = $(UDEV_LIBS)
 
 dist_man_MANS += tools/hid2hci.1
-- 
2.19.1


^ permalink raw reply	[flat|nested] 35+ messages in thread

* [PATCH 7/8] build: add missing ALSA_CFLAGS
  2018-11-25  9:20           ` [PATCH bluez] build system refresh (take 3) Jan Engelhardt
                               ` (5 preceding siblings ...)
  2018-11-25  9:20             ` [PATCH 6/8] build: add missing UDEV_CFLAGS Jan Engelhardt
@ 2018-11-25  9:20             ` Jan Engelhardt
  2018-11-25  9:20             ` [PATCH 8/8] build: add missing BACKTRACE_CFLAGS Jan Engelhardt
  2018-11-26 10:45             ` [PATCH bluez] build system refresh (take 3) Luiz Augusto von Dentz
  8 siblings, 0 replies; 35+ messages in thread
From: Jan Engelhardt @ 2018-11-25  9:20 UTC (permalink / raw)
  To: luiz.dentz; +Cc: linux-bluetooth

Some targets use ALSA_LIBS, hence need ALSA_CFLAGS.
---
 Makefile.am      | 4 +++-
 Makefile.plugins | 1 +
 2 files changed, 4 insertions(+), 1 deletion(-)

diff --git a/Makefile.am b/Makefile.am
index 5d7bc06b9..26e03b46f 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -160,6 +160,7 @@ gobex_sources = gobex/gobex.h gobex/gobex.c \
 
 builtin_modules =
 builtin_sources =
+builtin_cppflags =
 builtin_nodist =
 builtin_ldadd =
 
@@ -217,7 +218,8 @@ src_bluetoothd_DEPENDENCIES = lib/libbluetooth-internal.la \
 				src/bluetooth.service
 
 src_bluetoothd_CPPFLAGS = $(AM_CPPFLAGS) -DBLUETOOTH_PLUGIN_BUILTIN \
-					-DPLUGINDIR=\""$(build_plugindir)"\"
+					-DPLUGINDIR=\""$(build_plugindir)"\" \
+					$(builtin_cppflags)
 src_bluetoothd_SHORTNAME = bluetoothd
 
 builtin_files = src/builtin.h $(builtin_nodist)
diff --git a/Makefile.plugins b/Makefile.plugins
index 2aaeb7450..47bf317cb 100644
--- a/Makefile.plugins
+++ b/Makefile.plugins
@@ -97,6 +97,7 @@ builtin_modules += midi
 builtin_sources += profiles/midi/midi.c \
 			profiles/midi/libmidi.h \
 			profiles/midi/libmidi.c
+builtin_cppflags += $(ALSA_CFLAGS)
 builtin_ldadd += $(ALSA_LIBS)
 endif
 
-- 
2.19.1


^ permalink raw reply	[flat|nested] 35+ messages in thread

* [PATCH 8/8] build: add missing BACKTRACE_CFLAGS
  2018-11-25  9:20           ` [PATCH bluez] build system refresh (take 3) Jan Engelhardt
                               ` (6 preceding siblings ...)
  2018-11-25  9:20             ` [PATCH 7/8] build: add missing ALSA_CFLAGS Jan Engelhardt
@ 2018-11-25  9:20             ` Jan Engelhardt
  2018-11-26 10:45             ` [PATCH bluez] build system refresh (take 3) Luiz Augusto von Dentz
  8 siblings, 0 replies; 35+ messages in thread
From: Jan Engelhardt @ 2018-11-25  9:20 UTC (permalink / raw)
  To: luiz.dentz; +Cc: linux-bluetooth

Some targets use BACKTRACE_LIBS, hence need BACKTRACE_CFLAGS.
---
 Makefile.am | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/Makefile.am b/Makefile.am
index 26e03b46f..0b26ccc3e 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -219,7 +219,7 @@ src_bluetoothd_DEPENDENCIES = lib/libbluetooth-internal.la \
 
 src_bluetoothd_CPPFLAGS = $(AM_CPPFLAGS) -DBLUETOOTH_PLUGIN_BUILTIN \
 					-DPLUGINDIR=\""$(build_plugindir)"\" \
-					$(builtin_cppflags)
+					$(BACKTRACE_CFLAGS) $(builtin_cppflags)
 src_bluetoothd_SHORTNAME = bluetoothd
 
 builtin_files = src/builtin.h $(builtin_nodist)
-- 
2.19.1


^ permalink raw reply	[flat|nested] 35+ messages in thread

* Re: [PATCH bluez] build system refresh (take 3)
  2018-11-25  9:20           ` [PATCH bluez] build system refresh (take 3) Jan Engelhardt
                               ` (7 preceding siblings ...)
  2018-11-25  9:20             ` [PATCH 8/8] build: add missing BACKTRACE_CFLAGS Jan Engelhardt
@ 2018-11-26 10:45             ` Luiz Augusto von Dentz
  2018-11-28 14:38               ` Luiz Augusto von Dentz
  8 siblings, 1 reply; 35+ messages in thread
From: Luiz Augusto von Dentz @ 2018-11-26 10:45 UTC (permalink / raw)
  To: jengelh; +Cc: linux-bluetooth

Hi Jan,
On Sun, Nov 25, 2018 at 11:20 AM Jan Engelhardt <jengelh@inai.de> wrote:
>
>
> The following changes since commit 9568f4439efdf5daa2f941f544d8a84a2eee5cac:
>
>   doc: Initial Bluetooth Mesh API (2018-11-22 11:15:45 -0800)
>
> are available in the Git repository at:
>
>   git://github.com/jengelh/bluez
>
> for you to fetch changes up to 97561f245b7609e4c041b4083a7922817acc3ae7:
>
>   build: add missing BACKTRACE_CFLAGS (2018-11-24 20:09:10 +0100)
>
> ----------------------------------------------------------------
> Jan Engelhardt (8):
>       build: rename includedir to pkgincludedir
>       build: change @foo@ to $(foo) in automake makefiles
>       build: -l arguments to belong into LDADD/LIBADD not LDFLAGS
>       build: -D/-I arguments go into CPPFLAGS
>       build: add missing ELL_CFLAGS
>       build: add missing UDEV_CFLAGS
>       build: add missing ALSA_CFLAGS
>       build: add missing BACKTRACE_CFLAGS
>
>  Makefile.am         | 84 +++++++++++++++++++++++++++++++++++++++++++-----------------------------------------
>  Makefile.mesh       |  8 ++++++--
>  Makefile.obexd      | 15 ++++++++-------
>  Makefile.plugins    |  9 ++++++---
>  Makefile.tools      | 66 +++++++++++++++++++++++++++++++++++-------------------------------
>  android/Makefile.am | 41 +++++++++++++++++++++--------------------
>  6 files changed, 119 insertions(+), 104 deletions(-)
>

Applied, thanks.

-- 
Luiz Augusto von Dentz

^ permalink raw reply	[flat|nested] 35+ messages in thread

* Re: [PATCH bluez] build system refresh (take 3)
  2018-11-26 10:45             ` [PATCH bluez] build system refresh (take 3) Luiz Augusto von Dentz
@ 2018-11-28 14:38               ` Luiz Augusto von Dentz
  2018-11-28 15:04                 ` Jan Engelhardt
  0 siblings, 1 reply; 35+ messages in thread
From: Luiz Augusto von Dentz @ 2018-11-28 14:38 UTC (permalink / raw)
  To: jengelh; +Cc: linux-bluetooth

Hi Jan,

On Mon, Nov 26, 2018 at 12:45 PM Luiz Augusto von Dentz
<luiz.dentz@gmail.com> wrote:
>
> Hi Jan,
> On Sun, Nov 25, 2018 at 11:20 AM Jan Engelhardt <jengelh@inai.de> wrote:
> >
> >
> > The following changes since commit 9568f4439efdf5daa2f941f544d8a84a2eee5cac:
> >
> >   doc: Initial Bluetooth Mesh API (2018-11-22 11:15:45 -0800)
> >
> > are available in the Git repository at:
> >
> >   git://github.com/jengelh/bluez
> >
> > for you to fetch changes up to 97561f245b7609e4c041b4083a7922817acc3ae7:
> >
> >   build: add missing BACKTRACE_CFLAGS (2018-11-24 20:09:10 +0100)
> >
> > ----------------------------------------------------------------
> > Jan Engelhardt (8):
> >       build: rename includedir to pkgincludedir
> >       build: change @foo@ to $(foo) in automake makefiles
> >       build: -l arguments to belong into LDADD/LIBADD not LDFLAGS
> >       build: -D/-I arguments go into CPPFLAGS
> >       build: add missing ELL_CFLAGS
> >       build: add missing UDEV_CFLAGS
> >       build: add missing ALSA_CFLAGS
> >       build: add missing BACKTRACE_CFLAGS
> >
> >  Makefile.am         | 84 +++++++++++++++++++++++++++++++++++++++++++-----------------------------------------
> >  Makefile.mesh       |  8 ++++++--
> >  Makefile.obexd      | 15 ++++++++-------
> >  Makefile.plugins    |  9 ++++++---
> >  Makefile.tools      | 66 +++++++++++++++++++++++++++++++++++-------------------------------
> >  android/Makefile.am | 41 +++++++++++++++++++++--------------------
> >  6 files changed, 119 insertions(+), 104 deletions(-)
> >
>
> Applied, thanks.

Looks like this is breaking the build if coverage is enabled (set when
lcov is available).

-- 
Luiz Augusto von Dentz

^ permalink raw reply	[flat|nested] 35+ messages in thread

* Re: [PATCH bluez] build system refresh (take 3)
  2018-11-28 14:38               ` Luiz Augusto von Dentz
@ 2018-11-28 15:04                 ` Jan Engelhardt
  2018-11-28 15:06                   ` Luiz Augusto von Dentz
  0 siblings, 1 reply; 35+ messages in thread
From: Jan Engelhardt @ 2018-11-28 15:04 UTC (permalink / raw)
  To: Luiz Augusto von Dentz; +Cc: linux-bluetooth

On Wednesday 2018-11-28 15:38, Luiz Augusto von Dentz wrote:

>Hi Jan,
>
>> >  6 files changed, 119 insertions(+), 104 deletions(-)
>> Applied, thanks.
>
>Looks like this is breaking the build if coverage is enabled (set when
>lcov is available).

How are you specifically enabling coverage on your system?

^ permalink raw reply	[flat|nested] 35+ messages in thread

* Re: [PATCH bluez] build system refresh (take 3)
  2018-11-28 15:04                 ` Jan Engelhardt
@ 2018-11-28 15:06                   ` Luiz Augusto von Dentz
  2018-11-28 15:45                     ` [PATCH] build: make building with --coverage work again Jan Engelhardt
  0 siblings, 1 reply; 35+ messages in thread
From: Luiz Augusto von Dentz @ 2018-11-28 15:06 UTC (permalink / raw)
  To: jengelh; +Cc: linux-bluetooth

Hi Jan,
On Wed, Nov 28, 2018 at 5:04 PM Jan Engelhardt <jengelh@inai.de> wrote:
>
> On Wednesday 2018-11-28 15:38, Luiz Augusto von Dentz wrote:
>
> >Hi Jan,
> >
> >> >  6 files changed, 119 insertions(+), 104 deletions(-)
> >> Applied, thanks.
> >
> >Looks like this is breaking the build if coverage is enabled (set when
> >lcov is available).
>
> How are you specifically enabling coverage on your system?

Just install lcov and it will auto enable it.

-- 
Luiz Augusto von Dentz

^ permalink raw reply	[flat|nested] 35+ messages in thread

* [PATCH] build: make building with --coverage work again
  2018-11-28 15:06                   ` Luiz Augusto von Dentz
@ 2018-11-28 15:45                     ` Jan Engelhardt
  2018-11-29 11:57                       ` Luiz Augusto von Dentz
  0 siblings, 1 reply; 35+ messages in thread
From: Jan Engelhardt @ 2018-11-28 15:45 UTC (permalink / raw)
  To: luiz.dentz; +Cc: jengelh, linux-bluetooth

When `./configure --enable-coverage` is given and lcov is present,
MISC_CFLAGS and MISC_LDFLAGS will be set to --coverage. However,

1. obexd uses per-target LDFLAGS and, in doing so, forget to re-mention
$(AM_LDFLAGS). This problem existed for a long time.

2. obexd uses per-target CFLAGS and, in doing so, forgot to re-mention
$(AM_CFLAGS). This got broken in 06dbb223fbe50acc48b3ba1d33cb424275b4baaa.

This led to no --coverage showing up in the linker line for obexd,
causing a link failure indicating unresolved symbols like
__gcov_exit.
---
 Makefile.obexd      | 6 +++---
 android/Makefile.am | 4 ++--
 2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/Makefile.obexd b/Makefile.obexd
index 22a4977ef..1c1e500fe 100644
--- a/Makefile.obexd
+++ b/Makefile.obexd
@@ -81,15 +81,15 @@ obexd_src_obexd_LDADD = lib/libbluetooth-internal.la \
 			gdbus/libgdbus-internal.la \
 			$(ICAL_LIBS) $(DBUS_LIBS) $(GLIB_LIBS) -ldl
 
-obexd_src_obexd_LDFLAGS = -Wl,--export-dynamic
+obexd_src_obexd_LDFLAGS = $(AM_LDFLAGS) -Wl,--export-dynamic
 
-obexd_src_obexd_CPPFLAGS = $(AM_CFLAGS) $(GLIB_CFLAGS) $(DBUS_CFLAGS) \
+obexd_src_obexd_CPPFLAGS = $(AM_CPPFLAGS) $(GLIB_CFLAGS) $(DBUS_CFLAGS) \
 				$(ICAL_CFLAGS) -DOBEX_PLUGIN_BUILTIN \
 				-DPLUGINDIR=\""$(obex_plugindir)"\" \
 				-D_FILE_OFFSET_BITS=64 \
 				-I$(builddir)/lib -I$(builddir)/obexd/src
 
-obexd_src_obexd_CFLAGS = -fPIC
+obexd_src_obexd_CFLAGS = $(AM_CFLAGS) -fPIC
 
 endif
 
diff --git a/android/Makefile.am b/android/Makefile.am
index 5dd1adf9d..a370598a2 100644
--- a/android/Makefile.am
+++ b/android/Makefile.am
@@ -142,7 +142,7 @@ android_haltest_SOURCES = android/client/haltest.c \
 				android/hal-utils.h android/hal-utils.c
 android_haltest_CPPFLAGS = $(AM_CPPFLAGS) -I$(srcdir)/android \
 				-DPLUGINDIR=\""$(android_plugindir)"\"
-android_haltest_LDFLAGS = -pthread
+android_haltest_LDFLAGS = $(AM_LDFLAGS) -pthread
 android_haltest_LDADD = -ldl -lm
 
 noinst_PROGRAMS += android/android-tester
@@ -167,7 +167,7 @@ android_android_tester_CPPFLAGS = $(AM_CPPFLAGS) -I$(srcdir)/android \
 				-DPLUGINDIR=\""$(android_plugindir)"\"
 android_android_tester_LDADD = lib/libbluetooth-internal.la \
 				src/libshared-glib.la $(GLIB_LIBS) -ldl
-android_android_tester_LDFLAGS = -pthread
+android_android_tester_LDFLAGS = $(AM_LDFLAGS) -pthread
 
 noinst_PROGRAMS += android/ipc-tester
 
-- 
2.19.1


^ permalink raw reply	[flat|nested] 35+ messages in thread

* Re: [PATCH] build: make building with --coverage work again
  2018-11-28 15:45                     ` [PATCH] build: make building with --coverage work again Jan Engelhardt
@ 2018-11-29 11:57                       ` Luiz Augusto von Dentz
  0 siblings, 0 replies; 35+ messages in thread
From: Luiz Augusto von Dentz @ 2018-11-29 11:57 UTC (permalink / raw)
  To: jengelh; +Cc: linux-bluetooth

Hi Jan,
On Wed, Nov 28, 2018 at 5:45 PM Jan Engelhardt <jengelh@inai.de> wrote:
>
> When `./configure --enable-coverage` is given and lcov is present,
> MISC_CFLAGS and MISC_LDFLAGS will be set to --coverage. However,
>
> 1. obexd uses per-target LDFLAGS and, in doing so, forget to re-mention
> $(AM_LDFLAGS). This problem existed for a long time.
>
> 2. obexd uses per-target CFLAGS and, in doing so, forgot to re-mention
> $(AM_CFLAGS). This got broken in 06dbb223fbe50acc48b3ba1d33cb424275b4baaa.
>
> This led to no --coverage showing up in the linker line for obexd,
> causing a link failure indicating unresolved symbols like
> __gcov_exit.
> ---
>  Makefile.obexd      | 6 +++---
>  android/Makefile.am | 4 ++--
>  2 files changed, 5 insertions(+), 5 deletions(-)
>
> diff --git a/Makefile.obexd b/Makefile.obexd
> index 22a4977ef..1c1e500fe 100644
> --- a/Makefile.obexd
> +++ b/Makefile.obexd
> @@ -81,15 +81,15 @@ obexd_src_obexd_LDADD = lib/libbluetooth-internal.la \
>                         gdbus/libgdbus-internal.la \
>                         $(ICAL_LIBS) $(DBUS_LIBS) $(GLIB_LIBS) -ldl
>
> -obexd_src_obexd_LDFLAGS = -Wl,--export-dynamic
> +obexd_src_obexd_LDFLAGS = $(AM_LDFLAGS) -Wl,--export-dynamic
>
> -obexd_src_obexd_CPPFLAGS = $(AM_CFLAGS) $(GLIB_CFLAGS) $(DBUS_CFLAGS) \
> +obexd_src_obexd_CPPFLAGS = $(AM_CPPFLAGS) $(GLIB_CFLAGS) $(DBUS_CFLAGS) \
>                                 $(ICAL_CFLAGS) -DOBEX_PLUGIN_BUILTIN \
>                                 -DPLUGINDIR=\""$(obex_plugindir)"\" \
>                                 -D_FILE_OFFSET_BITS=64 \
>                                 -I$(builddir)/lib -I$(builddir)/obexd/src
>
> -obexd_src_obexd_CFLAGS = -fPIC
> +obexd_src_obexd_CFLAGS = $(AM_CFLAGS) -fPIC
>
>  endif
>
> diff --git a/android/Makefile.am b/android/Makefile.am
> index 5dd1adf9d..a370598a2 100644
> --- a/android/Makefile.am
> +++ b/android/Makefile.am
> @@ -142,7 +142,7 @@ android_haltest_SOURCES = android/client/haltest.c \
>                                 android/hal-utils.h android/hal-utils.c
>  android_haltest_CPPFLAGS = $(AM_CPPFLAGS) -I$(srcdir)/android \
>                                 -DPLUGINDIR=\""$(android_plugindir)"\"
> -android_haltest_LDFLAGS = -pthread
> +android_haltest_LDFLAGS = $(AM_LDFLAGS) -pthread
>  android_haltest_LDADD = -ldl -lm
>
>  noinst_PROGRAMS += android/android-tester
> @@ -167,7 +167,7 @@ android_android_tester_CPPFLAGS = $(AM_CPPFLAGS) -I$(srcdir)/android \
>                                 -DPLUGINDIR=\""$(android_plugindir)"\"
>  android_android_tester_LDADD = lib/libbluetooth-internal.la \
>                                 src/libshared-glib.la $(GLIB_LIBS) -ldl
> -android_android_tester_LDFLAGS = -pthread
> +android_android_tester_LDFLAGS = $(AM_LDFLAGS) -pthread
>
>  noinst_PROGRAMS += android/ipc-tester
>
> --
> 2.19.1

Applied, thanks.

-- 
Luiz Augusto von Dentz

^ permalink raw reply	[flat|nested] 35+ messages in thread

end of thread, back to index

Thread overview: 35+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-11-18 16:07 [PATCH bluez] build system refresh Jan Engelhardt
2018-11-18 16:07 ` [PATCH 1/8] build: rename libexecdir to pkglibexecdir Jan Engelhardt
2018-11-21 11:29   ` Luiz Augusto von Dentz
2018-11-21 12:57     ` Jan Engelhardt
2018-11-21 12:57       ` [PATCH 1/7] build: change @foo@ to $(foo) in automake makefiles Jan Engelhardt
2018-11-22  9:47         ` Luiz Augusto von Dentz
2018-11-24 13:27           ` Jan Engelhardt
2018-11-25  9:20           ` [PATCH bluez] build system refresh (take 3) Jan Engelhardt
2018-11-25  9:20             ` [PATCH 1/8] build: rename includedir to pkgincludedir Jan Engelhardt
2018-11-25  9:20             ` [PATCH 2/8] build: change @foo@ to $(foo) in automake makefiles Jan Engelhardt
2018-11-25  9:20             ` [PATCH 3/8] build: -l arguments to belong into LDADD/LIBADD not LDFLAGS Jan Engelhardt
2018-11-25  9:20             ` [PATCH 4/8] build: -D/-I arguments go into CPPFLAGS Jan Engelhardt
2018-11-25  9:20             ` [PATCH 5/8] build: add missing ELL_CFLAGS Jan Engelhardt
2018-11-25  9:20             ` [PATCH 6/8] build: add missing UDEV_CFLAGS Jan Engelhardt
2018-11-25  9:20             ` [PATCH 7/8] build: add missing ALSA_CFLAGS Jan Engelhardt
2018-11-25  9:20             ` [PATCH 8/8] build: add missing BACKTRACE_CFLAGS Jan Engelhardt
2018-11-26 10:45             ` [PATCH bluez] build system refresh (take 3) Luiz Augusto von Dentz
2018-11-28 14:38               ` Luiz Augusto von Dentz
2018-11-28 15:04                 ` Jan Engelhardt
2018-11-28 15:06                   ` Luiz Augusto von Dentz
2018-11-28 15:45                     ` [PATCH] build: make building with --coverage work again Jan Engelhardt
2018-11-29 11:57                       ` Luiz Augusto von Dentz
2018-11-21 12:57       ` [PATCH 2/7] build: -l arguments to belong into LDADD/LIBADD not LDFLAGS Jan Engelhardt
2018-11-21 12:57       ` [PATCH 3/7] build: -D/-I arguments go into CPPFLAGS Jan Engelhardt
2018-11-21 12:57       ` [PATCH 4/7] build: add missing ELL_CFLAGS Jan Engelhardt
2018-11-21 12:57       ` [PATCH 5/7] build: add missing UDEV_CFLAGS Jan Engelhardt
2018-11-21 12:57       ` [PATCH 6/7] build: add missing ALSA_CFLAGS Jan Engelhardt
2018-11-21 12:57       ` [PATCH 7/7] build: add missing BACKTRACE_CFLAGS Jan Engelhardt
2018-11-18 16:07 ` [PATCH 2/8] build: change @foo@ to $(foo) in automake makefiles Jan Engelhardt
2018-11-18 16:07 ` [PATCH 3/8] build: -l arguments to belong into LDADD/LIBADD not LDFLAGS Jan Engelhardt
2018-11-18 16:07 ` [PATCH 4/8] build: -D/-I arguments go into CPPFLAGS Jan Engelhardt
2018-11-18 16:07 ` [PATCH 5/8] build: add missing ELL_CFLAGS Jan Engelhardt
2018-11-18 16:08 ` [PATCH 6/8] build: add missing UDEV_CFLAGS Jan Engelhardt
2018-11-18 16:08 ` [PATCH 7/8] build: add missing ALSA_CFLAGS Jan Engelhardt
2018-11-18 16:08 ` [PATCH 8/8] build: add missing BACKTRACE_CFLAGS Jan Engelhardt

Linux-Bluetooth Archive on lore.kernel.org

Archives are clonable: git clone --mirror https://lore.kernel.org/linux-bluetooth/0 linux-bluetooth/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-bluetooth linux-bluetooth/ https://lore.kernel.org/linux-bluetooth \
		linux-bluetooth@vger.kernel.org linux-bluetooth@archiver.kernel.org
	public-inbox-index linux-bluetooth


Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.linux-bluetooth


AGPL code for this site: git clone https://public-inbox.org/ public-inbox