summaryrefslogtreecommitdiff
path: root/ninja.rc
diff options
context:
space:
mode:
authorMichael Forney <mforney@mforney.org>2016-06-27 01:23:03 -0700
committerMichael Forney <mforney@mforney.org>2016-06-27 01:23:03 -0700
commit076e97aee176afce9c51eef9c5cd39bbf0609b92 (patch)
tree5a5c6d9538642e53988d79efc45c38194e99f045 /ninja.rc
parent1f48964d15334a14de99fb4985077e3523f6f9ef (diff)
Reformulate "let" helper into "with"
Diffstat (limited to 'ninja.rc')
-rw-r--r--ninja.rc26
1 files changed, 11 insertions, 15 deletions
diff --git a/ninja.rc b/ninja.rc
index 755fb49a..2e1776da 100644
--- a/ninja.rc
+++ b/ninja.rc
@@ -7,16 +7,12 @@ fn set {
}
}
-fn let {
- vars=() {
- while(! ~ $1 --) {
- vars=($vars $1' = '$2)
- shift 2
- }
- shift
- $*
- printf ' %s\n' $vars
+fn with {
+ while(! ~ $#* 0) {
+ printf ' %s = %s\n' $1 $2
+ shift 2
}
+ status=()
}
fn subninja {
@@ -30,7 +26,7 @@ fn include {
fn rule {
name=$1 {
shift
- let command $"* -- echo rule $name
+ echo rule $name ; with command $"*
}
}
@@ -120,7 +116,7 @@ fn exe {
fn yacc {
outs='$outdir'/$1.tab.^(c h) {
- let yaccflags '-d -b '$1 -- build $"outs yacc $2
+ build $"outs yacc $2 ; with yaccflags '-d -b '$1
}
}
@@ -131,8 +127,8 @@ fn file {
if(fs $dir $1) {
out='$builddir/$repo.hash'/$1
mode=`{printf %4s $3 | tr ' ' 0 | tail -c 4}
- let args 10$mode' '$1 --\
- build $out githash $2 '|' '$builddir/$repo.stamp' scripts/hash.rc
+ build $out githash $2 '|' '$builddir/$repo.stamp' scripts/hash.rc ; with\
+ args 10$mode' '$1
tree_inputs=($tree_inputs $out)
if(! ~ $mode 0755 0644) tree_perms=($tree_perms 10$mode' '$1)
@@ -150,8 +146,8 @@ fn sym {
~ $#* 2
if(fs $dir $1) {
out='$builddir/$repo.hash'/$1
- let args 120000' '$1' '$2 --\
- build $out githash '|' '$builddir/$repo.stamp' scripts/hash.rc
+ build $out githash '|' '$builddir/$repo.stamp' scripts/hash.rc ; with\
+ args 120000' '$1' '$2
tree_inputs=($tree_inputs $out)
}
status=()