File tree 2 files changed +15
-0
lines changed
ebpf-examples/helloworld-go 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 (
13
13
"github.com/cilium/ebpf/rlimit"
14
14
)
15
15
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
16
18
func main () {
17
19
stopper := make (chan os.Signal , 1 )
18
20
signal .Notify (stopper , os .Interrupt , syscall .SIGTERM )
You can’t perform that action at this time.
0 commit comments