build: -D/-I arguments go into CPPFLAGS
authorJan Engelhardt <jengelh@inai.de>
Sun, 25 Nov 2018 09:20:08 +0000 (10:20 +0100)
committerhimanshu <h.himanshu@samsung.com>
Tue, 11 Feb 2020 08:58:20 +0000 (14:28 +0530)
-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.)

Change-Id: I7031834ae2d9446367ce02ca78be9842dece0683
Signed-off-by: himanshu <h.himanshu@samsung.com>
Makefile.am
Makefile.obexd
Makefile.plugins
android/Makefile.am

index db9da96..38b35f5 100755 (executable)
@@ -1,5 +1,6 @@
 
 AM_MAKEFLAGS = --no-print-directory
+AM_CPPFLAGS =
 
 lib_LTLIBRARIES =
 
@@ -309,7 +310,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)"\" \
                                        $(builtin_cppflags)
 src_bluetoothd_SHORTNAME = bluetoothd
@@ -377,9 +378,9 @@ EXTRA_DIST += doc/btsnoop.txt
 
 EXTRA_DIST += tools/magic.btsnoop
 
-AM_CFLAGS += $(DBUS_CFLAGS) $(GLIB_CFLAGS) @LIBXML_CFLAGS@ @INIPARSER_CFLAGS@
+AM_CFLAGS += @LIBXML_CFLAGS@ @INIPARSER_CFLAGS@
 
-AM_CPPFLAGS = -I$(builddir)/lib
+AM_CPPFLAGS += $(DBUS_CFLAGS) $(GLIB_CFLAGS) -I$(builddir)/lib
 
 
 unit_tests += unit/test-eir
@@ -537,7 +538,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
index ec55292..c554fe4 100755 (executable)
@@ -87,16 +87,17 @@ 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) \
                                @LIBXML_CFLAGS@ @INIPARSER_CFLAGS@ \
                                $(ICAL_CFLAGS) -DOBEX_PLUGIN_BUILTIN \
                                -DPLUGINDIR=\""$(obex_plugindir)"\" \
-                               -fPIC -D_FILE_OFFSET_BITS=64 -pie
-
-obexd_src_obexd_CPPFLAGS = -I$(builddir)/lib -I$(builddir)/obexd/src  \
+                               -D_FILE_OFFSET_BITS=64 \
+                               -I$(builddir)/lib -I$(builddir)/obexd/src \
                                -I$(srcdir)/obexd/src -I$(srcdir)/btio \
                                -I$(srcdir)/gobex -I$(srcdir)/gdbus
 
+obexd_src_obexd_CFLAGS = -fPIC
+
 endif
 
 obexd_src_obexd_SHORTNAME = obexd
index df02112..a9e537d 100755 (executable)
@@ -169,5 +169,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) @LIBXML_LIBS@ @INIPARSER_LIBS@
-plugins_sixaxis_la_CFLAGS = $(AM_CFLAGS) -fvisibility=hidden $(UDEV_CFLAGS) @LIBXML_CFLAGS@ @INIPARSER_CFLAGS@
+plugins_sixaxis_la_CPPFLAGS = $(AM_CPPFLAGS) $(UDEV_CFLAGS)
+plugins_sixaxis_la_CFLAGS = $(AM_CFLAGS) -fvisibility=hidden @LIBXML_CFLAGS@ @INIPARSER_CFLAGS@
 endif
index 0f04b6a..5dd1adf 100755 (executable)
@@ -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