github.com/x-motemen/ghq@v1.6.1/Makefile (about) 1 VERSION = $(shell godzil show-version) 2 CURRENT_REVISION = $(shell git rev-parse --short HEAD) 3 BUILD_LDFLAGS = "-s -w -X main.revision=$(CURRENT_REVISION)" 4 VERBOSE_FLAG = $(if $(VERBOSE),-v) 5 u := $(if $(update),-u) 6 7 .PHONY: deps 8 deps: 9 go get ${u} -d $(VERBOSE_FLAG) 10 go mod tidy 11 12 .PHONY: devel-deps 13 devel-deps: deps 14 go install github.com/Songmu/godzil/cmd/godzil@latest 15 go install github.com/tcnksm/ghr@latest 16 go install honnef.co/go/tools/cmd/staticcheck@latest 17 18 .PHONY: test 19 test: deps 20 go test $(VERBOSE_FLAG) ./... 21 22 .PHONY: lint 23 lint: devel-deps 24 staticcheck ./... 25 26 .PHONY: build 27 build: deps 28 go build $(VERBOSE_FLAG) -ldflags=$(BUILD_LDFLAGS) 29 30 .PHONY: install 31 install: deps 32 go install $(VERBOSE_FLAG) -ldflags=$(BUILD_LDFLAGS) 33 34 .PHONY: release 35 release: devel-deps 36 godzil release 37 38 CREDITS: devel-deps go.sum 39 godzil credits -w 40 41 DIST_DIR = dist/v$(VERSION) 42 .PHONY: crossbuild 43 crossbuild: CREDITS 44 rm -rf $(DIST_DIR) 45 env CGO_ENABLED=0 godzil crossbuild -build-ldflags=$(BUILD_LDFLAGS) \ 46 -include='misc/bash/_ghq','misc/zsh/_ghq' -z -d $(DIST_DIR) 47 cd $(DIST_DIR) && shasum $$(find * -type f -maxdepth 0) > SHASUMS 48 49 .PHONY: upload 50 upload: 51 ghr -body="$$(godzil changelog --latest -F markdown)" v$(VERSION) $(DIST_DIR)