~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/tools/bpf/bpftool/Makefile

Version: ~ [ linux-6.12-rc7 ] ~ [ linux-6.11.7 ] ~ [ linux-6.10.14 ] ~ [ linux-6.9.12 ] ~ [ linux-6.8.12 ] ~ [ linux-6.7.12 ] ~ [ linux-6.6.60 ] ~ [ linux-6.5.13 ] ~ [ linux-6.4.16 ] ~ [ linux-6.3.13 ] ~ [ linux-6.2.16 ] ~ [ linux-6.1.116 ] ~ [ linux-6.0.19 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.171 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.229 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.285 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.323 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.336 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.337 ] ~ [ linux-4.4.302 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.12 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

Diff markup

Differences between /tools/bpf/bpftool/Makefile (Version linux-6.12-rc7) and /tools/bpf/bpftool/Makefile (Version linux-6.8.12)


  1 # SPDX-License-Identifier: (GPL-2.0-only OR BS      1 # SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
  2 include ../../scripts/Makefile.include              2 include ../../scripts/Makefile.include
  3                                                     3 
  4 ifeq ($(srctree),)                                  4 ifeq ($(srctree),)
  5 srctree := $(patsubst %/,%,$(dir $(CURDIR)))        5 srctree := $(patsubst %/,%,$(dir $(CURDIR)))
  6 srctree := $(patsubst %/,%,$(dir $(srctree)))       6 srctree := $(patsubst %/,%,$(dir $(srctree)))
  7 srctree := $(patsubst %/,%,$(dir $(srctree)))       7 srctree := $(patsubst %/,%,$(dir $(srctree)))
  8 endif                                               8 endif
  9                                                     9 
 10 ifeq ($(V),1)                                      10 ifeq ($(V),1)
 11   Q =                                              11   Q =
 12 else                                               12 else
 13   Q = @                                            13   Q = @
 14 endif                                              14 endif
 15                                                    15 
 16 BPF_DIR = $(srctree)/tools/lib/bpf                 16 BPF_DIR = $(srctree)/tools/lib/bpf
 17                                                    17 
 18 ifneq ($(OUTPUT),)                                 18 ifneq ($(OUTPUT),)
 19   _OUTPUT := $(OUTPUT)                             19   _OUTPUT := $(OUTPUT)
 20 else                                               20 else
 21   _OUTPUT := $(CURDIR)/                            21   _OUTPUT := $(CURDIR)/
 22 endif                                              22 endif
 23 BOOTSTRAP_OUTPUT := $(_OUTPUT)bootstrap/           23 BOOTSTRAP_OUTPUT := $(_OUTPUT)bootstrap/
 24                                                    24 
 25 LIBBPF_OUTPUT := $(_OUTPUT)libbpf/                 25 LIBBPF_OUTPUT := $(_OUTPUT)libbpf/
 26 LIBBPF_DESTDIR := $(LIBBPF_OUTPUT)                 26 LIBBPF_DESTDIR := $(LIBBPF_OUTPUT)
 27 LIBBPF_INCLUDE := $(LIBBPF_DESTDIR)include         27 LIBBPF_INCLUDE := $(LIBBPF_DESTDIR)include
 28 LIBBPF_HDRS_DIR := $(LIBBPF_INCLUDE)/bpf           28 LIBBPF_HDRS_DIR := $(LIBBPF_INCLUDE)/bpf
 29 LIBBPF := $(LIBBPF_OUTPUT)libbpf.a                 29 LIBBPF := $(LIBBPF_OUTPUT)libbpf.a
 30                                                    30 
 31 LIBBPF_BOOTSTRAP_OUTPUT := $(BOOTSTRAP_OUTPUT)     31 LIBBPF_BOOTSTRAP_OUTPUT := $(BOOTSTRAP_OUTPUT)libbpf/
 32 LIBBPF_BOOTSTRAP_DESTDIR := $(LIBBPF_BOOTSTRAP     32 LIBBPF_BOOTSTRAP_DESTDIR := $(LIBBPF_BOOTSTRAP_OUTPUT)
 33 LIBBPF_BOOTSTRAP_INCLUDE := $(LIBBPF_BOOTSTRAP     33 LIBBPF_BOOTSTRAP_INCLUDE := $(LIBBPF_BOOTSTRAP_DESTDIR)include
 34 LIBBPF_BOOTSTRAP_HDRS_DIR := $(LIBBPF_BOOTSTRA     34 LIBBPF_BOOTSTRAP_HDRS_DIR := $(LIBBPF_BOOTSTRAP_INCLUDE)/bpf
 35 LIBBPF_BOOTSTRAP := $(LIBBPF_BOOTSTRAP_OUTPUT)     35 LIBBPF_BOOTSTRAP := $(LIBBPF_BOOTSTRAP_OUTPUT)libbpf.a
 36                                                    36 
 37 # We need to copy hashmap.h, nlattr.h, relo_co     37 # We need to copy hashmap.h, nlattr.h, relo_core.h and libbpf_internal.h
 38 # which are not otherwise exported by libbpf,      38 # which are not otherwise exported by libbpf, but still required by bpftool.
 39 LIBBPF_INTERNAL_HDRS := $(addprefix $(LIBBPF_H     39 LIBBPF_INTERNAL_HDRS := $(addprefix $(LIBBPF_HDRS_DIR)/,hashmap.h nlattr.h relo_core.h libbpf_internal.h)
 40 LIBBPF_BOOTSTRAP_INTERNAL_HDRS := $(addprefix      40 LIBBPF_BOOTSTRAP_INTERNAL_HDRS := $(addprefix $(LIBBPF_BOOTSTRAP_HDRS_DIR)/,hashmap.h relo_core.h libbpf_internal.h)
 41                                                    41 
 42 $(LIBBPF_OUTPUT) $(BOOTSTRAP_OUTPUT) $(LIBBPF_     42 $(LIBBPF_OUTPUT) $(BOOTSTRAP_OUTPUT) $(LIBBPF_BOOTSTRAP_OUTPUT) $(LIBBPF_HDRS_DIR) $(LIBBPF_BOOTSTRAP_HDRS_DIR):
 43         $(QUIET_MKDIR)mkdir -p $@                  43         $(QUIET_MKDIR)mkdir -p $@
 44                                                    44 
 45 $(LIBBPF): $(wildcard $(BPF_DIR)/*.[ch] $(BPF_     45 $(LIBBPF): $(wildcard $(BPF_DIR)/*.[ch] $(BPF_DIR)/Makefile) | $(LIBBPF_OUTPUT)
 46         $(Q)$(MAKE) -C $(BPF_DIR) OUTPUT=$(LIB     46         $(Q)$(MAKE) -C $(BPF_DIR) OUTPUT=$(LIBBPF_OUTPUT) \
 47                 DESTDIR=$(LIBBPF_DESTDIR:/=) p     47                 DESTDIR=$(LIBBPF_DESTDIR:/=) prefix= $(LIBBPF) install_headers
 48                                                    48 
 49 $(LIBBPF_INTERNAL_HDRS): $(LIBBPF_HDRS_DIR)/%.     49 $(LIBBPF_INTERNAL_HDRS): $(LIBBPF_HDRS_DIR)/%.h: $(BPF_DIR)/%.h | $(LIBBPF_HDRS_DIR)
 50         $(call QUIET_INSTALL, $@)                  50         $(call QUIET_INSTALL, $@)
 51         $(Q)install -m 644 -t $(LIBBPF_HDRS_DI     51         $(Q)install -m 644 -t $(LIBBPF_HDRS_DIR) $<
 52                                                    52 
 53 $(LIBBPF_BOOTSTRAP): $(wildcard $(BPF_DIR)/*.[     53 $(LIBBPF_BOOTSTRAP): $(wildcard $(BPF_DIR)/*.[ch] $(BPF_DIR)/Makefile) | $(LIBBPF_BOOTSTRAP_OUTPUT)
 54         $(Q)$(MAKE) -C $(BPF_DIR) OUTPUT=$(LIB     54         $(Q)$(MAKE) -C $(BPF_DIR) OUTPUT=$(LIBBPF_BOOTSTRAP_OUTPUT) \
 55                 DESTDIR=$(LIBBPF_BOOTSTRAP_DES     55                 DESTDIR=$(LIBBPF_BOOTSTRAP_DESTDIR:/=) prefix= \
 56                 ARCH= CROSS_COMPILE= CC="$(HOS     56                 ARCH= CROSS_COMPILE= CC="$(HOSTCC)" LD="$(HOSTLD)" AR="$(HOSTAR)" $@ install_headers
 57                                                    57 
 58 $(LIBBPF_BOOTSTRAP_INTERNAL_HDRS): $(LIBBPF_BO     58 $(LIBBPF_BOOTSTRAP_INTERNAL_HDRS): $(LIBBPF_BOOTSTRAP_HDRS_DIR)/%.h: $(BPF_DIR)/%.h | $(LIBBPF_BOOTSTRAP_HDRS_DIR)
 59         $(call QUIET_INSTALL, $@)                  59         $(call QUIET_INSTALL, $@)
 60         $(Q)install -m 644 -t $(LIBBPF_BOOTSTR     60         $(Q)install -m 644 -t $(LIBBPF_BOOTSTRAP_HDRS_DIR) $<
 61                                                    61 
 62 $(LIBBPF)-clean: FORCE | $(LIBBPF_OUTPUT)          62 $(LIBBPF)-clean: FORCE | $(LIBBPF_OUTPUT)
 63         $(call QUIET_CLEAN, libbpf)                63         $(call QUIET_CLEAN, libbpf)
 64         $(Q)$(MAKE) -C $(BPF_DIR) OUTPUT=$(LIB     64         $(Q)$(MAKE) -C $(BPF_DIR) OUTPUT=$(LIBBPF_OUTPUT) clean >/dev/null
 65                                                    65 
 66 $(LIBBPF_BOOTSTRAP)-clean: FORCE | $(LIBBPF_BO     66 $(LIBBPF_BOOTSTRAP)-clean: FORCE | $(LIBBPF_BOOTSTRAP_OUTPUT)
 67         $(call QUIET_CLEAN, libbpf-bootstrap)      67         $(call QUIET_CLEAN, libbpf-bootstrap)
 68         $(Q)$(MAKE) -C $(BPF_DIR) OUTPUT=$(LIB     68         $(Q)$(MAKE) -C $(BPF_DIR) OUTPUT=$(LIBBPF_BOOTSTRAP_OUTPUT) clean >/dev/null
 69                                                    69 
 70 prefix ?= /usr/local                               70 prefix ?= /usr/local
 71 bash_compdir ?= /usr/share/bash-completion/com     71 bash_compdir ?= /usr/share/bash-completion/completions
 72                                                    72 
 73 CFLAGS += -O2                                      73 CFLAGS += -O2
 74 CFLAGS += -W -Wall -Wextra -Wno-unused-paramet     74 CFLAGS += -W -Wall -Wextra -Wno-unused-parameter -Wno-missing-field-initializers
 75 CFLAGS += $(filter-out -Wswitch-enum -Wnested-     75 CFLAGS += $(filter-out -Wswitch-enum -Wnested-externs,$(EXTRA_WARNINGS))
 76 CFLAGS += -DPACKAGE='"bpftool"' -D__EXPORTED_H     76 CFLAGS += -DPACKAGE='"bpftool"' -D__EXPORTED_HEADERS__ \
 77         -I$(or $(OUTPUT),.) \                      77         -I$(or $(OUTPUT),.) \
 78         -I$(LIBBPF_INCLUDE) \                      78         -I$(LIBBPF_INCLUDE) \
 79         -I$(srctree)/kernel/bpf/ \                 79         -I$(srctree)/kernel/bpf/ \
 80         -I$(srctree)/tools/include \               80         -I$(srctree)/tools/include \
 81         -I$(srctree)/tools/include/uapi            81         -I$(srctree)/tools/include/uapi
 82 ifneq ($(BPFTOOL_VERSION),)                        82 ifneq ($(BPFTOOL_VERSION),)
 83 CFLAGS += -DBPFTOOL_VERSION='"$(BPFTOOL_VERSIO     83 CFLAGS += -DBPFTOOL_VERSION='"$(BPFTOOL_VERSION)"'
 84 endif                                              84 endif
 85 ifneq ($(EXTRA_CFLAGS),)                           85 ifneq ($(EXTRA_CFLAGS),)
 86 CFLAGS += $(EXTRA_CFLAGS)                          86 CFLAGS += $(EXTRA_CFLAGS)
 87 endif                                              87 endif
 88 ifneq ($(EXTRA_LDFLAGS),)                          88 ifneq ($(EXTRA_LDFLAGS),)
 89 LDFLAGS += $(EXTRA_LDFLAGS)                        89 LDFLAGS += $(EXTRA_LDFLAGS)
 90 endif                                              90 endif
 91                                                    91 
 92 HOST_CFLAGS := $(subst -I$(LIBBPF_INCLUDE),-I$ << 
 93                 $(subst $(CLANG_CROSS_FLAGS),, << 
 94 HOST_LDFLAGS := $(LDFLAGS)                     << 
 95                                                << 
 96 INSTALL ?= install                                 92 INSTALL ?= install
 97 RM ?= rm -f                                        93 RM ?= rm -f
 98                                                    94 
 99 FEATURE_USER = .bpftool                            95 FEATURE_USER = .bpftool
100                                                    96 
101 FEATURE_TESTS := clang-bpf-co-re                   97 FEATURE_TESTS := clang-bpf-co-re
102 FEATURE_TESTS += llvm                              98 FEATURE_TESTS += llvm
103 FEATURE_TESTS += libcap                            99 FEATURE_TESTS += libcap
104 FEATURE_TESTS += libbfd                           100 FEATURE_TESTS += libbfd
105 FEATURE_TESTS += libbfd-liberty                   101 FEATURE_TESTS += libbfd-liberty
106 FEATURE_TESTS += libbfd-liberty-z                 102 FEATURE_TESTS += libbfd-liberty-z
107 FEATURE_TESTS += disassembler-four-args           103 FEATURE_TESTS += disassembler-four-args
108 FEATURE_TESTS += disassembler-init-styled         104 FEATURE_TESTS += disassembler-init-styled
109                                                   105 
110 FEATURE_DISPLAY := clang-bpf-co-re                106 FEATURE_DISPLAY := clang-bpf-co-re
111 FEATURE_DISPLAY += llvm                           107 FEATURE_DISPLAY += llvm
112 FEATURE_DISPLAY += libcap                         108 FEATURE_DISPLAY += libcap
113 FEATURE_DISPLAY += libbfd                         109 FEATURE_DISPLAY += libbfd
114 FEATURE_DISPLAY += libbfd-liberty                 110 FEATURE_DISPLAY += libbfd-liberty
115 FEATURE_DISPLAY += libbfd-liberty-z               111 FEATURE_DISPLAY += libbfd-liberty-z
116                                                   112 
117 check_feat := 1                                   113 check_feat := 1
118 NON_CHECK_FEAT_TARGETS := clean uninstall doc     114 NON_CHECK_FEAT_TARGETS := clean uninstall doc doc-clean doc-install doc-uninstall
119 ifdef MAKECMDGOALS                                115 ifdef MAKECMDGOALS
120 ifeq ($(filter-out $(NON_CHECK_FEAT_TARGETS),$    116 ifeq ($(filter-out $(NON_CHECK_FEAT_TARGETS),$(MAKECMDGOALS)),)
121   check_feat := 0                                 117   check_feat := 0
122 endif                                             118 endif
123 endif                                             119 endif
124                                                   120 
125 ifeq ($(check_feat),1)                            121 ifeq ($(check_feat),1)
126 ifeq ($(FEATURES_DUMP),)                          122 ifeq ($(FEATURES_DUMP),)
127 include $(srctree)/tools/build/Makefile.featur    123 include $(srctree)/tools/build/Makefile.feature
128 else                                              124 else
129 include $(FEATURES_DUMP)                          125 include $(FEATURES_DUMP)
130 endif                                             126 endif
131 endif                                             127 endif
132                                                   128 
133 LIBS = $(LIBBPF) -lelf -lz                        129 LIBS = $(LIBBPF) -lelf -lz
134 LIBS_BOOTSTRAP = $(LIBBPF_BOOTSTRAP) -lelf -lz    130 LIBS_BOOTSTRAP = $(LIBBPF_BOOTSTRAP) -lelf -lz
135 ifeq ($(feature-libcap), 1)                       131 ifeq ($(feature-libcap), 1)
136 CFLAGS += -DUSE_LIBCAP                            132 CFLAGS += -DUSE_LIBCAP
137 LIBS += -lcap                                     133 LIBS += -lcap
138 endif                                             134 endif
139                                                   135 
140 include $(wildcard $(OUTPUT)*.d)                  136 include $(wildcard $(OUTPUT)*.d)
141                                                   137 
142 all: $(OUTPUT)bpftool                             138 all: $(OUTPUT)bpftool
143                                                   139 
144 SRCS := $(wildcard *.c)                           140 SRCS := $(wildcard *.c)
145                                                   141 
146 ifeq ($(feature-llvm),1)                          142 ifeq ($(feature-llvm),1)
147   # If LLVM is available, use it for JIT disas    143   # If LLVM is available, use it for JIT disassembly
148   CFLAGS  += -DHAVE_LLVM_SUPPORT                  144   CFLAGS  += -DHAVE_LLVM_SUPPORT
149   LLVM_CONFIG_LIB_COMPONENTS := mcdisassembler    145   LLVM_CONFIG_LIB_COMPONENTS := mcdisassembler all-targets
150   CFLAGS  += $(shell $(LLVM_CONFIG) --cflags)  !! 146   CFLAGS  += $(shell $(LLVM_CONFIG) --cflags --libs $(LLVM_CONFIG_LIB_COMPONENTS))
151   LIBS    += $(shell $(LLVM_CONFIG) --libs $(L    147   LIBS    += $(shell $(LLVM_CONFIG) --libs $(LLVM_CONFIG_LIB_COMPONENTS))
152   ifeq ($(shell $(LLVM_CONFIG) --shared-mode),    148   ifeq ($(shell $(LLVM_CONFIG) --shared-mode),static)
153     LIBS += $(shell $(LLVM_CONFIG) --system-li    149     LIBS += $(shell $(LLVM_CONFIG) --system-libs $(LLVM_CONFIG_LIB_COMPONENTS))
154     LIBS += -lstdc++                              150     LIBS += -lstdc++
155   endif                                           151   endif
156   LDFLAGS += $(shell $(LLVM_CONFIG) --ldflags)    152   LDFLAGS += $(shell $(LLVM_CONFIG) --ldflags)
157 else                                              153 else
158   # Fall back on libbfd                           154   # Fall back on libbfd
159   ifeq ($(feature-libbfd),1)                      155   ifeq ($(feature-libbfd),1)
160     LIBS += -lbfd -ldl -lopcodes                  156     LIBS += -lbfd -ldl -lopcodes
161   else ifeq ($(feature-libbfd-liberty),1)         157   else ifeq ($(feature-libbfd-liberty),1)
162     LIBS += -lbfd -ldl -lopcodes -liberty         158     LIBS += -lbfd -ldl -lopcodes -liberty
163   else ifeq ($(feature-libbfd-liberty-z),1)       159   else ifeq ($(feature-libbfd-liberty-z),1)
164     LIBS += -lbfd -ldl -lopcodes -liberty -lz     160     LIBS += -lbfd -ldl -lopcodes -liberty -lz
165   endif                                           161   endif
166                                                   162 
167   # If one of the above feature combinations i    163   # If one of the above feature combinations is set, we support libbfd
168   ifneq ($(filter -lbfd,$(LIBS)),)                164   ifneq ($(filter -lbfd,$(LIBS)),)
169     CFLAGS += -DHAVE_LIBBFD_SUPPORT               165     CFLAGS += -DHAVE_LIBBFD_SUPPORT
170                                                   166 
171     # Libbfd interface changed over time, figu    167     # Libbfd interface changed over time, figure out what we need
172     ifeq ($(feature-disassembler-four-args), 1    168     ifeq ($(feature-disassembler-four-args), 1)
173       CFLAGS += -DDISASM_FOUR_ARGS_SIGNATURE      169       CFLAGS += -DDISASM_FOUR_ARGS_SIGNATURE
174     endif                                         170     endif
175     ifeq ($(feature-disassembler-init-styled),    171     ifeq ($(feature-disassembler-init-styled), 1)
176       CFLAGS += -DDISASM_INIT_STYLED              172       CFLAGS += -DDISASM_INIT_STYLED
177     endif                                         173     endif
178   endif                                           174   endif
179 endif                                             175 endif
180 ifeq ($(filter -DHAVE_LLVM_SUPPORT -DHAVE_LIBB    176 ifeq ($(filter -DHAVE_LLVM_SUPPORT -DHAVE_LIBBFD_SUPPORT,$(CFLAGS)),)
181   # No support for JIT disassembly                177   # No support for JIT disassembly
182   SRCS := $(filter-out jit_disasm.c,$(SRCS))      178   SRCS := $(filter-out jit_disasm.c,$(SRCS))
183 endif                                             179 endif
184                                                   180 
                                                   >> 181 HOST_CFLAGS = $(subst -I$(LIBBPF_INCLUDE),-I$(LIBBPF_BOOTSTRAP_INCLUDE),\
                                                   >> 182                 $(subst $(CLANG_CROSS_FLAGS),,$(CFLAGS)))
                                                   >> 183 
185 BPFTOOL_BOOTSTRAP := $(BOOTSTRAP_OUTPUT)bpftoo    184 BPFTOOL_BOOTSTRAP := $(BOOTSTRAP_OUTPUT)bpftool
186                                                   185 
187 BOOTSTRAP_OBJS = $(addprefix $(BOOTSTRAP_OUTPU !! 186 BOOTSTRAP_OBJS = $(addprefix $(BOOTSTRAP_OUTPUT),main.o common.o json_writer.o gen.o btf.o xlated_dumper.o btf_dumper.o disasm.o)
188 $(BOOTSTRAP_OBJS): $(LIBBPF_BOOTSTRAP)            187 $(BOOTSTRAP_OBJS): $(LIBBPF_BOOTSTRAP)
189                                                   188 
190 OBJS = $(patsubst %.c,$(OUTPUT)%.o,$(SRCS)) $(    189 OBJS = $(patsubst %.c,$(OUTPUT)%.o,$(SRCS)) $(OUTPUT)disasm.o
191 $(OBJS): $(LIBBPF) $(LIBBPF_INTERNAL_HDRS)        190 $(OBJS): $(LIBBPF) $(LIBBPF_INTERNAL_HDRS)
192                                                   191 
193 VMLINUX_BTF_PATHS ?= $(if $(O),$(O)/vmlinux)      192 VMLINUX_BTF_PATHS ?= $(if $(O),$(O)/vmlinux)                            \
194                      $(if $(KBUILD_OUTPUT),$(K    193                      $(if $(KBUILD_OUTPUT),$(KBUILD_OUTPUT)/vmlinux)    \
195                      ../../../vmlinux             194                      ../../../vmlinux                                   \
196                      /sys/kernel/btf/vmlinux      195                      /sys/kernel/btf/vmlinux                            \
197                      /boot/vmlinux-$(shell una    196                      /boot/vmlinux-$(shell uname -r)
198 VMLINUX_BTF ?= $(abspath $(firstword $(wildcar    197 VMLINUX_BTF ?= $(abspath $(firstword $(wildcard $(VMLINUX_BTF_PATHS))))
199                                                   198 
200 bootstrap: $(BPFTOOL_BOOTSTRAP)                   199 bootstrap: $(BPFTOOL_BOOTSTRAP)
201                                                   200 
202 ifneq ($(VMLINUX_BTF)$(VMLINUX_H),)               201 ifneq ($(VMLINUX_BTF)$(VMLINUX_H),)
203 ifeq ($(feature-clang-bpf-co-re),1)               202 ifeq ($(feature-clang-bpf-co-re),1)
204                                                   203 
205 BUILD_BPF_SKELS := 1                              204 BUILD_BPF_SKELS := 1
206                                                   205 
207 ifeq ($(VMLINUX_H),)                           << 
208 $(OUTPUT)vmlinux.h: $(VMLINUX_BTF) $(BPFTOOL_B    206 $(OUTPUT)vmlinux.h: $(VMLINUX_BTF) $(BPFTOOL_BOOTSTRAP)
                                                   >> 207 ifeq ($(VMLINUX_H),)
209         $(QUIET_GEN)$(BPFTOOL_BOOTSTRAP) btf d    208         $(QUIET_GEN)$(BPFTOOL_BOOTSTRAP) btf dump file $< format c > $@
210 else                                              209 else
211 $(OUTPUT)vmlinux.h: $(VMLINUX_H)               << 
212         $(Q)cp "$(VMLINUX_H)" $@                  210         $(Q)cp "$(VMLINUX_H)" $@
213 endif                                             211 endif
214                                                   212 
215 $(OUTPUT)%.bpf.o: skeleton/%.bpf.c $(OUTPUT)vm    213 $(OUTPUT)%.bpf.o: skeleton/%.bpf.c $(OUTPUT)vmlinux.h $(LIBBPF_BOOTSTRAP)
216         $(QUIET_CLANG)$(CLANG) \                  214         $(QUIET_CLANG)$(CLANG) \
217                 -I$(or $(OUTPUT),.) \             215                 -I$(or $(OUTPUT),.) \
218                 -I$(srctree)/tools/include/uap    216                 -I$(srctree)/tools/include/uapi/ \
219                 -I$(LIBBPF_BOOTSTRAP_INCLUDE)     217                 -I$(LIBBPF_BOOTSTRAP_INCLUDE) \
220                 -g -O2 -Wall -fno-stack-protec    218                 -g -O2 -Wall -fno-stack-protector \
221                 --target=bpf -c $< -o $@          219                 --target=bpf -c $< -o $@
222         $(Q)$(LLVM_STRIP) -g $@                   220         $(Q)$(LLVM_STRIP) -g $@
223                                                   221 
224 $(OUTPUT)%.skel.h: $(OUTPUT)%.bpf.o $(BPFTOOL_    222 $(OUTPUT)%.skel.h: $(OUTPUT)%.bpf.o $(BPFTOOL_BOOTSTRAP)
225         $(QUIET_GEN)$(BPFTOOL_BOOTSTRAP) gen s    223         $(QUIET_GEN)$(BPFTOOL_BOOTSTRAP) gen skeleton $< > $@
226                                                   224 
227 $(OUTPUT)prog.o: $(OUTPUT)profiler.skel.h         225 $(OUTPUT)prog.o: $(OUTPUT)profiler.skel.h
228                                                   226 
229 $(OUTPUT)pids.o: $(OUTPUT)pid_iter.skel.h         227 $(OUTPUT)pids.o: $(OUTPUT)pid_iter.skel.h
230                                                   228 
231 endif                                             229 endif
232 endif                                             230 endif
233                                                   231 
234 CFLAGS += $(if $(BUILD_BPF_SKELS),,-DBPFTOOL_W    232 CFLAGS += $(if $(BUILD_BPF_SKELS),,-DBPFTOOL_WITHOUT_SKELETONS)
235                                                   233 
                                                   >> 234 $(BOOTSTRAP_OUTPUT)disasm.o: $(srctree)/kernel/bpf/disasm.c
                                                   >> 235         $(QUIET_CC)$(HOSTCC) $(HOST_CFLAGS) -c -MMD $< -o $@
                                                   >> 236 
236 $(OUTPUT)disasm.o: $(srctree)/kernel/bpf/disas    237 $(OUTPUT)disasm.o: $(srctree)/kernel/bpf/disasm.c
237         $(QUIET_CC)$(CC) $(CFLAGS) -c -MMD $<     238         $(QUIET_CC)$(CC) $(CFLAGS) -c -MMD $< -o $@
238                                                   239 
239 $(BPFTOOL_BOOTSTRAP): $(BOOTSTRAP_OBJS) $(LIBB    240 $(BPFTOOL_BOOTSTRAP): $(BOOTSTRAP_OBJS) $(LIBBPF_BOOTSTRAP)
240         $(QUIET_LINK)$(HOSTCC) $(HOST_CFLAGS)  !! 241         $(QUIET_LINK)$(HOSTCC) $(HOST_CFLAGS) $(LDFLAGS) $(BOOTSTRAP_OBJS) $(LIBS_BOOTSTRAP) -o $@
241                                                   242 
242 $(OUTPUT)bpftool: $(OBJS) $(LIBBPF)               243 $(OUTPUT)bpftool: $(OBJS) $(LIBBPF)
243         $(QUIET_LINK)$(CC) $(CFLAGS) $(LDFLAGS    244         $(QUIET_LINK)$(CC) $(CFLAGS) $(LDFLAGS) $(OBJS) $(LIBS) -o $@
244                                                   245 
245 $(BOOTSTRAP_OUTPUT)%.o: %.c $(LIBBPF_BOOTSTRAP    246 $(BOOTSTRAP_OUTPUT)%.o: %.c $(LIBBPF_BOOTSTRAP_INTERNAL_HDRS) | $(BOOTSTRAP_OUTPUT)
246         $(QUIET_CC)$(HOSTCC) $(HOST_CFLAGS) -c    247         $(QUIET_CC)$(HOSTCC) $(HOST_CFLAGS) -c -MMD $< -o $@
247                                                   248 
248 $(OUTPUT)%.o: %.c                                 249 $(OUTPUT)%.o: %.c
249         $(QUIET_CC)$(CC) $(CFLAGS) -c -MMD $<     250         $(QUIET_CC)$(CC) $(CFLAGS) -c -MMD $< -o $@
250                                                   251 
251 feature-detect-clean:                             252 feature-detect-clean:
252         $(call QUIET_CLEAN, feature-detect)       253         $(call QUIET_CLEAN, feature-detect)
253         $(Q)$(MAKE) -C $(srctree)/tools/build/    254         $(Q)$(MAKE) -C $(srctree)/tools/build/feature/ clean >/dev/null
254                                                   255 
255 clean: $(LIBBPF)-clean $(LIBBPF_BOOTSTRAP)-cle    256 clean: $(LIBBPF)-clean $(LIBBPF_BOOTSTRAP)-clean feature-detect-clean
256         $(call QUIET_CLEAN, bpftool)              257         $(call QUIET_CLEAN, bpftool)
257         $(Q)$(RM) -- $(OUTPUT)bpftool $(OUTPUT    258         $(Q)$(RM) -- $(OUTPUT)bpftool $(OUTPUT)*.o $(OUTPUT)*.d
258         $(Q)$(RM) -- $(OUTPUT)*.skel.h $(OUTPU    259         $(Q)$(RM) -- $(OUTPUT)*.skel.h $(OUTPUT)vmlinux.h
259         $(Q)$(RM) -r -- $(LIBBPF_OUTPUT) $(BOO    260         $(Q)$(RM) -r -- $(LIBBPF_OUTPUT) $(BOOTSTRAP_OUTPUT)
260         $(call QUIET_CLEAN, core-gen)             261         $(call QUIET_CLEAN, core-gen)
261         $(Q)$(RM) -- $(OUTPUT)FEATURE-DUMP.bpf    262         $(Q)$(RM) -- $(OUTPUT)FEATURE-DUMP.bpftool
262         $(Q)$(RM) -r -- $(OUTPUT)feature/         263         $(Q)$(RM) -r -- $(OUTPUT)feature/
263                                                   264 
264 install-bin: $(OUTPUT)bpftool                     265 install-bin: $(OUTPUT)bpftool
265         $(call QUIET_INSTALL, bpftool)            266         $(call QUIET_INSTALL, bpftool)
266         $(Q)$(INSTALL) -m 0755 -d $(DESTDIR)$(    267         $(Q)$(INSTALL) -m 0755 -d $(DESTDIR)$(prefix)/sbin
267         $(Q)$(INSTALL) $(OUTPUT)bpftool $(DEST    268         $(Q)$(INSTALL) $(OUTPUT)bpftool $(DESTDIR)$(prefix)/sbin/bpftool
268                                                   269 
269 install: install-bin                              270 install: install-bin
270         $(Q)$(INSTALL) -m 0755 -d $(DESTDIR)$(    271         $(Q)$(INSTALL) -m 0755 -d $(DESTDIR)$(bash_compdir)
271         $(Q)$(INSTALL) -m 0644 bash-completion    272         $(Q)$(INSTALL) -m 0644 bash-completion/bpftool $(DESTDIR)$(bash_compdir)
272                                                   273 
273 uninstall:                                        274 uninstall:
274         $(call QUIET_UNINST, bpftool)             275         $(call QUIET_UNINST, bpftool)
275         $(Q)$(RM) -- $(DESTDIR)$(prefix)/sbin/    276         $(Q)$(RM) -- $(DESTDIR)$(prefix)/sbin/bpftool
276         $(Q)$(RM) -- $(DESTDIR)$(bash_compdir)    277         $(Q)$(RM) -- $(DESTDIR)$(bash_compdir)/bpftool
277                                                   278 
278 doc:                                              279 doc:
279         $(call descend,Documentation)             280         $(call descend,Documentation)
280                                                   281 
281 doc-clean:                                        282 doc-clean:
282         $(call descend,Documentation,clean)       283         $(call descend,Documentation,clean)
283                                                   284 
284 doc-install:                                      285 doc-install:
285         $(call descend,Documentation,install)     286         $(call descend,Documentation,install)
286                                                   287 
287 doc-uninstall:                                    288 doc-uninstall:
288         $(call descend,Documentation,uninstall    289         $(call descend,Documentation,uninstall)
289                                                   290 
290 FORCE:                                            291 FORCE:
291                                                   292 
292 .SECONDARY:                                       293 .SECONDARY:
293 .PHONY: all FORCE bootstrap clean install-bin     294 .PHONY: all FORCE bootstrap clean install-bin install uninstall
294 .PHONY: doc doc-clean doc-install doc-uninstal    295 .PHONY: doc doc-clean doc-install doc-uninstall
295 .DEFAULT_GOAL := all                              296 .DEFAULT_GOAL := all
296                                                   297 
297 # Delete partially updated (corrupted) files o    298 # Delete partially updated (corrupted) files on error
298 .DELETE_ON_ERROR:                                 299 .DELETE_ON_ERROR:
                                                      

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

sflogo.php