about summary refs log tree commit diff
path: root/pkgs/tools/security/tracee/use-our-libbpf.patch
blob: 4f6dc5957a773061b36d2823dc8078fcd70783b8 (plain) (blame)
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
diff --git a/Makefile b/Makefile
index 29be1ae71..b88f31cba 100644
--- a/Makefile
+++ b/Makefile
@@ -54,6 +54,7 @@ CMD_CONTROLLER_GEN ?= controller-gen
 # libs
 #
 
+LIB_BPF ?= libbpf
 LIB_ELF ?= libelf
 LIB_ZLIB ?= zlib
 
@@ -299,8 +300,6 @@ OUTPUT_DIR = ./dist
 $(OUTPUT_DIR):
 #
 	@$(CMD_MKDIR) -p $@
-	$(CMD_MKDIR) -p $@/libbpf
-	$(CMD_MKDIR) -p $@/libbpf/obj
 
 #
 # embedded btfhub
@@ -353,7 +352,6 @@ TRACEE_EBPF_OBJ_HEADERS = $(shell find pkg/ebpf/c -name *.h)
 bpf: $(OUTPUT_DIR)/tracee.bpf.o
 
 $(OUTPUT_DIR)/tracee.bpf.o: \
-	$(OUTPUT_DIR)/libbpf/libbpf.a \
 	$(TRACEE_EBPF_OBJ_SRC) \
 	$(TRACEE_EBPF_OBJ_HEADERS)
 #
@@ -391,8 +389,8 @@ endif
 TRACEE_SRC_DIRS = ./cmd/ ./pkg/ ./signatures/
 TRACEE_SRC = $(shell find $(TRACEE_SRC_DIRS) -type f -name '*.go' ! -name '*_test.go')
 
-CUSTOM_CGO_CFLAGS = "-I$(abspath $(OUTPUT_DIR)/libbpf)"
-CUSTOM_CGO_LDFLAGS = "$(shell $(call pkg_config, $(LIB_ELF))) $(shell $(call pkg_config, $(LIB_ZLIB))) $(abspath $(OUTPUT_DIR)/libbpf/libbpf.a)"
+CUSTOM_CGO_CFLAGS = ""
+CUSTOM_CGO_LDFLAGS = "$(shell $(call pkg_config, $(LIB_BPF))) $(shell $(call pkg_config, $(LIB_ELF))) $(shell $(call pkg_config, $(LIB_ZLIB)))"
 
 GO_ENV_EBPF =
 GO_ENV_EBPF += GOOS=linux
@@ -437,6 +435,7 @@ $(OUTPUT_DIR)/tracee: \
 	$(OUTPUT_DIR)/tracee.bpf.o \
 	$(TRACEE_SRC) \
 	| .checkver_$(CMD_GO) \
+	.checklib_$(LIB_BPF) \
 	.checklib_$(LIB_ELF) \
 	.checklib_$(LIB_ZLIB) \
 	btfhub \