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 | bin/pomo |
15 | |
16 | default: bin/pomo test |
17 | |
18 | clean: |
19 | [[ -f bin/pomo ]] && rm bin/pomo || true |
20 | |
21 | bin/pomo: |
22 | cd cmd/pomo && \ |
23 | go build -ldflags '${LDFLAGS}' -o ../../$@ |
24 | |
25 | test: |
26 | go test ./... |
27 | go vet ./... |
28 | |
29 | install: |
30 | go install ./cmd/... |
31 | |
32 | man/pomo.1: man/pomo.1.scd |
33 | scdoc < $< > $@ |
34 | |
35 | manpages: man/pomo.1 |
36 | |
37 | docs: www/data/readme.json |
38 | cd www && hugo -d ../docs |
39 | |
40 | www/data/readme.json: www/data README.md |
41 | cat README.md | python -c 'import json,sys; print(json.dumps({"content": sys.stdin.read()}))' > $@ |
42 | |
43 | www/data bin: |
44 | mkdir -p $@ |