From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 1521) id BBBCE3858404; Tue, 10 Jan 2023 06:25:37 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org BBBCE3858404 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1673331937; bh=tQnHf9/IPS0/2weaLURzljZm4BmjD+bhxGw+iWF8iMQ=; h=From:To:Subject:Date:From; b=Uhu7uht/twKMUY90qFxaztfG3DqhEclwcPw5U21ec1Uw1iUFxUL2EeVJWJSHjnh8t +FGANDC5KJrQzOy136/dJg8HGlKfaqm/R5g1tpctF0Pms1VEZHlHD4iCMmETkT9ely 7gNC3d8t7d0yG/UC/+ewAlNs5Frc1eAV9/iv1d9I= Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable From: Michael Frysinger To: gdb-cvs@sourceware.org Subject: [binutils-gdb] sim: build: add basic framework for compiling arch objects in top-level X-Act-Checkin: binutils-gdb X-Git-Author: Mike Frysinger X-Git-Refname: refs/heads/master X-Git-Oldrev: 54e26255ca9e1e39b1c5d091809c3afe350c3d01 X-Git-Newrev: bc438b3e5931e7af87bf51b1365d9401cd69d519 Message-Id: <20230110062537.BBBCE3858404@sourceware.org> Date: Tue, 10 Jan 2023 06:25:37 +0000 (GMT) List-Id: https://sourceware.org/git/gitweb.cgi?p=3Dbinutils-gdb.git;h=3Dbc438b3e5931= e7af87bf51b1365d9401cd69d519 commit bc438b3e5931e7af87bf51b1365d9401cd69d519 Author: Mike Frysinger Date: Mon Dec 26 23:20:46 2022 -0500 sim: build: add basic framework for compiling arch objects in top-level =20 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. Diff: --- 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 e47244d7b8d..3c46925976f 100644 --- a/sim/Makefile.am +++ b/sim/Makefile.am @@ -41,15 +41,27 @@ BUILT_SOURCES =3D CLEANFILES =3D DISTCLEANFILES =3D MOSTLYCLEANFILES =3D core - -AM_CFLAGS =3D $(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 +=3D $(SIM_ENABLED_ARCHES:%=3D%/*.o) + +AM_CFLAGS =3D \ + $(WERROR_CFLAGS) \ + $(WARN_CFLAGS) \ + $(AM_CFLAGS_$(subst -,_,$(@D))) \ + $(AM_CFLAGS_$(subst -,_,$(@D)_$(@F))) AM_CPPFLAGS =3D \ $(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))) =20 AM_CPPFLAGS_FOR_BUILD =3D \ -I$(srcroot)/include \ diff --git a/sim/Makefile.in b/sim/Makefile.in index 839e6e17e27..6f2042a3523 100644 --- a/sim/Makefile.in +++ b/sim/Makefile.in @@ -1789,7 +1789,8 @@ CLEANFILES =3D common/version.c common/version.c-stam= p \ testsuite/common/bits32m31.c testsuite/common/bits64m0.c \ testsuite/common/bits64m63.c DISTCLEANFILES =3D $(am__append_100) -MOSTLYCLEANFILES =3D core $(common_HW_CONFIG_H_TARGETS) $(patsubst \ +MOSTLYCLEANFILES =3D core $(SIM_ENABLED_ARCHES:%=3D%/*.o) \ + $(common_HW_CONFIG_H_TARGETS) $(patsubst \ %,%/stamp-hw,$(SIM_ENABLED_ARCHES)) \ $(common_GEN_MODULES_C_TARGETS) $(patsubst \ %,%/stamp-modules,$(SIM_ENABLED_ARCHES)) $(am__append_7) \ @@ -1799,10 +1800,16 @@ MOSTLYCLEANFILES =3D core $(common_HW_CONFIG_H_TARG= ETS) $(patsubst \ $(am__append_71) $(am__append_77) $(am__append_83) \ $(am__append_99) $(am__append_106) $(am__append_115) \ $(am__append_130) $(am__append_135) -AM_CFLAGS =3D $(WERROR_CFLAGS) $(WARN_CFLAGS) -AM_CPPFLAGS =3D $(INCGNU) -I$(srcroot)/include -I../bfd -I.. \ - $(SIM_HW_CFLAGS) $(SIM_INLINE) -I$(srcdir)/common \ - -DSIM_COMMON_BUILD +AM_CFLAGS =3D \ + $(WERROR_CFLAGS) \ + $(WARN_CFLAGS) \ + $(AM_CFLAGS_$(subst -,_,$(@D))) \ + $(AM_CFLAGS_$(subst -,_,$(@D)_$(@F))) + +AM_CPPFLAGS =3D $(INCGNU) -I$(srcroot) -I$(srcroot)/include -I../bfd \ + -I.. -I$(@D) -I$(srcdir)/$(@D) $(SIM_HW_CFLAGS) $(SIM_INLINE) \ + $(AM_CPPFLAGS_$(subst -,_,$(@D))) $(AM_CPPFLAGS_$(subst \ + -,_,$(@D)_$(@F))) -I$(srcdir)/common -DSIM_TOPDIR_BUILD AM_CPPFLAGS_FOR_BUILD =3D -I$(srcroot)/include $(SIM_HW_CFLAGS) \ $(SIM_INLINE) -I$(srcdir)/common COMPILE_FOR_BUILD =3D $(CC_FOR_BUILD) $(AM_CPPFLAGS_FOR_BUILD) $(CPPFLAGS_= FOR_BUILD) $(CFLAGS_FOR_BUILD) @@ -1818,6 +1825,7 @@ SIM_ALL_RECURSIVE_DEPS =3D common/libcommon.a \ SIM_INSTALL_DATA_LOCAL_DEPS =3D=20 SIM_INSTALL_EXEC_LOCAL_DEPS =3D $(am__append_43) SIM_UNINSTALL_LOCAL_DEPS =3D $(am__append_44) +AM_CPPFLAGS_common =3D -DSIM_COMMON_BUILD common_libcommon_a_SOURCES =3D \ common/callback.c \ common/portability.c \ diff --git a/sim/common/defs.h b/sim/common/defs.h index bbaee4ebd0c..0f4062c2031 100644 --- a/sim/common/defs.h +++ b/sim/common/defs.h @@ -35,7 +35,7 @@ #undef PACKAGE_VERSION =20 /* 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 debb55da933..32b5db6a6ee 100644 --- a/sim/common/local.mk +++ b/sim/common/local.mk @@ -20,7 +20,8 @@ =20 AM_CPPFLAGS +=3D \ -I$(srcdir)/%D% \ - -DSIM_COMMON_BUILD + -DSIM_TOPDIR_BUILD +AM_CPPFLAGS_%C% =3D -DSIM_COMMON_BUILD AM_CPPFLAGS_FOR_BUILD +=3D -I$(srcdir)/%D% =20 ## This makes sure common parts are available before building the arch-sub= dirs