summaryrefslogtreecommitdiff
path: root/build-aux/no-builtin-variables.mk
diff options
context:
space:
mode:
authorLuke Shumaker <lukeshu@sbcglobal.net>2016-06-01 16:14:57 -0400
committerLuke Shumaker <lukeshu@sbcglobal.net>2016-06-01 16:14:57 -0400
commite32e227d140160b27405da8640c28a78c4756ef0 (patch)
tree65ca08cc6169b3fade8951a58759eaca6e8ab1d1 /build-aux/no-builtin-variables.mk
parenta8334ada043761e9e8ab29ae6d24d09a28688e6d (diff)
Be a little tougher with --no-builtin-variables
Diffstat (limited to 'build-aux/no-builtin-variables.mk')
-rw-r--r--build-aux/no-builtin-variables.mk15
1 files changed, 15 insertions, 0 deletions
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 ?=