diff options
| author | Michael Forney <mforney@mforney.org> | 2017-09-17 00:03:34 -0700 |
|---|---|---|
| committer | Michael Forney <mforney@mforney.org> | 2017-09-25 19:23:06 -0700 |
| commit | ba94a8513d9a0aadb3f2c834c74b64aa644c61e8 (patch) | |
| tree | 48ac6c85baa7b9d960b9e1e726a906e61ca60967 /pkg/scc/gen.lua | |
| parent | cb362b531d79708a259bbf070dee5104fd63df08 (diff) | |
Rewrite ninja generation scripts in Lua
Diffstat (limited to 'pkg/scc/gen.lua')
| -rw-r--r-- | pkg/scc/gen.lua | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/pkg/scc/gen.lua b/pkg/scc/gen.lua new file mode 100644 index 00000000..16cc4540 --- /dev/null +++ b/pkg/scc/gen.lua @@ -0,0 +1,45 @@ +set('arch', 'qbe') +cflags{ + '-std=c99', + [[-D 'SYS="linux"']], + [[-D 'ARCH="$arch"']], + '-D PREFIX=', + '-D NDEBUG', + '-I $dir/inc', + '-I $srcdir/inc/c99', + '-I $outdir/inc', +} + +lib('libcc.a', { + 'lib/debug.c', + 'lib/die.c', + 'lib/newitem.c', + 'lib/xcalloc.c', + 'lib/xmalloc.c', + 'lib/xrealloc.c', + 'lib/xstrdup.c', +}) + +build('awk', '$outdir/inc/error.h', {'$srcdir/cc2/cc2.h', '|', '$srcdir/cc2/generror.awk'}, { + expr='-f $srcdir/cc2/generror.awk', +}) + +cflags{[[-D 'ARCH="$arch"']]} + +exe('cc1-$arch', [[cc1/( + types.c decl.c lex.c error.c symbol.c main.c expr.c + code.c stmt.c cpp.c fold.c init.c builtin.c + arch/$arch/arch.c +) $outdir/libcc.a]]) +file('libexec/scc/cc1-$arch', '755', '$outdir/cc1-$arch') + +exe('cc2-$arch', [[cc2/( + main.c parser.c peep.c symbol.c node.c code.c optm.c + arch/$arch/(code.c cgen.c types.c optm.c) +) $outdir/libcc.a]], {'$outdir/inc/error.h'}) +file('libexec/scc/cc2-$arch', '755', '$outdir/cc2-$arch') + +exe('scc', {'driver/posix/scc.c', 'libcc.a'}) +file('bin/scc', '755', '$outdir/scc') + +fetch 'git' |
