VERSION ?= dev PKG := git.starwarslab.us/ATOM_IT/Deployr/internal/version COMMIT := $(shell git rev-parse --short HEAD 2>/dev/null || echo none) DATE := $(shell date -u +%Y-%m-%dT%H:%M:%SZ) LDFLAGS := -s -w -X $(PKG).Version=$(VERSION) -X $(PKG).Commit=$(COMMIT) -X $(PKG).Date=$(DATE) .PHONY: all build test vet fmt check dist clean install all: check build ## build: compile for the host platform into ./deployr build: CGO_ENABLED=0 go build -trimpath -ldflags "$(LDFLAGS)" -o deployr ./cmd/deployr ## test: run the unit tests test: go test ./... ## vet: static analysis for every supported platform vet: go vet ./... GOOS=windows GOARCH=amd64 go vet ./... GOOS=darwin GOARCH=arm64 go vet ./... GOOS=linux GOARCH=amd64 go vet ./... fmt: gofmt -l -w . ## check: fmt verification, vet and tests -- run this before pushing check: vet test @test -z "$$(gofmt -l . )" || (echo "gofmt needed:"; gofmt -l .; exit 1) ## dist: cross-compile release binaries into dist/ dist: VERSION=$(VERSION) ./scripts/build.sh ## install: install to /usr/local/bin (Unix) install: build install -m 0755 deployr /usr/local/bin/deployr clean: rm -rf dist deployr deployr.exe