From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp.gentoo.org (dev.gentoo.org [IPv6:2001:470:ea4a:1:5054:ff:fec7:86e4]) by sourceware.org (Postfix) with ESMTP id 349A238582A4 for ; Tue, 3 Jan 2023 07:57:31 +0000 (GMT) Received: by smtp.gentoo.org (Postfix, from userid 559) id DE2B6340CD7; Tue, 3 Jan 2023 07:57:30 +0000 (UTC) From: Mike Frysinger To: gdb-patches@sourceware.org Subject: [PATCH 38/83] sim: build: add basic framework for compiling arch objects in top-level Date: Tue, 3 Jan 2023 02:55:20 -0500 Message-Id: <20230103075605.13606-39-vapier@gentoo.org> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20230103075605.13606-1-vapier@gentoo.org> References: <20230103075605.13606-1-vapier@gentoo.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-11.2 required=5.0 tests=BAYES_00,GIT_PATCH_0,JMQ_SPF_NEUTRAL,KAM_DMARC_STATUS,SPF_HELO_PASS,SPF_PASS,TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: The code so far has been assuming that we only compile common/ objects. Now that we're ready to compile arch-specific objects, refactor some of the flags & checks a bit to support both. --- sim/Makefile.am | 18 +++++++++++++++--- sim/Makefile.in | 18 +++++++++++++----- sim/common/defs.h | 2 +- sim/common/local.mk | 3 ++- 4 files changed, 31 insertions(+), 10 deletions(-) diff --git a/sim/Makefile.am b/sim/Makefile.am index e47244d7b8dd..3c46925976f3 100644 --- a/sim/Makefile.am +++ b/sim/Makefile.am @@ -41,15 +41,27 @@ BUILT_SOURCES = CLEANFILES = DISTCLEANFILES = MOSTLYCLEANFILES = core - -AM_CFLAGS = $(WERROR_CFLAGS) $(WARN_CFLAGS) +## We build some objects ourselves directly that Automake doesn't track, so +## make sure all objects in subdirs get cleaned up. +MOSTLYCLEANFILES += $(SIM_ENABLED_ARCHES:%=%/*.o) + +AM_CFLAGS = \ + $(WERROR_CFLAGS) \ + $(WARN_CFLAGS) \ + $(AM_CFLAGS_$(subst -,_,$(@D))) \ + $(AM_CFLAGS_$(subst -,_,$(@D)_$(@F))) AM_CPPFLAGS = \ $(INCGNU) \ + -I$(srcroot) \ -I$(srcroot)/include \ -I../bfd \ -I.. \ + -I$(@D) \ + -I$(srcdir)/$(@D) \ $(SIM_HW_CFLAGS) \ - $(SIM_INLINE) + $(SIM_INLINE) \ + $(AM_CPPFLAGS_$(subst -,_,$(@D))) \ + $(AM_CPPFLAGS_$(subst -,_,$(@D)_$(@F))) AM_CPPFLAGS_FOR_BUILD = \ -I$(srcroot)/include \ diff --git a/sim/common/defs.h b/sim/common/defs.h index bbaee4ebd0ce..0f4062c2031d 100644 --- a/sim/common/defs.h +++ b/sim/common/defs.h @@ -35,7 +35,7 @@ #undef PACKAGE_VERSION /* Include common sim's various configure tests. */ -#ifndef SIM_COMMON_BUILD +#ifndef SIM_TOPDIR_BUILD #include "../config.h" #else #include "config.h" diff --git a/sim/common/local.mk b/sim/common/local.mk index debb55da933b..32b5db6a6eea 100644 --- a/sim/common/local.mk +++ b/sim/common/local.mk @@ -20,7 +20,8 @@ AM_CPPFLAGS += \ -I$(srcdir)/%D% \ - -DSIM_COMMON_BUILD + -DSIM_TOPDIR_BUILD +AM_CPPFLAGS_%C% = -DSIM_COMMON_BUILD AM_CPPFLAGS_FOR_BUILD += -I$(srcdir)/%D% ## This makes sure common parts are available before building the arch-subdirs -- 2.39.0