...
1SHELL := /bin/bash
2RAGEL := ragel
3GOFMT := go fmt
4
5export GO_TEST=env GOTRACEBACK=all go test $(GO_ARGS)
6
7.PHONY: build
8build: machine.go
9
10.PHONY: clean
11clean:
12 @rm -rf docs
13 @rm -f machine.go
14
15.PHONY: images
16images: docs/urn.png
17
18.PHONY: snake2camel
19snake2camel:
20 @cd ./tools/snake2camel; go build -o ../../snake2camel .
21
22.PHONY: removecomments
23removecomments:
24 @cd ./tools/removecomments; go build -o ../../removecomments .
25
26machine.go: machine.go.rl
27
28machine.go: snake2camel
29
30machine.go: removecomments
31
32machine.go:
33 $(RAGEL) -Z -G1 -e -o $@ $<
34 @./removecomments $@
35 @./snake2camel $@
36 $(GOFMT) $@
37
38docs/urn.dot: machine.go.rl
39 @mkdir -p docs
40 $(RAGEL) -Z -e -Vp $< -o $@
41
42docs/urn.png: docs/urn.dot
43 dot $< -Tpng -o $@
44
45.PHONY: bench
46bench: *_test.go machine.go
47 go test -bench=. -benchmem -benchtime=5s ./...
48
49.PHONY: tests
50tests: *_test.go
51 $(GO_TEST) ./...
View as plain text