summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorUwe Kleine-König <uwe@kleine-koenig.org>2019-02-12 20:33:50 +0100
committerLuc Van Oostenryck <luc.vanoostenryck@gmail.com>2019-02-17 17:54:46 +0100
commitf21358ee7ee79202fc026c151ffd8c5221bbce22 (patch)
treee95060368ca0546edbaee55f2ee3856881680807
parent582ec2e3c2209b95ca2153feb0c07535e06bfc31 (diff)
downloadsparse-f21358ee7ee79202fc026c151ffd8c5221bbce22.tar.gz
build: honor CFLAGS & friends from environment
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 and CHECKER_FLAGS. 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@kleine-koenig.org> Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
-rw-r--r--Makefile15
1 files changed, 9 insertions, 6 deletions
diff --git a/Makefile b/Makefile
index 113c488f..a1d86c52 100644
--- a/Makefile
+++ b/Makefile
@@ -6,16 +6,19 @@ OS = linux
CC = gcc
-CFLAGS = -O2 -g
LD = $(CC)
AR = ar
-PKG_CONFIG = pkg-config
-CHECKER_FLAGS = -Wno-vla
-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
+
+CHECKER_FLAGS ?= -Wno-vla
# Allow users to override build settings without dirtying their trees
# For debugging, put this in local.mk: