aboutsummaryrefslogtreecommitdiff
path: root/sim/ppc
diff options
context:
space:
mode:
authorMike Frysinger <vapier@gentoo.org>2024-01-01 15:48:15 -0500
committerMike Frysinger <vapier@gentoo.org>2024-01-01 16:12:16 -0500
commit5817b1f52f5f51cddadd3a982b0d34035d188648 (patch)
treef0c6a2295a891dbd0990cbe74addda07d23f0c1a /sim/ppc
parent179bd7a89d85a1d7b67c641778eac7df849b8d09 (diff)
downloadbinutils-5817b1f52f5f51cddadd3a982b0d34035d188648.zip
binutils-5817b1f52f5f51cddadd3a982b0d34035d188648.tar.gz
binutils-5817b1f52f5f51cddadd3a982b0d34035d188648.tar.bz2
sim: ppc: hoist igen compilation into top-level
This simplifies the build a bit (especially for deps in port subdirs), and avoids recursive make. This in turn speeds up the build, and lets us reuse existing build-time vs host-time logic from Makefile.am.
Diffstat (limited to 'sim/ppc')
-rw-r--r--sim/ppc/Makefile.in60
-rw-r--r--sim/ppc/local.mk64
2 files changed, 64 insertions, 60 deletions
diff --git a/sim/ppc/Makefile.in b/sim/ppc/Makefile.in
index ee8fb04..f7c37cc 100644
--- a/sim/ppc/Makefile.in
+++ b/sim/ppc/Makefile.in
@@ -88,7 +88,6 @@ BUILD_CFLAGS = $(CFLAGS_FOR_BUILD) $(INCLUDES) $(WARN_CFLAGS)
LIBS = $(COMMON_LIBS) @LIBS@ $(LIBGNU) $(LIBGNU_EXTRA_LIBS)
-COMPILE_FOR_BUILD = $(CC_FOR_BUILD) $(BUILD_CFLAGS)
LINK_FOR_BUILD = $(CC_FOR_BUILD) $(BUILD_CFLAGS) $(LDFLAGS_FOR_BUILD) -o $@
IGEN_OPCODE_RULES = @sim_opcode@
@@ -616,63 +615,6 @@ tmp-igen: igen $(srcdir)/powerpc.igen $(srcdir)/altivec.igen $(srcdir)/e500.igen
$(TARGETLIB): tmp-igen
itable.h itable.c icache.h icache.c idecode.h idecode.c semantics.h semantics.c model.h model.c support.h support.c: tmp-igen
-igen: igen.o table.o lf.o misc.o filter_host.o ld-decode.o ld-cache.o filter.o ld-insn.o gen-model.o gen-itable.o gen-icache.o gen-semantics.o gen-idecode.o gen-support.o
- $(ECHO_CCLD) $(LINK_FOR_BUILD) igen.o table.o lf.o misc.o filter_host.o ld-decode.o ld-cache.o filter.o ld-insn.o gen-model.o gen-itable.o gen-icache.o gen-semantics.o gen-idecode.o gen-support.o
-
-filter_host.o: filter_host.c $(CONFIG_H) $(FILTER_FILENAME_H)
- $(ECHO_CC) $(COMPILE_FOR_BUILD) -c $(srcdir)/filter_host.c
-
-table.o: table.c $(CONFIG_H) $(MISC_H) $(LF_H) $(TABLE_H)
- $(ECHO_CC) $(COMPILE_FOR_BUILD) -c $(srcdir)/table.c
-
-lf.o: lf.c $(CONFIG_H) $(MISC_H) $(LF_H)
- $(ECHO_CC) $(COMPILE_FOR_BUILD) -c $(srcdir)/lf.c
-
-filter.o: filter.c $(CONFIG_H) $(MISC_H) $(FILTER_H)
- $(ECHO_CC) $(COMPILE_FOR_BUILD) -c $(srcdir)/filter.c
-tmp-filter: filter.c $(MISC_H) misc.o
- $(ECHO_CCLD) $(LINK_FOR_BUILD) -DMAIN $(srcdir)/filter.c misc.o
-
-ld-decode.o: ld-decode.c $(MISC_H) $(LF_H) $(TABLE_H) $(LD_DECODE_H)
- $(ECHO_CC) $(COMPILE_FOR_BUILD) -c $(srcdir)/ld-decode.c
-tmp-ld-decode: ld-decode.c misc.o lf.o table.o filter_host.o
- $(ECHO_CCLD) $(LINK_FOR_BUILD) -DMAIN $(srcdir)/ld-decode.c misc.o lf.o table.o filter_host.o
-
-ld-cache.o: ld-cache.c $(MISC_H) $(LF_H) $(TABLE_H) $(LD_CACHE_H)
- $(ECHO_CC) $(COMPILE_FOR_BUILD) -c $(srcdir)/ld-cache.c
-tmp-ld-cache: ld-cache.c misc.o lf.o table.o filter_host.o
- $(ECHO_CCLD) $(LINK_FOR_BUILD) -DMAIN $(srcdir)/ld-cache.c misc.o lf.o table.o filter_host.o
-
-ld-insn.o: ld-insn.c $(MISC_H) $(LF_H) $(TABLE_H) $(FILTER_H) $(LD_DECODE_H) $(LD_CACHE_H) $(LD_INSN_H) $(IGEN_H)
- $(ECHO_CC) $(COMPILE_FOR_BUILD) -c $(srcdir)/ld-insn.c
-tmp-ld-insn: ld-insn.c ld-cache.o misc.o lf.o table.o ld-decode.o filter_host.o filter.o
- $(ECHO_CCLD) $(LINK_FOR_BUILD) -DMAIN $(srcdir)/ld-insn.c ld-cache.o misc.o lf.o table.o ld-decode.o filter_host.o filter.o
-
-gen-model.o: gen-model.c $(MISC_H) $(LF_H) $(TABLE_H) $(FILTER_H) $(LD_CACHE_H) $(LD_DECODE_H) $(LD_INSN_H) $(GEN_MODEL_H)
- $(ECHO_CC) $(COMPILE_FOR_BUILD) -c $(srcdir)/gen-model.c
-
-gen-itable.o: gen-itable.c $(MISC_H) $(LF_H) $(TABLE_H) $(FILTER_H) $(LD_CACHE_H) $(LD_DECODE_H) $(LD_INSN_H) $(IGEN_H) $(GEN_ITABLE_H)
- $(ECHO_CC) $(COMPILE_FOR_BUILD) -c $(srcdir)/gen-itable.c
-
-gen-icache.o: gen-icache.c $(MISC_H) $(LF_H) $(TABLE_H) $(FILTER_H) $(LD_DECODE_H) $(LD_CACHE_H) $(LD_INSN_H) $(IGEN_H) $(GEN_SEMANTICS_H) $(GEN_IDECODE_H) $(GEN_ICACHE_H)
- $(ECHO_CC) $(COMPILE_FOR_BUILD) -c $(srcdir)/gen-icache.c
-
-gen-semantics.o: gen-semantics.c $(MISC_H) $(LF_H) $(TABLE_H) $(FILTER_H) $(LD_DECODE_H) $(LD_CACHE_H) $(LD_INSN_H) $(IGEN_H) $(GEN_SEMANTICS_H) $(GEN_ICACHE_H) $(GEN_IDECODE_H)
- $(ECHO_CC) $(COMPILE_FOR_BUILD) -c $(srcdir)/gen-semantics.c
-
-gen-idecode.o: gen-idecode.c $(MISC_H) $(LF_H) $(TABLE_H) $(FILTER_H) $(LD_DECODE_H) $(LD_CACHE_H) $(LD_INSN_H) $(IGEN_H) $(GEN_IDECODE_H) $(GEN_ICACHE_H) $(GEN_SEMANTICS_H)
- $(ECHO_CC) $(COMPILE_FOR_BUILD) -c $(srcdir)/gen-idecode.c
-
-gen-support.o: gen-support.c $(MISC_H) $(LF_H) $(TABLE_H) $(FILTER_H) $(LD_DECODE_H) $(LD_CACHE_H) $(LD_INSN_H) $(IGEN_H) $(GEN_SEMANTICS_H) $(GEN_SUPPORT_H)
- $(ECHO_CC) $(COMPILE_FOR_BUILD) -c $(srcdir)/gen-support.c
-
-igen.o: igen.c $(MISC_H) $(LF_H) $(TABLE_H) $(CONFIG_H) $(FILTER_H) $(LD_CACHE_H) $(LD_DECODE_H) $(LD_INSN_H) $(IGEN_H) $(GEN_MODEL_H) $(GEN_ICACHE_H) $(GEN_ITABLE_H) $(GEN_IDECODE_H) $(GEN_SEMANTICS_H) $(GEN_SUPPORT_H)
- $(ECHO_CC) $(COMPILE_FOR_BUILD) -c $(srcdir)/igen.c
-
-misc.o: misc.c $(CONFIG_H) $(MISC_H)
- $(ECHO_CC) $(COMPILE_FOR_BUILD) -c $(srcdir)/misc.c
-
-
# real hardware
hw.c hw.h: tmp-hw; @true
@@ -762,7 +704,7 @@ TAGS: $(BUILT_SRC)
etags $(srcdir)/*.h $(srcdir)/*.c $(BUILT_SRC)
clean mostlyclean:
- rm -f tmp-* *.[oasi] core igen $(BUILT_SRC_WO_CONFIG)
+ rm -f tmp-* *.[oasi] core $(BUILT_SRC_WO_CONFIG)
distclean realclean: clean
rm -f TAGS Makefile config.cache config.status config.h defines.h stamp-h config.log
diff --git a/sim/ppc/local.mk b/sim/ppc/local.mk
index 9f55629..9156422 100644
--- a/sim/ppc/local.mk
+++ b/sim/ppc/local.mk
@@ -28,7 +28,7 @@ SIM_ALL_RECURSIVE_DEPS += common/libcommon.a
$(AM_V_at)$(MAKE) $(AM_MAKEFLAGS) -C $(@D) $(@F)
## Helper targets for running make from the top-level due to run's sis.o.
-%D%/%.o: %D%/%.c | %D%/libsim.a $(SIM_ALL_RECURSIVE_DEPS)
+%D%/main.o: %D%/%.o: %D%/%.c | %D%/libsim.a $(SIM_ALL_RECURSIVE_DEPS)
$(MAKE) $(AM_MAKEFLAGS) -C $(@D) $(@F)
noinst_PROGRAMS += %D%/run
@@ -43,5 +43,67 @@ noinst_PROGRAMS += %D%/run
$(AM_V_at)$(SHELL) $(srcroot)/move-if-change $@.tmp $(srcdir)/%D%/spreg.h
$(AM_V_at)touch $(srcdir)/%D%/spreg.h
+EXTRA_LIBRARIES += %D%/libigen.a
+%C%_libigen_a_SOURCES = \
+ %D%/table.c \
+ %D%/lf.c \
+ %D%/misc.c \
+ %D%/filter_host.c \
+ %D%/ld-decode.c \
+ %D%/ld-cache.c \
+ %D%/filter.c \
+ %D%/ld-insn.c \
+ %D%/gen-model.c \
+ %D%/gen-itable.c \
+ %D%/gen-icache.c \
+ %D%/gen-semantics.c \
+ %D%/gen-idecode.c \
+ %D%/gen-support.c
+
+%C%_igen_SOURCES = %D%/igen.c
+%C%_igen_LDADD = %D%/libigen.a
+
+PPC_IGEN = %D%/igen$(EXEEXT)
+
+SIM_ALL_RECURSIVE_DEPS += $(PPC_IGEN)
+
+## These rules are copied from automake, but tweaked to use FOR_BUILD variables.
+%D%/libigen.a: $(%C%_libigen_a_OBJECTS) $(%C%_libigen_a_DEPENDENCIES) $(EXTRA_%C%_libigen_a_DEPENDENCIES) %D%/$(am__dirstamp)
+ $(AM_V_at)-rm -f $@
+ $(AM_V_AR)$(AR_FOR_BUILD) $(ARFLAGS) $@ $(%C%_libigen_a_OBJECTS) $(%C%_libigen_a_LIBADD)
+ $(AM_V_at)$(RANLIB_FOR_BUILD) $@
+
+## igen is a build-time only tool. Override the default rules for it.
+%D%/igen$(EXEEXT): $(%C%_igen_OBJECTS) $(%C%_igen_DEPENDENCIES) %D%/$(am__dirstamp)
+ $(AM_V_CCLD)$(LINK_FOR_BUILD) $(%C%_igen_OBJECTS) $(%C%_igen_LDADD)
+
+$(%C%_libigen_a_OBJECTS) $(%C%_igen_OBJECTS): %D%/%.o: %D%/%.c
+ $(AM_V_CC)$(COMPILE_FOR_BUILD) -c $< -o $@
+
+## Build some of the files in standalone mode for developers of igen itself.
+%D%/%-main.o: %D%/%.c
+ $(AM_V_CC)$(COMPILE_FOR_BUILD) -DMAIN -c $< -o $@
+
+%C%_filter_SOURCES =
+%C%_filter_LDADD = %D%/filter-main.o %D%/libigen.a
+
+%C%_ld_cache_SOURCES =
+%C%_ld_cache_LDADD = %D%/ld-cache-main.o %D%/libigen.a
+
+%C%_ld_decode_SOURCES =
+%C%_ld_decode_LDADD = %D%/ld-decode-main.o %D%/libigen.a
+
+%C%_ld_insn_SOURCES =
+%C%_ld_insn_LDADD = %D%/ld-insn-main.o %D%/libigen.a
+
+%C%_IGEN_TOOLS = \
+ $(PPC_IGEN) \
+ %D%/filter \
+ %D%/ld-cache \
+ %D%/ld-decode \
+ %D%/ld-insn
+EXTRA_PROGRAMS += $(%C%_IGEN_TOOLS)
+MOSTLYCLEANFILES += $(%C%_IGEN_TOOLS) %D%/libigen.a
+
%C%docdir = $(docdir)/%C%
%C%doc_DATA = %D%/BUGS %D%/INSTALL %D%/README %D%/RUN