-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
61 lines (41 loc) · 1.08 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
GOLANGCI_LINT_BIN=golangci-lint
TARGETS=
EXAMPLES=wifi-command wifi-events wifi-scan
EXAMPLE_BUILD_TARGETS=$(addprefix example-, $(EXAMPLES))
TARGETS += $(EXAMPLE_BUILD_TARGETS)
EXAMPLE_CLEAN_TARGETS=$(addprefix clean-example-, $(EXAMPLES))
TARGETS += $(EXAMPLE_CLEAN_TARGETS)
all: examples
.PHONY: all
examples: $(EXAMPLE_BUILD_TARGETS)
.PHONY: examples
clean: clean-examples
.PHONY = clean
clean-examples: $(EXAMPLE_CLEAN_TARGETS)
.PHONY = clean-examples
targets:
@$(foreach target,$(TARGETS),echo $(target);)
.PHONY: targets
$(EXAMPLE_BUILD_TARGETS): example-%:
go build -o bin/$(@:example-%=%) ./examples/$(@:example-%=%)/*.go
.PHONY = $(EXAMPLE_BUILD_TARGETS)
$(EXAMPLE_CLEAN_TARGETS): clean-example-%:
rm -f bin/$(@:clean-example-%=%)
.PHONY = $(EXAMPLE_CLEAN_TARGETS)
test:
go test ./...
.PHONY: test
lint:
$(GOLANGCI_LINT_BIN) run
.PHONY: lint
vet:
go vet ./...
.PHONY: vet
check: vet lint
.PHONY: check
require-arg-%:
@: $(if $(value $*),,$(error required arg $* is undefined))
.PHONY: release
release: require-arg-TAG test check
git tag $(TAG)
git push -u origin $(TAG)