Makefile -rw-r--r-- 1.5 KiB
1VERSION ?= $(shell git describe --tags 2>/dev/null)
2ifeq "$(VERSION)" ""
3 VERSION := UNKNOWN
4endif
5
6.PHONY: \
7 all \
8 test \
9 docs \
10 readme \
11 release \
12 release-linux \
13 release-darwin
14
15all: bin/pomo
16
17bin/pomo: test
18 go build -o $@
19
20clean:
21 -rm -rfv bin/* docs/*
22
23bindata.go: tomato-icon.png
24 go-bindata -pkg main -o $@ $^
25
26test:
27 go test ./...
28 go vet ./...
29
30bin/pomo-$(VERSION)-linux-amd64: bin bindata.go
31 go build -ldflags "-X main.Version=$(VERSION)" -o $@
32
33bin/pomo-$(VERSION)-linux-amd64.md5:
34 md5sum bin/pomo-$(VERSION)-linux-amd64 | sed -e 's/bin\///' > $@
35
36bin/pomo-$(VERSION)-darwin-amd64: bin bindata.go
37 # This is used to cross-compile a Darwin compatible Mach-O executable
38 # on Linux for OSX, you need to install https://github.com/tpoechtrager/osxcross
39 PATH="$$PATH:/usr/local/osx-ndk-x86/bin" GOOS=darwin GOARCH=amd64 CC=/usr/local/osx-ndk-x86/bin/x86_64-apple-darwin15-cc CGO_ENABLED=1 go build $(FLAGS) -o $@
40
41
42bin/pomo-$(VERSION)-darwin-amd64.md5:
43 md5sum bin/pomo-$(VERSION)-darwin-amd64 | sed -e 's/bin\///' > $@
44
45release-linux: bin/pomo-$(VERSION)-linux-amd64 bin/pomo-$(VERSION)-linux-amd64.md5
46
47release-darwin: bin/pomo-$(VERSION)-darwin-amd64 bin/pomo-$(VERSION)-darwin-amd64.md5
48
49release: release-linux release-darwin
50
51docs: readme
52 cd www && hugo -d ../docs
53
54readme: www/data/readme.json
55
56www/data/readme.json: www/data README.md
57 cat README.md | python -c 'import json,sys; print(json.dumps({"content": sys.stdin.read()}))' > $@
58www/data bin:
59 mkdir -p $@