-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
99 lines (71 loc) · 2.85 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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
################################################################################
# This Makefile generated by GoMakeGen 2.2.0 using next command:
# gomakegen --mod .
#
# More info: https://kaos.sh/gomakegen
################################################################################
export GO111MODULE=on
ifdef VERBOSE ## Print verbose information (Flag)
VERBOSE_FLAG = -v
endif
MAKEDIR = $(dir $(realpath $(firstword $(MAKEFILE_LIST))))
GITREV ?= $(shell test -s $(MAKEDIR)/.git && git rev-parse --short HEAD)
################################################################################
.DEFAULT_GOAL := help
.PHONY = fmt vet all clean deps update init vendor mod-init mod-update mod-download mod-vendor help
################################################################################
all: init-exporter-converter ## Build all binaries
init-exporter-converter:
go build $(VERBOSE_FLAG) -ldflags="-X main.gitrev=$(GITREV)" init-exporter-converter.go
install: ## Install all binaries
cp init-exporter-converter /usr/bin/init-exporter-converter
uninstall: ## Uninstall all binaries
rm -f /usr/bin/init-exporter-converter
init: mod-init ## Initialize new module
deps: mod-download ## Download dependencies
update: mod-update ## Update dependencies to the latest versions
vendor: mod-vendor ## Make vendored copy of dependencies
mod-init:
ifdef MODULE_PATH ## Module path for initialization (String)
go mod init $(MODULE_PATH)
else
go mod init
endif
ifdef COMPAT ## Compatible Go version (String)
go mod tidy $(VERBOSE_FLAG) -compat=$(COMPAT)
else
go mod tidy $(VERBOSE_FLAG)
endif
mod-update:
ifdef UPDATE_ALL ## Update all dependencies (Flag)
go get -u $(VERBOSE_FLAG) all
else
go get -u $(VERBOSE_FLAG) ./...
endif
ifdef COMPAT
go mod tidy $(VERBOSE_FLAG) -compat=$(COMPAT)
else
go mod tidy $(VERBOSE_FLAG)
endif
test -d vendor && rm -rf vendor && go mod vendor $(VERBOSE_FLAG) || :
mod-download:
go mod download
mod-vendor:
rm -rf vendor && go mod vendor $(VERBOSE_FLAG)
fmt: ## Format source code with gofmt
find . -name "*.go" -exec gofmt -s -w {} \;
vet: ## Runs 'go vet' over sources
go vet -composites=false -printfuncs=LPrintf,TLPrintf,TPrintf,log.Debug,log.Info,log.Warn,log.Error,log.Critical,log.Print ./...
clean: ## Remove generated files
rm -f init-exporter-converter
help: ## Show this info
@echo -e '\n\033[1mTargets:\033[0m\n'
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) \
| awk 'BEGIN {FS = ":.*?## "}; {printf " \033[33m%-25s\033[0m %s\n", $$1, $$2}'
@echo -e '\n\033[1mVariables:\033[0m\n'
@grep -E '^ifdef [A-Z_]+ .*?## .*$$' $(abspath $(lastword $(MAKEFILE_LIST))) \
| sed 's/ifdef //' \
| awk 'BEGIN {FS = " .*?## "}; {printf " \033[32m%-14s\033[0m %s\n", $$1, $$2}'
@echo -e ''
@echo -e '\033[90mGenerated by GoMakeGen 2.2.0\033[0m\n'
################################################################################