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).] ATB, Ramsay Jones > > -DESTDIR= > +DESTDIR ?= > PREFIX ?= $(HOME) > -BINDIR=$(PREFIX)/bin > -MANDIR=$(PREFIX)/share/man > -MAN1DIR=$(MANDIR)/man1 > +BINDIR ?= $(PREFIX)/bin > +MANDIR ?= $(PREFIX)/share/man > +MAN1DIR ?= $(MANDIR)/man1 > > # Allow users to override build settings without dirtying their trees > # For debugging, put this in local.mk: >