[PATCH v3 4/4] build: 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 its default value using '?='.
Do the same for PKG_CONFIG, DESTDIR, BINDIR & MANDIR.

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 | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/Makefile b/Makefile
index fce74a096..9c0691467 100644
--- a/Makefile
+++ b/Makefile
@@ -6,15 +6,17 @@ OS = linux
 
 
 CC = gcc
-CFLAGS = -O2 -g
 LD = $(CC)
 AR = ar
-PKG_CONFIG = pkg-config
 
-DESTDIR=
+CFLAGS ?= -O2 -g
+
+DESTDIR ?=
 PREFIX ?= $(HOME)
-BINDIR=$(PREFIX)/bin
-MANDIR=$(PREFIX)/share/man
+BINDIR ?= $(PREFIX)/bin
+MANDIR ?= $(PREFIX)/share/man
+
+PKG_CONFIG ?= pkg-config
 
 # 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