Skip to content
This repository was archived by the owner on May 21, 2019. It is now read-only.

Commit 1d16fde

Browse files
committed
make: Add CheckCommandLineOverrides to my little Makefile library, a routine for
validating the variables set on the make command line. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@116517 91177308-0d34-0410-b5e6-96231b3b80d8
1 parent 8dd2433 commit 1d16fde

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

make/util.mk

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,17 @@ AssertEqual = \
8888
$(if $(call streq,$($(1)),$(2)),,\
8989
$(error Assertion failed: $(1): $(value $(1)) - $($(1)) != $(2)))
9090

91+
# Function: CheckCommandLineOverrides list
92+
#
93+
# Check that all command line variables are in the given list. This routine is
94+
# useful for validating that users aren't trying to override something which
95+
# will not work.
96+
CheckCommandLineOverrides = \
97+
$(foreach arg,$(MAKEOVERRIDES),\
98+
$(call Set,varname,$(firstword $(subst =, ,$(arg)))) \
99+
$(if $(call contains,$(1),$(varname)),,\
100+
$(error "Invalid command line override: $(1) $(varname) (not supported)")))
101+
91102
###
92103
# Clean up make behavior
93104

0 commit comments

Comments
 (0)