-
Notifications
You must be signed in to change notification settings - Fork 0
/
gen
executable file
·75 lines (59 loc) · 1.33 KB
/
gen
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
#!/usr/bin/env python
import script.output as output
import script.target as target
libprpc = target.lib(
"libprpc",
srcs = [
target.re2c( "src/prpc/prpc/lex.re.c" ),
"src/prpc/prpc/parse.c",
"src/prpc/prpc/msg.c",
"src/prpc/prpc/cmds.c"
],
incdirs=["src/prpc"]
)
###############################
libmain = target.lib(
"libmain",
srcs = [
"src/common/sys/ansiterm.c",
"src/common/sys/log.c",
],
incdirs=["src/common"]
)
example = target.executable(
"example",
srcs = [
target.re2c("src/example/cmds.re.c"),
"src/example/app.c",
"src/example/main.c"
],
incdirs=["src/common", "src/prpc"],
aliases=["app"],
objs=[libmain, libprpc]
)
libtest = target.lib(
"libtest",
srcs = [
"tests/lib/test.c"
],
incdirs = [
"src/common",
"src/prpc"
],
objs = [ libmain ]
)
def add_test( name ):
return target.executable(
"tests/%s" % name,
srcs = [ "tests/%s.c" % name ],
incdirs = ["src/prpc","src/common", "tests/lib"],
objs=[libprpc, libtest, libmain]
)
tests = [
add_test("parse"),
add_test("lex"),
add_test("msg")
]
with open( "targets/autogen.ninja", "w" ) as fhandle:
output.rules( fhandle, [example] + tests )
# MODIFIED