-
Notifications
You must be signed in to change notification settings - Fork 10
/
Makefile
86 lines (68 loc) · 1.9 KB
/
Makefile
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
CMD = ./cmd/ink.go
RUN = go run -race ${CMD}
LDFLAGS = -ldflags="-s -w"
all: run test
# run standard samples
run:
go build -race ${CMD}
./ink samples/fizzbuzz.ink
./ink samples/graph.ink
./ink samples/basic.ink
./ink samples/kv.ink
./ink samples/html.ink
./ink samples/fib.ink
./ink samples/collatz.ink
./ink samples/newton.ink
./ink samples/pi.ink
./ink samples/prime.ink
./ink samples/quicksort.ink
./ink samples/pingpong.ink
./ink samples/undefinedme.ink || true
./ink samples/error.ink || true
./ink samples/exec.ink
# we echo in some input for prompt.ink testing stdin
echo 'Linus' | ./ink samples/prompt.ink
rm ./ink
repl:
${RUN} -repl
# run just the minimal test suite
test-mini:
${RUN} samples/test.ink
# run standard test suites
test:
go build -race ${CMD}
./ink samples/mangled.ink
./ink samples/test.ink
./ink samples/io.ink
# run I/O test under isolated mode -- all ops should still return valid responses
# We copy the file in question -- eval.go -- to a temporary location, since
# no-read and no-write I/O operations will delete the file.
cp pkg/ink/eval.go tmp.go
./ink -no-read samples/io.ink
cp tmp.go pkg/ink/eval.go
./ink -no-write samples/io.ink
cp tmp.go pkg/ink/eval.go
./ink -isolate samples/io.ink
rm tmp.go
./ink -isolate samples/pingpong.ink
./ink -no-exec samples/exec.ink
# test -eval flag
./ink -eval "log:=load('samples/std').log,f:=x=>()=>log('Eval test: '+x),f('passed!')()"
rm ./ink
# build for specific OS target
build-%:
GOOS=$* GOARCH=amd64 go build ${LDFLAGS} -o ink-$* ${CMD}
# build for all OS targets, useful for releases
build: build-linux build-darwin build-windows build-openbsd
# install on host system
install:
cp utils/ink.vim ~/.vim/syntax/ink.vim
go install ${LDFLAGS} ${CMD}
ls -l `which ink`
# pre-commit hook
precommit:
go vet ./cmd ./pkg/ink
go fmt ./cmd ./pkg/ink
# clean any generated files
clean:
rm -rvf *.bmp ink ink-*