diff options
author | Mike Frysinger <vapier@gentoo.org> | 2022-12-26 22:08:08 -0500 |
---|---|---|
committer | Mike Frysinger <vapier@gentoo.org> | 2023-01-10 01:15:25 -0500 |
commit | 1f1afa43f5ec535449d0be22abfbeffaa93952a0 (patch) | |
tree | 0a3e2cbeeba674395527cb5f338a5bce5287cd68 /sim/mips | |
parent | a6ead8401a356dadc86aff01788a27db2325f174 (diff) | |
download | binutils-gdb-1f1afa43f5ec535449d0be22abfbeffaa93952a0.tar.gz |
sim: mips: 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. On my 4 core system, it adds ~100msec to the build per
port, so it's not great, but it shouldn't be a big deal. This will go
away of course once the top-level compiles objects.
The mips code is a little more tricky than others because, for multi-run
targets, it generates the list of sources & objects on the fly in the
configure script.
Diffstat (limited to 'sim/mips')
-rw-r--r-- | sim/mips/Makefile.in | 44 | ||||
-rw-r--r-- | sim/mips/acinclude.m4 | 20 | ||||
-rw-r--r-- | sim/mips/local.mk | 59 |
3 files changed, 70 insertions, 53 deletions
diff --git a/sim/mips/Makefile.in b/sim/mips/Makefile.in index eb20977c5cc..c79a831dd78 100644 --- a/sim/mips/Makefile.in +++ b/sim/mips/Makefile.in @@ -3,51 +3,9 @@ ## COMMON_PRE_CONFIG_FRAG -SIM_MIPS_GEN = @SIM_MIPS_GEN@ -SIM_MIPS_MULTI_OBJ = @SIM_MIPS_MULTI_OBJ@ - arch = mips -# Object files created by various simulator generators. - - -SIM_SINGLE_OBJ = \ - support.o \ - itable.o \ - semantics.o \ - idecode.o \ - icache.o \ - engine.o \ - irun.o \ - - -SIM_M16_OBJ = \ - m16_support.o \ - m16_semantics.o \ - m16_idecode.o \ - m16_icache.o \ - \ - m32_support.o \ - m32_semantics.o \ - m32_idecode.o \ - m32_icache.o \ - \ - itable.o \ - m16run.o \ - -SIM_MULTI_OBJ = $(SIM_MIPS_MULTI_OBJ) \ - itable.o \ - multi-run.o \ - -SIM_OBJS = \ - interp.o \ - $(SIM_$(SIM_MIPS_GEN)_OBJ) \ - $(SIM_NEW_COMMON_OBJS) \ - cp1.o \ - mdmx.o \ - dsp.o \ - sim-main.o \ - sim-resume.o \ +SIM_LIBSIM = # List of flags to always pass to $(CC). SIM_EXTRA_CFLAGS = @SIM_MIPS_SUBTARGET@ diff --git a/sim/mips/acinclude.m4 b/sim/mips/acinclude.m4 index f2dd97f3dc4..58b55a2782b 100644 --- a/sim/mips/acinclude.m4 +++ b/sim/mips/acinclude.m4 @@ -252,8 +252,8 @@ __EOF__ dnl The top-level function for the mips16 simulator is dnl in a file m16${name}_run.c, generated by the dnl tmp-run-multi Makefile rule. - AS_VAR_APPEND([SIM_MIPS_MULTI_SRC], [" m16${name}_run.c"]) - AS_VAR_APPEND([SIM_MIPS_MULTI_OBJ], [" m16${name}_run.o"]) + AS_VAR_APPEND([SIM_MIPS_MULTI_SRC], [" mips/m16${name}_run.c"]) + AS_VAR_APPEND([SIM_MIPS_MULTI_OBJ], [" mips/m16${name}_run.o"]) AS_VAR_APPEND([SIM_MIPS_IGEN_ITABLE_FLAGS], [" -F 16"]) ], [*:*micromips32*:*], [dnl @@ -264,8 +264,8 @@ __EOF__ dnl The top-level function for the micromips simulator is dnl in a file micromips${name}_run.c, generated by the dnl tmp-run-multi Makefile rule. - AS_VAR_APPEND([SIM_MIPS_MULTI_SRC], [" micromips${name}_run.c"]) - AS_VAR_APPEND([SIM_MIPS_MULTI_OBJ], [" micromips${name}_run.o"]) + AS_VAR_APPEND([SIM_MIPS_MULTI_SRC], [" mips/micromips${name}_run.c"]) + AS_VAR_APPEND([SIM_MIPS_MULTI_OBJ], [" mips/micromips${name}_run.o"]) AS_VAR_APPEND([SIM_MIPS_IGEN_ITABLE_FLAGS], [" -F 16,32"]) ], [*:*micromips64*:*], [dnl @@ -276,8 +276,8 @@ __EOF__ dnl The top-level function for the micromips simulator is dnl in a file micromips${name}_run.c, generated by the dnl tmp-run-multi Makefile rule. - AS_VAR_APPEND([SIM_MIPS_MULTI_SRC], [" micromips${name}_run.c"]) - AS_VAR_APPEND([SIM_MIPS_MULTI_OBJ], [" micromips${name}_run.o"]) + AS_VAR_APPEND([SIM_MIPS_MULTI_SRC], [" mips/micromips${name}_run.c"]) + AS_VAR_APPEND([SIM_MIPS_MULTI_OBJ], [" mips/micromips${name}_run.o"]) AS_VAR_APPEND([SIM_MIPS_IGEN_ITABLE_FLAGS], [" -F 16,32,64"]) ], [ws=m32]) @@ -286,9 +286,9 @@ __EOF__ dnl and ${SIM_MIPS_MULTI_OBJ}. for w in ${ws}; do for base in engine icache idecode model semantics support; do - AS_VAR_APPEND([SIM_MIPS_MULTI_SRC], [" ${w}${name}_${base}.c"]) - AS_VAR_APPEND([SIM_MIPS_MULTI_SRC], [" ${w}${name}_${base}.h"]) - AS_VAR_APPEND([SIM_MIPS_MULTI_OBJ], [" ${w}${name}_${base}.o"]) + AS_VAR_APPEND([SIM_MIPS_MULTI_SRC], [" mips/${w}${name}_${base}.c"]) + AS_VAR_APPEND([SIM_MIPS_MULTI_SRC], [" mips/${w}${name}_${base}.h"]) + AS_VAR_APPEND([SIM_MIPS_MULTI_OBJ], [" mips/${w}${name}_${base}.o"]) done AS_VAR_APPEND([SIM_MIPS_MULTI_IGEN_CONFIGS], [" ${w}${c}"]) done @@ -320,7 +320,7 @@ __EOF__ __EOF__ ], [dnl dnl For clean-extra target. - SIM_MIPS_MULTI_SRC=doesnt-exist.c + SIM_MIPS_MULTI_SRC=mips/doesnt-exist.c SIM_MIPS_IGEN_ITABLE_FLAGS='$(SIM_MIPS_SINGLE_FLAGS)' AS_VAR_IF([SIM_MIPS_GEN], ["M16"], [AS_VAR_APPEND([SIM_MIPS_IGEN_ITABLE_FLAGS], [' $(SIM_MIPS_M16_FLAGS)'])]) ]) diff --git a/sim/mips/local.mk b/sim/mips/local.mk index 5a7b12c29a1..f255ffca611 100644 --- a/sim/mips/local.mk +++ b/sim/mips/local.mk @@ -16,6 +16,65 @@ ## 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%_GEN_OBJ = +if SIM_MIPS_GEN_MODE_SINGLE +%C%_GEN_OBJ += \ + %D%/support.o \ + %D%/itable.o \ + %D%/semantics.o \ + %D%/idecode.o \ + %D%/icache.o \ + %D%/engine.o \ + %D%/irun.o +endif +if SIM_MIPS_GEN_MODE_M16 +%C%_GEN_OBJ += \ + %D%/m16_support.o \ + %D%/m16_semantics.o \ + %D%/m16_idecode.o \ + %D%/m16_icache.o \ + \ + %D%/m32_support.o \ + %D%/m32_semantics.o \ + %D%/m32_idecode.o \ + %D%/m32_icache.o \ + \ + %D%/itable.o \ + %D%/m16run.o +endif +if SIM_MIPS_GEN_MODE_MULTI +%C%_GEN_OBJ += \ + $(SIM_MIPS_MULTI_OBJ) \ + %D%/itable.o \ + %D%/multi-run.o +endif +%C%_libsim_a_SOURCES = +%C%_libsim_a_LIBADD = \ + $(common_libcommon_a_OBJECTS) \ + %D%/interp.o \ + $(%C%_GEN_OBJ) \ + $(patsubst %,%D%/%,$(SIM_NEW_COMMON_OBJS)) \ + $(patsubst %,%D%/dv-%.o,$(SIM_HW_DEVICES)) \ + $(patsubst %,%D%/dv-%.o,$(%C%_SIM_EXTRA_HW_DEVICES)) \ + %D%/cp1.o \ + %D%/dsp.o \ + %D%/mdmx.o \ + %D%/modules.o \ + %D%/sim-main.o \ + %D%/sim-resume.o +## Workaround Automake bug where $(SIM_MIPS_MULTI_OBJ) isn't copied from LIBADD +## to DEPENDENCIES automatically. +EXTRA_mips_libsim_a_DEPENDENCIES = $(SIM_MIPS_MULTI_OBJ) +$(%C%_libsim_a_OBJECTS) $(%C%_libsim_a_LIBADD): %D%/hw-config.h + +noinst_LIBRARIES += %D%/libsim.a + +%D%/%.o: %D%/%.c + $(AM_V_at)$(MAKE) $(AM_MAKEFLAGS) -C $(@D) $(@F) + +%D%/%.o: common/%.c + $(AM_V_at)$(MAKE) $(AM_MAKEFLAGS) -C $(@D) $(@F) + %C%_run_SOURCES = %C%_run_LDADD = \ %D%/nrun.o \ |