1 | VERSION ?= $(shell git describe --tags 2>/dev/null) |
2 | ifeq "$(VERSION)" "" |
3 | VERSION := UNKNOWN |
4 | endif |
5 | |
6 | LDFLAGS=\ |
7 | -X github.com/kevinschoon/pomo/pkg/internal.Version=$(VERSION) |
8 | |
9 | .PHONY: \ |
10 | test \ |
11 | docs \ |
12 | pomo-build \ |
13 | readme |
14 | |
15 | default: bin/pomo |
16 | |
17 | clean: |
18 | [[ -f bin/pomo ]] && rm bin/pomo || true |
19 | |
20 | bin/pomo: test |
21 | cd cmd/pomo && \ |
22 | go build -ldflags '${LDFLAGS}' -o ../../$@ |
23 | |
24 | test: |
25 | go test ./... |
26 | go vet ./... |
27 | |
28 | docs: www/data/readme.json |
29 | cd www && hugo -d ../docs |
30 | |
31 | www/data/readme.json: www/data README.md |
32 | cat README.md | python -c 'import json,sys; print(json.dumps({"content": sys.stdin.read()}))' > $@ |
33 | |
34 | www/data bin: |
35 | mkdir -p $@ |