Lines Matching +full:debian +full:- +full:testing
1 # SPDX-License-Identifier: GPL-2.0
5 EXTRAVERSION = -rc3
14 ifeq ($(filter output-sync,$(.FEATURES)),)
28 # Most importantly: sub-Makefiles should only ever modify files in
31 # unavoidable when linking the built-in.a targets which finally
41 this-makefile := $(lastword $(MAKEFILE_LIST))
42 abs_srctree := $(realpath $(dir $(this-makefile)))
47 # Do not use make's built-in rules and variables
48 # (this increases performance and avoids hard-to-debug behaviour)
49 MAKEFLAGS += -rR
61 # ---------------------------------------------------------------------------
71 # A simple variant is to prefix commands with $(Q) - that's useful
72 # for commands that shall be hidden in non-verbose mode.
94 # If the user is running make -s (silent mode), suppress echoing of
96 ifneq ($(findstring s,$(firstword -$(MAKEFLAGS))),)
106 # Use 'make C=1' to enable checking of only re-compiled files.
108 # of whether they are re-compiled or not.
110 # See the file "Documentation/dev-tools/sparse.rst" for more details,
165 # cd /dir/to/store/output/files; make -f /dir/to/kernel/source/Makefile
209 # $(realpath ...) gets empty if the path does not exist. Run 'mkdir -p' first.
210 $(shell mkdir -p "$(output)")
226 no-print-directory := --no-print-directory
229 need-sub-make := 1
232 ifeq ($(filter --no-print-directory, $(MAKEFLAGS)),)
233 # If --no-print-directory is unset, recurse once again to set it.
234 # You may end up recursing into __sub-make twice. This is needed due to the
236 need-sub-make := 1
239 ifeq ($(need-sub-make),1)
241 PHONY += $(MAKECMDGOALS) __sub-make
243 $(filter-out $(this-makefile), $(MAKECMDGOALS)) __all: __sub-make
247 __sub-make:
248 $(Q)$(MAKE) $(no-print-directory) -C $(abs_output) \
249 -f $(abs_srctree)/Makefile $(MAKECMDGOALS)
251 else # need-sub-make
293 clean-targets := %clean mrproper cleandocs
294 no-dot-config-targets := $(clean-targets) \
297 %asm-generic kernelversion %src-pkg dt_binding_check \
299 run-command
300 no-sync-config-targets := $(no-dot-config-targets) %install modules_sign kernelrelease \
302 single-targets := %.a %.i %.ko %.lds %.ll %.lst %.mod %.o %.rsi %.s %/
304 config-build :=
305 mixed-build :=
306 need-config := 1
307 may-sync-config := 1
308 single-build :=
310 ifneq ($(filter $(no-dot-config-targets), $(MAKECMDGOALS)),)
311 ifeq ($(filter-out $(no-dot-config-targets), $(MAKECMDGOALS)),)
312 need-config :=
316 ifneq ($(filter $(no-sync-config-targets), $(MAKECMDGOALS)),)
317 ifeq ($(filter-out $(no-sync-config-targets), $(MAKECMDGOALS)),)
318 may-sync-config :=
322 need-compiler := $(may-sync-config)
325 may-sync-config :=
330 config-build := 1
332 mixed-build := 1
338 ifneq ($(filter $(single-targets), $(MAKECMDGOALS)),)
339 single-build := 1
340 ifneq ($(filter-out $(single-targets), $(MAKECMDGOALS)),)
341 mixed-build := 1
345 # For "make -j clean all", "make -j mrproper defconfig all", etc.
346 ifneq ($(filter $(clean-targets),$(MAKECMDGOALS)),)
347 ifneq ($(filter-out $(clean-targets),$(MAKECMDGOALS)),)
348 mixed-build := 1
355 mixed-build := 1
359 ifdef mixed-build
370 $(Q)set -e; \
372 $(MAKE) -f $(srctree)/Makefile $$i; \
375 else # !mixed-build
380 KERNELRELEASE = $(call read-file, $(objtree)/include/config/kernel.release)
386 # Cross compiling and selecting different set of gcc/bin-utils
387 # ---------------------------------------------------------------------------
397 # during compilation. Only gcc and related bin-utils executables
400 # make CROSS_COMPILE=aarch64-linux-gnu-
449 else ifneq ($(filter -%,$(LLVM)),)
462 HOSTPKG_CONFIG = pkg-config
466 KERNELDOC = $(srctree)/tools/docs/kernel-doc
469 KBUILD_USERHOSTCFLAGS := -Wall -Wmissing-prototypes -Wstrict-prototypes \
470 -O2 -fomit-frame-pointer -std=gnu11
476 export rust_common_flags := --edition=2021 \
477 -Zbinary_dep_depinfo=y \
478 -Astable_features \
479 -Aunused_features \
480 -Dnon_ascii_idents \
481 -Dunsafe_op_in_unsafe_fn \
482 -Wmissing_docs \
483 -Wrust_2018_idioms \
484 -Wunreachable_pub \
485 -Wclippy::all \
486 -Wclippy::as_ptr_cast_mut \
487 -Wclippy::as_underscore \
488 -Wclippy::cast_lossless \
489 -Aclippy::collapsible_if \
490 -Aclippy::collapsible_match \
491 -Wclippy::ignored_unit_patterns \
492 -Aclippy::incompatible_msrv \
493 -Wclippy::mut_mut \
494 -Wclippy::needless_bitwise_bool \
495 -Aclippy::needless_lifetimes \
496 -Wclippy::no_mangle_with_rust_abi \
497 -Wclippy::ptr_as_ptr \
498 -Wclippy::ptr_cast_constness \
499 -Wclippy::ref_as_ptr \
500 -Wclippy::undocumented_unsafe_blocks \
501 -Aclippy::uninlined_format_args \
502 -Wclippy::unnecessary_safety_comment \
503 -Wclippy::unnecessary_safety_doc \
504 -Wrustdoc::missing_crate_level_docs \
505 -Wrustdoc::unescaped_backticks
508 $(HOSTCFLAGS) -I $(srctree)/scripts/include
509 KBUILD_HOSTCXXFLAGS := -Wall -O2 $(HOST_LFS_CFLAGS) $(HOSTCXXFLAGS) \
510 -I $(srctree)/scripts/include
511 KBUILD_HOSTRUSTFLAGS := $(rust_common_flags) -O -Cstrip=debuginfo \
512 -Zallow-features=
518 CPP = $(CC) -E
522 AR = $(LLVM_PREFIX)llvm-ar$(LLVM_SUFFIX)
523 LLVM_LINK = $(LLVM_PREFIX)llvm-link$(LLVM_SUFFIX)
524 NM = $(LLVM_PREFIX)llvm-nm$(LLVM_SUFFIX)
525 OBJCOPY = $(LLVM_PREFIX)llvm-objcopy$(LLVM_SUFFIX)
526 OBJDUMP = $(LLVM_PREFIX)llvm-objdump$(LLVM_SUFFIX)
527 READELF = $(LLVM_PREFIX)llvm-readelf$(LLVM_SUFFIX)
528 STRIP = $(LLVM_PREFIX)llvm-strip$(LLVM_SUFFIX)
542 CLIPPY_DRIVER = clippy-driver
563 CHECKFLAGS := -D__linux__ -Dlinux -D__STDC__ -Dunix -D__unix__ \
564 -Wbitwise -Wno-return-void -Wno-unknown-attribute $(CF)
577 -I$(srctree)/arch/$(SRCARCH)/include/uapi \
578 -I$(objtree)/arch/$(SRCARCH)/include/generated/uapi \
579 -I$(srctree)/include/uapi \
580 -I$(objtree)/include/generated/uapi \
581 -include $(srctree)/include/linux/compiler-version.h \
582 -include $(srctree)/include/linux/kconfig.h
587 -I$(srctree)/arch/$(SRCARCH)/include \
588 -I$(objtree)/arch/$(SRCARCH)/include/generated \
589 -I$(srctree)/include \
590 -I$(objtree)/include \
593 KBUILD_AFLAGS := -D__ASSEMBLY__ -fno-PIE
596 KBUILD_CFLAGS += -fshort-wchar
597 KBUILD_CFLAGS += -funsigned-char
598 KBUILD_CFLAGS += -fno-common
599 KBUILD_CFLAGS += -fno-PIE
600 KBUILD_CFLAGS += -fno-strict-aliasing
602 KBUILD_CPPFLAGS := -D__KERNEL__
604 -Cpanic=abort -Cembed-bitcode=n -Clto=n \
605 -Cforce-unwind-tables=n -Ccodegen-units=1 \
606 -Csymbol-mangling-version=v0 \
607 -Crelocation-model=static \
608 -Zfunction-sections=n \
609 -Wclippy::float_arithmetic
614 KBUILD_AFLAGS_MODULE := -DMODULE
615 KBUILD_CFLAGS_MODULE := -DMODULE
616 KBUILD_RUSTFLAGS_MODULE := --cfg MODULE
632 # Allows finding `.clippy.toml` in out-of-srctree builds.
653 export RCS_FIND_IGNORE := \( -name SCCS -o -name BitKeeper -o -name .svn -o \
654 -name CVS -o -name .pc -o -name .hg -o -name .git \) \
655 -prune -o
669 # Before starting out-of-tree build, make sure the source tree is clean.
700 @if [ -f $(srctree)/.config -o \
701 -d $(srctree)/include/config -o \
702 -d $(srctree)/arch/$(SRCARCH)/include/generated ]; then \
710 @if [ -f $(srcroot)/modules.order ]; then \
713 echo >&2 "*** Please run 'make -C $(abs_srctree) M=$(realpath $(srcroot)) clean'"; \
718 $(Q)ln -fsn $(srcroot) source
719 $(Q)test -e .gitignore || \
728 CC_VERSION_TEXT = $(subst $(pound),,$(shell LC_ALL=C $(CC) --version 2>/dev/null | head -n 1))
729 RUSTC_VERSION_TEXT = $(subst $(pound),,$(shell $(RUSTC) --version 2>/dev/null))
730 PAHOLE_VERSION = $(shell $(srctree)/scripts/pahole-version.sh $(PAHOLE))
737 # cc-cross-prefix to determine CROSS_COMPILE.
738 ifdef need-compiler
742 ifdef config-build
744 # *config targets only - make sure prerequisites are updated, and descend
747 # Read arch-specific Makefile to set KBUILD_DEFCONFIG as needed.
759 else #!config-build
761 # Build targets only - this includes vmlinux, arch-specific targets, clean
775 # Decide whether to build built-in, modular, or both.
776 # Normally, just do built-in.
781 # If we have only "make modules", don't compile built-in objects.
790 ifneq ($(filter all modules nsdeps compile_commands.json clang-%,$(MAKECMDGOALS)),)
800 ifdef need-config
804 CC_FLAGS_DIALECT := -std=gnu11
810 CC_FLAGS_DIALECT += -Wno-gnu
811 CC_FLAGS_DIALECT += -Wno-microsoft-anon-tag
818 core-y :=
819 drivers-y :=
820 libs-y := lib/
829 CFLAGS_GCOV := -fprofile-arcs -ftest-coverage
831 CFLAGS_GCOV += -fno-tree-loop-im
837 CC_FLAGS_FTRACE := -pg
859 # Per-version Rust flags. These are like `rust_common_flags`, but may
860 # depend on the Rust compiler version (e.g. using `rustc-min-version`).
862 # `-Aclippy::precedence`: the lint was extended in Rust 1.85.0 to
867 $(if $(call rustc-min-version,108600),,-Aclippy::precedence)
875 ifdef need-config
876 ifdef may-sync-config
895 # This exploits the 'multi-target pattern rule' trick.
903 $(Q)$(MAKE) -f $(srctree)/Makefile syncconfig
904 else # !may-sync-config
906 # and include/config/auto.conf but do not care if they are up-to-date.
909 checked-configs := $(addprefix $(objtree)/, include/generated/autoconf.h include/generated/rustc_cfg include/config/auto.conf)
910 missing-configs := $(filter-out $(wildcard $(checked-configs)), $(checked-configs))
912 ifdef missing-configs
918 @printf >&2 '*** - %s\n' $(missing-configs)
924 endif # may-sync-config
925 endif # need-config
927 KBUILD_CFLAGS += -fno-delete-null-pointer-checks
930 KBUILD_CFLAGS += -O2
931 KBUILD_RUSTFLAGS += -Copt-level=2
933 KBUILD_CFLAGS += -Os
934 KBUILD_RUSTFLAGS += -Copt-level=s
937 # Always set `debug-assertions` and `overflow-checks` because their default
938 # depends on `opt-level` and `debug-assertions`, respectively.
939 KBUILD_RUSTFLAGS += -Cdebug-assertions=$(if $(CONFIG_RUST_DEBUG_ASSERTIONS),y,n)
940 KBUILD_RUSTFLAGS += -Coverflow-checks=$(if $(CONFIG_RUST_OVERFLOW_CHECKS),y,n)
942 # Tell gcc to never replace conditional load with a non-conditional one
944 # gcc-10 renamed --param=allow-store-data-races=0 to
945 # -fno-allow-store-data-races.
946 KBUILD_CFLAGS += $(call cc-option,--param=allow-store-data-races=0)
947 KBUILD_CFLAGS += $(call cc-option,-fno-allow-store-data-races)
955 KBUILD_CFLAGS += -fno-reorder-blocks -fno-ipa-cp-clone -fno-partial-inlining
958 stackp-flags-y := -fno-stack-protector
959 stackp-flags-$(CONFIG_STACKPROTECTOR) := -fstack-protector
960 stackp-flags-$(CONFIG_STACKPROTECTOR_STRONG) := -fstack-protector-strong
962 KBUILD_CFLAGS += $(stackp-flags-y)
965 KBUILD_CFLAGS += -fno-omit-frame-pointer -fno-optimize-sibling-calls
966 KBUILD_RUSTFLAGS += -Cforce-frame-pointers=y
970 # select FRAME_POINTER. However, FUNCTION_TRACER adds -pg, and this is
971 # incompatible with -fomit-frame-pointer with current GCC, so we don't use
972 # -fomit-frame-pointer with FUNCTION_TRACER.
973 # In the Rust target specification, "frame-pointer" is set explicitly
974 # to "may-omit".
976 KBUILD_CFLAGS += -fomit-frame-pointer
982 KBUILD_CFLAGS += -ftrivial-auto-var-init=pattern
987 KBUILD_CFLAGS += -ftrivial-auto-var-init=zero
989 # https://github.com/llvm/llvm-project/issues/44842
990 CC_AUTO_VAR_INIT_ZERO_ENABLER := -enable-trivial-auto-var-init-zero-knowing-it-will-be-removed-from-clang
998 KBUILD_CFLAGS += -fexperimental-late-parse-attributes
1003 KBUILD_CFLAGS += $(call cc-option,-fzero-init-padding-bits=all)
1007 KBUILD_CFLAGS += $(call cc-option, -fno-stack-clash-protection)
1010 KBUILD_CFLAGS += $(call cc-option, -fdiagnostics-show-context=2)
1014 KBUILD_CFLAGS += $(call cc-option, -fdiagnostics-show-inlining-chain)
1018 KBUILD_CFLAGS += -fzero-call-used-regs=used-gpr
1023 CC_FLAGS_FTRACE += -mrecord-mcount
1025 ifeq ($(call cc-option-yn, -mnop-mcount),y)
1026 CC_FLAGS_FTRACE += -mnop-mcount
1027 CC_FLAGS_USING += -DCC_USING_NOP_MCOUNT
1033 CC_FLAGS_USING += -DCC_USING_NOP_MCOUNT
1043 # s390-linux-gnu-gcc did not support -mfentry until gcc-9.
1044 ifeq ($(call cc-option-yn, -mfentry),y)
1045 CC_FLAGS_FTRACE += -mfentry
1046 CC_FLAGS_USING += -DCC_USING_FENTRY
1056 KBUILD_CFLAGS += -fno-inline-functions-called-once
1059 # `rustc`'s `-Zfunction-sections` applies to data too (as of 1.59.0).
1061 KBUILD_CFLAGS_KERNEL += -ffunction-sections -fdata-sections
1062 KBUILD_RUSTFLAGS_KERNEL += -Zfunction-sections=y
1063 LDFLAGS_vmlinux += --gc-sections
1068 CC_FLAGS_SCS := -fsanitize=shadow-call-stack
1070 KBUILD_RUSTFLAGS += -Zsanitizer=shadow-call-stack
1077 CC_FLAGS_LTO := -flto=thin -fsplit-lto-unit
1078 KBUILD_LDFLAGS += $(call ld-option,--lto-whole-program-visibility -mllvm -always-rename-promoted-locals=false)
1080 CC_FLAGS_LTO := -flto
1082 CC_FLAGS_LTO += -fvisibility=hidden
1085 KBUILD_LDFLAGS += -mllvm -import-instr-limit=5
1089 KBUILD_CFLAGS += -fno-lto $(CC_FLAGS_LTO)
1090 KBUILD_AFLAGS += -fno-lto
1095 CC_FLAGS_CFI := -fsanitize=kcfi
1097 CC_FLAGS_CFI += -fsanitize-cfi-icall-experimental-normalize-integers
1100 CC_FLAGS_CFI += -fsanitize-kcfi-arity
1103 # Always pass -Zsanitizer-cfi-normalize-integers as CONFIG_RUST selects
1105 RUSTC_FLAGS_CFI := -Zsanitizer=kcfi -Zsanitizer-cfi-normalize-integers
1113 # Architectures can define flags to add/remove for floating-point support
1114 CC_FLAGS_FPU += -D_LINUX_FPU_COMPILATION_UNIT
1120 # -fmin-function-alignment if it is available, or fall back to -falign-funtions.
1123 KBUILD_CFLAGS += -fmin-function-alignment=$(CONFIG_FUNCTION_ALIGNMENT)
1125 KBUILD_CFLAGS += -falign-functions=$(CONFIG_FUNCTION_ALIGNMENT)
1130 NOSTDINC_FLAGS += -nostdinc
1136 KBUILD_CFLAGS += $(call cc-option, -fstrict-flex-arrays=3)
1139 KBUILD_CFLAGS += -fno-strict-overflow
1141 # Make sure -fstack-check isn't enabled (like gentoo apparently did)
1142 KBUILD_CFLAGS += -fno-stack-check
1146 KBUILD_CFLAGS += -fconserve-stack
1150 KBUILD_CFLAGS += -fno-builtin-wcslen
1154 KBUILD_CPPFLAGS += -fmacro-prefix-map=$(srcroot)/=
1155 ifeq ($(call rustc-option-yn, --remap-path-scope=macro),y)
1156 KBUILD_RUSTFLAGS += --remap-path-prefix=$(srcroot)/= --remap-path-scope=macro
1161 include-y := scripts/Makefile.warn
1162 include-$(CONFIG_DEBUG_INFO) += scripts/Makefile.debug
1163 include-$(CONFIG_DEBUG_INFO_BTF)+= scripts/Makefile.btf
1164 include-$(CONFIG_KASAN) += scripts/Makefile.kasan
1165 include-$(CONFIG_KCSAN) += scripts/Makefile.kcsan
1166 include-$(CONFIG_KMSAN) += scripts/Makefile.kmsan
1167 include-$(CONFIG_UBSAN) += scripts/Makefile.ubsan
1168 include-$(CONFIG_KCOV) += scripts/Makefile.kcov
1169 include-$(CONFIG_RANDSTRUCT) += scripts/Makefile.randstruct
1170 include-$(CONFIG_KSTACK_ERASE) += scripts/Makefile.kstack_erase
1171 include-$(CONFIG_AUTOFDO_CLANG) += scripts/Makefile.autofdo
1172 include-$(CONFIG_PROPELLER_CLANG) += scripts/Makefile.propeller
1173 include-$(CONFIG_WARN_CONTEXT_ANALYSIS) += scripts/Makefile.context-analysis
1174 include-$(CONFIG_GCC_PLUGINS) += scripts/Makefile.gcc-plugins
1176 include $(addprefix $(srctree)/, $(include-y))
1178 # scripts/Makefile.gcc-plugins is intentionally included last.
1179 # Do not add $(call cc-option,...) below this line. When you build the kernel
1188 KBUILD_LDFLAGS_MODULE += --build-id=sha1
1189 LDFLAGS_vmlinux += --build-id=sha1
1191 KBUILD_LDFLAGS += -z noexecstack
1193 KBUILD_LDFLAGS += $(call ld-option,--no-warn-rwx-segments)
1197 LDFLAGS_vmlinux += -X
1201 # ld.lld before 15 did not support -z pack-relative-relocs.
1202 LDFLAGS_vmlinux += $(call ld-option,--pack-dyn-relocs=relr,-z pack-relative-relocs)
1208 LDFLAGS_vmlinux += --orphan-handling=$(CONFIG_LD_ORPHAN_WARN_LEVEL)
1212 LDFLAGS_vmlinux += --emit-relocs --discard-none
1216 USERFLAGS_FROM_KERNEL := --target=%
1223 USERFLAGS_FROM_KERNEL += -m32 -m64
1231 KBUILD_USERLDFLAGS += --ld-path=$(LD)
1235 CHECKFLAGS += --arch=$(ARCH)
1238 CHECKFLAGS += $(if $(CONFIG_CPU_BIG_ENDIAN),-mbig-endian,-mlittle-endian)
1241 CHECKFLAGS += $(if $(CONFIG_64BIT),-m64,-m32)
1245 ifneq ($(shell $(srctree)/scripts/checker-valid.sh $(CHECK) $(CHECKFLAGS)), 1)
1283 build-dir := .
1284 clean-dirs := $(sort . Documentation \
1285 $(patsubst %/,%,$(filter %/, $(core-) \
1286 $(drivers-) $(libs-))))
1288 export ARCH_CORE := $(core-y)
1289 export ARCH_LIB := $(filter %/, $(libs-y))
1290 export ARCH_DRIVERS := $(drivers-y) $(drivers-m)
1291 # Externally visible symbols (used by link-vmlinux.sh)
1293 KBUILD_VMLINUX_OBJS := built-in.a $(patsubst %/, %/lib.a, $(filter %/, $(libs-y)))
1294 KBUILD_VMLINUX_LIBS := $(filter-out %/, $(libs-y))
1305 # '$(AR) mPi' needs 'T' to workaround the bug of llvm-ar <= 14
1308 rm -f $@; \
1310 $(AR) mPiT $$($(AR) t $@ | sed -n 1p) $@ $$($(AR) t $@ | grep -F -f $(srctree)/scripts/head-object-list.txt)
1313 vmlinux.a: $(KBUILD_VMLINUX_OBJS) scripts/head-object-list.txt FORCE
1318 $(Q)$(MAKE) -f $(srctree)/scripts/Makefile.vmlinux_o
1337 $(Q)$(MAKE) -f $(srctree)/scripts/Makefile.vmlinux
1362 # A multi level approach is used. prepareN is processed before prepareN-1.
1369 asm-generic $(version_h) include/generated/utsrelease.h \
1371 include/generated/rustc_cfg remove-stale-files
1384 PHONY += remove-stale-files
1385 remove-stale-files:
1386 $(Q)$(srctree)/scripts/remove-stale-files
1388 # Support for using generic headers in asm-generic
1389 asm-generic := -f $(srctree)/scripts/Makefile.asm-headers obj
1391 PHONY += asm-generic uapi-asm-generic
1392 asm-generic: uapi-asm-generic
1393 $(Q)$(MAKE) $(asm-generic)=arch/$(SRCARCH)/include/generated/asm \
1394 generic=include/asm-generic
1395 uapi-asm-generic:
1396 $(Q)$(MAKE) $(asm-generic)=arch/$(SRCARCH)/include/generated/uapi/asm \
1397 generic=include/uapi/asm-generic
1400 # ---------------------------------------------------------------------------
1407 if [ `echo -n "$(KERNELRELEASE)" | wc -c ` -gt $(uts_len) ]; then \
1415 if [ $(SUBLEVEL) -gt 255 ]; then \
1445 $(Q)find $(srctree)/include/ -name '*.h' | xargs --max-args 1 \
1446 $(srctree)/scripts/headerdep.pl -I$(srctree)/include
1448 # ---------------------------------------------------------------------------
1456 mkdir -p $(INSTALL_HDR_PATH); \
1457 rsync -mrl --include='*/' --include='*\.h' --exclude='*' \
1466 hdr-inst := -f $(srctree)/scripts/Makefile.headersinst obj
1469 headers: $(version_h) scripts_unifdef uapi-asm-generic archheaders
1471 $(Q)$(MAKE) -f $(srctree)/Makefile HEADER_ARCH= SRCARCH=$(HEADER_ARCH) headers
1473 $(Q)$(MAKE) $(hdr-inst)=include/uapi
1474 $(Q)$(MAKE) $(hdr-inst)=arch/$(SRCARCH)/include/uapi
1493 # ---------------------------------------------------------------------------
1504 # ---------------------------------------------------------------------------
1508 vdso_install: export INSTALL_FILES = $(vdso-install-y)
1510 $(Q)$(MAKE) -f $(srctree)/scripts/Makefile.vdsoinst
1512 # ---------------------------------------------------------------------------
1539 $(Q)$(MAKE) -sC $(srctree)/tools/bpf/resolve_btfids O=$(resolve_btfids_O) clean
1548 $(Q)$(MAKE) -sC $(abs_srctree)/tools/objtool O=$(objtool_O) srctree=$(abs_srctree) $(patsubst objtool_%,%,$@)
1552 $(Q)mkdir -p $(objtree)/tools
1553 $(Q)$(MAKE) O=$(abspath $(objtree)) subdir=tools -C $(srctree)/tools/
1556 $(Q)mkdir -p $(objtree)/tools
1557 $(Q)$(MAKE) O=$(abspath $(objtree)) subdir=tools -C $(srctree)/tools/ $*
1559 # ---------------------------------------------------------------------------
1564 $(Q)$(MAKE) -C $(srctree)/tools/testing/selftests run_tests
1566 kselftest-%: headers FORCE
1567 $(Q)$(MAKE) -C $(srctree)/tools/testing/selftests $*
1569 PHONY += kselftest-merge
1570 kselftest-merge:
1572 $(Q)find $(srctree)/tools/testing/selftests -name config -o -name config.$(UTS_MACHINE) | \
1573 xargs $(srctree)/scripts/kconfig/merge_config.sh -y -m $(objtree)/.config
1574 $(Q)$(MAKE) -f $(srctree)/Makefile olddefconfig
1576 # ---------------------------------------------------------------------------
1599 $(Q)$(MAKE) $(build)=$(dtstree) need-dtbslist=1
1617 $(Q)$(MAKE) -f $(srctree)/scripts/Makefile.dtbinst obj=$(dtstree)
1648 # ---------------------------------------------------------------------------
1658 # the built-in objects during the descend as well, in order to
1690 CLEAN_FILES += vmlinux.symvers modules-only.symvers \
1694 rust-project.json .vmlinux.objs .vmlinux.export.c \
1695 .builtin-dtbs-list .builtin-dtbs.S
1700 debian snap tar-install PKGBUILD pacman \
1705 vmlinux-gdb.py \
1710 # clean - Delete most, but leave enough to build external modules
1712 clean: private rm-files := $(CLEAN_FILES)
1717 $(Q)$(CONFIG_SHELL) $(srctree)/scripts/link-vmlinux.sh clean
1718 $(Q)$(if $(ARCH_POSTLINK), $(MAKE) -f $(ARCH_POSTLINK) clean)
1722 # mrproper - Delete all generated files, including .config
1724 mrproper: private rm-files := $(MRPROPER_FILES)
1725 mrproper-dirs := $(addprefix _mrproper_,scripts)
1727 PHONY += $(mrproper-dirs) mrproper
1728 $(mrproper-dirs):
1731 mrproper: clean objtool_mrproper $(mrproper-dirs)
1734 \( -name '*.rmeta' \) \
1735 -type f -print | xargs rm -f
1743 \( -name '*.orig' -o -name '*.rej' -o -name '*~' \
1744 -o -name '*.bak' -o -name '#*#' -o -name '*%' \
1745 -o -name 'core' -o -name tags -o -name TAGS -o -name 'cscope*' \
1746 -o -name GPATH -o -name GRTAGS -o -name GSYMS -o -name GTAGS \) \
1747 -type f -print | xargs rm -f
1751 # ---------------------------------------------------------------------------
1753 modules-cpio-pkg: usr_gen_init_cpio
1755 %src-pkg: FORCE
1756 $(Q)$(MAKE) -f $(srctree)/scripts/Makefile.package $@
1758 $(Q)$(MAKE) -f $(srctree)/scripts/Makefile.package $@
1761 # ---------------------------------------------------------------------------
1765 board-dirs := $(dir $(wildcard $(srctree)/arch/$(SRCARCH)/configs/*/*_defconfig))
1766 board-dirs := $(sort $(notdir $(board-dirs:/=)))
1771 @echo ' clean - Remove most generated files but keep the config and'
1773 @echo ' mrproper - Remove all generated files + config + various backup files'
1774 @echo ' distclean - mrproper + remove editor backup and patch files'
1776 @$(MAKE) -f $(srctree)/scripts/kconfig/Makefile help
1779 @echo ' all - Build all targets marked with [*]'
1780 @echo '* vmlinux - Build the bare kernel'
1781 @echo '* modules - Build all modules'
1782 @echo ' modules_install - Install all modules to INSTALL_MOD_PATH (default: /)'
1783 @echo ' vdso_install - Install unstripped vdso to INSTALL_MOD_PATH (default: /)'
1784 @echo ' dir/ - Build all files in dir and below'
1785 @echo ' dir/file.[ois] - Build specified target only'
1786 @echo ' dir/file.ll - Build the LLVM assembly file'
1788 @echo ' dir/file.lst - Build specified mixed source/assembly target only'
1790 @echo ' dir/file.ko - Build module including final link'
1791 @echo ' modules_prepare - Set up for building external modules'
1792 @echo ' tags/TAGS - Generate tags file for editors'
1793 @echo ' cscope - Generate cscope index'
1794 @echo ' gtags - Generate GNU GLOBAL index'
1795 @echo ' kernelrelease - Output the release version string (use with make -s)'
1796 @echo ' kernelversion - Output the version stored in Makefile (use with make -s)'
1797 @echo ' image_name - Output the image name (use with make -s)'
1798 @echo ' headers - Build ready-to-install UAPI headers in usr/include'
1799 @echo ' headers_install - Install sanitised kernel UAPI headers to INSTALL_HDR_PATH'; \
1803 @echo ' checkstack - Generate a list of stack hogs and consider all functions'
1805 @echo ' versioncheck - Sanity check on version.h usage'
1806 @echo ' includecheck - Check for duplicate included header files'
1807 @echo ' headerdep - Detect inclusion cycles in headers'
1808 @echo ' coccicheck - Check with Coccinelle'
1809 @echo ' clang-analyzer - Check with clang static analyzer'
1810 @echo ' clang-tidy - Check with clang-tidy'
1813 @echo ' nsdeps - Generate missing symbol namespace dependencies'
1816 @echo ' kselftest - Build and run kernel selftest'
1820 @echo ' kselftest-all - Build kernel selftest'
1821 @echo ' kselftest-install - Build and install kernel selftest'
1822 @echo ' kselftest-clean - Remove all generated kselftest files'
1823 @echo ' kselftest-merge - Merge all the config dependencies of'
1827 @echo ' rustavailable - Checks whether the Rust toolchain is'
1829 @echo ' rustfmt - Reformat all the Rust code in the kernel'
1830 @echo ' rustfmtcheck - Checks if all the Rust code in the kernel'
1832 @echo ' rustdoc - Generate Rust documentation'
1834 @echo ' rusttest - Runs the Rust tests'
1836 @echo ' rust-analyzer - Generate rust-project.json rust-analyzer support file'
1838 @echo ' dir/file.[os] - Build specified target only'
1839 @echo ' dir/file.rsi - Build macro expanded source, similar to C preprocessing.'
1842 @echo ' dir/file.ll - Build the LLVM assembly file'
1846 echo '* dtbs - Build device tree blobs for enabled boards'; \
1847 echo ' dtbs_install - Install dtbs to $(INSTALL_DTBS_PATH)'; \
1848 echo ' dt_binding_check - Validate device tree binding documents and examples'; \
1849 echo ' dt_binding_schemas - Build processed device tree binding schemas'; \
1850 echo ' dtbs_check - Validate device tree source files';\
1858 @$(MAKE) -f $(srctree)/scripts/Makefile.package help
1861 @$(MAKE) -f $(srctree)/Documentation/Makefile dochelp
1863 @echo 'Architecture-specific targets ($(SRCARCH)):'
1865 echo ' No architecture-specific help defined for $(SRCARCH)')
1869 printf " %-27s - Build for %s\\n" $(b) $(subst _defconfig,,$(b));) \
1871 @$(if $(board-dirs), \
1872 $(foreach b, $(board-dirs), \
1873 printf " %-16s - Show %s-specific targets\\n" help-$(b) $(b);) \
1874 printf " %-16s - Show all of the above\\n" help-boards; \
1881 @echo ' make C=1 [targets] Check re-compiled c source with $$CHECK'
1903 help-board-dirs := $(addprefix help-,$(board-dirs))
1905 help-boards: $(help-board-dirs)
1907 boards-per-dir = $(sort $(notdir $(wildcard $(srctree)/arch/$(SRCARCH)/configs/$*/*_defconfig)))
1909 $(help-board-dirs): help-%:
1910 @echo 'Architecture-specific targets ($(SRCARCH) $*):'
1911 @$(if $(boards-per-dir), \
1912 $(foreach b, $(boards-per-dir), \
1913 printf " %-24s - Build for %s\\n" $*/$(b) $(subst _defconfig,,$(b));) \
1918 # ---------------------------------------------------------------------------
1921 htmldocs-redirects
1929 # ---------------------------------------------------------------------------
1938 # Using the singular to avoid running afoul of `no-dot-config-targets`.
1943 # Testing target
1956 -path $(srctree)/rust/proc-macro2 \
1957 -o -path $(srctree)/rust/quote \
1958 -o -path $(srctree)/rust/syn \
1959 \) -prune -o \
1960 -type f -a -name '*.rs' -a ! -name '*generated*' -print \
1963 rustfmtcheck: rustfmt_flags = --check
1967 # ---------------------------------------------------------------------------
1969 PHONY += misc-check
1970 misc-check:
1971 $(Q)$(srctree)/scripts/misc-check
1973 all: misc-check
1978 $(Q)ln -fsn $(abspath $(srctree)/scripts/gdb/vmlinux-gdb.py)
1991 # read-only, and no consistency checks are made and the make
1999 build-dir := .
2001 clean-dirs := .
2002 clean: private rm-files := Module.symvers modules.nsdeps compile_commands.json
2023 @echo ' Syntax: make -C path/to/kernel/src M=$$PWD target'
2025 @echo ' modules - default target, build the module(s)'
2026 @echo ' modules_install - install the module'
2027 @echo ' clean - remove generated files in module directory only'
2028 @echo ' rust-analyzer - generate rust-project.json rust-analyzer support file'
2043 # ---------------------------------------------------------------------------
2049 $(Q)$(MAKE) -f $(srctree)/scripts/Makefile.modinst \
2050 sign-only=$(if $(filter modules_install,$(MAKECMDGOALS)),,y)
2067 modules.order: $(build-dir)
2074 $(Q)$(MAKE) -f $(srctree)/scripts/Makefile.modfinal
2079 $(Q)$(CONFIG_SHELL) $(srctree)/scripts/modules-check.sh $<
2091 modpost: $(if $(single-build),, $(if $(KBUILD_BUILTIN), vmlinux.o)) \
2093 $(Q)$(MAKE) -f $(srctree)/scripts/Makefile.modpost
2096 # ---------------------------------------------------------------------------
2101 # The supported suffixes for single-target are listed in 'single-targets'
2107 ifdef single-build
2110 single-ko := $(sort $(filter %.ko, $(MAKECMDGOALS)))
2111 single-no-ko := $(filter-out $(single-ko), $(MAKECMDGOALS)) \
2112 $(foreach x, o mod, $(patsubst %.ko, %.$x, $(single-ko)))
2114 $(single-ko): single_modules
2116 $(single-no-ko): $(build-dir)
2121 single_modules: $(single-no-ko) modules_prepare
2122 $(Q){ $(foreach m, $(single-ko), echo $(m:%.ko=%.o);) } > modules.order
2123 $(Q)$(MAKE) -f $(srctree)/scripts/Makefile.modpost
2125 $(Q)$(MAKE) -f $(srctree)/scripts/Makefile.modfinal
2127 $(Q)rm -f modules.order
2129 single-goals := $(addprefix $(build-dir)/, $(single-no-ko))
2141 PHONY += $(build-dir)
2142 $(build-dir): prepare
2143 $(Q)$(MAKE) $(build)=$@ need-builtin=1 need-modorder=1 $(single-goals)
2145 clean-dirs := $(addprefix _clean_, $(clean-dirs))
2146 PHONY += $(clean-dirs) clean
2147 $(clean-dirs):
2150 clean: $(clean-dirs)
2153 \( -name '*.[aios]' -o -name '*.rsi' -o -name '*.ko' -o -name '.*.cmd' \
2154 -o -name '*.ko.*' \
2155 -o -name '*.dtb' -o -name '*.dtbo' \
2156 -o -name '*.dtb.S' -o -name '*.dtbo.S' \
2157 -o -name '*.dt.yaml' -o -name 'dtbs-list' \
2158 -o -name '*.dwo' -o -name '*.lst' \
2159 -o -name '*.su' -o -name '*.mod' \
2160 -o -name '.*.d' -o -name '.*.tmp' -o -name '*.mod.c' \
2161 -o -name '*.lex.c' -o -name '*.tab.[ch]' \
2162 -o -name '*.asn1.[ch]' \
2163 -o -name '*.symtypes' -o -name 'modules.order' \
2164 -o -name '*.c.[012]*.*' \
2165 -o -name '*.ll' \
2166 -o -name '*.gcno' \
2167 \) -type f -print \
2168 -o -name '.tmp_*' -print \
2169 | xargs rm -rf
2172 # ---------------------------------------------------------------------------
2179 # Generate rust-project.json (a file that describes the structure of non-Cargo
2180 # Rust projects) for rust-analyzer (an implementation of the Language Server
2182 PHONY += rust-analyzer
2183 rust-analyzer:
2186 # FIXME: external modules must not descend into a sub-directory of the kernel
2193 # ---------------------------------------------------------------------------
2201 # ---------------------------------------------------------------------------
2204 cmd_gen_compile_commands = $(PYTHON3) $< -a $(AR) -o $@ $(filter-out $<, $(real-prereqs))
2206 compile_commands.json: $(srctree)/scripts/clang-tools/gen_compile_commands.py \
2213 PHONY += clang-tidy clang-analyzer
2217 cmd_clang_tools = $(PYTHON3) $(srctree)/scripts/clang-tools/run-clang-tools.py $@ $<
2219 clang-tidy clang-analyzer: compile_commands.json
2222 clang-tidy clang-analyzer:
2228 # ---------------------------------------------------------------------------
2234 -name '*.[hcS]' -type f -print | sort \
2235 | xargs $(PERL) -w $(srctree)/scripts/checkincludes.pl
2239 -name '*.[hcS]' -type f -print | sort \
2240 | xargs $(PERL) -w $(srctree)/scripts/checkversion.pl
2249 # else wants $(ARCH), including people doing cross-builds, which means
2258 $(OBJDUMP) -d vmlinux $$(find . -name '*.ko') | \
2270 PHONY += run-command
2271 run-command:
2274 quiet_cmd_rmfiles = $(if $(wildcard $(rm-files)),CLEAN $(wildcard $(rm-files)))
2275 cmd_rmfiles = rm -rf $(rm-files)
2278 existing-targets := $(wildcard $(sort $(targets)))
2280 -include $(foreach f,$(existing-targets),$(dir $(f)).$(notdir $(f)).cmd)
2282 endif # config-build
2283 endif # mixed-build
2284 endif # need-sub-make