While we remembered a configure-time CC, we didn't do the same for
other common user specified build variables, i.e. CPPFLAGS, CFLAGS,
and LDFLAGS. Fix that, and arrange for the user's values to come
last so that they can override the configuration values.
This matches expectations established by other tools, in particular
autoconf/automake, and avoids having to remember to specify overrides
to every invocation of make.
Signed-off-by: Rob Browning <rlb@defaultvalue.org>
Tested-by: Rob Browning <rlb@defaultvalue.org>
MAKEFLAGS += --warn-undefined-variables
MAKEFLAGS += --warn-undefined-variables
-OUTPUT_OPTION = -MMD -MP -o $@
SHELL := bash
.DEFAULT_GOAL := all
SHELL := bash
.DEFAULT_GOAL := all
os := $(shell ($(pf); uname | sed 's/[-_].*//') $(isok))
os := $(call shout,$(os),Unable to determine OS)
os := $(shell ($(pf); uname | sed 's/[-_].*//') $(isok))
os := $(call shout,$(os),Unable to determine OS)
+# CFLAGS CPPFLAGS LDFLAGS are handled vis config/config.vars.in
+
# Satisfy --warn-undefined-variables
# Satisfy --warn-undefined-variables
-bup_shared_cflags := -O2 -Wall -Werror -Wformat=2
+bup_shared_cflags := -O2 -Wall -Werror -Wformat=2 -MMD -MP
bup_shared_cflags := -Wno-unknown-pragmas -Wsign-compare $(bup_shared_cflags)
bup_shared_cflags := -D_FILE_OFFSET_BITS=64 $(bup_shared_cflags)
bup_shared_cflags := $(bup_config_cflags) $(bup_shared_cflags)
bup_shared_cflags := -Wno-unknown-pragmas -Wsign-compare $(bup_shared_cflags)
bup_shared_cflags := -D_FILE_OFFSET_BITS=64 $(bup_shared_cflags)
bup_shared_cflags := $(bup_config_cflags) $(bup_shared_cflags)
config/config.h: config/config.vars
clean_paths += config/config.h.tmp
config/config.h: config/config.vars
clean_paths += config/config.h.tmp
-cc_bin = $(CC) $(embed_cflags) $(CFLAGS) $^ $(embed_ldflags) $(LDFLAGS) -fPIE \
- -I src $(OUTPUT_OPTION)
+cc_bin = $(CC) $(embed_cflags) -I src $(CPPFLAGS) $(CFLAGS) $^ \
+ $(embed_ldflags) $(LDFLAGS) -fPIE -o $@
clean_paths += dev/python-proposed
generated_dependencies += dev/python-proposed.d
clean_paths += dev/python-proposed
generated_dependencies += dev/python-proposed.d
clean_paths += lib/bup/_helpers$(soext)
generated_dependencies += lib/bup/_helpers.d
lib/bup/_helpers$(soext): lib/bup/_helpers.c lib/bup/bupsplit.c
clean_paths += lib/bup/_helpers$(soext)
generated_dependencies += lib/bup/_helpers.d
lib/bup/_helpers$(soext): lib/bup/_helpers.c lib/bup/bupsplit.c
- $(CC) $(helpers_cflags) $(CFLAGS) $^ \
- $(helpers_ldflags) $(LDFLAGS) $(OUTPUT_OPTION)
+ $(CC) $(helpers_cflags) $(CPPFLAGS) $(CFLAGS) $^ \
+ $(helpers_ldflags) $(LDFLAGS) -o $@
`config/config.var/bup-python-config`, and you can change the
selection by re-running `./configure`.
`config/config.var/bup-python-config`, and you can change the
selection by re-running `./configure`.
+- If you want to specify your own `CPPFLAGS`, `CFLAGS`, or `LDFLAGS`,
+ you can set them for individual `make` invocations, e.g. `make
+ CFLAGS=-O0 check`, or persistently via `./configure` with
+ `CFLAGS=-O0 ./configure`. At the moment, `make clean` clears the
+ configuration, but we may change that at some point, perhaps by
+ adding and requiring a `make distclean` to clear the configuration.
+
From binary packages
--------------------
From binary packages
--------------------
GENERATED_FILES=@GENERATED_FILES@
CC = @CC@
GENERATED_FILES=@GENERATED_FILES@
CC = @CC@
+CFLAGS = @CFLAGS@
+CPPFLAGS = @CPPFLAGS@
+LDFLAGS = @LDFLAGS@
+
bup_config_cflags = @bup_config_cflags@
bup_make=@bup_make@
bup_config_cflags = @bup_config_cflags@
bup_make=@bup_make@