summaryrefslogtreecommitdiff
path: root/pkg/awk/gen.lua
blob: d433bb46ac58d1c84ad315d59892e1c53036a8bc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
cflags{
	'-std=c11', '-Wall', '-Wpedantic',
	'-D _XOPEN_SOURCE=700',
	'-I $outdir',
	'-I $srcdir',
}

yacc('awkgram', 'awkgram.y')

pkg.deps = {'$outdir/awkgram.tab.h'}

sub('tools.ninja', function()
	toolchain(config.host)
	cflags{'-I $outdir'}
	exe('maketab', {'maketab.c'})
end)

rule('maketab', '$outdir/maketab $in >$out')
build('maketab', '$outdir/proctab.c', {'$outdir/awkgram.tab.h', '|', '$outdir/maketab'})

exe('awk', [[
	b.c main.c parse.c tran.c lib.c run.c lex.c
	$outdir/(awkgram.tab.c proctab.c)
]])
file('bin/awk', '755', '$outdir/awk')
man{'awk.1'}

fetch 'git'