Makefile (9e8238020c5beba64e7ffafbb7ea0fb02fe68270) | Makefile (3ec8a5b33deacdeca4bef24fb15498a975e875ba) |
---|---|
1# SPDX-License-Identifier: GPL-2.0 2VERSION = 5 | 1# SPDX-License-Identifier: GPL-2.0 2VERSION = 5 |
3PATCHLEVEL = 7 | 3PATCHLEVEL = 8 |
4SUBLEVEL = 0 | 4SUBLEVEL = 0 |
5EXTRAVERSION = | 5EXTRAVERSION = -rc4 |
6NAME = Kleptomaniac Octopus 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 | 6NAME = Kleptomaniac Octopus 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 |
14$(if $(filter __%, $(MAKECMDGOALS)), \ 15 $(error targets prefixed with '__' are only for internal use)) 16 |
|
14# That's our default target when none is given on the command line | 17# That's our default target when none is given on the command line |
15PHONY := _all 16_all: | 18PHONY := __all 19__all: |
17 18# We are using a recursive build, so we need to do a little thinking 19# to get the ordering right. 20# 21# Most importantly: sub-Makefiles should only ever modify files in 22# their own directory. If in some directory we have a dependency on 23# a file in another dir (which doesn't happen often, but it's often 24# unavoidable when linking the built-in.a targets which finally --- 127 unchanged lines hidden (view full) --- 152# Look for make include files relative to root of kernel src 153# 154# This does not become effective immediately because MAKEFLAGS is re-parsed 155# once after the Makefile is read. We need to invoke sub-make. 156MAKEFLAGS += --include-dir=$(abs_srctree) 157need-sub-make := 1 158endif 159 | 20 21# We are using a recursive build, so we need to do a little thinking 22# to get the ordering right. 23# 24# Most importantly: sub-Makefiles should only ever modify files in 25# their own directory. If in some directory we have a dependency on 26# a file in another dir (which doesn't happen often, but it's often 27# unavoidable when linking the built-in.a targets which finally --- 127 unchanged lines hidden (view full) --- 155# Look for make include files relative to root of kernel src 156# 157# This does not become effective immediately because MAKEFLAGS is re-parsed 158# once after the Makefile is read. We need to invoke sub-make. 159MAKEFLAGS += --include-dir=$(abs_srctree) 160need-sub-make := 1 161endif 162 |
163this-makefile := $(lastword $(MAKEFILE_LIST)) 164 |
|
160ifneq ($(filter 3.%,$(MAKE_VERSION)),) 161# 'MAKEFLAGS += -rR' does not immediately become effective for GNU Make 3.x 162# We need to invoke sub-make to avoid implicit rules in the top Makefile. 163need-sub-make := 1 164# Cancel implicit rules for this Makefile. | 165ifneq ($(filter 3.%,$(MAKE_VERSION)),) 166# 'MAKEFLAGS += -rR' does not immediately become effective for GNU Make 3.x 167# We need to invoke sub-make to avoid implicit rules in the top Makefile. 168need-sub-make := 1 169# Cancel implicit rules for this Makefile. |
165$(lastword $(MAKEFILE_LIST)): ; | 170$(this-makefile): ; |
166endif 167 168export abs_srctree abs_objtree 169export sub_make_done := 1 170 171ifeq ($(need-sub-make),1) 172 | 171endif 172 173export abs_srctree abs_objtree 174export sub_make_done := 1 175 176ifeq ($(need-sub-make),1) 177 |
173PHONY += $(MAKECMDGOALS) sub-make | 178PHONY += $(MAKECMDGOALS) __sub-make |
174 | 179 |
175$(filter-out _all sub-make $(lastword $(MAKEFILE_LIST)), $(MAKECMDGOALS)) _all: sub-make | 180$(filter-out $(this-makefile), $(MAKECMDGOALS)) __all: __sub-make |
176 @: 177 178# Invoke a second make in the output directory, passing relevant variables | 181 @: 182 183# Invoke a second make in the output directory, passing relevant variables |
179sub-make: | 184__sub-make: |
180 $(Q)$(MAKE) -C $(abs_objtree) -f $(abs_srctree)/Makefile $(MAKECMDGOALS) 181 182endif # need-sub-make 183endif # sub_make_done 184 185# We process the rest of the Makefile if this is the final invocation of make 186ifeq ($(need-sub-make),) 187 --- 20 unchanged lines hidden (view full) --- 208endif 209 210# Use make M=dir or set the environment variable KBUILD_EXTMOD to specify the 211# directory of external module to build. Setting M= takes precedence. 212ifeq ("$(origin M)", "command line") 213 KBUILD_EXTMOD := $(M) 214endif 215 | 185 $(Q)$(MAKE) -C $(abs_objtree) -f $(abs_srctree)/Makefile $(MAKECMDGOALS) 186 187endif # need-sub-make 188endif # sub_make_done 189 190# We process the rest of the Makefile if this is the final invocation of make 191ifeq ($(need-sub-make),) 192 --- 20 unchanged lines hidden (view full) --- 213endif 214 215# Use make M=dir or set the environment variable KBUILD_EXTMOD to specify the 216# directory of external module to build. Setting M= takes precedence. 217ifeq ("$(origin M)", "command line") 218 KBUILD_EXTMOD := $(M) 219endif 220 |
221$(if $(word 2, $(KBUILD_EXTMOD)), \ 222 $(error building multiple external modules is not supported)) 223 |
|
216export KBUILD_CHECKSRC KBUILD_EXTMOD 217 218extmod-prefix = $(if $(KBUILD_EXTMOD),$(KBUILD_EXTMOD)/) 219 220ifeq ($(abs_srctree),$(abs_objtree)) 221 # building in the source tree 222 srctree := . 223 building_out_of_srctree := --- 92 unchanged lines hidden (view full) --- 316 317ifdef mixed-build 318# =========================================================================== 319# We're called with mixed targets (*config and build targets). 320# Handle them one by one. 321 322PHONY += $(MAKECMDGOALS) __build_one_by_one 323 | 224export KBUILD_CHECKSRC KBUILD_EXTMOD 225 226extmod-prefix = $(if $(KBUILD_EXTMOD),$(KBUILD_EXTMOD)/) 227 228ifeq ($(abs_srctree),$(abs_objtree)) 229 # building in the source tree 230 srctree := . 231 building_out_of_srctree := --- 92 unchanged lines hidden (view full) --- 324 325ifdef mixed-build 326# =========================================================================== 327# We're called with mixed targets (*config and build targets). 328# Handle them one by one. 329 330PHONY += $(MAKECMDGOALS) __build_one_by_one 331 |
324$(filter-out __build_one_by_one, $(MAKECMDGOALS)): __build_one_by_one | 332$(MAKECMDGOALS): __build_one_by_one |
325 @: 326 327__build_one_by_one: 328 $(Q)set -e; \ 329 for i in $(MAKECMDGOALS); do \ 330 $(MAKE) -f $(srctree)/Makefile $$i; \ 331 done 332 --- 68 unchanged lines hidden (view full) --- 401 402ifneq ($(LLVM),) 403HOSTCC = clang 404HOSTCXX = clang++ 405else 406HOSTCC = gcc 407HOSTCXX = g++ 408endif | 333 @: 334 335__build_one_by_one: 336 $(Q)set -e; \ 337 for i in $(MAKECMDGOALS); do \ 338 $(MAKE) -f $(srctree)/Makefile $$i; \ 339 done 340 --- 68 unchanged lines hidden (view full) --- 409 410ifneq ($(LLVM),) 411HOSTCC = clang 412HOSTCXX = clang++ 413else 414HOSTCC = gcc 415HOSTCXX = g++ 416endif |
409KBUILD_HOSTCFLAGS := -Wall -Wmissing-prototypes -Wstrict-prototypes -O2 \ 410 -fomit-frame-pointer -std=gnu89 $(HOST_LFS_CFLAGS) \ 411 $(HOSTCFLAGS) | 417 418export KBUILD_USERCFLAGS := -Wall -Wmissing-prototypes -Wstrict-prototypes \ 419 -O2 -fomit-frame-pointer -std=gnu89 420export KBUILD_USERLDFLAGS := 421 422KBUILD_HOSTCFLAGS := $(KBUILD_USERCFLAGS) $(HOST_LFS_CFLAGS) $(HOSTCFLAGS) |
412KBUILD_HOSTCXXFLAGS := -Wall -O2 $(HOST_LFS_CFLAGS) $(HOSTCXXFLAGS) 413KBUILD_HOSTLDFLAGS := $(HOST_LFS_LDFLAGS) $(HOSTLDFLAGS) 414KBUILD_HOSTLDLIBS := $(HOST_LFS_LIBS) $(HOSTLDLIBS) 415 416# Make variables (CC, etc...) 417CPP = $(CC) -E 418ifneq ($(LLVM),) 419CC = clang --- 22 unchanged lines hidden (view full) --- 442AWK = awk 443INSTALLKERNEL := installkernel 444DEPMOD = /sbin/depmod 445PERL = perl 446PYTHON = python 447PYTHON3 = python3 448CHECK = sparse 449BASH = bash | 423KBUILD_HOSTCXXFLAGS := -Wall -O2 $(HOST_LFS_CFLAGS) $(HOSTCXXFLAGS) 424KBUILD_HOSTLDFLAGS := $(HOST_LFS_LDFLAGS) $(HOSTLDFLAGS) 425KBUILD_HOSTLDLIBS := $(HOST_LFS_LIBS) $(HOSTLDLIBS) 426 427# Make variables (CC, etc...) 428CPP = $(CC) -E 429ifneq ($(LLVM),) 430CC = clang --- 22 unchanged lines hidden (view full) --- 453AWK = awk 454INSTALLKERNEL := installkernel 455DEPMOD = /sbin/depmod 456PERL = perl 457PYTHON = python 458PYTHON3 = python3 459CHECK = sparse 460BASH = bash |
461KGZIP = gzip 462KBZIP2 = bzip2 463KLZOP = lzop 464LZMA = lzma 465LZ4 = lz4c 466XZ = xz |
|
450 451CHECKFLAGS := -D__linux__ -Dlinux -D__STDC__ -Dunix -D__unix__ \ 452 -Wbitwise -Wno-return-void -Wno-unknown-attribute $(CF) 453NOSTDINC_FLAGS := 454CFLAGS_MODULE = 455AFLAGS_MODULE = 456LDFLAGS_MODULE = 457CFLAGS_KERNEL = --- 32 unchanged lines hidden (view full) --- 490export KBUILD_LDS_MODULE := $(srctree)/scripts/module-common.lds 491KBUILD_LDFLAGS := 492GCC_PLUGINS_CFLAGS := 493CLANG_FLAGS := 494 495export ARCH SRCARCH CONFIG_SHELL BASH HOSTCC KBUILD_HOSTCFLAGS CROSS_COMPILE LD CC 496export CPP AR NM STRIP OBJCOPY OBJDUMP OBJSIZE READELF PAHOLE LEX YACC AWK INSTALLKERNEL 497export PERL PYTHON PYTHON3 CHECK CHECKFLAGS MAKE UTS_MACHINE HOSTCXX | 467 468CHECKFLAGS := -D__linux__ -Dlinux -D__STDC__ -Dunix -D__unix__ \ 469 -Wbitwise -Wno-return-void -Wno-unknown-attribute $(CF) 470NOSTDINC_FLAGS := 471CFLAGS_MODULE = 472AFLAGS_MODULE = 473LDFLAGS_MODULE = 474CFLAGS_KERNEL = --- 32 unchanged lines hidden (view full) --- 507export KBUILD_LDS_MODULE := $(srctree)/scripts/module-common.lds 508KBUILD_LDFLAGS := 509GCC_PLUGINS_CFLAGS := 510CLANG_FLAGS := 511 512export ARCH SRCARCH CONFIG_SHELL BASH HOSTCC KBUILD_HOSTCFLAGS CROSS_COMPILE LD CC 513export CPP AR NM STRIP OBJCOPY OBJDUMP OBJSIZE READELF PAHOLE LEX YACC AWK INSTALLKERNEL 514export PERL PYTHON PYTHON3 CHECK CHECKFLAGS MAKE UTS_MACHINE HOSTCXX |
515export KGZIP KBZIP2 KLZOP LZMA LZ4 XZ |
|
498export KBUILD_HOSTCXXFLAGS KBUILD_HOSTLDFLAGS KBUILD_HOSTLDLIBS LDFLAGS_MODULE 499 500export KBUILD_CPPFLAGS NOSTDINC_FLAGS LINUXINCLUDE OBJCOPYFLAGS KBUILD_LDFLAGS 501export KBUILD_CFLAGS CFLAGS_KERNEL CFLAGS_MODULE | 516export KBUILD_HOSTCXXFLAGS KBUILD_HOSTLDFLAGS KBUILD_HOSTLDLIBS LDFLAGS_MODULE 517 518export KBUILD_CPPFLAGS NOSTDINC_FLAGS LINUXINCLUDE OBJCOPYFLAGS KBUILD_LDFLAGS 519export KBUILD_CFLAGS CFLAGS_KERNEL CFLAGS_MODULE |
502export CFLAGS_KASAN CFLAGS_KASAN_NOSANITIZE CFLAGS_UBSAN | 520export CFLAGS_KASAN CFLAGS_KASAN_NOSANITIZE CFLAGS_UBSAN CFLAGS_KCSAN |
503export KBUILD_AFLAGS AFLAGS_KERNEL AFLAGS_MODULE 504export KBUILD_AFLAGS_MODULE KBUILD_CFLAGS_MODULE KBUILD_LDFLAGS_MODULE 505export KBUILD_AFLAGS_KERNEL KBUILD_CFLAGS_KERNEL 506 507# Files to ignore in find ... statements 508 509export RCS_FIND_IGNORE := \( -name SCCS -o -name BitKeeper -o -name .svn -o \ 510 -name CVS -o -name .pc -o -name .hg -o -name .git \) \ --- 77 unchanged lines hidden (view full) --- 588 $(Q)$(MAKE) $(build)=scripts/kconfig $@ 589 590else #!config-build 591# =========================================================================== 592# Build targets only - this includes vmlinux, arch specific targets, clean 593# targets and others. In general all targets except *config targets. 594 595# If building an external module we do not care about the all: rule | 521export KBUILD_AFLAGS AFLAGS_KERNEL AFLAGS_MODULE 522export KBUILD_AFLAGS_MODULE KBUILD_CFLAGS_MODULE KBUILD_LDFLAGS_MODULE 523export KBUILD_AFLAGS_KERNEL KBUILD_CFLAGS_KERNEL 524 525# Files to ignore in find ... statements 526 527export RCS_FIND_IGNORE := \( -name SCCS -o -name BitKeeper -o -name .svn -o \ 528 -name CVS -o -name .pc -o -name .hg -o -name .git \) \ --- 77 unchanged lines hidden (view full) --- 606 $(Q)$(MAKE) $(build)=scripts/kconfig $@ 607 608else #!config-build 609# =========================================================================== 610# Build targets only - this includes vmlinux, arch specific targets, clean 611# targets and others. In general all targets except *config targets. 612 613# If building an external module we do not care about the all: rule |
596# but instead _all depend on modules | 614# but instead __all depend on modules |
597PHONY += all 598ifeq ($(KBUILD_EXTMOD),) | 615PHONY += all 616ifeq ($(KBUILD_EXTMOD),) |
599_all: all | 617__all: all |
600else | 618else |
601_all: modules | 619__all: modules |
602endif 603 604# Decide whether to build built-in, modular, or both. 605# Normally, just do built-in. 606 607KBUILD_MODULES := 608KBUILD_BUILTIN := 1 609 610# If we have only "make modules", don't compile built-in objects. | 620endif 621 622# Decide whether to build built-in, modular, or both. 623# Normally, just do built-in. 624 625KBUILD_MODULES := 626KBUILD_BUILTIN := 1 627 628# If we have only "make modules", don't compile built-in objects. |
611# When we're building modules with modversions, we need to consider 612# the built-in objects during the descend as well, in order to 613# make sure the checksums are up to date before we record them. 614 | |
615ifeq ($(MAKECMDGOALS),modules) | 629ifeq ($(MAKECMDGOALS),modules) |
616 KBUILD_BUILTIN := $(if $(CONFIG_MODVERSIONS),1) | 630 KBUILD_BUILTIN := |
617endif 618 619# If we have "make <whatever> modules", compile modules 620# in addition to whatever we do anyway. 621# Just "make" or "make all" shall build modules as well 622 | 631endif 632 633# If we have "make <whatever> modules", compile modules 634# in addition to whatever we do anyway. 635# Just "make" or "make all" shall build modules as well 636 |
623ifneq ($(filter all _all modules nsdeps,$(MAKECMDGOALS)),) | 637ifneq ($(filter all modules nsdeps,$(MAKECMDGOALS)),) |
624 KBUILD_MODULES := 1 625endif 626 627ifeq ($(MAKECMDGOALS),) 628 KBUILD_MODULES := 1 629endif 630 631export KBUILD_MODULES KBUILD_BUILTIN 632 633ifdef need-config 634include include/config/auto.conf 635endif 636 637ifeq ($(KBUILD_EXTMOD),) 638# Objects we will link into vmlinux / subdirs we need to visit | 638 KBUILD_MODULES := 1 639endif 640 641ifeq ($(MAKECMDGOALS),) 642 KBUILD_MODULES := 1 643endif 644 645export KBUILD_MODULES KBUILD_BUILTIN 646 647ifdef need-config 648include include/config/auto.conf 649endif 650 651ifeq ($(KBUILD_EXTMOD),) 652# Objects we will link into vmlinux / subdirs we need to visit |
639init-y := init/ | 653core-y := init/ usr/ |
640drivers-y := drivers/ sound/ 641drivers-$(CONFIG_SAMPLES) += samples/ | 654drivers-y := drivers/ sound/ 655drivers-$(CONFIG_SAMPLES) += samples/ |
642net-y := net/ | 656drivers-y += net/ virt/ |
643libs-y := lib/ | 657libs-y := lib/ |
644core-y := usr/ 645virt-y := virt/ | |
646endif # KBUILD_EXTMOD 647 648# The all: target is the default when no target is given on the 649# command line. 650# This allow a user to issue only 'make' to build a kernel including modules 651# Defaults to vmlinux, but the arch makefile usually adds further targets 652all: vmlinux 653 --- 36 unchanged lines hidden (view full) --- 690 691# The actual configuration files used during the build are stored in 692# include/generated/ and include/config/. Update them if .config is newer than 693# include/config/auto.conf (which mirrors .config). 694# 695# This exploits the 'multi-target pattern rule' trick. 696# The syncconfig should be executed only once to make all the targets. 697# (Note: use the grouped target '&:' when we bump to GNU Make 4.3) | 658endif # KBUILD_EXTMOD 659 660# The all: target is the default when no target is given on the 661# command line. 662# This allow a user to issue only 'make' to build a kernel including modules 663# Defaults to vmlinux, but the arch makefile usually adds further targets 664all: vmlinux 665 --- 36 unchanged lines hidden (view full) --- 702 703# The actual configuration files used during the build are stored in 704# include/generated/ and include/config/. Update them if .config is newer than 705# include/config/auto.conf (which mirrors .config). 706# 707# This exploits the 'multi-target pattern rule' trick. 708# The syncconfig should be executed only once to make all the targets. 709# (Note: use the grouped target '&:' when we bump to GNU Make 4.3) |
698%/auto.conf %/auto.conf.cmd: $(KCONFIG_CONFIG) | 710%/config/auto.conf %/config/auto.conf.cmd %/generated/autoconf.h: $(KCONFIG_CONFIG) |
699 $(Q)$(MAKE) -f $(srctree)/Makefile syncconfig 700else # !may-sync-config 701# External modules and some install targets need include/generated/autoconf.h 702# and include/config/auto.conf but do not care if they are up-to-date. 703# Use auto.conf to trigger the test 704PHONY += include/config/auto.conf 705 706include/config/auto.conf: --- 38 unchanged lines hidden (view full) --- 745 $(call cc-option,-fno-ipa-cp-clone,) \ 746 $(call cc-option,-fno-partial-inlining) 747endif 748 749ifneq ($(CONFIG_FRAME_WARN),0) 750KBUILD_CFLAGS += -Wframe-larger-than=$(CONFIG_FRAME_WARN) 751endif 752 | 711 $(Q)$(MAKE) -f $(srctree)/Makefile syncconfig 712else # !may-sync-config 713# External modules and some install targets need include/generated/autoconf.h 714# and include/config/auto.conf but do not care if they are up-to-date. 715# Use auto.conf to trigger the test 716PHONY += include/config/auto.conf 717 718include/config/auto.conf: --- 38 unchanged lines hidden (view full) --- 757 $(call cc-option,-fno-ipa-cp-clone,) \ 758 $(call cc-option,-fno-partial-inlining) 759endif 760 761ifneq ($(CONFIG_FRAME_WARN),0) 762KBUILD_CFLAGS += -Wframe-larger-than=$(CONFIG_FRAME_WARN) 763endif 764 |
753stackp-flags-$(CONFIG_CC_HAS_STACKPROTECTOR_NONE) := -fno-stack-protector | 765stackp-flags-y := -fno-stack-protector |
754stackp-flags-$(CONFIG_STACKPROTECTOR) := -fstack-protector 755stackp-flags-$(CONFIG_STACKPROTECTOR_STRONG) := -fstack-protector-strong 756 757KBUILD_CFLAGS += $(stackp-flags-y) 758 759ifdef CONFIG_CC_IS_CLANG 760KBUILD_CPPFLAGS += -Qunused-arguments 761KBUILD_CFLAGS += -Wno-format-invalid-specifier --- 47 unchanged lines hidden (view full) --- 809DEBUG_CFLAGS += -gdwarf-4 810endif 811 812ifdef CONFIG_DEBUG_INFO_REDUCED 813DEBUG_CFLAGS += $(call cc-option, -femit-struct-debug-baseonly) \ 814 $(call cc-option,-fno-var-tracking) 815endif 816 | 766stackp-flags-$(CONFIG_STACKPROTECTOR) := -fstack-protector 767stackp-flags-$(CONFIG_STACKPROTECTOR_STRONG) := -fstack-protector-strong 768 769KBUILD_CFLAGS += $(stackp-flags-y) 770 771ifdef CONFIG_CC_IS_CLANG 772KBUILD_CPPFLAGS += -Qunused-arguments 773KBUILD_CFLAGS += -Wno-format-invalid-specifier --- 47 unchanged lines hidden (view full) --- 821DEBUG_CFLAGS += -gdwarf-4 822endif 823 824ifdef CONFIG_DEBUG_INFO_REDUCED 825DEBUG_CFLAGS += $(call cc-option, -femit-struct-debug-baseonly) \ 826 $(call cc-option,-fno-var-tracking) 827endif 828 |
829ifdef CONFIG_DEBUG_INFO_COMPRESSED 830DEBUG_CFLAGS += -gz=zlib 831KBUILD_AFLAGS += -gz=zlib 832KBUILD_LDFLAGS += --compress-debug-sections=zlib 833endif 834 |
|
817KBUILD_CFLAGS += $(DEBUG_CFLAGS) 818export DEBUG_CFLAGS 819 820ifdef CONFIG_FUNCTION_TRACER 821ifdef CONFIG_FTRACE_MCOUNT_RECORD 822 # gcc 5 supports generating the mcount tables directly 823 ifeq ($(call cc-option-yn,-mrecord-mcount),y) 824 CC_FLAGS_FTRACE += -mrecord-mcount --- 32 unchanged lines hidden (view full) --- 857KBUILD_CFLAGS_KERNEL += -ffunction-sections -fdata-sections 858LDFLAGS_vmlinux += --gc-sections 859endif 860 861ifdef CONFIG_LIVEPATCH 862KBUILD_CFLAGS += $(call cc-option, -flive-patching=inline-clone) 863endif 864 | 835KBUILD_CFLAGS += $(DEBUG_CFLAGS) 836export DEBUG_CFLAGS 837 838ifdef CONFIG_FUNCTION_TRACER 839ifdef CONFIG_FTRACE_MCOUNT_RECORD 840 # gcc 5 supports generating the mcount tables directly 841 ifeq ($(call cc-option-yn,-mrecord-mcount),y) 842 CC_FLAGS_FTRACE += -mrecord-mcount --- 32 unchanged lines hidden (view full) --- 875KBUILD_CFLAGS_KERNEL += -ffunction-sections -fdata-sections 876LDFLAGS_vmlinux += --gc-sections 877endif 878 879ifdef CONFIG_LIVEPATCH 880KBUILD_CFLAGS += $(call cc-option, -flive-patching=inline-clone) 881endif 882 |
883ifdef CONFIG_SHADOW_CALL_STACK 884CC_FLAGS_SCS := -fsanitize=shadow-call-stack 885KBUILD_CFLAGS += $(CC_FLAGS_SCS) 886export CC_FLAGS_SCS 887endif 888 |
|
865# arch Makefile may override CC so keep this after arch Makefile is included 866NOSTDINC_FLAGS += -nostdinc -isystem $(shell $(CC) -print-file-name=include) 867 868# warn about C99 declaration after statement 869KBUILD_CFLAGS += -Wdeclaration-after-statement 870 871# Variable Length Arrays (VLAs) should not be used anywhere in the kernel 872KBUILD_CFLAGS += -Wvla --- 49 unchanged lines hidden (view full) --- 922# incompatible with -mindirect-branch=thunk-extern 923ifdef CONFIG_RETPOLINE 924KBUILD_CFLAGS += $(call cc-option,-fcf-protection=none) 925endif 926 927include scripts/Makefile.kasan 928include scripts/Makefile.extrawarn 929include scripts/Makefile.ubsan | 889# arch Makefile may override CC so keep this after arch Makefile is included 890NOSTDINC_FLAGS += -nostdinc -isystem $(shell $(CC) -print-file-name=include) 891 892# warn about C99 declaration after statement 893KBUILD_CFLAGS += -Wdeclaration-after-statement 894 895# Variable Length Arrays (VLAs) should not be used anywhere in the kernel 896KBUILD_CFLAGS += -Wvla --- 49 unchanged lines hidden (view full) --- 946# incompatible with -mindirect-branch=thunk-extern 947ifdef CONFIG_RETPOLINE 948KBUILD_CFLAGS += $(call cc-option,-fcf-protection=none) 949endif 950 951include scripts/Makefile.kasan 952include scripts/Makefile.extrawarn 953include scripts/Makefile.ubsan |
954include scripts/Makefile.kcsan |
|
930 931# Add user supplied CPPFLAGS, AFLAGS and CFLAGS as the last assignments 932KBUILD_CPPFLAGS += $(KCPPFLAGS) 933KBUILD_AFLAGS += $(KAFLAGS) 934KBUILD_CFLAGS += $(KCFLAGS) 935 936KBUILD_LDFLAGS_MODULE += --build-id 937LDFLAGS_vmlinux += --build-id 938 939ifeq ($(CONFIG_STRIP_ASM_SYMS),y) 940LDFLAGS_vmlinux += $(call ld-option, -X,) 941endif 942 943ifeq ($(CONFIG_RELR),y) 944LDFLAGS_vmlinux += --pack-dyn-relocs=relr 945endif 946 | 955 956# Add user supplied CPPFLAGS, AFLAGS and CFLAGS as the last assignments 957KBUILD_CPPFLAGS += $(KCPPFLAGS) 958KBUILD_AFLAGS += $(KAFLAGS) 959KBUILD_CFLAGS += $(KCFLAGS) 960 961KBUILD_LDFLAGS_MODULE += --build-id 962LDFLAGS_vmlinux += --build-id 963 964ifeq ($(CONFIG_STRIP_ASM_SYMS),y) 965LDFLAGS_vmlinux += $(call ld-option, -X,) 966endif 967 968ifeq ($(CONFIG_RELR),y) 969LDFLAGS_vmlinux += --pack-dyn-relocs=relr 970endif 971 |
972# Align the bit size of userspace programs with the kernel 973KBUILD_USERCFLAGS += $(filter -m32 -m64 --target=%, $(KBUILD_CFLAGS)) 974KBUILD_USERLDFLAGS += $(filter -m32 -m64 --target=%, $(KBUILD_CFLAGS)) 975 |
|
947# make the checker run with the right architecture 948CHECKFLAGS += --arch=$(ARCH) 949 950# insure the checker run with the right endianness 951CHECKFLAGS += $(if $(CONFIG_CPU_BIG_ENDIAN),-mbig-endian,-mlittle-endian) 952 953# the checker needs the correct machine size 954CHECKFLAGS += $(if $(CONFIG_64BIT),-m64,-m32) --- 45 unchanged lines hidden (view full) --- 1000 1001# CONFIG_MODULE_COMPRESS, if defined, will cause module to be compressed 1002# after they are installed in agreement with CONFIG_MODULE_COMPRESS_GZIP 1003# or CONFIG_MODULE_COMPRESS_XZ. 1004 1005mod_compress_cmd = true 1006ifdef CONFIG_MODULE_COMPRESS 1007 ifdef CONFIG_MODULE_COMPRESS_GZIP | 976# make the checker run with the right architecture 977CHECKFLAGS += --arch=$(ARCH) 978 979# insure the checker run with the right endianness 980CHECKFLAGS += $(if $(CONFIG_CPU_BIG_ENDIAN),-mbig-endian,-mlittle-endian) 981 982# the checker needs the correct machine size 983CHECKFLAGS += $(if $(CONFIG_64BIT),-m64,-m32) --- 45 unchanged lines hidden (view full) --- 1029 1030# CONFIG_MODULE_COMPRESS, if defined, will cause module to be compressed 1031# after they are installed in agreement with CONFIG_MODULE_COMPRESS_GZIP 1032# or CONFIG_MODULE_COMPRESS_XZ. 1033 1034mod_compress_cmd = true 1035ifdef CONFIG_MODULE_COMPRESS 1036 ifdef CONFIG_MODULE_COMPRESS_GZIP |
1008 mod_compress_cmd = gzip -n -f | 1037 mod_compress_cmd = $(KGZIP) -n -f |
1009 endif # CONFIG_MODULE_COMPRESS_GZIP 1010 ifdef CONFIG_MODULE_COMPRESS_XZ | 1038 endif # CONFIG_MODULE_COMPRESS_GZIP 1039 ifdef CONFIG_MODULE_COMPRESS_XZ |
1011 mod_compress_cmd = xz -f | 1040 mod_compress_cmd = $(XZ) -f |
1012 endif # CONFIG_MODULE_COMPRESS_XZ 1013endif # CONFIG_MODULE_COMPRESS 1014export mod_compress_cmd 1015 1016ifdef CONFIG_MODULE_SIG_ALL 1017$(eval $(call config_filename,MODULE_SIG_KEY)) 1018 1019mod_sign_cmd = scripts/sign-file $(CONFIG_MODULE_SIG_HASH) $(MODULE_SIG_KEY_SRCPREFIX)$(CONFIG_MODULE_SIG_KEY) certs/signing_key.x509 --- 18 unchanged lines hidden (view full) --- 1038PHONY += prepare0 1039 1040export MODORDER := $(extmod-prefix)modules.order 1041export MODULES_NSDEPS := $(extmod-prefix)modules.nsdeps 1042 1043ifeq ($(KBUILD_EXTMOD),) 1044core-y += kernel/ certs/ mm/ fs/ ipc/ security/ crypto/ block/ 1045 | 1041 endif # CONFIG_MODULE_COMPRESS_XZ 1042endif # CONFIG_MODULE_COMPRESS 1043export mod_compress_cmd 1044 1045ifdef CONFIG_MODULE_SIG_ALL 1046$(eval $(call config_filename,MODULE_SIG_KEY)) 1047 1048mod_sign_cmd = scripts/sign-file $(CONFIG_MODULE_SIG_HASH) $(MODULE_SIG_KEY_SRCPREFIX)$(CONFIG_MODULE_SIG_KEY) certs/signing_key.x509 --- 18 unchanged lines hidden (view full) --- 1067PHONY += prepare0 1068 1069export MODORDER := $(extmod-prefix)modules.order 1070export MODULES_NSDEPS := $(extmod-prefix)modules.nsdeps 1071 1072ifeq ($(KBUILD_EXTMOD),) 1073core-y += kernel/ certs/ mm/ fs/ ipc/ security/ crypto/ block/ 1074 |
1046vmlinux-dirs := $(patsubst %/,%,$(filter %/, $(init-y) $(init-m) \ | 1075vmlinux-dirs := $(patsubst %/,%,$(filter %/, \ |
1047 $(core-y) $(core-m) $(drivers-y) $(drivers-m) \ | 1076 $(core-y) $(core-m) $(drivers-y) $(drivers-m) \ |
1048 $(net-y) $(net-m) $(libs-y) $(libs-m) $(virt-y))) | 1077 $(libs-y) $(libs-m))) |
1049 1050vmlinux-alldirs := $(sort $(vmlinux-dirs) Documentation \ | 1078 1079vmlinux-alldirs := $(sort $(vmlinux-dirs) Documentation \ |
1051 $(patsubst %/,%,$(filter %/, $(init-) $(core-) \ 1052 $(drivers-) $(net-) $(libs-) $(virt-)))) | 1080 $(patsubst %/,%,$(filter %/, $(core-) \ 1081 $(drivers-) $(libs-)))) |
1053 | 1082 |
1083subdir-modorder := $(addsuffix modules.order,$(filter %/, \ 1084 $(core-y) $(core-m) $(libs-y) $(libs-m) \ 1085 $(drivers-y) $(drivers-m))) 1086 |
|
1054build-dirs := $(vmlinux-dirs) 1055clean-dirs := $(vmlinux-alldirs) 1056 | 1087build-dirs := $(vmlinux-dirs) 1088clean-dirs := $(vmlinux-alldirs) 1089 |
1057init-y := $(patsubst %/, %/built-in.a, $(init-y)) 1058core-y := $(patsubst %/, %/built-in.a, $(core-y)) 1059drivers-y := $(patsubst %/, %/built-in.a, $(drivers-y)) 1060net-y := $(patsubst %/, %/built-in.a, $(net-y)) 1061libs-y2 := $(patsubst %/, %/built-in.a, $(filter %/, $(libs-y))) | 1090# Externally visible symbols (used by link-vmlinux.sh) 1091KBUILD_VMLINUX_OBJS := $(head-y) $(patsubst %/,%/built-in.a, $(core-y)) 1092KBUILD_VMLINUX_OBJS += $(addsuffix built-in.a, $(filter %/, $(libs-y))) |
1062ifdef CONFIG_MODULES | 1093ifdef CONFIG_MODULES |
1063libs-y1 := $(filter-out %/, $(libs-y)) 1064libs-y2 += $(patsubst %/, %/lib.a, $(filter %/, $(libs-y))) | 1094KBUILD_VMLINUX_OBJS += $(patsubst %/, %/lib.a, $(filter %/, $(libs-y))) 1095KBUILD_VMLINUX_LIBS := $(filter-out %/, $(libs-y)) |
1065else | 1096else |
1066libs-y1 := $(patsubst %/, %/lib.a, $(libs-y)) | 1097KBUILD_VMLINUX_LIBS := $(patsubst %/,%/lib.a, $(libs-y)) |
1067endif | 1098endif |
1068virt-y := $(patsubst %/, %/built-in.a, $(virt-y)) | 1099KBUILD_VMLINUX_OBJS += $(patsubst %/,%/built-in.a, $(drivers-y)) |
1069 | 1100 |
1070# Externally visible symbols (used by link-vmlinux.sh) 1071export KBUILD_VMLINUX_OBJS := $(head-y) $(init-y) $(core-y) $(libs-y2) \ 1072 $(drivers-y) $(net-y) $(virt-y) 1073export KBUILD_VMLINUX_LIBS := $(libs-y1) | 1101export KBUILD_VMLINUX_OBJS KBUILD_VMLINUX_LIBS |
1074export KBUILD_LDS := arch/$(SRCARCH)/kernel/vmlinux.lds | 1102export KBUILD_LDS := arch/$(SRCARCH)/kernel/vmlinux.lds |
1075export LDFLAGS_vmlinux | |
1076# used by scripts/Makefile.package 1077export KBUILD_ALLDIRS := $(sort $(filter-out arch/%,$(vmlinux-alldirs)) LICENSES arch include scripts tools) 1078 1079vmlinux-deps := $(KBUILD_LDS) $(KBUILD_VMLINUX_OBJS) $(KBUILD_VMLINUX_LIBS) 1080 1081# Recurse until adjust_autoksyms.sh is satisfied 1082PHONY += autoksyms_recursive 1083ifdef CONFIG_TRIM_UNUSED_KSYMS | 1103# used by scripts/Makefile.package 1104export KBUILD_ALLDIRS := $(sort $(filter-out arch/%,$(vmlinux-alldirs)) LICENSES arch include scripts tools) 1105 1106vmlinux-deps := $(KBUILD_LDS) $(KBUILD_VMLINUX_OBJS) $(KBUILD_VMLINUX_LIBS) 1107 1108# Recurse until adjust_autoksyms.sh is satisfied 1109PHONY += autoksyms_recursive 1110ifdef CONFIG_TRIM_UNUSED_KSYMS |
1111# For the kernel to actually contain only the needed exported symbols, 1112# we have to build modules as well to determine what those symbols are. 1113# (this can be evaluated only once include/config/auto.conf has been included) 1114KBUILD_MODULES := 1 1115 |
|
1084autoksyms_recursive: descend modules.order 1085 $(Q)$(CONFIG_SHELL) $(srctree)/scripts/adjust_autoksyms.sh \ 1086 "$(MAKE) -f $(srctree)/Makefile vmlinux" 1087endif 1088 | 1116autoksyms_recursive: descend modules.order 1117 $(Q)$(CONFIG_SHELL) $(srctree)/scripts/adjust_autoksyms.sh \ 1118 "$(MAKE) -f $(srctree)/Makefile vmlinux" 1119endif 1120 |
1089# For the kernel to actually contain only the needed exported symbols, 1090# we have to build modules as well to determine what those symbols are. 1091# (this can be evaluated only once include/config/auto.conf has been included) 1092ifdef CONFIG_TRIM_UNUSED_KSYMS 1093 KBUILD_MODULES := 1 1094endif 1095 | |
1096autoksyms_h := $(if $(CONFIG_TRIM_UNUSED_KSYMS), include/generated/autoksyms.h) 1097 1098quiet_cmd_autoksyms_h = GEN $@ 1099 cmd_autoksyms_h = mkdir -p $(dir $@); \ 1100 $(CONFIG_SHELL) $(srctree)/scripts/gen_autoksyms.sh $@ 1101 1102$(autoksyms_h): 1103 $(call cmd,autoksyms_h) 1104 1105ARCH_POSTLINK := $(wildcard $(srctree)/arch/$(SRCARCH)/Makefile.postlink) 1106 1107# Final link of vmlinux with optional arch pass after final link 1108cmd_link-vmlinux = \ | 1121autoksyms_h := $(if $(CONFIG_TRIM_UNUSED_KSYMS), include/generated/autoksyms.h) 1122 1123quiet_cmd_autoksyms_h = GEN $@ 1124 cmd_autoksyms_h = mkdir -p $(dir $@); \ 1125 $(CONFIG_SHELL) $(srctree)/scripts/gen_autoksyms.sh $@ 1126 1127$(autoksyms_h): 1128 $(call cmd,autoksyms_h) 1129 1130ARCH_POSTLINK := $(wildcard $(srctree)/arch/$(SRCARCH)/Makefile.postlink) 1131 1132# Final link of vmlinux with optional arch pass after final link 1133cmd_link-vmlinux = \ |
1109 $(CONFIG_SHELL) $< $(LD) $(KBUILD_LDFLAGS) $(LDFLAGS_vmlinux) ; \ | 1134 $(CONFIG_SHELL) $< "$(LD)" "$(KBUILD_LDFLAGS)" "$(LDFLAGS_vmlinux)"; \ |
1110 $(if $(ARCH_POSTLINK), $(MAKE) -f $(ARCH_POSTLINK) $@, true) 1111 1112vmlinux: scripts/link-vmlinux.sh autoksyms_recursive $(vmlinux-deps) FORCE 1113 +$(call if_changed,link-vmlinux) 1114 1115targets := vmlinux 1116 1117# The actual objects are generated when descending, 1118# make sure no implicit rule kicks in | 1135 $(if $(ARCH_POSTLINK), $(MAKE) -f $(ARCH_POSTLINK) $@, true) 1136 1137vmlinux: scripts/link-vmlinux.sh autoksyms_recursive $(vmlinux-deps) FORCE 1138 +$(call if_changed,link-vmlinux) 1139 1140targets := vmlinux 1141 1142# The actual objects are generated when descending, 1143# make sure no implicit rule kicks in |
1119$(sort $(vmlinux-deps)): descend ; | 1144$(sort $(vmlinux-deps) $(subdir-modorder)): descend ; |
1120 1121filechk_kernel.release = \ 1122 echo "$(KERNELVERSION)$$($(CONFIG_SHELL) $(srctree)/scripts/setlocalversion $(srctree))" 1123 1124# Store (new) KERNELRELEASE string in include/config/kernel.release 1125include/config/kernel.release: FORCE 1126 $(call filechk,kernel.release) 1127 --- 8 unchanged lines hidden (view full) --- 1136# or the modules are listed in "prepare". 1137# A multi level approach is used. prepareN is processed before prepareN-1. 1138# archprepare is used in arch Makefiles and when processed asm symlink, 1139# version.h and scripts_basic is processed / created. 1140 1141PHONY += prepare archprepare 1142 1143archprepare: outputmakefile archheaders archscripts scripts include/config/kernel.release \ | 1145 1146filechk_kernel.release = \ 1147 echo "$(KERNELVERSION)$$($(CONFIG_SHELL) $(srctree)/scripts/setlocalversion $(srctree))" 1148 1149# Store (new) KERNELRELEASE string in include/config/kernel.release 1150include/config/kernel.release: FORCE 1151 $(call filechk,kernel.release) 1152 --- 8 unchanged lines hidden (view full) --- 1161# or the modules are listed in "prepare". 1162# A multi level approach is used. prepareN is processed before prepareN-1. 1163# archprepare is used in arch Makefiles and when processed asm symlink, 1164# version.h and scripts_basic is processed / created. 1165 1166PHONY += prepare archprepare 1167 1168archprepare: outputmakefile archheaders archscripts scripts include/config/kernel.release \ |
1144 asm-generic $(version_h) $(autoksyms_h) include/generated/utsrelease.h | 1169 asm-generic $(version_h) $(autoksyms_h) include/generated/utsrelease.h \ 1170 include/generated/autoconf.h |
1145 1146prepare0: archprepare 1147 $(Q)$(MAKE) $(build)=scripts/mod 1148 $(Q)$(MAKE) $(build)=. 1149 1150# All the preparing.. 1151prepare: prepare0 prepare-objtool 1152 --- 157 unchanged lines hidden (view full) --- 1310# Modules 1311 1312ifdef CONFIG_MODULES 1313 1314# By default, build modules as well 1315 1316all: modules 1317 | 1171 1172prepare0: archprepare 1173 $(Q)$(MAKE) $(build)=scripts/mod 1174 $(Q)$(MAKE) $(build)=. 1175 1176# All the preparing.. 1177prepare: prepare0 prepare-objtool 1178 --- 157 unchanged lines hidden (view full) --- 1336# Modules 1337 1338ifdef CONFIG_MODULES 1339 1340# By default, build modules as well 1341 1342all: modules 1343 |
1344# When we're building modules with modversions, we need to consider 1345# the built-in objects during the descend as well, in order to 1346# make sure the checksums are up to date before we record them. 1347ifdef CONFIG_MODVERSIONS 1348 KBUILD_BUILTIN := 1 1349endif 1350 |
|
1318# Build modules 1319# 1320# A module can be listed more than once in obj-m resulting in 1321# duplicate lines in modules.order files. Those are removed 1322# using awk while concatenating to the final file. 1323 1324PHONY += modules | 1351# Build modules 1352# 1353# A module can be listed more than once in obj-m resulting in 1354# duplicate lines in modules.order files. Those are removed 1355# using awk while concatenating to the final file. 1356 1357PHONY += modules |
1325modules: $(if $(KBUILD_BUILTIN),vmlinux) modules.order | 1358modules: $(if $(KBUILD_BUILTIN),vmlinux) modules_check |
1326 $(Q)$(MAKE) -f $(srctree)/scripts/Makefile.modpost | 1359 $(Q)$(MAKE) -f $(srctree)/scripts/Makefile.modpost |
1327 $(Q)$(CONFIG_SHELL) $(srctree)/scripts/modules-check.sh | |
1328 | 1360 |
1329modules.order: descend 1330 $(Q)$(AWK) '!x[$$0]++' $(addsuffix /$@, $(build-dirs)) > $@ | 1361PHONY += modules_check 1362modules_check: modules.order 1363 $(Q)$(CONFIG_SHELL) $(srctree)/scripts/modules-check.sh $< |
1331 | 1364 |
1365cmd_modules_order = $(AWK) '!x[$$0]++' $(real-prereqs) > $@ 1366 1367modules.order: $(subdir-modorder) FORCE 1368 $(call if_changed,modules_order) 1369 1370targets += modules.order 1371 |
|
1332# Target to prepare building external modules 1333PHONY += modules_prepare 1334modules_prepare: prepare 1335 1336# Target to install modules 1337PHONY += modules_install 1338modules_install: _modinst_ _modinst_post 1339 --- 44 unchanged lines hidden (view full) --- 1384### 1385# Cleaning is done on three levels. 1386# make clean Delete most generated files 1387# Leave enough to build external modules 1388# make mrproper Delete the current configuration, and all generated files 1389# make distclean Remove editor backup files, patch leftover files and the like 1390 1391# Directories & files removed with 'make clean' | 1372# Target to prepare building external modules 1373PHONY += modules_prepare 1374modules_prepare: prepare 1375 1376# Target to install modules 1377PHONY += modules_install 1378modules_install: _modinst_ _modinst_post 1379 --- 44 unchanged lines hidden (view full) --- 1424### 1425# Cleaning is done on three levels. 1426# make clean Delete most generated files 1427# Leave enough to build external modules 1428# make mrproper Delete the current configuration, and all generated files 1429# make distclean Remove editor backup files, patch leftover files and the like 1430 1431# Directories & files removed with 'make clean' |
1392CLEAN_DIRS += include/ksym 1393CLEAN_FILES += modules.builtin modules.builtin.modinfo modules.nsdeps | 1432CLEAN_FILES += include/ksym vmlinux.symvers \ 1433 modules.builtin modules.builtin.modinfo modules.nsdeps |
1394 1395# Directories & files removed with 'make mrproper' | 1434 1435# Directories & files removed with 'make mrproper' |
1396MRPROPER_DIRS += include/config include/generated \ | 1436MRPROPER_FILES += include/config include/generated \ |
1397 arch/$(SRCARCH)/include/generated .tmp_objdiff \ | 1437 arch/$(SRCARCH)/include/generated .tmp_objdiff \ |
1398 debian/ snap/ tar-install/ 1399MRPROPER_FILES += .config .config.old .version \ | 1438 debian snap tar-install \ 1439 .config .config.old .version \ |
1400 Module.symvers \ 1401 signing_key.pem signing_key.priv signing_key.x509 \ 1402 x509.genkey extra_certificates signing_key.x509.keyid \ 1403 signing_key.x509.signer vmlinux-gdb.py \ 1404 *.spec 1405 1406# Directories & files removed with 'make distclean' | 1440 Module.symvers \ 1441 signing_key.pem signing_key.priv signing_key.x509 \ 1442 x509.genkey extra_certificates signing_key.x509.keyid \ 1443 signing_key.x509.signer vmlinux-gdb.py \ 1444 *.spec 1445 1446# Directories & files removed with 'make distclean' |
1407DISTCLEAN_DIRS += | |
1408DISTCLEAN_FILES += tags TAGS cscope* GPATH GTAGS GRTAGS GSYMS 1409 1410# clean - Delete most, but leave enough to build external modules 1411# | 1447DISTCLEAN_FILES += tags TAGS cscope* GPATH GTAGS GRTAGS GSYMS 1448 1449# clean - Delete most, but leave enough to build external modules 1450# |
1412clean: rm-dirs := $(CLEAN_DIRS) | |
1413clean: rm-files := $(CLEAN_FILES) 1414 1415PHONY += archclean vmlinuxclean 1416 1417vmlinuxclean: 1418 $(Q)$(CONFIG_SHELL) $(srctree)/scripts/link-vmlinux.sh clean 1419 $(Q)$(if $(ARCH_POSTLINK), $(MAKE) -f $(ARCH_POSTLINK) clean) 1420 1421clean: archclean vmlinuxclean 1422 1423# mrproper - Delete all generated files, including .config 1424# | 1451clean: rm-files := $(CLEAN_FILES) 1452 1453PHONY += archclean vmlinuxclean 1454 1455vmlinuxclean: 1456 $(Q)$(CONFIG_SHELL) $(srctree)/scripts/link-vmlinux.sh clean 1457 $(Q)$(if $(ARCH_POSTLINK), $(MAKE) -f $(ARCH_POSTLINK) clean) 1458 1459clean: archclean vmlinuxclean 1460 1461# mrproper - Delete all generated files, including .config 1462# |
1425mrproper: rm-dirs := $(wildcard $(MRPROPER_DIRS)) | |
1426mrproper: rm-files := $(wildcard $(MRPROPER_FILES)) 1427mrproper-dirs := $(addprefix _mrproper_,scripts) 1428 1429PHONY += $(mrproper-dirs) mrproper 1430$(mrproper-dirs): 1431 $(Q)$(MAKE) $(clean)=$(patsubst _mrproper_%,%,$@) 1432 1433mrproper: clean $(mrproper-dirs) | 1463mrproper: rm-files := $(wildcard $(MRPROPER_FILES)) 1464mrproper-dirs := $(addprefix _mrproper_,scripts) 1465 1466PHONY += $(mrproper-dirs) mrproper 1467$(mrproper-dirs): 1468 $(Q)$(MAKE) $(clean)=$(patsubst _mrproper_%,%,$@) 1469 1470mrproper: clean $(mrproper-dirs) |
1434 $(call cmd,rmdirs) | |
1435 $(call cmd,rmfiles) 1436 1437# distclean 1438# | 1471 $(call cmd,rmfiles) 1472 1473# distclean 1474# |
1439distclean: rm-dirs := $(wildcard $(DISTCLEAN_DIRS)) | |
1440distclean: rm-files := $(wildcard $(DISTCLEAN_FILES)) 1441 1442PHONY += distclean 1443 1444distclean: mrproper | 1475distclean: rm-files := $(wildcard $(DISTCLEAN_FILES)) 1476 1477PHONY += distclean 1478 1479distclean: mrproper |
1445 $(call cmd,rmdirs) | |
1446 $(call cmd,rmfiles) 1447 @find $(srctree) $(RCS_FIND_IGNORE) \ 1448 \( -name '*.orig' -o -name '*.rej' -o -name '*~' \ 1449 -o -name '*.bak' -o -name '#*#' -o -name '*%' \ 1450 -o -name 'core' \) \ 1451 -type f -print | xargs rm -f 1452 1453 --- 169 unchanged lines hidden (view full) --- 1623# make M=dir Same as 'make M=dir modules' 1624# make M=dir modules_install 1625# Install the modules built in the module directory 1626# Assumes install directory is already created 1627 1628# We are always building modules 1629KBUILD_MODULES := 1 1630 | 1480 $(call cmd,rmfiles) 1481 @find $(srctree) $(RCS_FIND_IGNORE) \ 1482 \( -name '*.orig' -o -name '*.rej' -o -name '*~' \ 1483 -o -name '*.bak' -o -name '#*#' -o -name '*%' \ 1484 -o -name 'core' \) \ 1485 -type f -print | xargs rm -f 1486 1487 --- 169 unchanged lines hidden (view full) --- 1657# make M=dir Same as 'make M=dir modules' 1658# make M=dir modules_install 1659# Install the modules built in the module directory 1660# Assumes install directory is already created 1661 1662# We are always building modules 1663KBUILD_MODULES := 1 1664 |
1631PHONY += $(objtree)/Module.symvers 1632$(objtree)/Module.symvers: 1633 @test -e $(objtree)/Module.symvers || ( \ 1634 echo; \ 1635 echo " WARNING: Symbol version dump $(objtree)/Module.symvers"; \ 1636 echo " is missing; modules will have no dependencies and modversions."; \ 1637 echo ) 1638 | |
1639build-dirs := $(KBUILD_EXTMOD) 1640PHONY += modules | 1665build-dirs := $(KBUILD_EXTMOD) 1666PHONY += modules |
1641modules: descend $(objtree)/Module.symvers | 1667modules: descend |
1642 $(Q)$(MAKE) -f $(srctree)/scripts/Makefile.modpost 1643 1644PHONY += modules_install 1645modules_install: _emodinst_ _emodinst_post 1646 1647install-dir := $(if $(INSTALL_MOD_DIR),$(INSTALL_MOD_DIR),extra) 1648PHONY += _emodinst_ 1649_emodinst_: 1650 $(Q)mkdir -p $(MODLIB)/$(install-dir) 1651 $(Q)$(MAKE) -f $(srctree)/scripts/Makefile.modinst 1652 1653PHONY += _emodinst_post 1654_emodinst_post: _emodinst_ 1655 $(call cmd,depmod) 1656 1657clean-dirs := $(KBUILD_EXTMOD) 1658clean: rm-files := $(KBUILD_EXTMOD)/Module.symvers $(KBUILD_EXTMOD)/modules.nsdeps 1659 | 1668 $(Q)$(MAKE) -f $(srctree)/scripts/Makefile.modpost 1669 1670PHONY += modules_install 1671modules_install: _emodinst_ _emodinst_post 1672 1673install-dir := $(if $(INSTALL_MOD_DIR),$(INSTALL_MOD_DIR),extra) 1674PHONY += _emodinst_ 1675_emodinst_: 1676 $(Q)mkdir -p $(MODLIB)/$(install-dir) 1677 $(Q)$(MAKE) -f $(srctree)/scripts/Makefile.modinst 1678 1679PHONY += _emodinst_post 1680_emodinst_post: _emodinst_ 1681 $(call cmd,depmod) 1682 1683clean-dirs := $(KBUILD_EXTMOD) 1684clean: rm-files := $(KBUILD_EXTMOD)/Module.symvers $(KBUILD_EXTMOD)/modules.nsdeps 1685 |
1660PHONY += / 1661/: 1662 @echo >&2 '"$(MAKE) /" is no longer supported. Please use "$(MAKE) ./" instead.' 1663 | |
1664PHONY += help 1665help: 1666 @echo ' Building external modules.' 1667 @echo ' Syntax: make -C path/to/kernel/src M=$$PWD target' 1668 @echo '' 1669 @echo ' modules - default target, build the module(s)' 1670 @echo ' modules_install - install the module' 1671 @echo ' clean - remove generated files in module directory only' --- 41 unchanged lines hidden (view full) --- 1713export KBUILD_SINGLE_TARGETS := $(addprefix $(extmod-prefix), $(single-no-ko)) 1714 1715# trim unrelated directories 1716build-dirs := $(foreach d, $(build-dirs), \ 1717 $(if $(filter $(d)/%, $(KBUILD_SINGLE_TARGETS)), $(d))) 1718 1719endif 1720 | 1686PHONY += help 1687help: 1688 @echo ' Building external modules.' 1689 @echo ' Syntax: make -C path/to/kernel/src M=$$PWD target' 1690 @echo '' 1691 @echo ' modules - default target, build the module(s)' 1692 @echo ' modules_install - install the module' 1693 @echo ' clean - remove generated files in module directory only' --- 41 unchanged lines hidden (view full) --- 1735export KBUILD_SINGLE_TARGETS := $(addprefix $(extmod-prefix), $(single-no-ko)) 1736 1737# trim unrelated directories 1738build-dirs := $(foreach d, $(build-dirs), \ 1739 $(if $(filter $(d)/%, $(KBUILD_SINGLE_TARGETS)), $(d))) 1740 1741endif 1742 |
1743ifndef CONFIG_MODULES 1744KBUILD_MODULES := 1745endif 1746 |
|
1721# Handle descending into subdirectories listed in $(build-dirs) 1722# Preset locale variables to speed up the build process. Limit locale 1723# tweaks to this spot to avoid wrong language settings when running 1724# make menuconfig etc. 1725# Error messages still appears in the original language 1726PHONY += descend $(build-dirs) 1727descend: $(build-dirs) 1728$(build-dirs): prepare 1729 $(Q)$(MAKE) $(build)=$@ \ 1730 single-build=$(if $(filter-out $@/, $(filter $@/%, $(single-no-ko))),1) \ 1731 need-builtin=1 need-modorder=1 1732 1733clean-dirs := $(addprefix _clean_, $(clean-dirs)) 1734PHONY += $(clean-dirs) clean 1735$(clean-dirs): 1736 $(Q)$(MAKE) $(clean)=$(patsubst _clean_%,%,$@) 1737 1738clean: $(clean-dirs) | 1747# Handle descending into subdirectories listed in $(build-dirs) 1748# Preset locale variables to speed up the build process. Limit locale 1749# tweaks to this spot to avoid wrong language settings when running 1750# make menuconfig etc. 1751# Error messages still appears in the original language 1752PHONY += descend $(build-dirs) 1753descend: $(build-dirs) 1754$(build-dirs): prepare 1755 $(Q)$(MAKE) $(build)=$@ \ 1756 single-build=$(if $(filter-out $@/, $(filter $@/%, $(single-no-ko))),1) \ 1757 need-builtin=1 need-modorder=1 1758 1759clean-dirs := $(addprefix _clean_, $(clean-dirs)) 1760PHONY += $(clean-dirs) clean 1761$(clean-dirs): 1762 $(Q)$(MAKE) $(clean)=$(patsubst _clean_%,%,$@) 1763 1764clean: $(clean-dirs) |
1739 $(call cmd,rmdirs) | |
1740 $(call cmd,rmfiles) 1741 @find $(if $(KBUILD_EXTMOD), $(KBUILD_EXTMOD), .) $(RCS_FIND_IGNORE) \ 1742 \( -name '*.[aios]' -o -name '*.ko' -o -name '.*.cmd' \ 1743 -o -name '*.ko.*' \ 1744 -o -name '*.dtb' -o -name '*.dtb.S' -o -name '*.dt.yaml' \ 1745 -o -name '*.dwo' -o -name '*.lst' \ 1746 -o -name '*.su' -o -name '*.mod' \ 1747 -o -name '.*.d' -o -name '.*.tmp' -o -name '*.mod.c' \ --- 78 unchanged lines hidden (view full) --- 1826tools/: FORCE 1827 $(Q)mkdir -p $(objtree)/tools 1828 $(Q)$(MAKE) LDFLAGS= MAKEFLAGS="$(tools_silent) $(filter --j% -j,$(MAKEFLAGS))" O=$(abspath $(objtree)) subdir=tools -C $(srctree)/tools/ 1829 1830tools/%: FORCE 1831 $(Q)mkdir -p $(objtree)/tools 1832 $(Q)$(MAKE) LDFLAGS= MAKEFLAGS="$(tools_silent) $(filter --j% -j,$(MAKEFLAGS))" O=$(abspath $(objtree)) subdir=tools -C $(srctree)/tools/ $* 1833 | 1765 $(call cmd,rmfiles) 1766 @find $(if $(KBUILD_EXTMOD), $(KBUILD_EXTMOD), .) $(RCS_FIND_IGNORE) \ 1767 \( -name '*.[aios]' -o -name '*.ko' -o -name '.*.cmd' \ 1768 -o -name '*.ko.*' \ 1769 -o -name '*.dtb' -o -name '*.dtb.S' -o -name '*.dt.yaml' \ 1770 -o -name '*.dwo' -o -name '*.lst' \ 1771 -o -name '*.su' -o -name '*.mod' \ 1772 -o -name '.*.d' -o -name '.*.tmp' -o -name '*.mod.c' \ --- 78 unchanged lines hidden (view full) --- 1851tools/: FORCE 1852 $(Q)mkdir -p $(objtree)/tools 1853 $(Q)$(MAKE) LDFLAGS= MAKEFLAGS="$(tools_silent) $(filter --j% -j,$(MAKEFLAGS))" O=$(abspath $(objtree)) subdir=tools -C $(srctree)/tools/ 1854 1855tools/%: FORCE 1856 $(Q)mkdir -p $(objtree)/tools 1857 $(Q)$(MAKE) LDFLAGS= MAKEFLAGS="$(tools_silent) $(filter --j% -j,$(MAKEFLAGS))" O=$(abspath $(objtree)) subdir=tools -C $(srctree)/tools/ $* 1858 |
1834# FIXME Should go into a make.lib or something 1835# =========================================================================== 1836 1837quiet_cmd_rmdirs = $(if $(wildcard $(rm-dirs)),CLEAN $(wildcard $(rm-dirs))) 1838 cmd_rmdirs = rm -rf $(rm-dirs) 1839 | |
1840quiet_cmd_rmfiles = $(if $(wildcard $(rm-files)),CLEAN $(wildcard $(rm-files))) | 1859quiet_cmd_rmfiles = $(if $(wildcard $(rm-files)),CLEAN $(wildcard $(rm-files))) |
1841 cmd_rmfiles = rm -f $(rm-files) | 1860 cmd_rmfiles = rm -rf $(rm-files) |
1842 1843# Run depmod only if we have System.map and depmod is executable 1844quiet_cmd_depmod = DEPMOD $(KERNELRELEASE) 1845 cmd_depmod = $(CONFIG_SHELL) $(srctree)/scripts/depmod.sh $(DEPMOD) \ 1846 $(KERNELRELEASE) 1847 1848# read saved command lines for existing targets 1849existing-targets := $(wildcard $(sort $(targets))) --- 13 unchanged lines hidden --- | 1861 1862# Run depmod only if we have System.map and depmod is executable 1863quiet_cmd_depmod = DEPMOD $(KERNELRELEASE) 1864 cmd_depmod = $(CONFIG_SHELL) $(srctree)/scripts/depmod.sh $(DEPMOD) \ 1865 $(KERNELRELEASE) 1866 1867# read saved command lines for existing targets 1868existing-targets := $(wildcard $(sort $(targets))) --- 13 unchanged lines hidden --- |