summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Buetow <paul@buetow.org>2024-02-19 11:06:39 +0200
committerPaul Buetow <paul@buetow.org>2024-02-19 11:06:39 +0200
commit72185eae0eefed8f6d5a899c10dfea1d41e57690 (patch)
treeda4acae050af064072da0b8afb86a9f818df004b
parentf7ba8b694a4c6b1d6583b730cf918e7953b20a72 (diff)
refactor makefiel
-rw-r--r--internal/c/Makefile11
-rw-r--r--internal/c/ioriotng.bpf.c1
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";