On Tue, May 25, 2010 at 5:06 PM, Paolo Bonzini <bonz...@gnu.org> wrote: > On Tue, May 25, 2010 at 16:59, Andreas Schwab <sch...@redhat.com> wrote: >> Steven Bosscher <stevenb....@gmail.com> writes: >> >>> So I guess this plan of mine is not going to work... >>> Other ideas? >> >> Add $(CFLAGS-$(@F)) to the .c.o rule > > Actually $@ is fine, since you want cp/tree.o to have different flags > from tree.o. > >> and define CFLAGS-foo for each foo >> in $(ALL_HOST_FRONTEND_OBJS). Though the latter is a bit tricky if you >> want to do it automatically. > > That would be something like > > $(foreach file,$(ALL_HOST_FRONTEND_OBJS),$(eval CFLAGS-$(file) += ...)) > > (All on one line, no spaces after commas!)
OK, the patch at the end of this mail appears to do what I've been trying to achieve. Does it look correct, and acceptable for the trunk after proper testing? Ciao! Steven Index: Makefile.in =================================================================== --- Makefile.in (revision 159900) +++ Makefile.in (working copy) @@ -1048,7 +1048,7 @@ $(PPLINC) $(CLOOGINC) $(LIBELFINC) .c.o: - $(COMPILER) -c $(ALL_COMPILERFLAGS) $(ALL_CPPFLAGS) $< $(OUTPUT_OPTION) + $(COMPILER) -c $(ALL_COMPILERFLAGS) $(CFLAGS-$@) $(ALL_CPPFLAGS) $< $(OUTPUT_OPTION) # # Support for additional languages (other than C). @@ -1445,15 +1445,26 @@ OBJS-onestep = libbackend.o $(OBJS-archive) -# This lists all host object files, whether they are included in this -# compilation or not. -ALL_HOST_OBJS = $(GCC_OBJS) $(C_OBJS) $(OBJS) libbackend.o \ +# This lists all host objects for the front ends. +ALL_HOST_FRONTEND_OBJS = $(C_OBJS) \ + $(foreach v,$(CONFIG_LANGUAGES),$($(v)_OBJS)) + +# Signal that these files are front-end objects. This causes extra symbols +# to be poisoned: Things no front end should ever look at, like RTL. +$(foreach file,$(ALL_HOST_FRONTEND_OBJS),$(eval CFLAGS-$(file) += -DIN_GCC_FRONTEND)) + +# FIXME: c-common.c still includes expr.h +CFLAGS-c-common.o = + +ALL_HOST_BACKEND_OBJS = $(GCC_OBJS) $(OBJS) libbackend.o \ @TREEBROWSER@ main.o gccspec.o version.o intl.o prefix.o cppspec.o \ - $(foreach v,$(CONFIG_LANGUAGES),$($(v)_OBJS)) \ - $(COLLECT2_OBJS) $(EXTRA_GCC_OBJS) \ - mips-tfile.o mips-tdump.o \ + $(COLLECT2_OBJS) $(EXTRA_GCC_OBJS) mips-tfile.o mips-tdump.o \ $(GCOV_OBJS) $(GCOV_DUMP_OBJS) +# This lists all host object files, whether they are included in this +# compilation or not. +ALL_HOST_OBJS = $(ALL_HOST_FRONTEND_OBJS) $(ALL_HOST_BACKEND_OBJS) + BACKEND = main.o @TREEBROWSER@ libbackend.a $(CPPLIB) $(LIBDECNUMBER) MOSTLYCLEANFILES = insn-flags.h insn-config.h insn-codes.h \ Index: system.h =================================================================== --- system.h (revision 159900) +++ system.h (working copy) @@ -789,6 +789,10 @@ VA_FIXEDARG VA_CLOSE VA_START #endif /* IN_GCC */ +#if defined(IN_GCC_FRONTEND) +#pragma GCC poison GCC_RTL_H +#endif + /* Note: not all uses of the `index' token (e.g. variable names and structure members) have been eliminated. */ #undef bcopy