Permalink
Cannot retrieve contributors at this time
31 lines (26 sloc)
1.18 KB
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Version := $(shell git describe --tags --dirty) | |
# Version := "dev" | |
GitCommit := $(shell git rev-parse HEAD) | |
LDFLAGS := "-s -w -X github.com/alexellis/k3sup/cmd.Version=$(Version) -X github.com/alexellis/k3sup/cmd.GitCommit=$(GitCommit)" | |
export GO111MODULE=on | |
SOURCE_DIRS = cmd pkg main.go | |
.PHONY: all | |
all: gofmt test dist hash | |
.PHONY: test | |
test: | |
CGO_ENABLED=0 go test $(shell go list ./... | grep -v /vendor/|xargs echo) -cover | |
.PHONY: gofmt | |
gofmt: | |
@test -z $(shell gofmt -l -s $(SOURCE_DIRS) ./ | tee /dev/stderr) || (echo "[WARN] Fix formatting issues with 'make fmt'" && exit 1) | |
.PHONY: dist | |
dist: | |
mkdir -p bin/ | |
rm -rf bin/k3sup* | |
CGO_ENABLED=0 GOOS=linux go build -a -ldflags $(LDFLAGS) -installsuffix cgo -o bin/k3sup | |
CGO_ENABLED=0 GOOS=darwin go build -a -ldflags $(LDFLAGS) -installsuffix cgo -o bin/k3sup-darwin | |
GOARM=6 GOARCH=arm CGO_ENABLED=0 GOOS=linux go build -a -ldflags $(LDFLAGS) -installsuffix cgo -o bin/k3sup-armhf | |
GOARCH=arm64 CGO_ENABLED=0 GOOS=linux go build -a -ldflags $(LDFLAGS) -installsuffix cgo -o bin/k3sup-arm64 | |
GOOS=windows CGO_ENABLED=0 go build -a -ldflags $(LDFLAGS) -installsuffix cgo -o bin/k3sup.exe | |
.PHONY: hash | |
hash: | |
rm -rf bin/*.sha256 && ./hack/hashgen.sh |