public inbox for newlib@sourceware.org
 help / color / mirror / Atom feed
* [PATCH 1/2] libgloss: xtensa: fix crt0.o rule
@ 2023-12-27  7:45 Mike Frysinger
  2023-12-27  7:45 ` [PATCH 2/2] libgloss: xtensa: fix CPPFLAGS clobbering Mike Frysinger
  0 siblings, 1 reply; 2+ messages in thread
From: Mike Frysinger @ 2023-12-27  7:45 UTC (permalink / raw)
  To: newlib

Don't hardcode a custom rule for this -- reuse libobjs_a_SOURCES
which was designed for this exact scenario.
---
 libgloss/Makefile.in         | 106 ++++++++++++++++++++---------------
 libgloss/xtensa/Makefile.inc |   7 ++-
 2 files changed, 64 insertions(+), 49 deletions(-)

diff --git a/libgloss/xtensa/Makefile.inc b/libgloss/xtensa/Makefile.inc
index 02308e4f3487..3ce02c190e8b 100644
--- a/libgloss/xtensa/Makefile.inc
+++ b/libgloss/xtensa/Makefile.inc
@@ -8,6 +8,10 @@ multilibtool_DATA += \
 	%D%/sys.qemu.specs \
 	%D%/sys.openocd.specs \
 	%D%/crt0.o
+libobjs_a_SOURCES += \
+	%D%/crt0.S \
+	%D%/crt1-sim.S \
+	%D%/crt1-boards.S
 
 multilibtool_LIBRARIES += %D%/libgloss.a
 
@@ -50,6 +54,3 @@ multilibtool_DATA += %D%/boards/esp32s3/memory.elf.ld
 %C%_libsys_openocd_a_CPPFLAGS += -I$(srcdir)/%D%/boards/esp32s3/include
 endif
 endif
-
-%D%/crt0.$(OBJEXT): %D%/crt0.S
-	$(AM_V_CPPAS)$(CPPASCOMPILE) $(CPPFLAGS) -o $@ -c $<
-- 
2.43.0


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

* [PATCH 2/2] libgloss: xtensa: fix CPPFLAGS clobbering
  2023-12-27  7:45 [PATCH 1/2] libgloss: xtensa: fix crt0.o rule Mike Frysinger
@ 2023-12-27  7:45 ` Mike Frysinger
  0 siblings, 0 replies; 2+ messages in thread
From: Mike Frysinger @ 2023-12-27  7:45 UTC (permalink / raw)
  To: newlib

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(-)

diff --git a/libgloss/xtensa/Makefile.inc b/libgloss/xtensa/Makefile.inc
index 3ce02c190e8b..4c5c9ada516c 100644
--- a/libgloss/xtensa/Makefile.inc
+++ b/libgloss/xtensa/Makefile.inc
@@ -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
-- 
2.43.0


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

end of thread, other threads:[~2023-12-27  7:45 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-12-27  7:45 [PATCH 1/2] libgloss: xtensa: fix crt0.o rule Mike Frysinger
2023-12-27  7:45 ` [PATCH 2/2] libgloss: xtensa: fix CPPFLAGS clobbering Mike Frysinger

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).