diff options
author | Luke Shumaker <lukeshu@sbcglobal.net> | 2016-06-01 16:14:57 -0400 |
---|---|---|
committer | Luke Shumaker <lukeshu@sbcglobal.net> | 2016-06-01 16:14:57 -0400 |
commit | e32e227d140160b27405da8640c28a78c4756ef0 (patch) | |
tree | 65ca08cc6169b3fade8951a58759eaca6e8ab1d1 | |
parent | a8334ada043761e9e8ab29ae6d24d09a28688e6d (diff) |
Be a little tougher with --no-builtin-variables
-rw-r--r-- | .gitignore | 1 | ||||
-rw-r--r-- | build-aux/no-builtin-variables.mk | 15 | ||||
-rw-r--r-- | config.mk.in | 3 |
3 files changed, 18 insertions, 1 deletions
diff --git a/.gitignore b/.gitignore index 50a65d2dfe..590482ceab 100644 --- a/.gitignore +++ b/.gitignore @@ -30,6 +30,7 @@ /build-aux/* !/build-aux/Makefile* !/build-aux/write-ifchanged +!/build-aux/no-builtin-variables.mk /busctl /cdrom_id /collect diff --git a/build-aux/no-builtin-variables.mk b/build-aux/no-builtin-variables.mk new file mode 100644 index 0000000000..c3aef5874f --- /dev/null +++ b/build-aux/no-builtin-variables.mk @@ -0,0 +1,15 @@ +MAKEFLAGS += --no-builtin-variables + +# This version is more correct, but is slower: +# $(foreach v,$(shell bash -c 'comm -23 <(env -i $(MAKE) -f - <<<"\$$(info \$$(.VARIABLES))all:"|sed "s/ /\n/g"|sort) <(env -i $(MAKE) -R -f - <<<"\$$(info \$$(.VARIABLES))all:"|sed "s/ /\n/g"|sort)'), +# $(if $(filter default,$(origin $v)),$(eval undefine $v))) + +_default_variables = $(foreach v,$(.VARIABLES),$(if $(filter default,$(origin $v)),$v)) +$(foreach v,$(filter-out .% MAKE% SUFFIXES,$(_default_variables))\ + $(filter .LIBPATTERNS MAKEINFO,$(_default_variables)),\ + $(eval undefine $v)) +undefine _default_variables + +# Because Make uses .LIBPATTERNS internally, it should always be +# defined in case --warn-undefined-variables +.LIBPATTERNS ?= diff --git a/config.mk.in b/config.mk.in index 4f19139e75..5033d634cb 100644 --- a/config.mk.in +++ b/config.mk.in @@ -23,7 +23,8 @@ ifeq ($(topsrcdir),) -MAKEFLAGS += --no-builtin-rules --no-builtin-variables --warn-undefined-variables +MAKEFLAGS += --warn-undefined-variables +include $(topsrcdir)/build-aux/no-builtin-variables.mk .LIBPATTERNS = lib%.so lib%.a topoutdir := $(patsubst %/,%,$(dir $(lastword $(MAKEFILE_LIST)))) |