From 72185eae0eefed8f6d5a899c10dfea1d41e57690 Mon Sep 17 00:00:00 2001 From: Paul Buetow Date: Mon, 19 Feb 2024 11:06:39 +0200 Subject: refactor makefiel --- internal/c/Makefile | 11 +++++++++-- internal/c/ioriotng.bpf.c | 1 - 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/internal/c/Makefile b/internal/c/Makefile index 439e413..03181b8 100644 --- a/internal/c/Makefile +++ b/internal/c/Makefile @@ -1,9 +1,16 @@ export LIBBPFGO = $(CURDIR)/../../../libbpfgo export CC = clang -ioriotng.bpf.o: ioriotng.bpf.c vmlinux.h +SOURCES := $(wildcard *.bpf.c) +TARGETS := $(SOURCES:.bpf.c=.bpf.o) + +all: $(TARGETS) + # Only required when linking multiple .o into a single .o (not doing that atm) + # bpftool gen object ioriotng.bpf.o $(TARGETS) + +%.bpf.o: %.bpf.c vmlinux.h $(CC) -g -O2 -Wall -fpie -target bpf -D__TARGET_ARCH_amd64 \ - -I$(LIBBPFGO)/output -c ioriotng.bpf.c -o ioriotng.bpf.o + -I$(LIBBPFGO)/output -c $< -o $@ vmlinux.h: bpftool btf dump file /sys/kernel/btf/vmlinux format c > vmlinux.h diff --git a/internal/c/ioriotng.bpf.c b/internal/c/ioriotng.bpf.c index c9c9c88..2247daa 100644 --- a/internal/c/ioriotng.bpf.c +++ b/internal/c/ioriotng.bpf.c @@ -132,5 +132,4 @@ int handle_exit_write(struct trace_event_raw_sys_enter *ctx) { return 0; } - char LICENSE[] SEC("license") = "Dual BSD/GPL"; -- cgit v1.2.3