chiark / gitweb /
tests/filter/extract-doctests: Recognise directives first
[subdirmk.git] / generate
index ad8c9eadecf8ae1df38183cdb8e010cd53fff865..c2dc42da1ae75eb7ca8f17c1c0e0c635de22541c 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...
 #
@@ -187,7 +188,9 @@ our %warn_unk;
 
 sub err ($) {
     my ($m) = @_;
-    die "subdirmk: ${err_file}:$.: $m\n";
+    die defined $err_file
+       ? "subdirmk: ${err_file}:$.: $m\n"
+       : "subdirmk: $m\n";
 }
 
 sub wrncore ($$) {
@@ -368,11 +371,11 @@ sub process_input_mk ($$$$) {
                $note_varref->($2,!!$1) if m{^($esc)?([^()\$]+\))};
            }
            elsif (s{^\$(\d+)}{}) { ddbl_only($&); oud "\${$1}"; }
-           elsif (s{^\$\{}{}) {
+           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?)";