makefile 865 B

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