-
Notifications
You must be signed in to change notification settings - Fork 10
/
Makefile
52 lines (35 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
# -*- mode: Makefile-gmake -*-
SHELL := bash
TOP_DIR := $(abspath $(dir $(lastword $(MAKEFILE_LIST))))
DIAGRAM_DIR := doc/diagram
DIAGRAMS := $(DIAGRAM_DIR)/architecture.png
BUILD_DIR := build
COVERAGE_DIR := $(BUILD_DIR)/coverage
TESTDATA_SOURCES := $(shell find testdata -name "*_def.go")
IGNORED_TESTDATA := testdata/_/__def.go testdata/emptier/emptier_def.go
GENERATED_TESTDATA := $(subst _def,,$(filter-out $(IGNORED_TESTDATA),$(TESTDATA_SOURCES)))
all: test
doc/diagram/%.png: doc/%.dot
@mkdir -p $(DIAGRAM_DIR)
dot -Tpng $< > $@
doc: $(DIAGRAMS)
$(BUILD_DIR):
@mkdir -p $@
$(COVERAGE_DIR):
@mkdir -p $@
clean:
rm -rf $(BUILD_DIR)
fmt:
go fmt ./...
vet:
go vet ./...
charlatan:
go build
# Get the capitalized interface name from the filename and pass it to charlatan
%.go: %_def.go
rm -f $@
iface=$(*F); ./charlatan -dir=testdata/$(*F) -output=$@ $${iface^}
test: $(COVERAGE_DIR)
go test -v -coverprofile=$(TOP_DIR)/$(COVERAGE_DIR)/$(@F)_coverage.out -covermode=atomic ./...
testdata: charlatan $(GENERATED_TESTDATA)
.PHONY: clean doc vet fmt charlatan test testdata