diff options
author | rillig <rillig@pkgsrc.org> | 2020-03-20 16:39:03 +0000 |
---|---|---|
committer | rillig <rillig@pkgsrc.org> | 2020-03-20 16:39:03 +0000 |
commit | 72db9b0fff481fcda50e3d12cc0cda2c02835d07 (patch) | |
tree | f32671533e6075d5f850535d70dcf68f5eeb4de4 /mk | |
parent | 52aa54f18992bc0425e7a724e7d34b73ee3a726c (diff) | |
download | pkgsrc-72db9b0fff481fcda50e3d12cc0cda2c02835d07.tar.gz |
show-all: fix output for list variables containing dollar characters
Before, variables containing dollar characters displayed so wrong that it
was hard to explain.
To fix the problem, I typed almost random characters into the code until
the output was exactly as expected. I still do not understand:
* why the list variables need 8 dollars to survive the @x@ loop,
* why the code only works if the dollars come from an external variable
instead of being written inline,
* why the backslash in the :C modifier needs to be doubled.
Anyway, the output of "bmake show-all-extract" now contains the shell
variable $${extract_file}, just as it should. The dollars are now doubled
in the output and thereby match the source code from the Makefile
exactly.
Diffstat (limited to 'mk')
-rw-r--r-- | mk/misc/show.mk | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/mk/misc/show.mk b/mk/misc/show.mk index b516720acf2..89e3f5e291d 100644 --- a/mk/misc/show.mk +++ b/mk/misc/show.mk @@ -1,4 +1,4 @@ -# $NetBSD: show.mk,v 1.18 2019/09/08 09:01:04 rillig Exp $ +# $NetBSD: show.mk,v 1.19 2020/03/20 16:39:03 rillig Exp $ # # This file contains some targets that print information gathered from # variables. They do not modify any variables. @@ -165,6 +165,9 @@ show-all: show-all-${g} # using the :sh modifier may show warnings, for example because ${WRKDIR} # doesn't exist. +_SHOW_ALL.d4= $$$$ # see regress/show-all +_SHOW_ALL.d8= $$$$$$$$ # see regress/show-all + show-all-${g}: .PHONY @${RUN} printf '%s:\n' ${g:Q} @@ -181,7 +184,7 @@ show-all-${g}: .PHONY printf ' %s\t%-23s # empty\n' ${_LABEL.${c}} ${v:Q}=; \ else \ printf ' %s\t%-23s \\\n' ${_LABEL.${c}} ${v:Q}=; \ - printf '\t\t\t\t%s \\\n' ${${v}:O:@x@${x:Q}@}; \ + printf '\t\t\t\t%s \\\n' ${${v}:O:C,\\$$,${_SHOW_ALL.d8},g:@x@${x:Q}@}; \ printf '\t\t\t\t# end of %s (sorted)\n' ${v:Q}; \ fi @@ -195,7 +198,7 @@ show-all-${g}: .PHONY printf ' %s\t%-23s # empty\n' ${_LABEL.${c}} ${v:Q}=; \ else \ printf ' %s\t%-23s \\\n' ${_LABEL.${c}} ${v:Q}=; \ - printf '\t\t\t\t%s \\\n' ${${v}:@x@${x:Q}@}; \ + printf '\t\t\t\t%s \\\n' ${${v}:C,\\$$,${_SHOW_ALL.d8},g:@x@${x:Q}@}; \ printf '\t\t\t\t# end of %s\n' ${v:Q}; \ fi @@ -205,7 +208,7 @@ show-all-${g}: .PHONY ${RUN} \ if ${!defined(${v}) :? true : false}; then \ printf ' %s\t%-23s # undefined\n' ${_LABEL.${c}} ${v:Q}; \ - elif value=${${v}:U:Q} && test "x$$value" = "x"; then \ + elif value=${${v}:U:C,\\$$,${_SHOW_ALL.d4},gW:Q} && test "x$$value" = "x"; then \ printf ' %s\t%-23s # empty\n' ${_LABEL.${c}} ${v:Q}=; \ else \ case "$$value" in (*[\ \ ]) eol="# ends with space";; (*) eol=""; esac; \ |