summaryrefslogtreecommitdiff
path: root/pkg/perp/gen.rc
blob: df8647a6f422dfcde013157d8282bd41b13bb340 (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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
cflags\
	-I '$srcdir'/lasagna\
	-I '$outdir'

{
	toolchain host
	exe mk_outvec lasagna/outvec/mk_outvec.c
	exe mk_rlimit lasagna/rlimit/mk_rlimit.c
	exe mksysstr lasagna/sysstr/mksysstr.c
} >tools.ninja ; subninja tools.ninja

rule outvec '$outdir/mk_outvec >$out.tmp && mv $out.tmp $out'
build '$outdir'/outvec_STDOUT.h outvec '|' '$outdir'/mk_outvec

rule rlimit '$outdir/mk_rlimit >$out.tmp && mv $out.tmp $out'
build '$outdir'/rlimit_defs.c.in rlimit '|' '$outdir'/mk_rlimit

rule sysstr '$outdir/mksysstr $type >$out.tmp && mv $out.tmp $out'
build '$outdir'/sysstr_errno.c.in sysstr '|' '$outdir'/mksysstr ; with type errno
build '$outdir'/sysstr_signo.c.in sysstr '|' '$outdir'/mksysstr ; with type signo

phony deps '$outdir'/^(outvec_STDOUT.h rlimit_defs.c.in sysstr_^(errno signo)^.c.in)

lib libasagna.a -d '$dir'/deps lasagna/^(\
	buf/buf_^(cmp copy fill ndx rcopy rndx)^.c\
	cstr/cstr_^(cat chop cmp cmpi contains copy dup lcat lcpy len ltrim match matchi ncmp pos rpos rtrim trim vcat_ vcopy_ vlen_)^.c\
	cdb/^(cdb_^(find cc clear close distance dynget dynread get hashpart init open read seq) cdbmk_^(add addioq addrec clear finish init _update))^.c\
	devout/devout.c\
	domsock/domsock_^(accept close connect create)^.c\
	dynbuf/^(dynbuf.c dynbuf_^(clear copy free freebuf grow need new pack put putb)^.c)\
	dynstr/^(dynstr.c dynstr_^(chop clear copy copys free freestr grow need new put putc putn puts set vputs_)^.c)\
	dynstuf/dynstuf_^(find free get grow init isempty items new peek pop push replace reverse set slots sort stuf visit)^.c\
	execvx/execvx.c\
	fd/fd_^(blocking cloexec dupe move nonblock)^.c\
	hdb/hdb_^(find cc clear close distance dynget dynread get hashpart init open read seq)^.c\
	hdb/hdbmk_^(add addioq addrec clear finish start _update)^.c\
	hfunc/hfunc_^(djba djbm djbx elf1 fnva fnvm ghfa ghfm ghfx jsw1 kp37 kr31 kx17 murm oat1 p50a pjw1 rsuh rot1 rotm sax1 sdbm sfh1 postmix32)^.c\
	ioq/ioq_^(get getln init put putfd putfile stderr stdin stdout vputs_)^.c\
	newenv/newenv.c\
	nextopt/^(nextopt nextopt_progname)^.c\
	nfmt/nfmt_^(uint32 uint32_pad uint32_pad_ uint32_pad0 uint32_pad0_ uint32o uint32o_pad0 uint32o_pad0_ uint32x uint32x_pad uint32x_pad_ uint32x_pad0 uint32x_pad0_ uint64 uint64_pad uint64_pad_ uint64_pad0 uint64_pad0_)^.c\
	nuscan/nuscan_^(uint32 uint32o)^.c\
	outvec/outvec_^(STDERR STDOUT flush put puts vputs_)^.c\
	packet/packet_^(read write)^.c\
	padlock/padlock_^(exbyte exlock extest fcntl shbyte shlock shtest unbyte unlock)^.c\
	pidlock/pidlock_^(check set)^.c\
	pkt/pkt_^(load read write)^.c\
	pollio/pollio.c\
	rlimit/rlimit.c\
	sig/sig_^(block catch catchr unblock)^.c\
	sysstr/sysstr_^(errno signal)^.c\
	tain/tain_^(assign iszero less load load_msecs load_utc minus now pack packhex pause plus tai_pack tai_unpack uptime to_float to_msecs to_utc unpack unpackhex)^.c\
	tx64/^(base64_vec tx64_encode)^.c\
	ufunc/ufunc_^(u32add u48add)^.c\
	upak/upak_vpack.c\
	upak/upak^('' 16 24 32 48 64)^_pack.c\
	upak/upak^('' 16 24 32 48 64)^_unpack.c\
)

fn x {
	subdir=$1
	exe=$2
	shift 2
	exe $exe $subdir/$* libasagna.a
	if(! ~ $exe cat*)
		man -d $subdir/man 8 $exe.8
	file bin/$exe '$outdir'/$exe 755
}

x perp perpd perpd.c perpd_conn.c perpd_svdef.c

cc perp/tinylog.c ; with\
	cflags '$cflags -D ''TINYLOG_ZIP="/bin/gzip"'' -D ''ZIP_EXT=".gz"'''
x perp tinylog tinylog.c.o

for(exe in perp^(boot ctl hup ls ok stat)) x perp $exe $exe.c
tools=(\
	run^(args argv0 choom detach deux env file limit lock pause session tool trap uid)\
	cat^(args env limits uid)\
) for(exe in $tools) x runtools $exe $exe.c

man -d perp/man 5 perpetrate.5 8 perp_intro.8
man -d runtools/man 8 runtools_intro.8

fetch curl