summaryrefslogtreecommitdiff
path: root/internal/c/Makefile
diff options
context:
space:
mode:
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