-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
38 lines (30 loc) · 1.29 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
# This Makefile implements basic build and test actions for the ubntc/go projects.
.PHONY: ⚙️
MODULES = $(shell find . -name go.mod | xargs dirname)
PACKAGES = internal/errchan cli playground batching/batsub batching/batbq metrics
TARGETS = cli batching/batsub batching/batbq metrics
help: ⚙️
# usage: make TARGET PACKAGES="dir1 dir2 ..."
# targets:
#
# test run tests for PACKAGES=$(PACKAGES)
# cover check and update test coverage for PACKAGES=$(PACKAGES)
# tidy run go mod tidy for MODULES=$(MODULES)
# make run `make` in subdirs for TARGETS=$(TARGETS)
debug: GOTEST_ARGS=-v
debug: ⚙️ test
test: ⚙️ $(addsuffix -test, $(PACKAGES))
cover: ⚙️ $(addsuffix -cover, $(PACKAGES))
make: ⚙️ $(addsuffix -make, $(TARGETS))
tag: ⚙️ $(addsuffix -tag, $(TARGETS))
refresh: ⚙️ $(addsuffix -refresh, $(TARGETS))
tidy: ⚙️ $(addsuffix -tidy, $(MODULES))
go work sync
# Generic package testing and coverage
%-test: %; GOTEST_ARGS="$(GOTEST_ARGS)" scripts/test.sh $*
%-cover: %; GOTEST_ARGS="$(GOTEST_ARGS)" scripts/cover.sh $*
%-tidy: %; cd $* && go mod tidy
# Generic build targets and version management
%-make: %; $(MAKE) -C $*
%-tag: %; # TODO: use bumpversion tool + push it
%-refresh: %; scripts/version.sh $*