summaryrefslogtreecommitdiffstats
path: root/lib/util/Makefile
diff options
context:
space:
mode:
Diffstat (limited to 'lib/util/Makefile')
-rw-r--r--lib/util/Makefile34
1 files changed, 34 insertions, 0 deletions
diff --git a/lib/util/Makefile b/lib/util/Makefile
new file mode 100644
index 0000000..24070f0
--- /dev/null
+++ b/lib/util/Makefile
@@ -0,0 +1,34 @@
+include util.mk
+
+LIB_DIR ?= ..
+
+include $(LIB_DIR)/defines.mk
+include $(LIBXDP_DIR)/libxdp.mk
+
+all: $(UTIL_OBJS)
+
+UTIL_SKEL_H = $(UTIL_BPF_OBJS:.bpf.o=.skel.h)
+
+$(UTIL_OBJS): %.o: %.c %.h $(UTIL_SKEL_H) $(LIBMK)
+ $(QUIET_CC)$(CC) $(CFLAGS) $(CPPFLAGS) -Wall -I../../headers -c -o $@ $<
+
+clean:
+ $(Q)rm -f $(UTIL_OBJS) $(UTIL_BPF_OBJS) $(UTIL_SKEL_H)
+
+BPF_CFLAGS += -I$(HEADER_DIR) $(ARCH_INCLUDES)
+
+$(UTIL_BPF_OBJS): %.o: %.c $(KERN_USER_H) $(BPF_HEADERS) $(LIBMK)
+ $(QUIET_CLANG)$(CLANG) -S \
+ -target $(BPF_TARGET) \
+ -D __BPF_TRACING__ \
+ $(BPF_CFLAGS) \
+ -Wall \
+ -Wno-unused-value \
+ -Wno-pointer-sign \
+ -Wno-compare-distinct-pointer-types \
+ -Werror \
+ -O2 -emit-llvm -c -g -o ${@:.o=.ll} $<
+ $(QUIET_LLC)$(LLC) -march=$(BPF_TARGET) -filetype=obj -o $@ ${@:.o=.ll}
+
+$(UTIL_SKEL_H): %.skel.h: %.bpf.o
+ $(QUIET_GEN)$(BPFTOOL) gen skeleton $< name ${@:.skel.h=} > $@