makefile: apply version, compress artefacts, trim gopath from release binaries
This commit is contained in:
parent
a36a293dfa
commit
5667bd6cbb
37
Makefile
37
Makefile
@ -1,24 +1,39 @@
|
|||||||
.PHONY: all clean
|
.PHONY: all clean
|
||||||
|
|
||||||
OBJS := $(addprefix webcmd.,linux64 linux32 win64 win32)
|
VERSION := 1.0.0
|
||||||
|
|
||||||
|
OBJS := webcmd-$(VERSION)-linux64.tar.xz \
|
||||||
|
webcmd-$(VERSION)-linux32.tar.xz \
|
||||||
|
webcmd-$(VERSION)-win64.zip \
|
||||||
|
webcmd-$(VERSION)-win32.zip
|
||||||
|
|
||||||
|
XZ_OPTS=-9
|
||||||
|
|
||||||
all: $(OBJS)
|
all: $(OBJS)
|
||||||
|
|
||||||
define compile
|
define compilelinux
|
||||||
/bin/bash -c 'GOARCH=$(1) GOOS=$(2) go build -o ./webcmd.$(3) -ldflags "-s -w" ./cmd/webcmd'
|
/bin/bash -c 'GOARCH=$(1) GOOS=linux go build -a -o ./webcmd -ldflags "-s -w -X code.ivysaur.me/webcmd.APP_VERSION=$(VERSION)" -gcflags "-trimpath=$(GOPATH)" ./cmd/webcmd'
|
||||||
|
tar caf webcmd-$(2)-$(VERSION).tar.xz webcmd -C cmd/webcmd webcmd.conf-sample --owner=0 --group=0
|
||||||
|
rm webcmd
|
||||||
endef
|
endef
|
||||||
|
|
||||||
webcmd.linux64:
|
define compilewin
|
||||||
$(call compile,amd64,linux,linux64)
|
/bin/bash -c 'GOARCH=$(1) GOOS=windows go build -a -o ./webcmd -ldflags "-s -w -X code.ivysaur.me/webcmd.APP_VERSION=$(VERSION)" -gcflags "-trimpath=$(GOPATH)" ./cmd/webcmd'
|
||||||
|
zip -j webcmd-$(2)-$(VERSION).zip webcmd cmd/webcmd/webcmd.conf-sample
|
||||||
|
rm webcmd
|
||||||
|
endef
|
||||||
|
|
||||||
webcmd.linux32:
|
webcmd-$(VERSION)-linux64.tar.xz:
|
||||||
$(call compile,386,linux,linux32)
|
$(call compilelinux,amd64,linux64)
|
||||||
|
|
||||||
webcmd.win64:
|
webcmd-$(VERSION)-linux32.tar.xz:
|
||||||
$(call compile,amd64,windows,win64)
|
$(call compilelinux,386,linux32)
|
||||||
|
|
||||||
webcmd.win32:
|
webcmd-$(VERSION)-win64.zip:
|
||||||
$(call compile,386,windows,win32)
|
$(call compilewin,amd64,win64)
|
||||||
|
|
||||||
|
webcmd-$(VERSION)-win32.zip:
|
||||||
|
$(call compilewin,386,win32)
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
rm $(OBJS)
|
rm $(OBJS)
|
Loading…
Reference in New Issue
Block a user