From 154789606e9dc7e484de616646db762c73f81be5 Mon Sep 17 00:00:00 2001 From: Tomohiro Taira Date: Tue, 10 Dec 2019 18:40:14 +0900 Subject: [PATCH] Update Makefile --- Makefile | 35 ++++++++++++++++++++--------------- 1 file changed, 20 insertions(+), 15 deletions(-) diff --git a/Makefile b/Makefile index 79da57a..d823890 100644 --- a/Makefile +++ b/Makefile @@ -1,16 +1,17 @@ # Project information -OWNER = "tomohiro" -PACKAGE = $(shell basename $(PWD)) -VERSION = $(shell git describe --abbrev=0 --tags) +OWNER := tomohiro +PACKAGE := $(shell basename $(PWD)) +VERSION := $(shell git describe --abbrev=0 --tags) # Build information -DIST_DIR = $(PWD)/dist -ASSETS_DIR = $(DIST_DIR)/$(VERSION) -XC_OS = "linux darwin" -XC_ARCH = "386 amd64" -BUILD_FLAGS = "-w -s" +DIST_DIR := $(PWD)/dist +ASSETS_DIR := $(DIST_DIR)/$(VERSION) +XC_OS := "linux darwin" +XC_ARCH := "386 amd64" +BUILD_FLAGS := "-w -s" # Tasks +.PHONY: help help: @echo "Please type: make [target]" @echo " setup Setup development environment" @@ -23,46 +24,50 @@ help: @echo " clean Clean assets" @echo " help Show this help messages" +.PHONY: setup setup: @echo "===> Setup development tools..." - - # goxz - Just do cross building and archiving go tools conventionally + # Install goxz - Just do cross building and archiving go tools conventionally GO111MODULE=off go get -u github.com/Songmu/goxz/cmd/goxz - - # ghr - Upload multiple artifacts to GitHub Release in parallel + # Install ghr - Upload multiple artifacts to GitHub Release in parallel GO111MODULE=off go get -u github.com/tcnksm/ghr +.PHONY: deps deps: @echo "===> Installing runtime dependencies..." go mod download +.PHONY: updatedeps updatedeps: @echo "===> Updating runtime dependencies..." go get -u +.PHONY: lint lint: deps @echo "===> Running lint..." go vet ./... golint -set_exit_status ./... +.PHONY: test test: deps @echo "===> Running tests..." go test -v -cover ./... +.PHONY: dist dist: deps @echo "===> Shipping packages as release assets..." - goxz -d $(ASSETS_DIR) -z -os $(XC_OS) -arch $(XC_ARCH) --build-ldflags=$(BUILD_LDFLAGS) + goxz -z -d $(ASSETS_DIR) -os $(XC_OS) -arch $(XC_ARCH) --build-ldflags=$(BUILD_FLAGS) pushd $(ASSETS_DIR); \ shasum -a 256 *.zip > ./$(VERSION)_SHA256SUMS; \ popd +.PHONY: release release: @echo "===> Publishing release assets to GitHub..." ghr -u $(OWNER) -r $(PACKAGE) $(VERSION) $(ASSETS_DIR) +.PHONY: clean clean: @echo "===> Cleaning assets..." go clean rm -rf $(DIST_DIR) - -.PHONY: help setup deps updatedeps test dist release clean