1
0
mirror of https://github.com/schollz/cowyo.git synced 2023-08-10 21:13:00 +03:00

Remove unused cgo and split debug/non-debug asset builds

It's now much harder to accidentally build a release with debug or old assets.
This commit is contained in:
Daniel Heath
2018-02-16 10:52:06 +11:00
parent dfd9aea863
commit db48f1291b
4 changed files with 1208 additions and 13 deletions

View File

@@ -2,39 +2,49 @@
# make -j4 release
VERSION=$(shell git describe)
LDFLAGS=-ldflags "-s -w -X main.version=${VERSION} -X main.hotCodeReloading=false" -a -installsuffix cgo
LDFLAGS=-ldflags "-X main.version=${VERSION}"
.PHONY: build
build:
go-bindata static/... templates/...
build: bindata.go
go build ${LDFLAGS}
STATICFILES := $(wildcard static/*)
TEMPLATES := $(wildcard templates/*)
bindata.go: $(STATICFILES) $(TEMPLATES)
go-bindata -tags '!debug' static/... templates/...
bindata-debug.go: $(STATICFILES) $(TEMPLATES)
go-bindata -tags 'debug' -o bindata-debug.go -debug static/... templates/...
.PHONY: devel
devel: bindata-debug.go
go build -tags debug
.PHONY: quick
quick:
go-bindata -debug static/... templates/...
go build -ldflags "-X main.hotCodeReloading=true"
quick: bindata.go
go build
.PHONY: linuxarm
linuxarm:
linuxarm: bindata.go
env GOOS=linux GOARCH=arm go build ${LDFLAGS} -o dist/cowyo_linux_arm
#cd dist && upx --brute cowyo_linux_arm
.PHONY: linux32
linux32:
linux32: bindata.go
env GOOS=linux GOARCH=386 go build ${LDFLAGS} -o dist/cowyo_linux_32bit
#cd dist && upx --brute cowyo_linux_32bit
.PHONY: linux64
linux64:
linux64: bindata.go
env GOOS=linux GOARCH=amd64 go build ${LDFLAGS} -o dist/cowyo_linux_amd64
.PHONY: windows
windows:
windows: bindata.go
env GOOS=windows GOARCH=amd64 go build ${LDFLAGS} -o dist/cowyo_windows_amd64.exe
#cd dist && upx --brute cowyo_windows_amd64.exe
.PHONY: osx
osx:
osx: bindata.go
env GOOS=darwin GOARCH=amd64 go build ${LDFLAGS} -o dist/cowyo_osx_amd64
#cd dist && upx --brute cowyo_osx_amd64