summaryrefslogtreecommitdiff
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
commit1c5a4e839cf68c45d7b2a15bd5f64290d2154118 (patch)
tree6066630b53060796a5f1eb610f2640ba6902c769
parentdd84a8ab8f67cbc94aa3a427693970dbf3797e23 (diff)
(systemd) Be a little tougher with --no-builtin-variables
-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 0000000..c3aef58
--- /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 ?=