webcmd/Makefile

40 lines
1.1 KiB
Makefile
Raw Permalink Normal View History

2017-03-25 02:41:36 +00:00
.PHONY: all clean
2017-03-27 08:53:01 +00:00
VERSION := 1.0.2
OBJS := webcmd-$(VERSION)-linux64.tar.xz \
webcmd-$(VERSION)-linux32.tar.xz \
webcmd-$(VERSION)-win64.zip \
webcmd-$(VERSION)-win32.zip
XZ_OPTS=-9
2017-03-25 02:41:36 +00:00
all: $(OBJS)
define compilelinux
/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
define compilewin
/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
2017-03-25 02:41:36 +00:00
endef
webcmd-$(VERSION)-linux64.tar.xz:
$(call compilelinux,amd64,linux64)
2017-03-25 02:41:36 +00:00
webcmd-$(VERSION)-linux32.tar.xz:
$(call compilelinux,386,linux32)
2017-03-25 02:41:36 +00:00
webcmd-$(VERSION)-win64.zip:
$(call compilewin,amd64,win64)
2017-03-25 02:41:36 +00:00
webcmd-$(VERSION)-win32.zip:
$(call compilewin,386,win32)
2017-03-25 02:41:36 +00:00
clean:
rm $(OBJS)