improve build support

This commit is contained in:
Kevin Schoon 2018-02-01 16:11:44 -05:00
parent 06bec467f1
commit 5b39aa365e
3 changed files with 22 additions and 7 deletions

3
.gitignore vendored
View File

@ -25,7 +25,8 @@ _testmain.go
*.swp *.swp
bin/ bin/*
!bin/.gitkeep
www/public/ www/public/
www/data/ www/data/

View File

@ -8,12 +8,14 @@ endif
test \ test \
docs \ docs \
readme \ readme \
release release \
release-linux \
release-darwin
all: bin/pomo all: bin/pomo
clean: clean:
-rm -fv bin/* docs/* -rm -rfv bin/* docs/*
bindata.go: tomato-icon.png bindata.go: tomato-icon.png
go-bindata -pkg main -o $@ $^ go-bindata -pkg main -o $@ $^
@ -22,15 +24,27 @@ test:
go test ./... go test ./...
go vet ./... go vet ./...
release-linux: bin bindata.go bin/pomo-$(VERSION)-linux-amd64: bin bindata.go
go build -ldflags "-X main.Version=$(VERSION)" -o bin/pomo-$(VERSION)-linux-amd64 go build -ldflags "-X main.Version=$(VERSION)" -o $@
release-osx: bin bindata.go bin/pomo-$(VERSION)-linux-amd64.md5:
md5sum bin/pomo-$(VERSION)-linux-amd64 > $@
bin/pomo-$(VERSION)-darwin-amd64: bin bindata.go
# This is used to cross-compile a Darwin compatible Mach-O executable # 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 # on Linux for OSX, you need to install https://github.com/tpoechtrager/osxcross
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 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:
md5sum bin/pomo-$(VERSION)-darwin-amd64 > $@
release-linux: bin/pomo-$(VERSION)-linux-amd64 bin/pomo-$(VERSION)-linux-amd64
release-darwin: bin/pomo-$(VERSION)-darwin-amd64 bin/pomo-$(VERSION)-darwin-amd64
release: release-linux release-darwin
docs: readme docs: readme
cd www && hugo -d ../docs cd www && hugo -d ../docs

0
bin/.gitkeep Normal file
View File