[coreboot] PATCH: fix for flashrom makefile when CFLAGS are specified on command line.

Clark Rawlins clark at bit63.org
Tue Feb 12 22:02:38 CET 2008


On Tue, 2008-02-12 at 21:22 +0100, Uwe Hermann wrote:
> On Tue, Feb 12, 2008 at 02:37:37PM -0500, Clark Rawlins wrote:
> > With this small change it is possible to build flashrom again when
> > specifying custom CFLAGS from the make command line like:
> > 
> > make CFLAGS="..."
> > 
> > I need to do this when building flashrom in a cross compiler environment
> > like buildroot for a foreign target. 
> > 
> > Signed-of-by: Clark Rawlins <clark at bit63.org>
> > 
> > Please guide me if I have not completed all the required steps or if my
> > patch isn't quite ready.
> 
> Untested yet, but looks good to me. Can you post another patch which
> also does the same for LDFLAGS etc. while we're at it?

I am not sure that LDFLAGS needs the same treatment.
CFLAGS for flashrom.c at least is broken because flashrom.c uses the
FLASHROM_VERSION define to print a message to the user.  I doubt that
anyone who is building flashrom should really be changing the
FLASHROM_VERSION define without confusing the end user and anyone
supporting it.

On the LDFLAGS could be overridden for a number of reasons in a cross
compiler environment depending on how and where the libraries that are
being linked in are located.

Here is a second attempt to fix the problem in a more precise way.
This patch doesn't define FLASHROM_VERSION for every .o target, it only
adds the SVNDEF to the compiler options for flashrom.o.

Is this better?

Signed-of-by: Clark Rawlins <clark at bit63.org>

> 
> 
> > Index: Makefile
> > ===================================================================
> > --- Makefile	(revision 3101)
> > +++ Makefile	(working copy)
> > @@ -32,7 +32,7 @@
> >  # of the checked out flashrom files.
> >  SVNDEF := -D'FLASHROM_VERSION="$(shell svnversion -cn . \
> >            | sed -e "s/.*://" -e "s/\([0-9]*\).*/\1/")"'
> > -CFLAGS += $(SVNDEF)
> > +FLASHROM_CFLAGS = $(CFLAGS) $(SVNDEF)
> >  
> >  $(PROGRAM): $(OBJS)
> >  	$(CC) -o $(PROGRAM) $(OBJS) $(LDFLAGS)
> > @@ -69,3 +69,5 @@
> >  
> >  -include .dependencies
> >  
> > +%.o : %.c
> > +	$(CC) -c $(FLASHROM_CFLAGS) $(CPPFLAGS) $< -o $@
> 
> 
> Thanks, Uwe.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: makefile-cflags.diff
Type: text/x-patch
Size: 521 bytes
Desc: not available
URL: <http://www.coreboot.org/pipermail/coreboot/attachments/20080212/b113cc75/attachment.diff>


More information about the coreboot mailing list