summaryrefslogtreecommitdiff
path: root/pkg/awk
diff options
context:
space:
mode:
authorMichael Forney <mforney@mforney.org>2017-09-17 00:03:34 -0700
committerMichael Forney <mforney@mforney.org>2017-09-25 19:23:06 -0700
commitba94a8513d9a0aadb3f2c834c74b64aa644c61e8 (patch)
tree48ac6c85baa7b9d960b9e1e726a906e61ca60967 /pkg/awk
parentcb362b531d79708a259bbf070dee5104fd63df08 (diff)
Rewrite ninja generation scripts in Lua
Diffstat (limited to 'pkg/awk')
-rw-r--r--pkg/awk/gen.lua29
-rw-r--r--pkg/awk/gen.rc25
2 files changed, 29 insertions, 25 deletions
diff --git a/pkg/awk/gen.lua b/pkg/awk/gen.lua
new file mode 100644
index 00000000..cbb7e9e7
--- /dev/null
+++ b/pkg/awk/gen.lua
@@ -0,0 +1,29 @@
+cflags{
+ '-std=c90',
+ '-D _POSIX_C_SOURCE=200809L',
+ '-I $outdir',
+ '-I $srcdir',
+}
+
+yacc('gram', 'awkgram.y')
+build('copy', '$outdir/ytab.h', '$outdir/gram.tab.h')
+
+pkg.deps = {'$outdir/ytab.h'}
+
+sub('tools.ninja', function()
+ toolchain 'host'
+ cflags{'-I $outdir'}
+ exe('maketab', {'maketab.c'})
+end)
+
+rule('maketab', '(cd $outdir && ./maketab) >$out.tmp && mv $out.tmp $out')
+build('maketab', '$outdir/proctab.c', {'|', '$outdir/maketab', '$outdir/ytab.h'})
+
+exe('awk', [[
+ b.c main.c parse.c tran.c lib.c run.c lex.c
+ $outdir/(gram.tab.c proctab.c)
+]])
+file('bin/awk', '755', '$outdir/awk')
+man{'awk.1'}
+
+fetch 'git'
diff --git a/pkg/awk/gen.rc b/pkg/awk/gen.rc
deleted file mode 100644
index 319ddc1c..00000000
--- a/pkg/awk/gen.rc
+++ /dev/null
@@ -1,25 +0,0 @@
-cflags\
- '-std=c90' \
- -D '_POSIX_C_SOURCE=200809L' \
- -I '$outdir' \
- -I '$srcdir'
-
-yacc gram '$srcdir'/awkgram.y
-build '$outdir'/ytab.h copy '$outdir'/gram.tab.h
-
-{
- toolchain host
- cflags -I '$outdir'
- exe maketab -d '$outdir'/ytab.h maketab.c
-} >tools.ninja ; subninja tools.ninja
-
-rule maketab '(cd $outdir && ./maketab) >$out.tmp && mv $out.tmp $out'
-build '$outdir'/proctab.c maketab '|' '$outdir'/^(maketab ytab.h)
-
-exe awk -d '$outdir'/ytab.h\
- b.c main.c parse.c tran.c lib.c run.c lex.c\
- '$outdir'/^(gram.tab.c proctab.c)
-file bin/awk '$outdir'/awk 755
-man 1 awk.1
-
-fetch git