github.com/creativeprojects/go-selfupdate@v1.2.0/Makefile (about) 1 # 2 # Makefile for go-selfupdate 3 # 4 GOCMD=go 5 GOBUILD=$(GOCMD) build 6 GOINSTALL=$(GOCMD) install 7 GORUN=$(GOCMD) run 8 GOCLEAN=$(GOCMD) clean 9 GOTEST=$(GOCMD) test 10 GOTOOL=$(GOCMD) tool 11 GOGET=$(GOCMD) get 12 GOPATH?=`$(GOCMD) env GOPATH` 13 14 TESTS=. ./update 15 COVERAGE_FILE=coverage.out 16 17 BUILD_DATE=`date` 18 BUILD_COMMIT=`git rev-parse HEAD` 19 20 README=README.md 21 TOC_START=<\!--ts--> 22 TOC_END=<\!--te--> 23 TOC_PATH=toc.md 24 25 .PHONY: all test build coverage full-coverage clean toc 26 27 all: test build 28 29 build: 30 $(GOBUILD) -v ./... 31 32 test: 33 $(GOTEST) -race -v $(TESTS) 34 35 coverage: 36 $(GOTEST) -short -coverprofile=$(COVERAGE_FILE) $(TESTS) 37 $(GOTOOL) cover -html=$(COVERAGE_FILE) 38 39 full-coverage: 40 $(GOTEST) -coverprofile=$(COVERAGE_FILE) $(TESTS) 41 $(GOTOOL) cover -html=$(COVERAGE_FILE) 42 43 clean: 44 rm detect-latest-release go-get-release coverage.out 45 $(GOCLEAN) 46 47 toc: 48 @echo "[*] $@" 49 $(GOINSTALL) github.com/ekalinin/github-markdown-toc.go/cmd/gh-md-toc@latest 50 cat ${README} | gh-md-toc --hide-footer > ${TOC_PATH} 51 sed -i ".1" "/${TOC_START}/,/${TOC_END}/{//!d;}" "${README}" 52 sed -i ".2" "/${TOC_START}/r ${TOC_PATH}" "${README}" 53 rm ${README}.1 ${README}.2 ${TOC_PATH}