]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
[WIP] sim: aarch64: merge libsim.a build into top-level
authorMike Frysinger <vapier@gentoo.org>
Sun, 6 Nov 2022 03:59:27 +0000 (10:59 +0700)
committerMike Frysinger <vapier@gentoo.org>
Thu, 10 Nov 2022 18:44:16 +0000 (01:44 +0700)
sim/Makefile.am
sim/aarch64/local.mk
sim/common/defs.h
sim/common/local.mk

index 7197590035f6964e3e5b7924f779ddf8d1f60b72..630de804c8dd813c2f81d38a7d98622adf9e1d9d 100644 (file)
@@ -47,8 +47,11 @@ AM_CPPFLAGS = \
        -I$(srcroot)/include \
        -I../bfd \
        -I.. \
+       -I$(@D) \
+       -I$(srcdir)/$(@D) \
        $(SIM_HW_CFLAGS) \
-       $(SIM_INLINE)
+       $(SIM_INLINE) \
+       $(AM_CPPFLAGS_$(@D))
 
 AM_CPPFLAGS_FOR_BUILD = \
        -I$(srcroot)/include \
index 747ecc7c0d0ece8718a30a9c272e12902423935c..bbcf5920723193f8b7545a546b06bf0beb149989 100644 (file)
 ## You should have received a copy of the GNU General Public License
 ## along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
-%C%_libsim_a_SOURCES =
+AM_CPPFLAGS_%D% = -DSIM_TOPDIR_BUILD
+
+%C%_libsim_a_SOURCES = \
+       %D%/cpustate.c \
+       %D%/interp.c \
+       %D%/memory.c \
+       %D%/modules.c \
+       %D%/simulator.c
 %C%_libsim_a_LIBADD = \
        $(common_libcommon_a_OBJECTS) \
        $(patsubst %,%D%/%,$(SIM_NEW_COMMON_OBJS)) \
        $(patsubst %,%D%/dv-%.o,$(SIM_HW_DEVICES)) \
-       %D%/cpustate.o \
-       %D%/interp.o \
-       %D%/memory.o \
-       %D%/modules.o \
-       %D%/sim-resume.o \
-       %D%/simulator.o
+       %D%/sim-resume.o
 
 noinst_LIBRARIES += %D%/libsim.a
 
@@ -40,10 +42,11 @@ noinst_PROGRAMS += %D%/run
 
 SIM_ALL_RECURSIVE_DEPS += %D%/modules.c
 
-$(%C%_libsim_a_LIBADD): | $(SIM_ALL_RECURSIVE_DEPS)
-
-%D%/%.o: %D%/%.c | $(SIM_ALL_RECURSIVE_DEPS)
-       $(AM_V_at)$(MAKE) $(AM_MAKEFLAGS) -C $(@D) $(@F)
+$(%C%_libsim_a_OBJECTS) $(%C%_run_OBJECTS) $(%C%_libsim_a_LIBADD): | $(SIM_ALL_RECURSIVE_DEPS)
 
 %D%/%.o: common/%.c | $(SIM_ALL_RECURSIVE_DEPS)
-       $(AM_V_at)$(MAKE) $(AM_MAKEFLAGS) -C $(@D) $(@F)
+       $(AM_V_CC)$(COMPILE) -c -o $@ $<
+
+# See sim_pre_argv_init and sim_module_install in sim-module.c for more details.
+#%D%/modules.c: %D%/stamp-modules ; @true
+#%D%/stamp-modules: Makefile $(%C%_libsim_a_SOURCES) ; $(DO_MODULES_C)
index 17c5ca275865627a937b08a9ce7995d66508a900..b74dcc3ce18b29f21ba490bdbb266533cde63543 100644 (file)
@@ -35,7 +35,7 @@
 #undef PACKAGE_VERSION
 
 /* Include common sim's various configure tests.  */
-#ifndef SIM_COMMON_BUILD
+#if !defined(SIM_COMMON_BUILD) && !defined(SIM_TOPDIR_BUILD)
 #include "../config.h"
 #else
 #include "config.h"
index 9fdd8d86b8a22498ffbd4a46e7905a2f964ff9c8..29b1970865420f8dd54a004b64d1ff5037a827ea 100644 (file)
@@ -18,9 +18,8 @@
 ## Parts of the common/ sim code that have been unified.
 ## Most still lives in common/Make-common.in.
 
-AM_CPPFLAGS += \
-       -I$(srcdir)/%D% \
-       -DSIM_COMMON_BUILD
+AM_CPPFLAGS += -I$(srcdir)/%D%
+AM_CPPFLAGS_%D% = -DSIM_COMMON_BUILD
 AM_CPPFLAGS_FOR_BUILD += -I$(srcdir)/%D%
 
 ## This makes sure common parts are available before building the arch-subdirs