Rombobjörn

summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--comfignat.mk27
1 files changed, 14 insertions, 13 deletions
diff --git a/comfignat.mk b/comfignat.mk
index ce19784..e90c9fb 100644
--- a/comfignat.mk
+++ b/comfignat.mk
@@ -40,7 +40,7 @@ GNAT_BUILDER ?= gprbuild
# value of GNATFLAGS compatible with Gnatmake. Otherwise make it suitable for
# building multi-language projects with GPRbuild.
GNATFLAGS ?= ${if ${findstring gnatmake, \
- ${notdir ${call mung,${GNAT_BUILDER}}}}, \
+ ${notdir ${call mung_string,${GNAT_BUILDER}}}}, \
${GNAT_BUILDER_FLAGS} \
-cargs ${ADAFLAGS} \
-bargs ${GNATBINDFLAGS} \
@@ -237,12 +237,12 @@ build_GPR = "${GNAT_BUILDER}" -P ${firstword ${filter %.gpr,$^}} -p \
#
nil =
-space_sub = _Comfignat_magic_protective_space_character_substitute_
-percent_sub = _Comfignat_magic_protective_percent_character_substitute_
-mung = ${subst %,${percent_sub},${subst ${nil} ,${space_sub},${1}}}
-unmung = ${subst ${percent_sub},%,${subst ${space_sub}, ,${1}}}
-# mung and unmung are used to prevent Make from interpreting space and percent
-# characters in strings.
+inert_space = _Comfignat_magic_protective_space_character_substitute_
+inert_percent = _Comfignat_magic_protective_percent_character_substitute_
+mung_string = ${subst %,${inert_percent},${subst ${nil} ,${inert_space},${1}}}
+unmung_string = ${subst ${inert_percent},%,${subst ${inert_space}, ,${1}}}
+# mung_string and unmung_string are used to prevent Make from interpreting
+# space and percent characters in strings.
relativize = ${if ${filter ${2}%,${1}}, \
${3}${1:${2}%=%}, \
@@ -260,24 +260,25 @@ relativize = ${if ${filter ${2}%,${1}}, \
# directory names will match. Otherwise "/usr/lib" could match "/usr/lib64" for
# example.
-prep = ${subst //,/,${abspath ${call mung,${1}}}/}
-# prep prepares a pathname for use as a parameter to relativize.
+prepare_pathname = ${subst //,/,${abspath ${call mung_string,${1}}}/}
+# prepare_pathname prepares a pathname for use as a parameter to relativize.
# · Protect space and percent characters from interpretation by Make.
# · Normalize the pathname, eliminating ".", ".." and "//".
# · Append a slash.
# · If the input was "/", then it is now "//". Change that back to "/".
relative_to = \
- ${or ${call unmung,${patsubst %/,%,${call relativize \
- ,${call prep,${1}} \
- ,${call prep,${2}},}}},.}
+ ${or ${call unmung_string \
+ ,${patsubst %/,%,${call relativize \
+ ,${call prepare_pathname,${1}} \
+ ,${call prepare_pathname,${2}},}}},.}
# relative_to converts an absolute pathname into a relative one. What it
# actually does is to prepare the input to relativize and fix up its output.
# Parameters:
# 1: an absolute pathname to convert to relative
# 2: the absolute base pathname that 1 shall be made relative to
# Processing:
-# · Prepare the two input pathnames with prep.
+# · Prepare the two input pathnames with prepare_pathname.
# · Call relativize with the prepared pathnames for parameters 1 and 2, and
# an empty string for 3.
# · Strip the result of surrounding spaces and the trailing slash.