-
Notifications
You must be signed in to change notification settings - Fork 22
/
Copy pathMakefile
50 lines (39 loc) · 1.28 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
BUILD_DIR ?= ./artifacts
.PHONY: build
build:
$(shell mkdir -p $(BUILD_DIR))
$(MAKE) build-linux_amd64
$(MAKE) build-darwin_amd64
$(MAKE) build-windows_amd64
$(MAKE) build-server-xdp-linux_amd64
.PHONY: build-server-xdp-linux_amd64
build-server-xdp-linux_amd64:
GOOS=linux GOARCH=amd64 go build -tags xdp -o $(BUILD_DIR)/openspa_xdp_linux_amd64 ./cli/openspa
.PHONY: build-linux_amd64
build-linux_amd64:
GOOS=linux GOARCH=amd64 go build -o $(BUILD_DIR)/openspa_linux_amd64 ./cli/openspa
.PHONY: build-darwin_amd64
build-darwin_amd64:
GOOS=darwin GOARCH=amd64 go build -o $(BUILD_DIR)/openspa_darwin_amd64 ./cli/openspa
.PHONY: build-windows_amd64
build-windows_amd64:
GOOS=windows GOARCH=amd64 go build -o $(BUILD_DIR)/openspa_windows_amd64 ./cli/openspa
.PHONY: test
test:
go test ./...
cd ./examples && $(MAKE) test
.PHONY: bench
bench:
go test -bench=. ./...
.PHONY: lint
lint:
golangci-lint run
.PHONY: clean
clean:
$(RM) -drf "$(BUILD_DIR)"
.PHONY: coverage
coverage:
$(shell mkdir -p $(BUILD_DIR))
go test $(shell go list ./... | grep -v internal/xdp) -covermode=count -coverprofile=$(BUILD_DIR)/coverage_raw.out
cat $(BUILD_DIR)/coverage_raw.out | grep -v "mock" | grep -v "stub" > $(BUILD_DIR)/coverage_filtered.out
go tool cover -func=$(BUILD_DIR)/coverage_filtered.out