[coreboot] build optimization

Ronald Hoogenboom ronald at zonnet.nl
Thu Apr 2 22:48:52 CEST 2009

On Wed, 2009-04-01 at 18:56 -0700, Russell Whitaker wrote:
> On Wed, 1 Apr 2009, Ward Vandewege wrote:
> > On Wed, Apr 01, 2009 at 04:45:44PM -0700, ron minnich wrote:
> >> On Wed, Apr 1, 2009 at 4:42 PM, Corey Osgood <corey.osgood at gmail.com> wrote:
> >>> I think you're missing part of the patch, there should be a settings.h
> >>> included, right?
> >>
> >> no,that is generated by the >> in the patch.
> >>
> >> I kind of like this. But, if the python is run twice, do you get the
> >> file twice as large? There's no "zero out the file" step from what i
> >> can see.
> >
> > Hmm. Seems like replacing the >> by > should fix that.
> >
> I suspect the patch should look something like:
> +	file.write('/* autogenerated */' > settings.h)\n")
> +	file.write("D_item = $(shell echo '$(if $(subst undefined,,$(origin $1)),\\#define $1$(if $($1), $($1),),\\#undef $1)' >> settings.h)\n\n")
> +	file.write("CPUFLAGS := $(strip $(foreach _var_,$(VARIABLES),$(call D_item,$(_var_)))--include=settings.h)\n\n")
> Now the first line forces a new copy and (if I didn't goof it up) the 2nd
> and 3rd lines can add multiple lines to settings.h
> Perhaps the nest step would be to combine the 2nd & 3rd lines.
>     Russ
Hi guys,

The original patch has all of that already. Please test it before

The settings.h is generated from scratch each time the Makefile is read,
because each time the CPUFLAGS will be set to its value (it's a simply
expanded variable!, see 'info make'). The first $(shell echo...) will
truncate the file (or create an new one) and put the 'autogenerated'
line in. The subsequent echo's in the D_item macro will append #define
lines to that file. These $(shell ) functions will only contribute
whitespace to the CPUFLAGS variable, because of the redirection. The
whitespace is later stripped off by the strip function.


More information about the coreboot mailing list