File tree Expand file tree Collapse file tree 2 files changed +15
-0
lines changed
ebpf-examples/helloworld-go Expand file tree Collapse file tree 2 files changed +15
-0
lines changed Original file line number Diff line number Diff line change 1+ CLANG ?= clang-10
2+ CFLAGS ?= -O2 -g -Wall -Werror
3+
4+ LIBEBPF_TOP = /home/tonybai/go/src/github.com/cilium/ebpf
5+ EXAMPLES_HEADERS = $(LIBEBPF_TOP ) /examples/headers
6+
7+ all : generate
8+
9+ generate : export BPF_CLANG=$(CLANG )
10+ generate : export BPF_CFLAGS=$(CFLAGS )
11+ generate : export BPF_HEADERS=$(EXAMPLES_HEADERS )
12+ generate :
13+ go generate ./...
Original file line number Diff line number Diff line change @@ -13,6 +13,8 @@ import (
1313 "github.com/cilium/ebpf/rlimit"
1414)
1515
16+ // $BPF_CLANG, $BPF_CFLAGS and $BPF_HEADERS are set by the Makefile.
17+ //go:generate bpf2go -cc $BPF_CLANG -cflags $BPF_CFLAGS -target bpfel,bpfeb bpf helloworld.bpf.c -- -I $BPF_HEADERS
1618func main () {
1719 stopper := make (chan os.Signal , 1 )
1820 signal .Notify (stopper , os .Interrupt , syscall .SIGTERM )
You can’t perform that action at this time.
0 commit comments