1cflags{
2 '-std=c99', '-Wall', '-Wpedantic',
3 '-Wno-maybe-uninitialized', '-Wno-overflow', '-Wno-format-truncation',
4 '-D _GNU_SOURCE',
5 '-D _XOPEN_SOURCE=700',
6 '-I $dir',
7}
8
9lib('libutil.a', [[libutil/(
10 agetcwd.c
11 agetline.c
12 apathmax.c
13 concat.c
14 ealloc.c
15 eprintf.c
16 estrtol.c
17 estrtoul.c
18 explicit_bzero.c
19 passwd.c
20 proc.c
21 putword.c
22 recurse.c
23 strlcat.c
24 strlcpy.c
25 strtonum.c
26 tty.c
27)]])
28
29local tools = {
30 {'blkdiscard', 8},
31 {'chvt', 1},
32 {'clear', 1},
33 {'ctrlaltdel', 8},
34 {'df', 1},
35 {'dmesg', 1},
36 {'eject', 1},
37 {'fallocate', 1},
38 {'free', 1},
39 {'freeramdisk', 8},
40 {'fsfreeze', 8},
41 {'getty', 8},
42 {'halt', 8},
43 {'hwclock', 8},
44 {'id', 1},
45 {'insmod', 8},
46 {'killall5', 8},
47 {'last'},
48 {'lastlog', 8},
49 {'login', 1},
50 {'lsmod', 8},
51 {'lsusb', 8},
52 {'mesg', 1},
53 {'mkswap', 8},
54 {'mount', 8},
55 {'mountpoint', 1},
56 {'nologin', 8},
57 {'pagesize', 1},
58 {'passwd', 1, '4755'},
59 {'pidof', 1},
60 {'pivot_root', 8},
61 {'ps', 1},
62 {'pwdx', 1},
63 {'readahead', 8},
64 {'respawn', 1},
65 {'rmmod', 8},
66 {'stat', 1},
67 {'stty'},
68 {'swaplabel', 8},
69 {'swapoff', 8},
70 {'swapon', 8},
71 {'switch_root', 8},
72 {'sysctl', 8},
73 {'truncate', 1},
74 {'umount', 8},
75 {'unshare', 1},
76 {'uptime', 1},
77 {'vmstat'},
78 {'vtallow', 1},
79 {'watch', 1},
80 {'who', 1},
81}
82
83for _, tool in ipairs(tools) do
84 local name, sect, mode = tool[1], tool[2], tool[3]
85 file('bin/'..name, mode or '755', exe(name, {name..'.c', 'libutil.a'}))
86 if sect then
87 man{name..'.'..sect}
88 end
89end
90
91fetch 'git'