From c6c7769d9dd166c45bd9d422e91ca537752c0382 Mon Sep 17 00:00:00 2001 From: Mike Frysinger Date: Mon, 8 Mar 2021 01:41:35 -0500 Subject: sim: introduce {COMPILE,LINK}_FOR_BUILD These use the same pattern as seen in the opcodes/ dir and in automake in general (ish). This helps simplify the boilerplate for building and linking build-time code, and fixes some inconsistency in flag usage. For rules that were compiling+linking in a single step, split them into separate steps so we can apply the correct set of options. This matches automake behavior too. --- sim/ppc/ChangeLog | 7 +++++++ sim/ppc/Makefile.in | 51 +++++++++++++++++++++++++++------------------------ 2 files changed, 34 insertions(+), 24 deletions(-) (limited to 'sim/ppc') diff --git a/sim/ppc/ChangeLog b/sim/ppc/ChangeLog index 4dd82e1..61bb3d9 100644 --- a/sim/ppc/ChangeLog +++ b/sim/ppc/ChangeLog @@ -1,3 +1,10 @@ +2021-03-13 Mike Frysinger + + * Makefile.in (COMPILE_FOR_BUILD, LINK_FOR_BUILD): Define. + Change $(CC_FOR_BUILD) $(BUILD_CFLAGS) $(BUILD_LDFLAGS) to + $(LINK_FOR_BUILD). Change $(CC_FOR_BUILD) $(BUILD_CFLAGS) to + $(COMPILE_FOR_BUILD). + 2021-03-08 Mike Frysinger * Makefile.in (gentmap, dgen, igen, tmp-filter, tmp-ld-decode, diff --git a/sim/ppc/Makefile.in b/sim/ppc/Makefile.in index 3ff8ced..8c58635 100644 --- a/sim/ppc/Makefile.in +++ b/sim/ppc/Makefile.in @@ -110,6 +110,9 @@ BUILD_CFLAGS = $(CFLAGS_FOR_BUILD) $(INCLUDES) $(WARNING_CFLAGS) BUILD_LDFLAGS = LIBS = @LIBS@ +COMPILE_FOR_BUILD = $(CC_FOR_BUILD) $(BUILD_CFLAGS) +LINK_FOR_BUILD = $(CC_FOR_BUILD) $(BUILD_CFLAGS) $(BUILD_LDFLAGS) -o $@ + CONFIG_FILE = @sim_config@ IGEN_OPCODE_RULES = @sim_opcode@ IGEN_DECODE_MECHANISM = @sim_decode_mechanism@ @@ -618,8 +621,8 @@ mon.o: mon.c $(BASICS_H) $(CPU_H) $(MON_H) # GDB after 4.16 expects the default_callback structure to be setup. # As a kludge, build the common stuff here for now. gentmap: $(srcdir)/../common/gentmap.c Makefile targ-vals.def - $(CC_FOR_BUILD) $(BUILD_CFLAGS) -I. -I../common -I$(srcdir)/../common \ - -o gentmap $(srcdir)/../common/gentmap.c + $(LINK_FOR_BUILD) -I. -I../common -I$(srcdir)/../common \ + $(srcdir)/../common/gentmap.c targ-vals.def: $(srcdir)/../common/nltvals.def rm -f targ-vals.def tmp-def @@ -709,69 +712,69 @@ itable.h itable.c icache.h icache.c idecode.h idecode.c semantics.h semantics.c spreg.h spreg.c: tmp-dgen dgen: dgen.o table.o lf.o misc.o filter_host.o - $(CC_FOR_BUILD) $(BUILD_CFLAGS) -o dgen dgen.o table.o lf.o misc.o filter_host.o + $(LINK_FOR_BUILD) dgen.o table.o lf.o misc.o filter_host.o 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 - $(CC_FOR_BUILD) $(BUILD_CFLAGS) $(BUILD_LDFLAGS) -o 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 + $(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.c: filter_filename.c cat $(srcdir)/filter_filename.c > filter_host.c filter_host.o: filter_host.c $(CONFIG_H) $(PPC_CONFIG_H) $(FILTER_FILENAME_H) - $(CC_FOR_BUILD) $(BUILD_CFLAGS) -c filter_host.c + $(COMPILE_FOR_BUILD) -c filter_host.c table.o: table.c $(CONFIG_H) $(MISC_H) $(LF_H) $(TABLE_H) - $(CC_FOR_BUILD) $(BUILD_CFLAGS) -c $(srcdir)/table.c + $(COMPILE_FOR_BUILD) -c $(srcdir)/table.c lf.o: lf.c $(CONFIG_H) $(MISC_H) $(LF_H) - $(CC_FOR_BUILD) $(BUILD_CFLAGS) -c $(srcdir)/lf.c + $(COMPILE_FOR_BUILD) -c $(srcdir)/lf.c filter.o: filter.c $(CONFIG_H) $(MISC_H) $(FILTER_H) - $(CC_FOR_BUILD) $(BUILD_CFLAGS) -c $(srcdir)/filter.c + $(COMPILE_FOR_BUILD) -c $(srcdir)/filter.c tmp-filter: filter.c $(MISC_H) misc.o - $(CC_FOR_BUILD) $(BUILD_CFLAGS) $(BUILD_LDFLAGS) -o tmp-filter -DMAIN $(srcdir)/filter.c misc.o + $(LINK_FOR_BUILD) -DMAIN $(srcdir)/filter.c misc.o ld-decode.o: ld-decode.c $(MISC_H) $(LF_H) $(TABLE_H) $(LD_DECODE_H) - $(CC_FOR_BUILD) $(BUILD_CFLAGS) -c $(srcdir)/ld-decode.c + $(COMPILE_FOR_BUILD) -c $(srcdir)/ld-decode.c tmp-ld-decode: ld-decode.c misc.o lf.o table.o filter_host.o - $(CC_FOR_BUILD) $(BUILD_CFLAGS) $(BUILD_LDFLAGS) -o tmp-ld-decode -DMAIN $(srcdir)/ld-decode.c misc.o lf.o table.o filter_host.o + $(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) - $(CC_FOR_BUILD) $(BUILD_CFLAGS) -c $(srcdir)/ld-cache.c + $(COMPILE_FOR_BUILD) -c $(srcdir)/ld-cache.c tmp-ld-cache: ld-cache.c misc.o lf.o table.o filter_host.o - $(CC_FOR_BUILD) $(BUILD_CFLAGS) $(BUILD_LDFLAGS) -o tmp-ld-cache -DMAIN $(srcdir)/ld-cache.c misc.o lf.o table.o filter_host.o + $(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) - $(CC_FOR_BUILD) $(BUILD_CFLAGS) -c $(srcdir)/ld-insn.c + $(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 - $(CC_FOR_BUILD) $(BUILD_CFLAGS) $(BUILD_LDFLAGS) -o tmp-ld-insn -DMAIN $(srcdir)/ld-insn.c ld-cache.o misc.o lf.o table.o ld-decode.o filter_host.o filter.o + $(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) - $(CC_FOR_BUILD) $(BUILD_CFLAGS) -c $(srcdir)/gen-model.c + $(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) - $(CC_FOR_BUILD) $(BUILD_CFLAGS) -c $(srcdir)/gen-itable.c + $(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) - $(CC_FOR_BUILD) $(BUILD_CFLAGS) -c $(srcdir)/gen-icache.c + $(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) - $(CC_FOR_BUILD) $(BUILD_CFLAGS) -c $(srcdir)/gen-semantics.c + $(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) - $(CC_FOR_BUILD) $(BUILD_CFLAGS) -c $(srcdir)/gen-idecode.c + $(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) - $(CC_FOR_BUILD) $(BUILD_CFLAGS) -c $(srcdir)/gen-support.c + $(COMPILE_FOR_BUILD) -c $(srcdir)/gen-support.c dgen.o: dgen.c $(CONFIG_H) $(MISC_H) $(LF_H) $(TABLE_H) - $(CC_FOR_BUILD) $(BUILD_CFLAGS) -c $(srcdir)/dgen.c + $(COMPILE_FOR_BUILD) -c $(srcdir)/dgen.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) - $(CC_FOR_BUILD) $(BUILD_CFLAGS) -c $(srcdir)/igen.c + $(COMPILE_FOR_BUILD) -c $(srcdir)/igen.c misc.o: misc.c $(CONFIG_H) $(MISC_H) - $(CC_FOR_BUILD) $(BUILD_CFLAGS) -c $(srcdir)/misc.c + $(COMPILE_FOR_BUILD) -c $(srcdir)/misc.c -- cgit v1.1