treerack/Makefile

89 lines
1.8 KiB
Makefile
Raw Normal View History

2017-06-25 17:51:08 +02:00
SOURCES = $(shell find . -name '*.go')
2017-10-29 20:01:33 +01:00
PARSERS = $(shell find . -name '*.treerack')
2017-06-25 17:51:08 +02:00
default: build
2017-11-05 03:48:38 +01:00
deps:
go get golang.org/x/tools/cmd/goimports
2017-11-05 04:08:08 +01:00
go get -t ./...
2017-11-05 03:48:38 +01:00
2017-11-05 03:28:36 +01:00
imports: $(SOURCES)
2018-01-05 19:06:10 +01:00
@echo imports
2017-06-25 17:51:08 +02:00
@goimports -w $(SOURCES)
build: $(SOURCES)
2018-01-05 19:06:10 +01:00
go build
head: $(SOURCES)
go run scripts/createhead.go -- \
char.go \
sequence.go \
choice.go \
idset.go \
results.go \
context.go \
nodehead.go \
syntaxhead.go \
> head.go
generate: $(SOURCES) $(PARSERS) head
go run scripts/boot.go < syntax.treerack > self/self.go.next
@mv self/self.go{.next,}
@gofmt -s -w self/self.go
regenerate: $(SOURCES) $(PARSERS) head
go run scripts/boot.go < syntax.treerack > self/self.go.next
@mv self/self.go{.next,}
go run scripts/boot.go < syntax.treerack > self/self.go.next
@mv self/self.go{.next,}
@gofmt -s -w self/self.go
2017-06-25 17:51:08 +02:00
2017-11-05 03:28:36 +01:00
check: imports build $(PARSERS)
go test -test.short -run ^Test
2017-06-25 17:51:08 +02:00
2017-11-05 04:55:37 +01:00
check-full: imports build $(PARSERS)
2017-11-05 03:28:36 +01:00
go test
2017-10-29 16:47:03 +01:00
2017-11-05 03:28:36 +01:00
.coverprofile: $(SOURCES) imports
go test -coverprofile .coverprofile
cover: .coverprofile
go tool cover -func .coverprofile
show-cover: .coverprofile
go tool cover -html .coverprofile
2017-06-25 17:51:08 +02:00
2017-11-05 03:38:24 +01:00
publish-coverage: .coverprofile
curl -s https://codecov.io/bash -o codecov
bash codecov -Zf .coverprofile
2017-11-05 03:38:24 +01:00
2017-07-30 05:10:46 +02:00
cpu.out: $(SOURCES) $(PARSERS)
2017-07-30 02:35:51 +02:00
go test -v -run TestMMLFile -cpuprofile cpu.out
cpu: cpu.out
go tool pprof -top cpu.out
2017-11-05 03:28:36 +01:00
fmt: $(SOURCES)
2018-01-05 19:06:10 +01:00
@echo fmt
2017-11-05 03:28:36 +01:00
@gofmt -w -s $(SOURCES)
2017-11-05 05:07:20 +01:00
check-fmt: $(SOURCES)
2018-01-05 19:06:10 +01:00
@echo check fmt
2017-11-05 05:07:20 +01:00
@if [ "$$(gofmt -s -d $(SOURCES))" != "" ]; then false; else true; fi
vet:
2018-01-05 19:06:10 +01:00
go vet
2017-11-05 05:07:20 +01:00
2018-01-05 19:06:10 +01:00
precommit: regenerate fmt vet build check-full
2017-07-30 02:35:51 +02:00
clean:
2018-01-05 19:06:10 +01:00
rm -f *.test
rm -f cpu.out
rm -f .coverprofile
go clean -i ./...
2017-11-05 03:45:15 +01:00
2017-11-06 11:14:28 +01:00
ci-trigger: deps check-fmt build check-full
2017-11-05 04:01:27 +01:00
ifeq ($(TRAVIS_BRANCH)_$(TRAVIS_PULL_REQUEST), master_false)
make publish-coverage
endif