-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathMakefile
46 lines (36 loc) · 1.11 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
# The development version of clang is distributed as the 'clang' binary,
# while stable/released versions have a version number attached.
# Pin the default clang to a stable version.
CLANG ?= clang-14
STRIP ?= llvm-strip-14
OBJCOPY ?= llvm-objcopy-14
CFLAGS := -O2 -g -Wall -Werror $(CFLAGS)
DEV ?= lo
HOST ?= 10.2.0.105
STOREHOUSE ?= zmosquito
NAME ?= prism
VERSION ?= v0.0.1
IMAGE ?= $(STOREHOUSE)/$(NAME):$(VERSION)
format:
find . -type f -name "*.c" | xargs clang-format -i
env:
go env -w GOPROXY=https://goproxy.cn,direct && go install github.com/cilium/ebpf/cmd/bpf2go@latest
# $BPF_CLANG is used in go:generate invocations.
gen: export BPF_CLANG := $(CLANG)
gen: export BPF_CFLAGS := $(CFLAGS)
gen: export GO111MODULE=on
gen:
go generate ./...
ps:
ssh root@$(HOST) "rm -rf /root/prism && mkdir prism"
scp -r * root@$(HOST):/root/prism/
pl:
scp -r root@$(HOST):/root/prism/* .
build: env gen
go mod tidy && go build -ldflags "-s -w" -o prism .
run: build
./prism -n $(DEV)
build-image:
docker build -t $(IMAGE) .
run-image:
docker run --net host --privileged --name $(NAME) -itd $(IMAGE) ./$(NAME) -n $(DEV)