aboutsummaryrefslogtreecommitdiff
path: root/sim/ppc
diff options
context:
space:
mode:
authorMike Frysinger <vapier@gentoo.org>2024-01-02 09:50:43 -0500
committerMike Frysinger <vapier@gentoo.org>2024-01-03 01:21:48 -0500
commit01c2a7aa695147ad6b9a46034056b2073119ca7b (patch)
tree9d6e71e5920006686ff66658ed0c526f17708bf6 /sim/ppc
parente0e9cd645f3e421a39e67b0cc32d5f7551318b9e (diff)
downloadfsf-binutils-gdb-01c2a7aa695147ad6b9a46034056b2073119ca7b.zip
fsf-binutils-gdb-01c2a7aa695147ad6b9a46034056b2073119ca7b.tar.gz
fsf-binutils-gdb-01c2a7aa695147ad6b9a46034056b2073119ca7b.tar.bz2
sim: ppc: move libsim.a creation to top-level
The objects are still compiled in the subdir, but the creation of the archive itself is in the top-level. This is a required step before we can move compilation itself up, and makes it easier to review. The downside is that each object compile is a recursive make instead of a single one. It adds some overhead, so it's not great, but it shouldn't be a big deal. This will go away once compilation is hoisted up.
Diffstat (limited to 'sim/ppc')
-rw-r--r--sim/ppc/Makefile.in9
-rw-r--r--sim/ppc/local.mk54
2 files changed, 49 insertions, 14 deletions
diff --git a/sim/ppc/Makefile.in b/sim/ppc/Makefile.in
index 7841e75..8c05568 100644
--- a/sim/ppc/Makefile.in
+++ b/sim/ppc/Makefile.in
@@ -97,10 +97,7 @@ INCLUDES = -I. -I$(srcdir) $(LIB_INCLUDES) $(BFD_INCLUDES) -I../..
LIBIBERTY_LIB = ../../libiberty/libiberty.a
BFD_LIB = ../../bfd/libbfd.la
-
-TARGETLIB = libsim.a
-
-all: $(TARGETLIB) $(GDB_OBJ)
+all:
.c.o:
$(ECHO_CC) $(CC) -c $(STD_CFLAGS) $<
@@ -444,10 +441,6 @@ PACKAGE_SRC = pk_disklabel.c
PACKAGE_OBJ = $(PACKAGE_SRC:.c=.o)
-$(TARGETLIB): defines.h $(LIB_OBJ) $(GDB_OBJ)
- $(ECHO_AR) $(AR) $(AR_FLAGS) $(TARGETLIB) $(LIB_OBJ) $(GDB_OBJ)
- $(ECHO_RANLIB) $(RANLIB) $(TARGETLIB)
-
psim.o: psim.c $(CPU_H) $(IDECODE_H) $(OPTIONS_H) $(TREE_H) $(BFD_H)
bits.o: bits.c $(BASICS_H)
diff --git a/sim/ppc/local.mk b/sim/ppc/local.mk
index 3c36b60..90f9489 100644
--- a/sim/ppc/local.mk
+++ b/sim/ppc/local.mk
@@ -26,6 +26,53 @@ AM_CPPFLAGS_%C% = \
$(sim_ppc_model) $(sim_ppc_default_model) $(sim_ppc_model_issue) \
$(sim_ppc_switch)
+%C%_libsim_a_SOURCES = \
+ $(common_libcommon_a_SOURCES)
+%C%_libsim_a_LIBADD = \
+ %D%/debug.o \
+ %D%/bits.o \
+ %D%/sim-endian.o \
+ %D%/os_emul.o \
+ %D%/emul_generic.o \
+ %D%/emul_bugapi.o \
+ %D%/emul_chirp.o \
+ %D%/emul_netbsd.o \
+ %D%/emul_unix.o \
+ %D%/registers.o \
+ %D%/vm.o \
+ %D%/corefile.o \
+ %D%/model.o \
+ %D%/spreg.o \
+ %D%/cpu.o \
+ %D%/interrupts.o \
+ %D%/events.o \
+ %D%/cap.o \
+ %D%/device.o \
+ %D%/tree.o \
+ %D%/device_table.o \
+ %D%/itable.o \
+ %D%/mon.o \
+ %D%/icache.o \
+ %D%/semantics.o \
+ %D%/idecode.o \
+ %D%/support.o \
+ %D%/sim-fpu.o \
+ %D%/psim.o \
+ %D%/pk_disklabel.o \
+ $(patsubst %,%D%/%,$(sim_ppc_hw_obj)) \
+ %D%/options.o \
+ %D%/gdb-sim.o \
+ %D%/sim_calls.o
+
+noinst_LIBRARIES += %D%/libsim.a
+
+## common/sim-endian.c is matched before ppc/sim-endian.c due to the pattern
+## rule below. Force the ppc version until we can unify the two properly.
+%D%/sim-endian.o: $(srcdir)/%D%/sim-endian.c ; $(SIM_COMPILE)
+
+%D%/%.o: common/%.c ; $(SIM_COMPILE)
+-@am__include@ %D%/$(DEPDIR)/*.Po
+
%C%_run_SOURCES = \
%D%/main.c
%C%_run_LDADD = \
@@ -34,13 +81,11 @@ AM_CPPFLAGS_%C% = \
## This makes sure common parts are available before building the arch-subdirs
## which will refer to these.
-SIM_ALL_RECURSIVE_DEPS += common/libcommon.a
-%D%/libsim.a: common/libcommon.a
+%D%/%.o: %D%/%.c | common/libcommon.a %D%/defines.h %D%/stamp-igen %D%/hw.c %D%/hw.h
$(AM_V_at)$(MAKE) $(AM_MAKEFLAGS) -C $(@D) $(@F)
noinst_PROGRAMS += %D%/run
-SIM_ALL_RECURSIVE_DEPS += %D%/defines.h
%D%/defines.h: %D%/stamp-defines ; @true
%D%/stamp-defines: config.h Makefile
$(AM_V_GEN)sed -n -e '/^#define HAVE_/s/ 1$$/",/' -e '/^#define HAVE_/s//"HAVE_/p' < config.h > %D%/defines.hin
@@ -120,7 +165,6 @@ BUILT_SOURCES += \
$(%C%_BUILT_SRC_FROM_IGEN) \
%D%/stamp-igen
-SIM_ALL_RECURSIVE_DEPS += %D%/stamp-igen
$(%C%_BUILT_SRC_FROM_IGEN): %D%/stamp-igen
%C%_IGEN_OPCODE_RULES = %D%/@sim_ppc_opcode@
@@ -224,7 +268,6 @@ BUILT_SOURCES += \
%D%/hw.c \
%D%/hw.h \
%D%/stamp-hw
-SIM_ALL_RECURSIVE_DEPS += %D%/stamp-hw
%D%/hw.c %D%/hw.h: %D%/stamp-igen
## Real packages
@@ -249,7 +292,6 @@ $(srcdir)/%D%/pk.h: @MAINT@ %D%/stamp-pk ; @true
$(AM_V_at)touch $@
%C%_BUILD_OUTPUTS += %D%/stamp-pk
-SIM_ALL_RECURSIVE_DEPS += %D%/stamp-pk
%C%docdir = $(docdir)/%C%
%C%doc_DATA = %D%/BUGS %D%/INSTALL %D%/README %D%/RUN