kevinschoon-pomo/Makefile

57 lines
1.4 KiB
Makefile
Raw Normal View History

2018-01-21 16:38:17 +01:00
VERSION ?= $(shell git describe --tags 2>/dev/null)
ifeq "$(VERSION)" ""
VERSION := UNKNOWN
endif
.PHONY: \
2018-01-21 16:38:17 +01:00
all \
2018-01-22 16:07:58 +01:00
test \
docs \
2018-01-22 17:27:35 +01:00
readme \
2018-02-01 22:11:44 +01:00
release \
release-linux \
release-darwin
all: bin/pomo
clean:
2018-02-01 22:11:44 +01:00
-rm -rfv bin/* docs/*
bindata.go: tomato-icon.png
go-bindata -pkg main -o $@ $^
2018-01-21 16:38:17 +01:00
test:
go test ./...
2018-01-26 16:34:21 +01:00
go vet ./...
2018-01-21 16:38:17 +01:00
2018-02-01 22:11:44 +01:00
bin/pomo-$(VERSION)-linux-amd64: bin bindata.go
go build -ldflags "-X main.Version=$(VERSION)" -o $@
2018-02-01 21:20:22 +01:00
2018-02-01 22:11:44 +01:00
bin/pomo-$(VERSION)-linux-amd64.md5:
2018-02-01 22:27:09 +01:00
md5sum bin/pomo-$(VERSION)-linux-amd64 | sed -e 's/bin\///' > $@
2018-02-01 22:11:44 +01:00
bin/pomo-$(VERSION)-darwin-amd64: bin bindata.go
2018-02-01 21:20:22 +01:00
# This is used to cross-compile a Darwin compatible Mach-O executable
# on Linux for OSX, you need to install https://github.com/tpoechtrager/osxcross
2018-02-01 22:11:44 +01:00
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 $@
bin/pomo-$(VERSION)-darwin-amd64.md5:
2018-02-01 22:27:09 +01:00
md5sum bin/pomo-$(VERSION)-darwin-amd64 | sed -e 's/bin\///' > $@
2018-02-01 22:11:44 +01:00
2018-02-01 22:16:55 +01:00
release-linux: bin/pomo-$(VERSION)-linux-amd64 bin/pomo-$(VERSION)-linux-amd64.md5
2018-02-01 22:11:44 +01:00
2018-02-01 22:16:55 +01:00
release-darwin: bin/pomo-$(VERSION)-darwin-amd64 bin/pomo-$(VERSION)-darwin-amd64.md5
2018-02-01 21:20:22 +01:00
2018-02-01 22:11:44 +01:00
release: release-linux release-darwin
2018-01-22 15:59:03 +01:00
2018-01-22 17:27:35 +01:00
docs: readme
2018-01-22 16:07:58 +01:00
cd www && hugo -d ../docs
readme: www/data/readme.json
www/data/readme.json: www/data README.md
cat README.md | python -c 'import json,sys; print(json.dumps({"content": sys.stdin.read()}))' > $@
www/data bin:
mkdir -p $@