-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy pathMakefile-help
96 lines (82 loc) · 2.63 KB
/
Makefile-help
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
# vim: set foldmethod=indent foldnestmax=1 foldcolumn=1:
# Use color in Makefiles.
_USE_COLOR ?= true
export SHELL = bash
.DEFAULT_GOAL := help
# Color vars
_help_padding = 30
_black = \033[0;30m
_red = \033[0;31m
_green = \033[0;32m
_orange = \033[0;33m
_blue = \033[0;34m
_purple = \033[0;35m
_cyan = \033[0;36m
_lt_gray = \033[0;37m
_gray = \033[1;30m
_lt_red = \033[1;31m
_lt_green = \033[1;32m
_yellow = \033[1;33m
_lt_blue = \033[1;34m
_lt_purple= \033[1;35m
_lt_cyan = \033[1;36m
_white = \033[1;37m
_reset = \033[0m
# Customize colors for 'make help'
_group ?= $(_purple)
_recipe ?= $(_green)
# Customize colors for make recipe begin/finish
_heading ?= $(_lt_purple)
# Execute commands with consistent options
_make = make --no-print-directory
_watch = watch --color -n 1 --no-title
_infinishell = term=XTERM infinishell --no-paging -u $(_IBOX_USERNAME) -p $(_IBOX_PASSWORD) $(_IBOX_HOSTNAME)
_cd-back = cd - >/dev/null
_clinn ?= kubectl
_cli ?= $(_clinn) -n $(_namespace)
_helm = helm -n $(_namespace)
# Other vars
_LEADER = "================ ["
_FOLLOWER = "] ================"
ifneq ($(_USE_COLOR),true)
# No color
_group =
_recipe =
_heading =
_reset =
endif
_begin = "$(_heading)$(_LEADER) Begin $@ $(_FOLLOWER)$(_reset)"
_finish = "$(_heading)$(_LEADER) Completed $@ $(_FOLLOWER)$(_reset)"
##@ General
.PHONY: help
help: ## Display this help.
@echo "$(_purpose)"
@awk 'BEGIN {FS = ":.*##"; printf "\nUsage:\n make $(_recipe)<recipe>$(_reset)\n"} /^[\.a-zA-Z_0-9-]+:.*?##/ { printf "$(_recipe)%-$(_help_padding)s$(_reset) %s\n", $$1, $$2 } /^##@/ { printf "\n$(_group)%s$(_reset)\n", substr($$0, 5) } ' $(MAKEFILE_LIST)
.PHONY: color-help
color-help: ## Edit Makefile-help to change color schemes.
@echo -e $(_begin)
@echo "To enable colors in make output, 'export _USE_COLOR=true' with the leading underscore"
@echo "Edit Makefile-help to change color schemes"
ifeq ($(_USE_COLOR),true)
@printf "\n\tColor is currently enabled\n\n"
else
@printf "\n\tColor is currently disabled\n\n"
endif
@echo -e $(_finish)
_go_find_ignore=.git|test|log
.PHONY: gofind
gofind: ## Search project go files using: f='search term' make gofind
@echo -e $(_begin)
find . -name "*.go" | xargs grep -n "$$f" | egrep -v '$(_go_find_ignore)'
@echo -e $(_finish)
.PHONY: gofindfunc
gofindfunc: ## Search project go files for a func using: f='search term' make gofindfunc
@echo -e $(_begin)
find . -name "*.go" | xargs grep -n "^func.*$$f" | egrep -v '$(_go_find_ignore)'
@echo -e $(_finish)
define setup_env
$(eval include ../../../Makefile-vars-git-ignored)
$(eval export)
endef
devEnv:
$(call setup_env)