From f03baad31e5e137e423570ac2b3f65908e294b5c Mon Sep 17 00:00:00 2001 From: Hiroshi Hatake Date: Thu, 14 Nov 2024 17:21:41 +0900 Subject: [PATCH] in_ebpf: Prepare build directory for building eBPF objects (#9592) Signed-off-by: Hiroshi Hatake --- plugins/in_ebpf/CMakeLists.txt | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/plugins/in_ebpf/CMakeLists.txt b/plugins/in_ebpf/CMakeLists.txt index 5ae9a1d6e8b..382e2fa0f2a 100644 --- a/plugins/in_ebpf/CMakeLists.txt +++ b/plugins/in_ebpf/CMakeLists.txt @@ -34,6 +34,9 @@ file(GLOB_RECURSE TRACE_C_FILES ${CMAKE_SOURCE_DIR}/plugins/in_ebpf/traces/*/bpf set(TRACE_OBJ_FILES "") set(TRACE_SKEL_HEADERS "") +add_custom_target(ebpf-generated-directory ALL + COMMAND ${CMAKE_COMMAND} -E make_directory ${CMAKE_BINARY_DIR}/plugins/in_ebpf/traces/includes/generated/) + # Iterate over each trace bpf.c file to generate corresponding .o and .skel.h files foreach(TRACE_C_FILE ${TRACE_C_FILES}) # Get the filename and parent directory name (for uniqueness) @@ -61,7 +64,7 @@ foreach(TRACE_C_FILE ${TRACE_C_FILES}) -I${VMLINUX_PATH} # Include the correct vmlinux.h based on architecture -c ${TRACE_C_FILE} -o ${TRACE_OBJ_FILE} - DEPENDS ${TRACE_C_FILE} + DEPENDS ${TRACE_C_FILE} ebpf-generated-directory ) # Generate skeleton header for each compiled BPF object file