Re: [PATCH] honor CFLAGS & friends from environment

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, Feb 15, 2019 at 01:42:53AM +0000, Ramsay Jones wrote:
> 
> 
> On 14/02/2019 23:34, Luc Van Oostenryck wrote:
> > From: Uwe Kleine-König <uwe@xxxxxxxxxxxxxxxxx>
> > 
> > Debian build scripts pass CFLAGS in the environment.
> > However, this is ignored by Sparse's Makefile since 'CFLAGS'
> > is unconditionaly initialized.
> > 
> > Fix this by initializing CFLAGS to their default value using '?='.
> > Do the same for PKG_CONFIG, CHECKER, CHECKER_FLAGS and
> > DESTDIR, BINDIR, MANDIR & MAN1DIR.
> > 
> > Note: It's useless to try to do the same for CC, LD & AR since
> >       they're builtin variables so '?= ...' is a no-op for them
> >       (unless make is called with -R).
> > 
> > Note: This makes sparse native builds reproducible for Debian.
> > 
> > Signed-off-by: Uwe Kleine-König <uwe@xxxxxxxxxxxxxxxxx>
> > Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@xxxxxxxxx>
> > ---
> >  Makefile | 17 ++++++++---------
> >  1 file changed, 8 insertions(+), 9 deletions(-)
> > 
> > diff --git a/Makefile b/Makefile
> > index bd2b089f3..2d72be9e2 100644
> > --- a/Makefile
> > +++ b/Makefile
> > @@ -6,19 +6,18 @@ OS = linux
> >  
> >  
> >  CC = gcc
> > -CFLAGS = -O2 -g
> > -CFLAGS += -Wall -Wwrite-strings
> > +CFLAGS ?= -O2 -g -Wall -Wwrite-strings
> >  LD = $(CC)
> >  AR = ar
> > -PKG_CONFIG = pkg-config
> > -CHECKER = CHECK=./sparse ./cgcc -no-compile
> > -CHECKER_FLAGS = -Wno-vla
> > +PKG_CONFIG ?= pkg-config
> > +CHECKER ?= CHECK=./sparse ./cgcc -no-compile
> > +CHECKER_FLAGS ?= -Wno-vla
> 
> Hmm, I don't think CHECKER and CHECKER_FLAGS should be
> included here. These are, to my mind anyway, internal
> to the makefile and should not be settable from the
> environment.
> 
> Everything else looks OK. ;-)
> 
> [Uwe - in an earlier email you said the you had 'other
> patches applied' (including setting CC=gcc-8 and LDFLAGS).
> An obvious question would be: What patches and why? :-D
> (I assume it has something to do with 'packaging', but
> the question remains).]

I use CC = gcc-8 for the debian package because other it can happen (and
it actually did) that /usr/bin/gcc was updated from gcc-X to gcc-(X+1)
and then sparse started to fail because it still used
/usr/lib/gcc/x86_64-linux-gnu/X/ (i.e. the output of

	gcc --print-file-name=

) which disappeard as it changes on major version bumps.

So sparse depends explicitly on the current gcc version and uses this.

The LDFLAGS change isn't strictly Debian specific, upstream could maybe
benefit here, too. See

	https://sources.debian.org/src/sparse/0.6.0-3/debian/patches/ld-as-needed.patch/

for the actual change.

Best regards
Uwe

Attachment: signature.asc
Description: PGP signature


[Index of Archives]     [Newbies FAQ]     [LKML]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Trinity Fuzzer Tool]

  Powered by Linux