Makefile (57a30218fa25c469ed507964bbf028b7a064309a) Makefile (ec31f868ec674edfcf653cc7c82b365c6f570cd9)
1# SPDX-License-Identifier: GPL-2.0
2VERSION = 6
3PATCHLEVEL = 2
4SUBLEVEL = 0
1# SPDX-License-Identifier: GPL-2.0
2VERSION = 6
3PATCHLEVEL = 2
4SUBLEVEL = 0
5EXTRAVERSION = -rc6
5EXTRAVERSION = -rc5
6NAME = Hurr durr I'ma ninja sloth
7
8# *DOCUMENTATION*
9# To see a list of typical targets execute "make help"
10# More info can be located in ./README
11# Comments in this file are targeted only to the developer, do not
12# expect to learn how to build the kernel reading this file.
13

--- 37 unchanged lines hidden (view full) ---

51export LC_COLLATE LC_NUMERIC
52
53# Avoid interference with shell env settings
54unexport GREP_OPTIONS
55
56# Beautify output
57# ---------------------------------------------------------------------------
58#
6NAME = Hurr durr I'ma ninja sloth
7
8# *DOCUMENTATION*
9# To see a list of typical targets execute "make help"
10# More info can be located in ./README
11# Comments in this file are targeted only to the developer, do not
12# expect to learn how to build the kernel reading this file.
13

--- 37 unchanged lines hidden (view full) ---

51export LC_COLLATE LC_NUMERIC
52
53# Avoid interference with shell env settings
54unexport GREP_OPTIONS
55
56# Beautify output
57# ---------------------------------------------------------------------------
58#
59# Normally, we echo the whole command before executing it. By making
60# that echo $($(quiet)$(cmd)), we now have the possibility to set
61# $(quiet) to choose other forms of output instead, e.g.
59# Most of build commands in Kbuild start with "cmd_". You can optionally define
60# "quiet_cmd_*". If defined, the short log is printed. Otherwise, no log from
61# that command is printed by default.
62#
62#
63# quiet_cmd_cc_o_c = Compiling $(RELDIR)/$@
64# cmd_cc_o_c = $(CC) $(c_flags) -c -o $@ $<
63# e.g.)
64# quiet_cmd_depmod = DEPMOD $(MODLIB)
65# cmd_depmod = $(srctree)/scripts/depmod.sh $(DEPMOD) $(KERNELRELEASE)
65#
66#
66# If $(quiet) is empty, the whole command will be printed.
67# If it is set to "quiet_", only the short version will be printed.
68# If it is set to "silent_", nothing will be printed at all, since
69# the variable $(silent_cmd_cc_o_c) doesn't exist.
70#
71# A simple variant is to prefix commands with $(Q) - that's useful
72# for commands that shall be hidden in non-verbose mode.
73#
67# A simple variant is to prefix commands with $(Q) - that's useful
68# for commands that shall be hidden in non-verbose mode.
69#
74# $(Q)ln $@ :<
70# $(Q)$(MAKE) $(build)=scripts/basic
75#
71#
76# If KBUILD_VERBOSE equals 0 then the above command will be hidden.
77# If KBUILD_VERBOSE equals 1 then the above command is displayed.
78# If KBUILD_VERBOSE equals 2 then give the reason why each target is rebuilt.
72# If KBUILD_VERBOSE contains 1, the whole command is echoed.
73# If KBUILD_VERBOSE contains 2, the reason for rebuilding is printed.
79#
80# To put more focus on warnings, be less verbose as default
81# Use 'make V=1' to see the full commands
82
83ifeq ("$(origin V)", "command line")
84 KBUILD_VERBOSE = $(V)
85endif
74#
75# To put more focus on warnings, be less verbose as default
76# Use 'make V=1' to see the full commands
77
78ifeq ("$(origin V)", "command line")
79 KBUILD_VERBOSE = $(V)
80endif
86ifndef KBUILD_VERBOSE
87 KBUILD_VERBOSE = 0
88endif
89
81
90ifeq ($(KBUILD_VERBOSE),1)
82quiet = quiet_
83Q = @
84
85ifneq ($(findstring 1, $(KBUILD_VERBOSE)),)
91 quiet =
92 Q =
86 quiet =
87 Q =
93else
94 quiet=quiet_
95 Q = @
96endif
97
98# If the user is running make -s (silent mode), suppress echoing of
99# commands
100# make-4.0 (and later) keep single letter options in the 1st word of MAKEFLAGS.
101
102ifeq ($(filter 3.%,$(MAKE_VERSION)),)
88endif
89
90# If the user is running make -s (silent mode), suppress echoing of
91# commands
92# make-4.0 (and later) keep single letter options in the 1st word of MAKEFLAGS.
93
94ifeq ($(filter 3.%,$(MAKE_VERSION)),)
103silence:=$(findstring s,$(firstword -$(MAKEFLAGS)))
95short-opts := $(firstword -$(MAKEFLAGS))
104else
96else
105silence:=$(findstring s,$(filter-out --%,$(MAKEFLAGS)))
97short-opts := $(filter-out --%,$(MAKEFLAGS))
106endif
107
98endif
99
108ifeq ($(silence),s)
100ifneq ($(findstring s,$(short-opts)),)
109quiet=silent_
101quiet=silent_
110KBUILD_VERBOSE = 0
102override KBUILD_VERBOSE :=
111endif
112
113export quiet Q KBUILD_VERBOSE
114
115# Call a source code checker (by default, "sparse") as part of the
116# C compilation.
117#
118# Use 'make C=1' to enable checking of only re-compiled files.

--- 453 unchanged lines hidden (view full) ---

572KBUILD_AFLAGS := -D__ASSEMBLY__ -fno-PIE
573KBUILD_CFLAGS := -Wall -Wundef -Werror=strict-prototypes -Wno-trigraphs \
574 -fno-strict-aliasing -fno-common -fshort-wchar -fno-PIE \
575 -Werror=implicit-function-declaration -Werror=implicit-int \
576 -Werror=return-type -Wno-format-security -funsigned-char \
577 -std=gnu11
578KBUILD_CPPFLAGS := -D__KERNEL__
579KBUILD_RUSTFLAGS := $(rust_common_flags) \
103endif
104
105export quiet Q KBUILD_VERBOSE
106
107# Call a source code checker (by default, "sparse") as part of the
108# C compilation.
109#
110# Use 'make C=1' to enable checking of only re-compiled files.

--- 453 unchanged lines hidden (view full) ---

564KBUILD_AFLAGS := -D__ASSEMBLY__ -fno-PIE
565KBUILD_CFLAGS := -Wall -Wundef -Werror=strict-prototypes -Wno-trigraphs \
566 -fno-strict-aliasing -fno-common -fshort-wchar -fno-PIE \
567 -Werror=implicit-function-declaration -Werror=implicit-int \
568 -Werror=return-type -Wno-format-security -funsigned-char \
569 -std=gnu11
570KBUILD_CPPFLAGS := -D__KERNEL__
571KBUILD_RUSTFLAGS := $(rust_common_flags) \
580 --target=$(objtree)/rust/target.json \
572 --target=$(objtree)/scripts/target.json \
581 -Cpanic=abort -Cembed-bitcode=n -Clto=n \
582 -Cforce-unwind-tables=n -Ccodegen-units=1 \
583 -Csymbol-mangling-version=v0 \
584 -Crelocation-model=static \
585 -Zfunction-sections=n \
586 -Dclippy::float_arithmetic
587
588KBUILD_AFLAGS_KERNEL :=

--- 284 unchanged lines hidden (view full) ---

873KBUILD_CPPFLAGS-$(CONFIG_WERROR) += -Werror
874KBUILD_CPPFLAGS += $(KBUILD_CPPFLAGS-y)
875KBUILD_CFLAGS-$(CONFIG_CC_NO_ARRAY_BOUNDS) += -Wno-array-bounds
876
877KBUILD_RUSTFLAGS-$(CONFIG_WERROR) += -Dwarnings
878KBUILD_RUSTFLAGS += $(KBUILD_RUSTFLAGS-y)
879
880ifdef CONFIG_CC_IS_CLANG
573 -Cpanic=abort -Cembed-bitcode=n -Clto=n \
574 -Cforce-unwind-tables=n -Ccodegen-units=1 \
575 -Csymbol-mangling-version=v0 \
576 -Crelocation-model=static \
577 -Zfunction-sections=n \
578 -Dclippy::float_arithmetic
579
580KBUILD_AFLAGS_KERNEL :=

--- 284 unchanged lines hidden (view full) ---

865KBUILD_CPPFLAGS-$(CONFIG_WERROR) += -Werror
866KBUILD_CPPFLAGS += $(KBUILD_CPPFLAGS-y)
867KBUILD_CFLAGS-$(CONFIG_CC_NO_ARRAY_BOUNDS) += -Wno-array-bounds
868
869KBUILD_RUSTFLAGS-$(CONFIG_WERROR) += -Dwarnings
870KBUILD_RUSTFLAGS += $(KBUILD_RUSTFLAGS-y)
871
872ifdef CONFIG_CC_IS_CLANG
881KBUILD_CPPFLAGS += -Qunused-arguments
882# The kernel builds with '-std=gnu11' so use of GNU extensions is acceptable.
883KBUILD_CFLAGS += -Wno-gnu
884else
885
886# gcc inanely warns about local variables called 'main'
887KBUILD_CFLAGS += -Wno-main
888endif
889

--- 372 unchanged lines hidden (view full) ---

1262vmlinux: export LDFLAGS_vmlinux = $(_LDFLAGS_vmlinux)
1263vmlinux: vmlinux.o $(KBUILD_LDS) modpost
1264 $(Q)$(MAKE) -f $(srctree)/scripts/Makefile.vmlinux
1265
1266# The actual objects are generated when descending,
1267# make sure no implicit rule kicks in
1268$(sort $(KBUILD_LDS) $(KBUILD_VMLINUX_OBJS) $(KBUILD_VMLINUX_LIBS)): . ;
1269
873# The kernel builds with '-std=gnu11' so use of GNU extensions is acceptable.
874KBUILD_CFLAGS += -Wno-gnu
875else
876
877# gcc inanely warns about local variables called 'main'
878KBUILD_CFLAGS += -Wno-main
879endif
880

--- 372 unchanged lines hidden (view full) ---

1253vmlinux: export LDFLAGS_vmlinux = $(_LDFLAGS_vmlinux)
1254vmlinux: vmlinux.o $(KBUILD_LDS) modpost
1255 $(Q)$(MAKE) -f $(srctree)/scripts/Makefile.vmlinux
1256
1257# The actual objects are generated when descending,
1258# make sure no implicit rule kicks in
1259$(sort $(KBUILD_LDS) $(KBUILD_VMLINUX_OBJS) $(KBUILD_VMLINUX_LIBS)): . ;
1260
1270filechk_kernel.release = \
1271 echo "$(KERNELVERSION)$$($(CONFIG_SHELL) $(srctree)/scripts/setlocalversion $(srctree))"
1261filechk_kernel.release = $(srctree)/scripts/setlocalversion $(srctree)
1272
1273# Store (new) KERNELRELEASE string in include/config/kernel.release
1274include/config/kernel.release: FORCE
1275 $(call filechk,kernel.release)
1276
1277# Additional helpers built in scripts/
1278# Carefully list dependencies so we do not try to build scripts twice
1279# in parallel

--- 329 unchanged lines hidden (view full) ---

1609 arch/$(SRCARCH)/include/generated .objdiff \
1610 debian snap tar-install \
1611 .config .config.old .version \
1612 Module.symvers \
1613 certs/signing_key.pem \
1614 certs/x509.genkey \
1615 vmlinux-gdb.py \
1616 *.spec \
1262
1263# Store (new) KERNELRELEASE string in include/config/kernel.release
1264include/config/kernel.release: FORCE
1265 $(call filechk,kernel.release)
1266
1267# Additional helpers built in scripts/
1268# Carefully list dependencies so we do not try to build scripts twice
1269# in parallel

--- 329 unchanged lines hidden (view full) ---

1599 arch/$(SRCARCH)/include/generated .objdiff \
1600 debian snap tar-install \
1601 .config .config.old .version \
1602 Module.symvers \
1603 certs/signing_key.pem \
1604 certs/x509.genkey \
1605 vmlinux-gdb.py \
1606 *.spec \
1617 rust/target.json rust/libmacros.so
1607 rust/libmacros.so
1618
1619# clean - Delete most, but leave enough to build external modules
1620#
1621clean: rm-files := $(CLEAN_FILES)
1622
1623PHONY += archclean vmlinuxclean
1624
1625vmlinuxclean:

--- 148 unchanged lines hidden (view full) ---

1774 printf " %-27s - Build for %s\\n" $(b) $(subst _defconfig,,$(b));) \
1775 echo '')
1776 @$(if $(board-dirs), \
1777 $(foreach b, $(board-dirs), \
1778 printf " %-16s - Show %s-specific targets\\n" help-$(b) $(b);) \
1779 printf " %-16s - Show all of the above\\n" help-boards; \
1780 echo '')
1781
1608
1609# clean - Delete most, but leave enough to build external modules
1610#
1611clean: rm-files := $(CLEAN_FILES)
1612
1613PHONY += archclean vmlinuxclean
1614
1615vmlinuxclean:

--- 148 unchanged lines hidden (view full) ---

1764 printf " %-27s - Build for %s\\n" $(b) $(subst _defconfig,,$(b));) \
1765 echo '')
1766 @$(if $(board-dirs), \
1767 $(foreach b, $(board-dirs), \
1768 printf " %-16s - Show %s-specific targets\\n" help-$(b) $(b);) \
1769 printf " %-16s - Show all of the above\\n" help-boards; \
1770 echo '')
1771
1782 @echo ' make V=0|1 [targets] 0 => quiet build (default), 1 => verbose build'
1783 @echo ' make V=2 [targets] 2 => give reason for rebuild of target'
1772 @echo ' make V=n [targets] 1: verbose build'
1773 @echo ' 2: give reason for rebuild of target'
1774 @echo ' V=1 and V=2 can be combined with V=12'
1784 @echo ' make O=dir [targets] Locate all output files in "dir", including .config'
1785 @echo ' make C=1 [targets] Check re-compiled c source with $$CHECK'
1786 @echo ' (sparse by default)'
1787 @echo ' make C=2 [targets] Force check of all c source with $$CHECK'
1788 @echo ' make RECORDMCOUNT_WARN=1 [targets] Warn about ignored mcount sections'
1789 @echo ' make W=n [targets] Enable extra build checks, n=1,2,3 where'
1790 @echo ' 1: warnings which may be relevant and do not occur too often'
1791 @echo ' 2: warnings which occur quite often but may still be relevant'

--- 71 unchanged lines hidden (view full) ---

1863# IDE support targets
1864PHONY += rust-analyzer
1865rust-analyzer:
1866 $(Q)$(MAKE) $(build)=rust $@
1867
1868# Misc
1869# ---------------------------------------------------------------------------
1870
1775 @echo ' make O=dir [targets] Locate all output files in "dir", including .config'
1776 @echo ' make C=1 [targets] Check re-compiled c source with $$CHECK'
1777 @echo ' (sparse by default)'
1778 @echo ' make C=2 [targets] Force check of all c source with $$CHECK'
1779 @echo ' make RECORDMCOUNT_WARN=1 [targets] Warn about ignored mcount sections'
1780 @echo ' make W=n [targets] Enable extra build checks, n=1,2,3 where'
1781 @echo ' 1: warnings which may be relevant and do not occur too often'
1782 @echo ' 2: warnings which occur quite often but may still be relevant'

--- 71 unchanged lines hidden (view full) ---

1854# IDE support targets
1855PHONY += rust-analyzer
1856rust-analyzer:
1857 $(Q)$(MAKE) $(build)=rust $@
1858
1859# Misc
1860# ---------------------------------------------------------------------------
1861
1862PHONY += misc-check
1863misc-check:
1864 $(Q)$(srctree)/scripts/misc-check
1865
1866all: misc-check
1867
1871PHONY += scripts_gdb
1872scripts_gdb: prepare0
1873 $(Q)$(MAKE) $(build)=scripts/gdb
1874 $(Q)ln -fsn $(abspath $(srctree)/scripts/gdb/vmlinux-gdb.py)
1875
1876ifdef CONFIG_GDB_SCRIPTS
1877all: scripts_gdb
1878endif

--- 155 unchanged lines hidden (view full) ---

2034 -o -name '*.dtb.S' -o -name '*.dtbo.S' \
2035 -o -name '*.dt.yaml' \
2036 -o -name '*.dwo' -o -name '*.lst' \
2037 -o -name '*.su' -o -name '*.mod' -o -name '*.usyms' \
2038 -o -name '.*.d' -o -name '.*.tmp' -o -name '*.mod.c' \
2039 -o -name '*.lex.c' -o -name '*.tab.[ch]' \
2040 -o -name '*.asn1.[ch]' \
2041 -o -name '*.symtypes' -o -name 'modules.order' \
1868PHONY += scripts_gdb
1869scripts_gdb: prepare0
1870 $(Q)$(MAKE) $(build)=scripts/gdb
1871 $(Q)ln -fsn $(abspath $(srctree)/scripts/gdb/vmlinux-gdb.py)
1872
1873ifdef CONFIG_GDB_SCRIPTS
1874all: scripts_gdb
1875endif

--- 155 unchanged lines hidden (view full) ---

2031 -o -name '*.dtb.S' -o -name '*.dtbo.S' \
2032 -o -name '*.dt.yaml' \
2033 -o -name '*.dwo' -o -name '*.lst' \
2034 -o -name '*.su' -o -name '*.mod' -o -name '*.usyms' \
2035 -o -name '.*.d' -o -name '.*.tmp' -o -name '*.mod.c' \
2036 -o -name '*.lex.c' -o -name '*.tab.[ch]' \
2037 -o -name '*.asn1.[ch]' \
2038 -o -name '*.symtypes' -o -name 'modules.order' \
2042 -o -name '.tmp_*' \
2043 -o -name '*.c.[012]*.*' \
2044 -o -name '*.ll' \
2045 -o -name '*.gcno' \
2039 -o -name '*.c.[012]*.*' \
2040 -o -name '*.ll' \
2041 -o -name '*.gcno' \
2046 -o -name '*.*.symversions' \) -type f -print | xargs rm -f
2042 -o -name '*.*.symversions' \) -type f -print \
2043 -o -name '.tmp_*' -print \
2044 | xargs rm -rf
2047
2048# Generate tags for editors
2049# ---------------------------------------------------------------------------
2050quiet_cmd_tags = GEN $@
2051 cmd_tags = $(BASH) $(srctree)/scripts/tags.sh $@
2052
2053tags TAGS cscope gtags: FORCE
2054 $(call cmd,tags)

--- 65 unchanged lines hidden (view full) ---

2120else
2121CHECKSTACK_ARCH := $(ARCH)
2122endif
2123checkstack:
2124 $(OBJDUMP) -d vmlinux $$(find . -name '*.ko') | \
2125 $(PERL) $(srctree)/scripts/checkstack.pl $(CHECKSTACK_ARCH)
2126
2127kernelrelease:
2045
2046# Generate tags for editors
2047# ---------------------------------------------------------------------------
2048quiet_cmd_tags = GEN $@
2049 cmd_tags = $(BASH) $(srctree)/scripts/tags.sh $@
2050
2051tags TAGS cscope gtags: FORCE
2052 $(call cmd,tags)

--- 65 unchanged lines hidden (view full) ---

2118else
2119CHECKSTACK_ARCH := $(ARCH)
2120endif
2121checkstack:
2122 $(OBJDUMP) -d vmlinux $$(find . -name '*.ko') | \
2123 $(PERL) $(srctree)/scripts/checkstack.pl $(CHECKSTACK_ARCH)
2124
2125kernelrelease:
2128 @echo "$(KERNELVERSION)$$($(CONFIG_SHELL) $(srctree)/scripts/setlocalversion $(srctree))"
2126 @$(srctree)/scripts/setlocalversion $(srctree)
2129
2130kernelversion:
2131 @echo $(KERNELVERSION)
2132
2133image_name:
2134 @echo $(KBUILD_IMAGE)
2135
2136quiet_cmd_rmfiles = $(if $(wildcard $(rm-files)),CLEAN $(wildcard $(rm-files)))

--- 17 unchanged lines hidden ---
2127
2128kernelversion:
2129 @echo $(KERNELVERSION)
2130
2131image_name:
2132 @echo $(KBUILD_IMAGE)
2133
2134quiet_cmd_rmfiles = $(if $(wildcard $(rm-files)),CLEAN $(wildcard $(rm-files)))

--- 17 unchanged lines hidden ---