xref: /linux/kernel/bpf/Makefile (revision 6af91e3d2cfc8bb579b1aa2d22cd91f8c34acdf6)
1# SPDX-License-Identifier: GPL-2.0
2obj-y := core.o
3ifneq ($(CONFIG_BPF_JIT_ALWAYS_ON),y)
4# ___bpf_prog_run() needs GCSE disabled on x86; see 3193c0836f203 for details
5cflags-nogcse-$(CONFIG_X86)$(CONFIG_CC_IS_GCC) := -fno-gcse
6endif
7CFLAGS_core.o += -Wno-override-init $(cflags-nogcse-yy)
8
9obj-$(CONFIG_BPF_SYSCALL) += syscall.o verifier.o inode.o helpers.o tnum.o log.o token.o
10obj-$(CONFIG_BPF_SYSCALL) += bpf_iter.o map_iter.o task_iter.o prog_iter.o link_iter.o
11obj-$(CONFIG_BPF_SYSCALL) += hashtab.o arraymap.o percpu_freelist.o bpf_lru_list.o lpm_trie.o map_in_map.o bloom_filter.o
12obj-$(CONFIG_BPF_SYSCALL) += local_storage.o queue_stack_maps.o ringbuf.o
13obj-$(CONFIG_BPF_SYSCALL) += bpf_local_storage.o bpf_task_storage.o
14obj-${CONFIG_BPF_LSM}	  += bpf_inode_storage.o
15obj-$(CONFIG_BPF_SYSCALL) += disasm.o mprog.o
16obj-$(CONFIG_BPF_JIT) += trampoline.o
17obj-$(CONFIG_BPF_SYSCALL) += btf.o memalloc.o
18ifeq ($(CONFIG_MMU)$(CONFIG_64BIT),yy)
19obj-$(CONFIG_BPF_SYSCALL) += arena.o
20endif
21obj-$(CONFIG_BPF_JIT) += dispatcher.o
22ifeq ($(CONFIG_NET),y)
23obj-$(CONFIG_BPF_SYSCALL) += devmap.o
24obj-$(CONFIG_BPF_SYSCALL) += cpumap.o
25obj-$(CONFIG_BPF_SYSCALL) += offload.o
26obj-$(CONFIG_BPF_SYSCALL) += net_namespace.o
27obj-$(CONFIG_BPF_SYSCALL) += tcx.o
28endif
29ifeq ($(CONFIG_PERF_EVENTS),y)
30obj-$(CONFIG_BPF_SYSCALL) += stackmap.o
31endif
32ifeq ($(CONFIG_CGROUPS),y)
33obj-$(CONFIG_BPF_SYSCALL) += cgroup_iter.o bpf_cgrp_storage.o
34endif
35obj-$(CONFIG_CGROUP_BPF) += cgroup.o
36ifeq ($(CONFIG_INET),y)
37obj-$(CONFIG_BPF_SYSCALL) += reuseport_array.o
38endif
39ifeq ($(CONFIG_SYSFS),y)
40obj-$(CONFIG_DEBUG_INFO_BTF) += sysfs_btf.o
41endif
42ifeq ($(CONFIG_BPF_JIT),y)
43obj-$(CONFIG_BPF_SYSCALL) += bpf_struct_ops.o
44obj-$(CONFIG_BPF_SYSCALL) += cpumask.o
45obj-${CONFIG_BPF_LSM} += bpf_lsm.o
46endif
47ifneq ($(CONFIG_CRYPTO),)
48obj-$(CONFIG_BPF_SYSCALL) += crypto.o
49endif
50obj-$(CONFIG_BPF_PRELOAD) += preload/
51
52obj-$(CONFIG_BPF_SYSCALL) += relo_core.o
53obj-$(CONFIG_BPF_SYSCALL) += btf_iter.o
54obj-$(CONFIG_BPF_SYSCALL) += btf_relocate.o
55
56# Some source files are common to libbpf.
57vpath %.c $(srctree)/kernel/bpf:$(srctree)/tools/lib/bpf
58
59$(obj)/%.o: %.c FORCE
60	$(call if_changed_rule,cc_o_c)
61