-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
79 lines (63 loc) · 1.9 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
# Makefile adapted from https://github.com/thockin/go-build-template
# Released under the Apache-2.0 license.
DBG_MAKEFILE ?=
ifeq ($(DBG_MAKEFILE),1)
$(warning ***** starting Makefile for goal(s) "$(MAKECMDGOALS)")
$(warning ***** $(shell date))
else
# If we're not debugging the Makefile, don't echo recipes.
MAKEFLAGS += -s
endif
VERSION ?= "0.0.0-$(shell git log -n 1 --pretty=format:%h 2>/dev/null || printf "0000000")"
OS := $(if $(GOOS),$(GOOS),$(shell go env GOOS))
ARCH := $(if $(GOARCH),$(GOARCH),$(shell go env GOARCH))
DBG ?=
# We don't need make's built-in rules.
MAKEFLAGS += --no-builtin-rules
# Be pedantic about undefined variables.
MAKEFLAGS += --warn-undefined-variables
OS := $(if $(GOOS),$(GOOS),$(shell go env GOOS))
ARCH := $(if $(GOARCH),$(GOARCH),$(shell go env GOARCH))
TAG := $(VERSION)__$(OS)_$(ARCH)
GOBIN ?= "go"
GOFLAGS ?=
HTTP_PROXY ?=
HTTPS_PROXY ?=
default: verify
test: # @HELP run tests
test:
./scripts/test.sh
lint: # @HELP run code linting
lint:
./scripts/lint.sh
format: # @HELP format code
format:
./scripts/format.sh
verify: # @HELP run tests and code linting
verify: lint test
install: # @HELP build and install from current code
install:
OS=$(OS) ARCH=$(ARCH) VERSION=$(VERSION) ./scripts/install.sh
next-version: # @HELP determine the next semantic release version
next-version:
$(GOBIN) run github.com/caarlos0/svu@latest next
clean: # @HELP remove build artifacts
clean:
rm -rf ./bin
rm -rf ./dist
help: # @HELP prints this message
help:
echo "VARIABLES:"
echo " VERSION = $(VERSION)"
echo " OS = $(OS)"
echo " ARCH = $(ARCH)"
echo " GOBIN = $(GOBIN)"
echo " GOFLAGS = $(GOFLAGS)"
echo " DBG = $(DBG)"
echo
echo "TARGETS:"
grep -E '^.*: *# *@HELP' $(MAKEFILE_LIST) \
| awk ' \
BEGIN {FS = ": *# *@HELP"}; \
{ printf " %-30s %s\n", $$1, $$2 }; \
'