github.com/motemen/ghq@v1.0.3/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 export GO111MODULE=on 8 9 .PHONY: deps 10 deps: 11 go get ${u} -d $(VERBOSE_FLAG) 12 go mod tidy 13 14 .PHONY: devel-deps 15 devel-deps: deps 16 sh -c '\ 17 tmpdir=$$(mktemp -d); \ 18 cd $$tmpdir; \ 19 go get ${u} \ 20 golang.org/x/lint/golint \ 21 github.com/Songmu/godzil/cmd/godzil \ 22 github.com/tcnksm/ghr; \ 23 rm -rf $$tmpdir' 24 25 .PHONY: test 26 test: deps 27 go test $(VERBOSE_FLAG) ./... 28 29 .PHONY: lint 30 lint: devel-deps 31 golint -set_exit_status ./... 32 33 .PHONY: build 34 build: deps 35 go build $(VERBOSE_FLAG) -ldflags=$(BUILD_LDFLAGS) 36 37 .PHONY: install 38 install: deps 39 go install $(VERBOSE_FLAG) -ldflags=$(BUILD_LDFLAGS) 40 41 .PHONY: release 42 release: devel-deps 43 godzil release 44 45 CREDITS: devel-deps go.sum 46 godzil credits -w 47 48 DIST_DIR = dist/v$(VERSION) 49 .PHONY: crossbuild 50 crossbuild: CREDITS 51 rm -rf $(DIST_DIR) 52 env CGO_ENABLED=0 godzil crossbuild -build-ldflags=$(BUILD_LDFLAGS) \ 53 -include='misc/zsh/_ghq' -z -d $(DIST_DIR) 54 cd $(DIST_DIR) && shasum $$(find * -type f -maxdepth 0) > SHASUMS 55 56 .PHONY: upload 57 upload: 58 ghr -body="$$(godzil changelog --latest -F markdown)" v$(VERSION) $(DIST_DIR)