Rombobjörn

summaryrefslogtreecommitdiff
path: root/comfignat.mk
diff options
context:
space:
mode:
authorBjörn Persson <Bjorn@Rombobjörn.se>2014-02-23 15:26:27 +0100
committerBjörn Persson <Bjorn@Rombobjörn.se>2014-02-23 15:26:27 +0100
commitb9d89b95bbb1a89842cd9a285390a265157c6779 (patch)
treee86541319092824871a8da833e68194ea594b0f1 /comfignat.mk
parenta0143d6c228c01a355687b0a821847defb1ba9e6 (diff)
Improved the error when an option is undefined.
Diffstat (limited to 'comfignat.mk')
-rw-r--r--comfignat.mk41
1 files changed, 23 insertions, 18 deletions
diff --git a/comfignat.mk b/comfignat.mk
index bfe60ba..be030f0 100644
--- a/comfignat.mk
+++ b/comfignat.mk
@@ -424,21 +424,28 @@ usage_relevant = ${filter ${usage_directory_variables},${1}}
# relevant directory variables. If given a single variable name, it returns
# that name if the variable is usage-relevant, or an empty string if it isn't.
-maybe_relative_to = \
- ${if ${or ${filter-out 1,${words ${relocatable_package}}}, \
- ${filter-out true false,${relocatable_package}}}, \
- ${error relocatable_package must be "true" or "false"} \
- ,${if ${filter true,${relocatable_package}} \
- ,${call relative_to,${1},${2}},${1}}}
+checked_boolean = ${or ${and ${filter 1,${words ${${1}}}}, \
+ ${filter true false,${${1}}}}, \
+ ${error ${1} must be "true" or "false"}}
+# checked_boolean takes the name of a variable and checks that its value is a
+# single word, and that that word is either "true" or "false". If so it returns
+# the value; otherwise it complains and stops the execution.
+
+checked_true = ${filter true,${call checked_boolean,${1}}}
+# checked_true takes the name of a variable and checks that it has a boolean
+# value. It then returns an empty string for "false" or a non-empty string for
+# "true".
+
+maybe_relative_to = ${if ${call checked_true,relocatable_package} \
+ ,${call relative_to,${1},${2}},${1}}
# maybe_relative_to converts an absolute pathname into a relative one if a
# relocatable package is desired.
# Parameters:
# 1: an absolute pathname to maybe convert to relative
# 2: the absolute base pathname that 1 may be made relative to
-# First check that the value of relocatable_package is a single word and that
-# that word is either "true" or "false". Complain and stop if that isn't so.
-# Then, if relocatable_package is "true", let relative_to convert the pathname,
+# If relocatable_package is "true", then let relative_to convert the pathname,
# otherwise return parameter 1 unchanged.
+# It is checked that relocatable_package has a boolean value.
embed_pathname = ${call maybe_relative_to,${${1}},${if ${filter bindir,${1}} \
,${libexecdir},${bindir}}}
@@ -541,15 +548,13 @@ ${eval ${foreach var,${builder_directory_variables}, \
option_values = \
${foreach option,${options}, \
- ${if ${and ${filter-out environment,${origin ${option}}}, \
- ${filter 1,${words ${${option}}}}, \
- ${filter true false,${${option}}}}, \
- ${option}=${${option}}, \
- ${error ${option} must be "true" or "false"}}}
-# For each variable listed in options, check that it didn't come from the
-# environment (to prevent accidents), that its value is a single word, and that
-# that word is either "true" or "false". If so, output a name/value pair;
-# otherwise complain and stop.
+ ${if ${filter-out undefined environment,${origin ${option}}}, \
+ ${option}=${call checked_boolean,${option}}, \
+ ${error ${option} has no default value and must be set to \
+ "true" or "false" on the command line}}}
+# For each variable listed in options, check that it exists, that it didn't
+# come from the environment (to prevent accidents), and that it has a boolean
+# value. If so, output a name/value pair; otherwise complain and stop.
# Convey boolean options to Gnatprep.
options_preprocessing = ${addprefix -D,${option_values}}