feat: makefile release compression

The `Makefile` `build-release` target now zips all executables after
compilation.
This commit is contained in:
Chris Lane 2020-01-20 13:54:53 -05:00
parent 91f0d02de2
commit 126231db1f
1 changed files with 6 additions and 3 deletions

View File

@ -16,6 +16,7 @@ RM := rm
SCC := scc SCC := scc
SED := sed SED := sed
SORT := sort SORT := sort
ZIP := zip -m
# build flags # build flags
BUILD_FLAGS := -ldflags="-s -w" -mod vendor BUILD_FLAGS := -ldflags="-s -w" -mod vendor
@ -60,9 +61,11 @@ generate:
.PHONY: $(RELEASES) .PHONY: $(RELEASES)
$(RELEASES): clean generate check $(RELEASES): clean generate check
ifeq ($(arch),arm) ifeq ($(arch),arm)
GOARCH=$(arch) GOOS=$(os) GOARM=$(arm) $(GO) build $(BUILD_FLAGS) -o $(dist_dir)/$(bin) $(cmd_dir) GOARCH=$(arch) GOOS=$(os) GOARM=$(arm) $(GO) build $(BUILD_FLAGS) -o $(dist_dir)/$(bin) $(cmd_dir) && \
$(ZIP) $(dist_dir)/$(bin).zip $(dist_dir)/$(bin)
else else
GOARCH=$(arch) GOOS=$(os) $(GO) build $(BUILD_FLAGS) -o $(dist_dir)/$(bin) $(cmd_dir) GOARCH=$(arch) GOOS=$(os) $(GO) build $(BUILD_FLAGS) -o $(dist_dir)/$(bin) $(cmd_dir) && \
$(ZIP) $(dist_dir)/$(bin).zip $(dist_dir)/$(bin)
endif endif
## install: builds and installs cheat on your PATH ## install: builds and installs cheat on your PATH
@ -111,7 +114,7 @@ fmt:
## lint: lints go source files ## lint: lints go source files
.PHONY: lint .PHONY: lint
lint: lint:
$(LINT) -exclude $(root_dir)/vendor/... $(root_dir)/... $(LINT) -exclude $(root_dir)/vendor/... $(root_dir)/... && \
$(GO) vet $(root_dir)/... $(GO) vet $(root_dir)/...
## test: runs unit-tests ## test: runs unit-tests