summaryrefslogtreecommitdiff
path: root/internal/c/Makefile
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 /internal/c/Makefile
parentf7ba8b694a4c6b1d6583b730cf918e7953b20a72 (diff)
refactor makefiel
Diffstat (limited to 'internal/c/Makefile')
-rw-r--r--internal/c/Makefile11
1 files changed, 9 insertions, 2 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