chiark / gitweb /
subdirmk: Implement new syntax
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Thu, 14 Nov 2019 19:36:39 +0000 (19:36 +0000)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Thu, 14 Nov 2019 19:37:07 +0000 (19:37 +0000)
But I plan to go back to ^ and ~

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
mtest/Subdir.sd.mk
stest/Subdir.sd.mk
subdirmk/example/Subdir.sd.mk
subdirmk/example/lib/Subdir.sd.mk
subdirmk/generate
test-common.sd.mk
test-example/Subdir.sd.mk

index 9921717192a0b75625061cf3c49c2a88208d8f6a..7c9953ecad132f9c7a1b3fd7d2bbab333d5c550a 100644 (file)
@@ -1,7 +1,7 @@
 
-&DEPS += $(src)/make-secnet-sites
-&DEPS += $(src)/ipaddrset.py
-&DEPS += &^/common.tcl
+&DEPS += $make-secnet-sites
+&DEPS += $ipaddrset.py
+&DEPS += &common.tcl
 
 &:include test-common.sd.mk
 
index 222e82c86736fade302c6e03219f8b65f3351664..6eb32092fc0e3b14199a8d56c86d37828ee54688 100644 (file)
@@ -2,7 +2,7 @@
 &TARGETS += & udp-preload.so
 
 &DEPS += & udp-preload.so
-&DEPS += &^/common.tcl
+&DEPS += &common.tcl
 &DEPS += secnet
 &DEPS += test-example/sites.conf
 &DEPS += test-example/inside.key
index 5c2040a1b8f65b8ce848380a3ee3c7fd7a688029..162d7ce8a166beb152fa07a2edd3ad6ee7153237 100644 (file)
@@ -3,7 +3,7 @@
 #  Copyright 2019 Ian Jackson
 # SPDX-License-Identifier: LGPL-2.0-or-later
 
-INCLUDES       += -I&^/lib/
+INCLUDES       += -I&;lib/
 
 include subdirmk/usual.mk
 include subdirmk/regen.mk
index c2939c54457ebe992e86b2a244e0550391d4aab4..8ac946dbc616b2e95c6bb74579e6eef053fb7a0e 100644 (file)
@@ -10,4 +10,4 @@
 &libtoy.a:     $(&OBJECTS)
        $(AR) rc $@ $^
 
--include &^/lib/for-test.mk
+-include &,for-test.mk
index 0bb4b7b3501014b9696e782b95c3186494113c51..b4c52ae40073c1c3cca1b3026a2c52595e1d9851 100755 (executable)
@@ -131,6 +131,12 @@ sub process_input_mk ($$$$$$$$) {
     }
     $input_files{$f}++;
 
+    my %pfxmap = (
+                 ''  => $dir_prefix,
+                 ',' => "\$(top_srcdir)${dir_suffix}/",
+                 ';' => "\$(top_srcdir)/",
+                );
+
     while (<$input>) {
        if (s#^\s*$esc\:##) {
            $buffering_output='';
@@ -147,19 +153,13 @@ sub process_input_mk ($$$$$$$$) {
                $targets->{$t} //= [ ];
            }
            elsif (m{^(?=$caps_re)}) { o $var_prefix }
-           elsif (m{^(?=$lc_re)}) { o $dir_prefix }
+           elsif (s{^([,;]?)(?=$lc_re)}{}) { o $pfxmap{$1} }
            elsif (s{^_}{}) { o $var_prefix }
-           elsif (s{^/}{}) { o $dir_prefix }
            elsif (s{^=_}{}) { o $var_prefix }
+           elsif (s{^([,;]?)/}{}) { o $pfxmap{$1} }
            elsif (s{^=/}{}) { o $dir_name }
-           elsif (s{^\^}{}) { o "\$(top_srcdir)${dir_suffix}" }
-           elsif (s{^\}}{}) { o "\$(abs_top_srcdir)${dir_suffix}" }
-           elsif (s{^(?:[ \t]+([~^]))?(?=[ \t])}{}) {
-               my $prefix =
-                   !$1       ? $dir_prefix                     :
-                   $1 eq '~' ? '$(abs_top_srcdir)'.$dir_suffix :
-                   $1 eq '~' ? '$(abs_top_srcdir)'.$dir_suffix :
-                   die;
+           elsif (s{^([,;]?)(?=[ \t])}{}) {
+               my $prefix = $pfxmap{$1} // die;
                my $after='';
                if (m{([ \t])$esc}) { ($_,$after) = ($`, $1.$'); }
                s{(?<=[ \t])(?=\S)(?!\\\s*$)}{$prefix}g;
index 0584a98ba00799d3e7103e9cdb2be91d7e0d3d03..b830264e55908b3998b3079bf24e1b4e2a84ef9a 100644 (file)
@@ -1,7 +1,7 @@
 
 include common.make
 
-&TESTSCRIPTS ?= $(shell echo &^/t-*[0-9a-z])
+&TESTSCRIPTS ?= $(shell echo &,t-*[0-9a-z])
 &TESTNAMES := $(patsubst t-%,%,$(notdir $(&TESTSCRIPTS)))
 
 &DEPS += $(src)/test-common.tcl
@@ -15,7 +15,7 @@ include common.make
 
 CHECK_SILENT ?= @
 
-&d-%/ok: &^/t-% $(&DEPS)
+&d-%/ok: &,t-% $(&DEPS)
        $(CHECK_SILENT) rm -rf &d-$*; mkdir &d-$*
        $(CHECK_SILENT) export SECNET_TEST_BUILDDIR=$(topbuilddir); \
         export PYTHONBYTECODEBASE=/dev/null; \
index 66cdaf80b13e7946b250e987a409744e23065b90..835aab6e814b6004203efa35dcda4c44137dde0f 100644 (file)
@@ -2,11 +2,11 @@
 
 include common.make
 
-&/%.key: &^/%.key.b64
+&/%.key: &,/%.key.b64
        base64 -d <$< >$@.new && mv -f $@.new $@
 
-&sites.conf: $(src)/make-secnet-sites &^/sites Subdir.mk
-       $(src)/make-secnet-sites &^/sites &sites.conf
+&sites.conf: $(src)/make-secnet-sites &,sites Subdir.mk
+       $(src)/make-secnet-sites &,sites &sites.conf
 
 &clean::
        rm -f *~ ./#*# *.new