chiark / gitweb /
Syntax: Provide convenience syntax &( for $(eval
[subdirmk.git] / generate
index 01c123e1c5c45b67af8d1c60c2b76870a40c3113..b564260dea4c02e4385fc0b36974e04efbddf718 100755 (executable)
--- a/generate
+++ b/generate
@@ -3,6 +3,7 @@
 # subdirmk - &-filter (makefile generation program)
 #  Copyright 2019 Ian Jackson
 # SPDX-License-Identifier: LGPL-2.0-or-later
+# There is NO WARRANTY.
 #
 # $(srcdir)/subdirmk/generate [--srcdir=SRCDIR] [--] SUBDIR...
 #
@@ -370,11 +371,13 @@ sub process_input_mk ($$$$) {
                $note_varref->($2,!!$1) if m{^($esc)?([^()\$]+\))};
            }
            elsif (s{^\$(\d+)}{}) { ddbl_only($&); oud "\${$1}"; }
-           elsif (s{^\$\{}{}) {
+           elsif (s{^\(\s*$esc(?=$lc_re)}{}) { od "\$(call ${var_prefix}" }
+           elsif (s{^\(\s*(?=\S)}{}        ) { od "\$(call "              }
+           elsif (s{^\{}{}) {
                err 'macro invocation cannot be re-$-doubled' if $ddbl;
                od '${eval ${call ';
                $evalcall_brackets = 1;
-               $push_nest->('eval',1, '&${...}');
+               $push_nest->('eval',1, '&{...}');
                $note_varref->($2,!!$1) if m{^\s*($esc)?([^,{}\$]+)};
            } elsif (s{^([~^]?)(?=[ \t])}{}) {
                my $prefix = $pfxmap{$1} // die "internal error ($1?)";