[PATCH] honor CFLAGS & friends from environment

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

 



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
 
-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:
-- 
2.20.0




[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