On Mon, Jan 6, 2014 at 6:33 PM, Patrick Palka <patr...@parcs.ath.cx> wrote: > Hi, > > The following tiny patch allows GCC to be built with the > "--no-builtin-rules" GNU make flag. It replaces two usages of the > automatic variable $* within the body of an explicit rule. Using $* > inside the body of an explicit rule should be avoided[0] and, as in > this scenario, may break an otherwise fine Makefile under the > --no-builtin-rules flag. > > From what I inferred from the make manual[0], $* is functionally > equivalent to $(basename $@) in this case. This patch therefore > replaces $* with $(basename $@). I tested this patch by successfully > performing a 3-stage bootstrap and a non-bootstrap build with and > without the --no-builtin-rules flag. Without the patch, the build > would fail during the compilation of libgcc/morestack.S under the > --no-builtin-rules flag. > > This patch is interesting because the --no-builtin-rules flag may > significantly shorten rebuild times. For example, on my machine an > idempotent rebuild of the (non-bootstrapped) compiler takes 2s with > the flag versus 2.6s without. Similarly, a rebuild after changing a > single source file takes 20s versus 22s. This patch lets you > seamlessly build and rebuild the compiler under the --no-builtin-rules > flag without having to worry about possible build errors. > > [0]: > http://www.gnu.org/software/make/manual/html_node/Automatic-Variables.html#Automatic-Variables
Oops, forgot the patch: --- a/libgcc/ChangeLog +++ b/libgcc/ChangeLog @@ -1,3 +1,8 @@ +2014-01-06 Patrick Palka <patr...@parcs.ath.cx> + + * shared-object.mk ($(base)$(objext)): Don't use $*. + * static-object.mk ($(base)$(objext)): Likewise. + 2014-01-02 Joseph Myers <jos...@codesourcery.com> * config/rs6000/ibm-ldouble.c (__gcc_qdiv): Scale up arguments in diff --git a/libgcc/shared-object.mk b/libgcc/shared-object.mk index d9ee922..adbd165 100644 --- a/libgcc/shared-object.mk +++ b/libgcc/shared-object.mk @@ -25,7 +25,7 @@ endif endif $(base)$(objext): $o $(base).vis - $(gcc_compile) -c -xassembler-with-cpp -include $*.vis $< + $(gcc_compile) -c -xassembler-with-cpp -include $(basename $@).vis $< $(base).vis: $(base)_s$(objext) $(gen-hide-list) diff --git a/libgcc/static-object.mk b/libgcc/static-object.mk index 4f53636..19c3006 100644 --- a/libgcc/static-object.mk +++ b/libgcc/static-object.mk @@ -25,7 +25,7 @@ endif endif $(base)$(objext): $o $(base).vis - $(gcc_compile) -c -xassembler-with-cpp -include $*.vis $< + $(gcc_compile) -c -xassembler-with-cpp -include $(basename $@).vis $< $(base).vis: $(base)_s$(objext) $(gen-hide-list)