-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathbase.mk
62 lines (47 loc) · 1.23 KB
/
base.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
# public variables that can be changed by projects
BUILD_DIR ?= .build
COVERAGE_DIR ?= $(BUILD_DIR)/coverage
# _DEFAULT_BUILD_TARGETS can be modified by sub-makefiles to add additional "default" behaviour
# when you run `make`
_DEFAULT_BUILD_TARGETS = build
.DEFAULT_GOAL = default
.PHONY: default
default:
make $(_DEFAULT_BUILD_TARGETS)
.PHONY: verify
verify: lint test cover
$(BUILD_DIR) $(COVERAGE_DIR):
mkdir -p $@
# We define a buch of internal make targets prefixed with '_'; these all use the double-colon
# syntax to allow us to add new commands to them in other *internal* makefiles. They're not
# intended to be modified or overwritten in project-specific makefiles. Each of these
# are pre-requisites for the "public" targets, which have the same name without the underscore
.PHONY: _setup
_setup::
pre-commit install
.PHONY: _lint
_lint::
pre-commit run --all
.PHONY: _test
_test:: | $(COVERAGE_DIR)
rm -rf $(COVERAGE_DIR)/*
.PHONY: _cover
_cover::
.PHONY: _build
_build:: | $(BUILD_DIR)
.PHONY: _clean
_clean::
rm -rf $(BUILD_DIR)
# Public targets defined below
.PHONY: setup
setup: _setup
.PHONY: lint
lint: _lint
.PHONY: test
test: _test
.PHONY: cover
cover: _cover
.PHONY: build
build: _build
.PHONY: clean
clean: _clean