2019-03-17 20:10:28 +01:00
|
|
|
DOCKER_CMD=docker run --rm -ti --user 1000 -w /build/pomo -v $$PWD:/build/pomo
|
|
|
|
DOCKER_IMAGE=pomo-build
|
2018-01-21 16:38:17 +01:00
|
|
|
VERSION ?= $(shell git describe --tags 2>/dev/null)
|
|
|
|
ifeq "$(VERSION)" ""
|
|
|
|
VERSION := UNKNOWN
|
|
|
|
endif
|
2018-01-21 11:35:03 +01:00
|
|
|
|
|
|
|
.PHONY: \
|
2018-01-22 16:07:58 +01:00
|
|
|
test \
|
|
|
|
docs \
|
2019-03-17 20:10:28 +01:00
|
|
|
pomo-build \
|
2018-01-22 17:27:35 +01:00
|
|
|
readme \
|
2018-02-01 22:11:44 +01:00
|
|
|
release \
|
|
|
|
release-linux \
|
|
|
|
release-darwin
|
2018-01-21 11:35:03 +01:00
|
|
|
|
2018-07-12 21:04:02 +02:00
|
|
|
bin/pomo: test
|
|
|
|
go build -o $@
|
|
|
|
|
2018-02-01 10:20:12 +01:00
|
|
|
bindata.go: tomato-icon.png
|
|
|
|
go-bindata -pkg main -o $@ $^
|
2018-01-21 11:35:03 +01:00
|
|
|
|
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
|
|
|
|
2019-03-17 20:10:28 +01:00
|
|
|
pomo-build:
|
|
|
|
docker build -t $(DOCKER_IMAGE) .
|
|
|
|
|
|
|
|
bin/pomo-linux: bin/pomo-$(VERSION)-linux-amd64
|
|
|
|
|
|
|
|
bin/pomo-darwin: bin/pomo-$(VERSION)-darwin-amd64
|
|
|
|
|
2018-02-01 22:11:44 +01:00
|
|
|
bin/pomo-$(VERSION)-linux-amd64: bin bindata.go
|
2019-03-17 20:10:28 +01:00
|
|
|
$(DOCKER_CMD) --env GOOS=linux --env GOARCH=amd64 $(DOCKER_IMAGE) 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
|
2019-03-17 20:10:28 +01:00
|
|
|
# This is used to cross-compile a Darwin compatible Mach-O executable
|
2018-02-01 21:20:22 +01:00
|
|
|
# on Linux for OSX, you need to install https://github.com/tpoechtrager/osxcross
|
2019-03-17 20:10:28 +01:00
|
|
|
$(DOCKER_CMD) --env GOOS=darwin --env GOARCH=amd64 --env CC=x86_64-apple-darwin15-cc --env CGO_ENABLED=1 $(DOCKER_IMAGE) go build -ldflags "-X main.Version=$(VERSION)" -o $@
|
2018-02-01 22:11:44 +01:00
|
|
|
|
|
|
|
|
|
|
|
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
|
|
|
|
2019-02-10 21:39:45 +01:00
|
|
|
docs: www/data/readme.json
|
|
|
|
cd www && cp ../install.sh static/ && hugo -d ../docs
|
2018-02-01 10:00:51 +01:00
|
|
|
|
2018-02-01 10:10:24 +01:00
|
|
|
www/data/readme.json: www/data README.md
|
2018-02-01 10:13:39 +01:00
|
|
|
cat README.md | python -c 'import json,sys; print(json.dumps({"content": sys.stdin.read()}))' > $@
|
2019-02-10 21:39:45 +01:00
|
|
|
|
2018-02-01 10:06:05 +01:00
|
|
|
www/data bin:
|
2018-02-01 10:00:51 +01:00
|
|
|
mkdir -p $@
|