From patchwork Wed Dec 27 07:45:34 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Frysinger X-Patchwork-Id: 82883 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 07B7D3858C53 for ; Wed, 27 Dec 2023 07:45:55 +0000 (GMT) X-Original-To: newlib@sourceware.org Delivered-To: newlib@sourceware.org Received: from smtp.gentoo.org (woodpecker.gentoo.org [IPv6:2001:470:ea4a:1:5054:ff:fec7:86e4]) by sourceware.org (Postfix) with ESMTP id A5F0D3858D35 for ; Wed, 27 Dec 2023 07:45:38 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org A5F0D3858D35 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=gentoo.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gentoo.org ARC-Filter: OpenARC Filter v1.0.0 sourceware.org A5F0D3858D35 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2001:470:ea4a:1:5054:ff:fec7:86e4 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1703663140; cv=none; b=qIYIZKMtYLlpvDEaOfpwnuZ0dVIAbC0eHU2QluuP0E2FVdgd8reUnN5/BOq6PgfG2t64Zx+W5bPhueEM2umIEKg4XuwfDEo274cw7qzK0gYqkEdShIWX3RASL6eyDtgpyvAmjasM8T67dc7h3fijO4s+/bYbW7+0kJvBbwQYpAM= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1703663140; c=relaxed/simple; bh=XS4fRKjy5x1FmuDo6k3U95K8Ap7E1jklr9728rPIL6U=; h=From:To:Subject:Date:Message-ID:MIME-Version; b=T7lqZHra9hYPT7zfTlTZqJXzqVEVNyJ+1zF3q1IjYWpxRcfZ3DQ/mkMty6xuSBYZWJlfEzKUJnHftBy8suVWGztK6bQoJrO4mY471qv7NkeNWREq08rMISUdgUZ/nwtSxqV4k4KcqlBJlZX9uAysw5vU4iQ7crFCVXG9geLhiQs= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by smtp.gentoo.org (Postfix, from userid 559) id 3429E34069F; Wed, 27 Dec 2023 07:45:38 +0000 (UTC) From: Mike Frysinger To: newlib@sourceware.org Subject: [PATCH 2/2] libgloss: xtensa: fix CPPFLAGS clobbering Date: Wed, 27 Dec 2023 02:45:34 -0500 Message-ID: <20231227074534.6579-2-vapier@gentoo.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20231227074534.6579-1-vapier@gentoo.org> References: <20231227074534.6579-1-vapier@gentoo.org> MIME-Version: 1.0 X-Spam-Status: No, score=-11.3 required=5.0 tests=BAYES_00, GIT_PATCH_0, JMQ_SPF_NEUTRAL, KAM_DMARC_STATUS, SPF_HELO_PASS, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: newlib@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Newlib mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: newlib-bounces+patchwork=sourceware.org@sourceware.org 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