chiark / gitweb /
Syntax: Provide &$VARIABLE
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Mon, 9 Dec 2019 16:31:59 +0000 (16:31 +0000)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Sat, 28 Dec 2019 22:19:08 +0000 (22:19 +0000)
Testing is done by the doctests.

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
README
generate

diff --git a/README b/README
index 4da4091..6bc8e82 100644 (file)
--- a/README
+++ b/README
@@ -251,6 +251,9 @@ So pathname syntax is a subset of:
 &\&            =>      &               general escaping mechanism
 &\$            =>      $
 
+&$VARIABLE     =>      $(sub_dir_VARIABLE)     or $(TOP_VARIABLE)
+       VARIABLE is ASCII starting with a letter and matching \w+
+
 & thing thing... &
 &^ thing thing... &
 &~ thing thing... &
index dd6df29..e7da435 100755 (executable)
--- a/generate
+++ b/generate
@@ -162,6 +162,7 @@ sub process_input_mk ($$$$$$$$$) {
                $targets->{$t} //= [ ];
            }
            elsif (m{^(?=$caps_re)}) { o $var_prefix }
+           elsif (s{^\$([A-Za-z]\w+)}{}) { o "\$(${var_prefix}$1)" }
            elsif (s{^([~^]?)(?=$lc_re)}{}) { o $pfxmap{$1} }
            elsif (s{^_}{}) { o $var_prefix }
            elsif (s{^=}{}) { o $var_prefix_name }