-
Notifications
You must be signed in to change notification settings - Fork 0
/
standard.mk
123 lines (97 loc) · 3.38 KB
/
standard.mk
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
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
##
# Default Makefile Settings
# These will run by default, unless the Makefile re-defines them.
#
# Helpful links:
#
# * https://makefiletutorial.com
# * https://stackoverflow.com/questions/11958626/make-file-warning-overriding-commands-for-target/49804748
# * https://www.gnu.org/software/make/manual/html_node/Make-Control-Functions.html
##
# Shell
SHELL:=bash
# Color stuff
HASH := \#
FOREGROUND:=$(HASH)FFFC67
YELLOW:=gum style --foreground='$(FOREGROUND)' --bold
WHITE:=gum style --bold
ERROR:=gum style --foreground='$(HASH)FFFFFF' --background='$(HASH)CC0000' --bold --padding='0 1'
BORDER:=gum style --foreground='$(HASH)FFFFFF' --border='rounded' --border-foreground='240' --padding='0 1' --margin='1 0'
HEADER:=gum style --foreground='$(FOREGROUND)' --border='rounded' --border-foreground='12' --bold --width='78' --padding='0 1' --margin='1 0 0 0'
# Tooling
GO=$(shell which go)
NEXT_VERSION ?= $(shell git cliff --bump --unreleased --context | jq -r .[0].version)
#-------------------------------------------------------------------------------
# Running `make` will show the list of subcommands that will run.
all: help
.PHONY: help
## help: [help]* Prints this help message.
help:
@ $(WHITE) "Usage:"
@ echo ""
@ sed -n 's/^##//p' ${MAKEFILE_LIST} | column -t -s ':' | sed -e 's/^/ /' | \
while IFS= read -r line; do \
if [[ "$$line" == *"]*"* ]]; then \
$(YELLOW) "$$line"; \
else \
echo "$$line"; \
fi; \
done | LC_ALL=C sort --ignore-nonprinting --stable --ignore-leading-blanks --field-separator=' ' --key=4
#-------------------------------------------------------------------------------
# Checks
.PHONY: __req-on-host
__req-on-host:
@ if [[ -f /.dockerenv ]]; then $(ERROR) "This command MUST be run on the host environment."; exit 1; fi
.PHONY: __req-inside-image
__req-inside-image:
@ if [[ ! -f /.dockerenv ]]; then $(ERROR) "This command MUST be run inside the development environment."; exit 1; fi
#-------------------------------------------------------------------------------
# Mac-specific functions
.PHONY: clean-ds
## clean-ds: [host] Clean .DS_Store files.
clean-ds:
@ $(HEADER) "=====> Cleaning .DS_Store files..."
find . -type f -name ".DS_Store" | xargs -I% rm -fv "%"
#-------------------------------------------------------------------------------
# Default functions that should be overwritten as appropriate in local Makefiles
%: %-default
@ true
.PHONY: clean-default
clean-default:
@ $(ERROR) "No 'clean' task defined."
.PHONY: docs-default
docs-default:
@ $(ERROR) "No 'docs' task defined."
.PHONY: lint-default
lint-default:
@ $(ERROR) "No 'lint' task defined."
.PHONY: test-default
test-default:
@ $(ERROR) "No 'test' task defined."
.PHONY: list-tests-default
list-tests-default:
@ $(ERROR) "No 'list-tests' task defined."
.PHONY: acc-default
acc-default:
@ $(ERROR) "No 'acc' task defined."
.PHONY: unit-default
unit-default:
@ $(ERROR) "No 'unit' task defined."
.PHONY: mutate-default
mutate-default:
@ $(ERROR) "No 'mutate' task defined."
.PHONY: terratest-default
terratest-default:
@ $(ERROR) "No 'terratest' task defined."
.PHONY: examples-default
examples-default:
@ $(ERROR) "No 'examples' task defined."
.PHONY: fuzz-default
fuzz-default:
@ $(ERROR) "No 'fuzz' task defined."
.PHONY: quickbench-default
quickbench-default:
@ $(ERROR) "No 'quickbench' task defined."
.PHONY: bench-default
bench-default:
@ $(ERROR) "No 'bench' task defined."