2021-08-12 19:03:24 +00:00
|
|
|
SHELL := /bin/bash
|
2023-03-20 10:05:46 +00:00
|
|
|
RAGEL := ragel
|
|
|
|
GOFMT := go fmt
|
2021-08-12 19:03:24 +00:00
|
|
|
|
2023-03-20 10:05:46 +00:00
|
|
|
export GO_TEST=env GOTRACEBACK=all go test $(GO_ARGS)
|
|
|
|
|
|
|
|
.PHONY: build
|
2021-08-12 19:03:24 +00:00
|
|
|
build: machine.go
|
|
|
|
|
2023-03-20 10:05:46 +00:00
|
|
|
.PHONY: clean
|
|
|
|
clean:
|
|
|
|
@rm -rf docs
|
|
|
|
@rm -f machine.go
|
|
|
|
|
|
|
|
.PHONY: images
|
2021-08-12 19:03:24 +00:00
|
|
|
images: docs/urn.png
|
|
|
|
|
2024-03-11 10:12:06 +00:00
|
|
|
.PHONY: snake2camel
|
|
|
|
snake2camel:
|
|
|
|
@cd ./tools/snake2camel; go build -o ../../snake2camel .
|
|
|
|
|
2023-03-20 10:05:46 +00:00
|
|
|
.PHONY: removecomments
|
|
|
|
removecomments:
|
2023-05-22 07:17:48 +00:00
|
|
|
@cd ./tools/removecomments; go build -o ../../removecomments .
|
2023-03-20 10:05:46 +00:00
|
|
|
|
2021-08-12 19:03:24 +00:00
|
|
|
machine.go: machine.go.rl
|
2023-03-20 10:05:46 +00:00
|
|
|
|
2024-03-11 10:12:06 +00:00
|
|
|
machine.go: snake2camel
|
|
|
|
|
2023-03-20 10:05:46 +00:00
|
|
|
machine.go: removecomments
|
|
|
|
|
|
|
|
machine.go:
|
2024-03-11 10:12:06 +00:00
|
|
|
$(RAGEL) -Z -G1 -e -o $@ $<
|
2023-03-20 10:05:46 +00:00
|
|
|
@./removecomments $@
|
2024-03-11 10:12:06 +00:00
|
|
|
@./snake2camel $@
|
2023-03-20 10:05:46 +00:00
|
|
|
$(GOFMT) $@
|
2021-08-12 19:03:24 +00:00
|
|
|
|
|
|
|
docs/urn.dot: machine.go.rl
|
|
|
|
@mkdir -p docs
|
2023-03-20 10:05:46 +00:00
|
|
|
$(RAGEL) -Z -e -Vp $< -o $@
|
2021-08-12 19:03:24 +00:00
|
|
|
|
|
|
|
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-03-11 10:12:06 +00:00
|
|
|
tests: *_test.go
|
2023-03-20 10:05:46 +00:00
|
|
|
$(GO_TEST) ./...
|