[2/2] libgloss: xtensa: fix CPPFLAGS clobbering
Commit Message
No sub-Makefile.inc file should ever set CPPFLAGS directly. That is
a global/common variable. Instead, ports should set the per-target
CPPFLAGS to include what they need.
Further, per-target CPPFLAGS should respect $(AM_CPPFLAGS).
---
libgloss/Makefile.in | 48 +++++++++++++++++++++---------------
libgloss/xtensa/Makefile.inc | 19 ++++++++++----
2 files changed, 42 insertions(+), 25 deletions(-)
@@ -1,4 +1,4 @@
-CPPFLAGS += -D_LIBGLOSS -I$(srcdir)/%D%/include
+%C%_CPPFLAGS = -D_LIBGLOSS -I$(srcdir)/%D%/include
multilibtool_DATA += \
%D%/default.specs \
@@ -25,23 +25,32 @@ multilibtool_DATA += \
%D%/sleep.S \
%D%/syscalls.c \
%D%/window-vectors.S
+%C%_libgloss_a_CPPFLAGS = \
+ $(AM_CPPFLAGS) \
+ $(%C%_CPPFLAGS)
multilibtool_LIBRARIES += %D%/libsys_qemu.a
-%C%_libsys_qemu_a_CPPFLAGS = -DQEMU_SEMIHOSTING
+%C%_libsys_qemu_a_CPPFLAGS = \
+ $(AM_CPPFLAGS) \
+ $(%C%_CPPFLAGS) \
+ -DQEMU_SEMIHOSTING
%C%_libsys_qemu_a_SOURCES = \
%D%/sim-vectors.S \
%D%/sim-call.S \
%D%/syscalls.c
multilibtool_LIBRARIES += %D%/libsys_openocd.a
-%C%_libsys_openocd_a_CPPFLAGS = -DOPENOCD_SEMIHOSTING
+%C%_libsys_openocd_a_CPPFLAGS = \
+ $(AM_CPPFLAGS) \
+ $(%C%_CPPFLAGS) \
+ -DOPENOCD_SEMIHOSTING
%C%_libsys_openocd_a_SOURCES = \
%D%/syscalls.c
if HAVE_XTENSA_BOARD_ESP32
multilibtool_DATA += %D%/boards/esp32/memory.elf.ld
%C%_libgloss_a_SOURCES += %D%/boards/esp32/board.c
-%C%_libgloss_a_CPPFLAGS = -I$(srcdir)/%D%/boards/esp32/include
+%C%_libgloss_a_CPPFLAGS += -I$(srcdir)/%D%/boards/esp32/include
%C%_libsys_qemu_a_CPPFLAGS += -I$(srcdir)/%D%/boards/esp32/include
%C%_libsys_openocd_a_CPPFLAGS += -I$(srcdir)/%D%/boards/esp32/include
endif
@@ -49,7 +58,7 @@ endif
if HAVE_XTENSA_BOARD_ESP32S3
multilibtool_DATA += %D%/boards/esp32s3/memory.elf.ld
%C%_libgloss_a_SOURCES += %D%/boards/esp32s3/board.c
-%C%_libgloss_a_CPPFLAGS = -I$(srcdir)/%D%/boards/esp32s3/include
+%C%_libgloss_a_CPPFLAGS += -I$(srcdir)/%D%/boards/esp32s3/include
%C%_libsys_qemu_a_CPPFLAGS += -I$(srcdir)/%D%/boards/esp32s3/include
%C%_libsys_openocd_a_CPPFLAGS += -I$(srcdir)/%D%/boards/esp32s3/include
endif