-
Notifications
You must be signed in to change notification settings - Fork 151
/
Makefile
34 lines (25 loc) · 912 Bytes
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
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) *.ll
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=} > $@