-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.ninja
108 lines (79 loc) · 1.98 KB
/
build.ninja
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
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
#
# Variables
#
exefile = lissajous
srcfile = $exefile.go
#
# Rules
#
rule mod_init_r
command = go mod init $exefile
rule tidy_r
command = go mod tidy
rule build_r
command = go build $out
rule exe_r
command = ./$in
#rule test2_r
# command = echo "this\nthis\nthat\n" | ./$exefile
# description = "tests with standard input"
# NOTE: this might need an entry for implicit = out.gif
# however it chokes on implicit = line
#
# The way its working now, test3 and out.gif are both outputs
# of the build rule. However, test3 is an implicit output.
# An implicit output does not show up in the list of outputs
# passed to rule and referred to as $out.
rule test3_r
command = ./$in > $out; open $out
# command = ./$in > out.gif; open out.gif
# command = ./$in > $out1; open $out1
# command = ./$exefile > out.gif
# command = "./$exefile > out.gif; open out.gif"
description = "tests by making gif and then display"
# implicit = out.gif
#
# build targets
#
# go.mod
build $
go.mod $
: mod_init_r
# tidy
build $
nothing $
: tidy_r $srcfile $
| go.mod
# build stanza notes
#build $ # signifies a build stanza
#$exefile $ # list of outputs
#: build_r $srcfile # : denotes a rule and list of inputs
#| go.mod # | denotes a list of dependencies
#build $ # signifies a build stanza
#$exefile $ # list of outputs
#: build_r $srcfile $ # : denotes a rule and list of inputs
#| go.mod # | denotes a list of dependencies
# $exefile
build $
$exefile $
: build_r $srcfile $
| go.mod
# test 1
build $
test1 $
: exe_r $exefile
# test 2
# $ ninja test2
#build $
#test2 $
#: test2_r $exefile
# test 3
# This shows that out.gif is an implicit output generated
# by running the build but it did not work
build $
out.gif $
| test3 $
: test3_r $exefile
# by default only this target is made
#default $exefile
default test3