xref: /linux/kernel/bpf/preload/Makefile (revision c88fb897c1fb5a590dc6353ac4b01c8f46a347b3)
1# SPDX-License-Identifier: GPL-2.0
2
3LIBBPF_SRCS = $(srctree)/tools/lib/bpf/
4LIBBPF_A = $(obj)/libbpf.a
5LIBBPF_OUT = $(abspath $(obj))
6
7# Although not in use by libbpf's Makefile, set $(O) so that the "dummy" test
8# in tools/scripts/Makefile.include always succeeds when building the kernel
9# with $(O) pointing to a relative path, as in "make O=build bindeb-pkg".
10$(LIBBPF_A):
11	$(Q)$(MAKE) -C $(LIBBPF_SRCS) O=$(LIBBPF_OUT)/ OUTPUT=$(LIBBPF_OUT)/ $(LIBBPF_OUT)/libbpf.a
12
13userccflags += -I $(srctree)/tools/include/ -I $(srctree)/tools/include/uapi \
14	-I $(srctree)/tools/lib/ -Wno-unused-result
15
16userprogs := bpf_preload_umd
17
18clean-files := $(userprogs) bpf_helper_defs.h FEATURE-DUMP.libbpf staticobjs/ feature/
19
20bpf_preload_umd-objs := iterators/iterators.o
21bpf_preload_umd-userldlibs := $(LIBBPF_A) -lelf -lz
22
23$(obj)/bpf_preload_umd: $(LIBBPF_A)
24
25$(obj)/bpf_preload_umd_blob.o: $(obj)/bpf_preload_umd
26
27obj-$(CONFIG_BPF_PRELOAD_UMD) += bpf_preload.o
28bpf_preload-objs += bpf_preload_kern.o bpf_preload_umd_blob.o
29