2023-12-21 22:17:40 +08:00
|
|
|
SHELL := /bin/bash
|
|
|
|
RAGEL := ragel
|
|
|
|
GOFMT := go fmt
|
|
|
|
|
|
|
|
export GO_TEST=env GOTRACEBACK=all go test $(GO_ARGS)
|
|
|
|
|
|
|
|
.PHONY: build
|
|
|
|
build: machine.go
|
|
|
|
|
|
|
|
.PHONY: clean
|
|
|
|
clean:
|
|
|
|
@rm -rf docs
|
|
|
|
@rm -f machine.go
|
|
|
|
|
|
|
|
.PHONY: images
|
|
|
|
images: docs/urn.png
|
|
|
|
|
2024-05-15 19:09:45 +08:00
|
|
|
.PHONY: snake2camel
|
|
|
|
snake2camel:
|
|
|
|
@cd ./tools/snake2camel; go build -o ../../snake2camel .
|
|
|
|
|
2023-12-21 22:17:40 +08:00
|
|
|
.PHONY: removecomments
|
|
|
|
removecomments:
|
|
|
|
@cd ./tools/removecomments; go build -o ../../removecomments .
|
|
|
|
|
|
|
|
machine.go: machine.go.rl
|
|
|
|
|
2024-05-15 19:09:45 +08:00
|
|
|
machine.go: snake2camel
|
|
|
|
|
2023-12-21 22:17:40 +08:00
|
|
|
machine.go: removecomments
|
|
|
|
|
|
|
|
machine.go:
|
2024-05-15 19:09:45 +08:00
|
|
|
$(RAGEL) -Z -G1 -e -o $@ $<
|
2023-12-21 22:17:40 +08:00
|
|
|
@./removecomments $@
|
2024-05-15 19:09:45 +08:00
|
|
|
@./snake2camel $@
|
2023-12-21 22:17:40 +08:00
|
|
|
$(GOFMT) $@
|
|
|
|
|
|
|
|
docs/urn.dot: machine.go.rl
|
|
|
|
@mkdir -p docs
|
|
|
|
$(RAGEL) -Z -e -Vp $< -o $@
|
|
|
|
|
|
|
|
docs/urn.png: docs/urn.dot
|
|
|
|
dot $< -Tpng -o $@
|
|
|
|
|
|
|
|
.PHONY: bench
|
|
|
|
bench: *_test.go machine.go
|
|
|
|
go test -bench=. -benchmem -benchtime=5s ./...
|
|
|
|
|
|
|
|
.PHONY: tests
|
2024-05-15 19:09:45 +08:00
|
|
|
tests: *_test.go
|
2023-12-21 22:17:40 +08:00
|
|
|
$(GO_TEST) ./...
|