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