-
Notifications
You must be signed in to change notification settings - Fork 18
Expand file tree
/
Copy pathMakefile
More file actions
40 lines (29 loc) · 971 Bytes
/
Copy pathMakefile
File metadata and controls
40 lines (29 loc) · 971 Bytes
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
.PHONY: all build test vet check release-build generate vmlinux install clean
BINARY := pktz
MODULE := github.com/immanuwell/pktz
BPF_SRC := bpf/pktz.c
VMLINUX := bpf/vmlinux.h
PREFIX ?= /usr/local
DIST_DIR ?= dist
all: generate build
vmlinux:
bpftool btf dump file /sys/kernel/btf/vmlinux format c > $(VMLINUX)
generate: vmlinux
go generate ./internal/collector/...
build:
go build -o $(BINARY) .
test:
go test ./...
vet:
go vet ./...
check: test vet build
release-build:
mkdir -p $(DIST_DIR)
GOOS=linux GOARCH=amd64 go build -ldflags="-s -w" -o $(DIST_DIR)/$(BINARY)-linux-amd64 .
GOOS=linux GOARCH=arm64 go build -ldflags="-s -w" -o $(DIST_DIR)/$(BINARY)-linux-arm64 .
GOOS=linux GOARCH=arm GOARM=7 go build -ldflags="-s -w" -o $(DIST_DIR)/$(BINARY)-linux-armv7 .
install: build
sudo install -m 0755 $(BINARY) $(PREFIX)/bin/$(BINARY)
clean:
rm -f $(BINARY) $(VMLINUX)
rm -f internal/collector/pktz_bpf*.go internal/collector/pktz_bpf*.o