forked from 0xfe/experiments
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwscript
39 lines (30 loc) · 816 Bytes
/
wscript
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
APPNAME = "gohello"
VERSION = "1.0"
top = "."
out = "build"
def configure(ctx):
ctx.env.GOC = "6g"
ctx.env.GOL = "6l"
def build(ctx):
sources = ["echo.go", "hello.go", "slices.go"]
for file in sources:
# Files with ".go" extensions are automatically compiled and linked
ctx(source=file)
# Remove .bin extension from file
binary = file.replace(".go", "")
ctx(rule="mv ${SRC} ${TGT}", source=(binary + ".bin"), target=binary)
"""
Code to automatically compile and link files with ".go" as their extension.
"""
from waflib import TaskGen
TaskGen.declare_chain(
name = "goc",
rule = "${GOC} -o ${TGT} ${SRC}",
ext_in = ".go",
ext_out = ".6")
TaskGen.declare_chain(
name = "gol",
rule = "${GOL} -o ${TGT} ${SRC}",
ext_in = ".6",
ext_out = ".bin",
reentrant = False)