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