Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Golang Release Makefile (Gox like with only linux utils)
BINS_DIR = bins
VERSION = $(shell git describe --tag --dirty)
SRC = $(shell find . -type f -name '*.go')
# Set the GOOS and GOARCH here in GOOS_GOARCH format
BINS_OUT = $(patsubst %, $(BINS_DIR)/$(VERSION)/jsonnet-%, $(PLATFORMS))
mkdir -p $(BINS_DIR)/$(VERSION)
$(eval BINARY = $(notdir $@))
$(eval PARTS = $(word 2, $(subst -, ,$(BINARY))))
$(eval BUILD = $(subst _, ,$(PARTS)))
CGO_ENABLED=0 GOOS=$(word 1, $(BUILD)) GOARCH=$(word 2, $(BUILD)) go build -o $@ ./cmd/jsonnet
.PHONY: release
release: $(BINS_OUT)
.PHONY: clean
rm -rf $(BINS_DIR)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.