Makefile (4263eb6880df8383fff0efb872278a99eb6142c8) Makefile (e4a42c82e943b97ce124539fcd7a47445b43fa0d)
1# SPDX-License-Identifier: GPL-2.0
2VERSION = 5
3PATCHLEVEL = 7
4SUBLEVEL = 0
5EXTRAVERSION =
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
1# SPDX-License-Identifier: GPL-2.0
2VERSION = 5
3PATCHLEVEL = 7
4SUBLEVEL = 0
5EXTRAVERSION =
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
502export CFLAGS_KASAN CFLAGS_KASAN_NOSANITIZE CFLAGS_UBSAN
503export KBUILD_AFLAGS AFLAGS_KERNEL AFLAGS_MODULE
504export KBUILD_AFLAGS_MODULE KBUILD_CFLAGS_MODULE KBUILD_LDFLAGS_MODULE
505export KBUILD_AFLAGS_KERNEL KBUILD_CFLAGS_KERNEL

--- 82 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
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
520export CFLAGS_KASAN CFLAGS_KASAN_NOSANITIZE CFLAGS_UBSAN
521export KBUILD_AFLAGS AFLAGS_KERNEL AFLAGS_MODULE
522export KBUILD_AFLAGS_MODULE KBUILD_CFLAGS_MODULE KBUILD_LDFLAGS_MODULE
523export KBUILD_AFLAGS_KERNEL KBUILD_CFLAGS_KERNEL

--- 82 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:

--- 102 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
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:

--- 102 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 += -Wa,--compress-debug-sections=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

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

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
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

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

963ifeq ($(CONFIG_STRIP_ASM_SYMS),y)
964LDFLAGS_vmlinux += $(call ld-option, -X,)
965endif
966
967ifeq ($(CONFIG_RELR),y)
968LDFLAGS_vmlinux += --pack-dyn-relocs=relr
969endif
970
971# Align the bit size of userspace programs with the kernel
972KBUILD_USERCFLAGS += $(filter -m32 -m64, $(KBUILD_CFLAGS))
973KBUILD_USERLDFLAGS += $(filter -m32 -m64, $(KBUILD_CFLAGS))
974
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
975# make the checker run with the right architecture
976CHECKFLAGS += --arch=$(ARCH)
977
978# insure the checker run with the right endianness
979CHECKFLAGS += $(if $(CONFIG_CPU_BIG_ENDIAN),-mbig-endian,-mlittle-endian)
980
981# the checker needs the correct machine size
982CHECKFLAGS += $(if $(CONFIG_64BIT),-m64,-m32)

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

1028
1029# CONFIG_MODULE_COMPRESS, if defined, will cause module to be compressed
1030# after they are installed in agreement with CONFIG_MODULE_COMPRESS_GZIP
1031# or CONFIG_MODULE_COMPRESS_XZ.
1032
1033mod_compress_cmd = true
1034ifdef CONFIG_MODULE_COMPRESS
1035 ifdef CONFIG_MODULE_COMPRESS_GZIP
1008 mod_compress_cmd = gzip -n -f
1036 mod_compress_cmd = $(KGZIP) -n -f
1009 endif # CONFIG_MODULE_COMPRESS_GZIP
1010 ifdef CONFIG_MODULE_COMPRESS_XZ
1037 endif # CONFIG_MODULE_COMPRESS_GZIP
1038 ifdef CONFIG_MODULE_COMPRESS_XZ
1011 mod_compress_cmd = xz -f
1039 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
1040 endif # CONFIG_MODULE_COMPRESS_XZ
1041endif # CONFIG_MODULE_COMPRESS
1042export mod_compress_cmd
1043
1044ifdef CONFIG_MODULE_SIG_ALL
1045$(eval $(call config_filename,MODULE_SIG_KEY))
1046
1047mod_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) ---

1066PHONY += prepare0
1067
1068export MODORDER := $(extmod-prefix)modules.order
1069export MODULES_NSDEPS := $(extmod-prefix)modules.nsdeps
1070
1071ifeq ($(KBUILD_EXTMOD),)
1072core-y += kernel/ certs/ mm/ fs/ ipc/ security/ crypto/ block/
1073
1046vmlinux-dirs := $(patsubst %/,%,$(filter %/, $(init-y) $(init-m) \
1074vmlinux-dirs := $(patsubst %/,%,$(filter %/, \
1047 $(core-y) $(core-m) $(drivers-y) $(drivers-m) \
1075 $(core-y) $(core-m) $(drivers-y) $(drivers-m) \
1048 $(net-y) $(net-m) $(libs-y) $(libs-m) $(virt-y)))
1076 $(libs-y) $(libs-m)))
1049
1050vmlinux-alldirs := $(sort $(vmlinux-dirs) Documentation \
1077
1078vmlinux-alldirs := $(sort $(vmlinux-dirs) Documentation \
1051 $(patsubst %/,%,$(filter %/, $(init-) $(core-) \
1052 $(drivers-) $(net-) $(libs-) $(virt-))))
1079 $(patsubst %/,%,$(filter %/, $(core-) \
1080 $(drivers-) $(libs-))))
1053
1081
1082subdir-modorder := $(addsuffix modules.order,$(filter %/, \
1083 $(core-y) $(core-m) $(libs-y) $(libs-m) \
1084 $(drivers-y) $(drivers-m)))
1085
1054build-dirs := $(vmlinux-dirs)
1055clean-dirs := $(vmlinux-alldirs)
1056
1086build-dirs := $(vmlinux-dirs)
1087clean-dirs := $(vmlinux-alldirs)
1088
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)))
1089# Externally visible symbols (used by link-vmlinux.sh)
1090KBUILD_VMLINUX_OBJS := $(head-y) $(patsubst %/,%/built-in.a, $(core-y))
1091KBUILD_VMLINUX_OBJS += $(addsuffix built-in.a, $(filter %/, $(libs-y)))
1062ifdef CONFIG_MODULES
1092ifdef CONFIG_MODULES
1063libs-y1 := $(filter-out %/, $(libs-y))
1064libs-y2 += $(patsubst %/, %/lib.a, $(filter %/, $(libs-y)))
1093KBUILD_VMLINUX_OBJS += $(patsubst %/, %/lib.a, $(filter %/, $(libs-y)))
1094KBUILD_VMLINUX_LIBS := $(filter-out %/, $(libs-y))
1065else
1095else
1066libs-y1 := $(patsubst %/, %/lib.a, $(libs-y))
1096KBUILD_VMLINUX_LIBS := $(patsubst %/,%/lib.a, $(libs-y))
1067endif
1097endif
1068virt-y := $(patsubst %/, %/built-in.a, $(virt-y))
1098KBUILD_VMLINUX_OBJS += $(patsubst %/,%/built-in.a, $(drivers-y))
1069
1099
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)
1100export KBUILD_VMLINUX_OBJS KBUILD_VMLINUX_LIBS
1074export 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
1101export KBUILD_LDS := arch/$(SRCARCH)/kernel/vmlinux.lds
1102export LDFLAGS_vmlinux
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)

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

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
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)

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

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

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

1304
1305PHONY += dt_binding_check
1306dt_binding_check: scripts_dtc
1307 $(Q)$(MAKE) $(build)=Documentation/devicetree/bindings
1308
1309# ---------------------------------------------------------------------------
1310# Modules
1311
1171
1172prepare0: archprepare
1173 $(Q)$(MAKE) $(build)=scripts/mod
1174 $(Q)$(MAKE) $(build)=.
1175
1176# All the preparing..
1177prepare: prepare0 prepare-objtool
1178

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

1330
1331PHONY += dt_binding_check
1332dt_binding_check: scripts_dtc
1333 $(Q)$(MAKE) $(build)=Documentation/devicetree/bindings
1334
1335# ---------------------------------------------------------------------------
1336# Modules
1337
1338# install modules.builtin regardless of CONFIG_MODULES
1339PHONY += _builtin_inst_
1340_builtin_inst_:
1341 @mkdir -p $(MODLIB)/
1342 @cp -f modules.builtin $(MODLIB)/
1343 @cp -f $(objtree)/modules.builtin.modinfo $(MODLIB)/
1344
1345PHONY += install
1346install: _builtin_inst_
1347
1312ifdef CONFIG_MODULES
1313
1314# By default, build modules as well
1315
1316all: modules
1317
1348ifdef CONFIG_MODULES
1349
1350# By default, build modules as well
1351
1352all: modules
1353
1354# When we're building modules with modversions, we need to consider
1355# the built-in objects during the descend as well, in order to
1356# make sure the checksums are up to date before we record them.
1357ifdef CONFIG_MODVERSIONS
1358 KBUILD_BUILTIN := 1
1359endif
1360
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
1361# Build modules
1362#
1363# A module can be listed more than once in obj-m resulting in
1364# duplicate lines in modules.order files. Those are removed
1365# using awk while concatenating to the final file.
1366
1367PHONY += modules
1325modules: $(if $(KBUILD_BUILTIN),vmlinux) modules.order
1368modules: $(if $(KBUILD_BUILTIN),vmlinux) modules_check
1326 $(Q)$(MAKE) -f $(srctree)/scripts/Makefile.modpost
1369 $(Q)$(MAKE) -f $(srctree)/scripts/Makefile.modpost
1327 $(Q)$(CONFIG_SHELL) $(srctree)/scripts/modules-check.sh
1328
1370
1329modules.order: descend
1330 $(Q)$(AWK) '!x[$$0]++' $(addsuffix /$@, $(build-dirs)) > $@
1371PHONY += modules_check
1372modules_check: modules.order
1373 $(Q)$(CONFIG_SHELL) $(srctree)/scripts/modules-check.sh $<
1331
1374
1375cmd_modules_order = $(AWK) '!x[$$0]++' $(real-prereqs) > $@
1376
1377modules.order: $(subdir-modorder) FORCE
1378 $(call if_changed,modules_order)
1379
1380targets += modules.order
1381
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
1340PHONY += _modinst_
1382# Target to prepare building external modules
1383PHONY += modules_prepare
1384modules_prepare: prepare
1385
1386# Target to install modules
1387PHONY += modules_install
1388modules_install: _modinst_ _modinst_post
1389
1390PHONY += _modinst_
1341_modinst_:
1391_modinst_: _builtin_inst_
1342 @rm -rf $(MODLIB)/kernel
1343 @rm -f $(MODLIB)/source
1344 @mkdir -p $(MODLIB)/kernel
1345 @ln -s $(abspath $(srctree)) $(MODLIB)/source
1346 @if [ ! $(objtree) -ef $(MODLIB)/build ]; then \
1347 rm -f $(MODLIB)/build ; \
1348 ln -s $(CURDIR) $(MODLIB)/build ; \
1349 fi
1350 @sed 's:^:kernel/:' modules.order > $(MODLIB)/modules.order
1392 @rm -rf $(MODLIB)/kernel
1393 @rm -f $(MODLIB)/source
1394 @mkdir -p $(MODLIB)/kernel
1395 @ln -s $(abspath $(srctree)) $(MODLIB)/source
1396 @if [ ! $(objtree) -ef $(MODLIB)/build ]; then \
1397 rm -f $(MODLIB)/build ; \
1398 ln -s $(CURDIR) $(MODLIB)/build ; \
1399 fi
1400 @sed 's:^:kernel/:' modules.order > $(MODLIB)/modules.order
1351 @cp -f modules.builtin $(MODLIB)/
1352 @cp -f $(objtree)/modules.builtin.modinfo $(MODLIB)/
1353 $(Q)$(MAKE) -f $(srctree)/scripts/Makefile.modinst
1354
1355# This depmod is only for convenience to give the initial
1356# boot a modules.dep even before / is mounted read-write. However the
1357# boot script depmod is the master version.
1358PHONY += _modinst_post
1359_modinst_post: _modinst_
1360 $(call cmd,depmod)

--- 23 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'
1401 $(Q)$(MAKE) -f $(srctree)/scripts/Makefile.modinst
1402
1403# This depmod is only for convenience to give the initial
1404# boot a modules.dep even before / is mounted read-write. However the
1405# boot script depmod is the master version.
1406PHONY += _modinst_post
1407_modinst_post: _modinst_
1408 $(call cmd,depmod)

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

1432###
1433# Cleaning is done on three levels.
1434# make clean Delete most generated files
1435# Leave enough to build external modules
1436# make mrproper Delete the current configuration, and all generated files
1437# make distclean Remove editor backup files, patch leftover files and the like
1438
1439# Directories & files removed with 'make clean'
1392CLEAN_DIRS += include/ksym
1393CLEAN_FILES += modules.builtin modules.builtin.modinfo modules.nsdeps
1440CLEAN_FILES += include/ksym vmlinux.symvers \
1441 modules.builtin modules.builtin.modinfo modules.nsdeps
1394
1395# Directories & files removed with 'make mrproper'
1442
1443# Directories & files removed with 'make mrproper'
1396MRPROPER_DIRS += include/config include/generated \
1444MRPROPER_FILES += include/config include/generated \
1397 arch/$(SRCARCH)/include/generated .tmp_objdiff \
1445 arch/$(SRCARCH)/include/generated .tmp_objdiff \
1398 debian/ snap/ tar-install/
1399MRPROPER_FILES += .config .config.old .version \
1446 debian snap tar-install \
1447 .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'
1448 Module.symvers \
1449 signing_key.pem signing_key.priv signing_key.x509 \
1450 x509.genkey extra_certificates signing_key.x509.keyid \
1451 signing_key.x509.signer vmlinux-gdb.py \
1452 *.spec
1453
1454# 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#
1455DISTCLEAN_FILES += tags TAGS cscope* GPATH GTAGS GRTAGS GSYMS
1456
1457# clean - Delete most, but leave enough to build external modules
1458#
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#
1459clean: rm-files := $(CLEAN_FILES)
1460
1461PHONY += archclean vmlinuxclean
1462
1463vmlinuxclean:
1464 $(Q)$(CONFIG_SHELL) $(srctree)/scripts/link-vmlinux.sh clean
1465 $(Q)$(if $(ARCH_POSTLINK), $(MAKE) -f $(ARCH_POSTLINK) clean)
1466
1467clean: archclean vmlinuxclean
1468
1469# mrproper - Delete all generated files, including .config
1470#
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)
1471mrproper: rm-files := $(wildcard $(MRPROPER_FILES))
1472mrproper-dirs := $(addprefix _mrproper_,scripts)
1473
1474PHONY += $(mrproper-dirs) mrproper
1475$(mrproper-dirs):
1476 $(Q)$(MAKE) $(clean)=$(patsubst _mrproper_%,%,$@)
1477
1478mrproper: clean $(mrproper-dirs)
1434 $(call cmd,rmdirs)
1435 $(call cmd,rmfiles)
1436
1437# distclean
1438#
1479 $(call cmd,rmfiles)
1480
1481# distclean
1482#
1439distclean: rm-dirs := $(wildcard $(DISTCLEAN_DIRS))
1440distclean: rm-files := $(wildcard $(DISTCLEAN_FILES))
1441
1442PHONY += distclean
1443
1444distclean: mrproper
1483distclean: rm-files := $(wildcard $(DISTCLEAN_FILES))
1484
1485PHONY += distclean
1486
1487distclean: 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
1488 $(call cmd,rmfiles)
1489 @find $(srctree) $(RCS_FIND_IGNORE) \
1490 \( -name '*.orig' -o -name '*.rej' -o -name '*~' \
1491 -o -name '*.bak' -o -name '#*#' -o -name '*%' \
1492 -o -name 'core' \) \
1493 -type f -print | xargs rm -f
1494
1495

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

1665# make M=dir Same as 'make M=dir modules'
1666# make M=dir modules_install
1667# Install the modules built in the module directory
1668# Assumes install directory is already created
1669
1670# We are always building modules
1671KBUILD_MODULES := 1
1672
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
1673build-dirs := $(KBUILD_EXTMOD)
1674PHONY += modules
1641modules: descend $(objtree)/Module.symvers
1675modules: 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
1676 $(Q)$(MAKE) -f $(srctree)/scripts/Makefile.modpost
1677
1678PHONY += modules_install
1679modules_install: _emodinst_ _emodinst_post
1680
1681install-dir := $(if $(INSTALL_MOD_DIR),$(INSTALL_MOD_DIR),extra)
1682PHONY += _emodinst_
1683_emodinst_:
1684 $(Q)mkdir -p $(MODLIB)/$(install-dir)
1685 $(Q)$(MAKE) -f $(srctree)/scripts/Makefile.modinst
1686
1687PHONY += _emodinst_post
1688_emodinst_post: _emodinst_
1689 $(call cmd,depmod)
1690
1691clean-dirs := $(KBUILD_EXTMOD)
1692clean: rm-files := $(KBUILD_EXTMOD)/Module.symvers $(KBUILD_EXTMOD)/modules.nsdeps
1693
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
1694PHONY += help
1695help:
1696 @echo ' Building external modules.'
1697 @echo ' Syntax: make -C path/to/kernel/src M=$$PWD target'
1698 @echo ''
1699 @echo ' modules - default target, build the module(s)'
1700 @echo ' modules_install - install the module'
1701 @echo ' clean - remove generated files in module directory only'

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

1743export KBUILD_SINGLE_TARGETS := $(addprefix $(extmod-prefix), $(single-no-ko))
1744
1745# trim unrelated directories
1746build-dirs := $(foreach d, $(build-dirs), \
1747 $(if $(filter $(d)/%, $(KBUILD_SINGLE_TARGETS)), $(d)))
1748
1749endif
1750
1751ifndef CONFIG_MODULES
1752KBUILD_MODULES :=
1753endif
1754
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)
1755# Handle descending into subdirectories listed in $(build-dirs)
1756# Preset locale variables to speed up the build process. Limit locale
1757# tweaks to this spot to avoid wrong language settings when running
1758# make menuconfig etc.
1759# Error messages still appears in the original language
1760PHONY += descend $(build-dirs)
1761descend: $(build-dirs)
1762$(build-dirs): prepare
1763 $(Q)$(MAKE) $(build)=$@ \
1764 single-build=$(if $(filter-out $@/, $(filter $@/%, $(single-no-ko))),1) \
1765 need-builtin=1 need-modorder=1
1766
1767clean-dirs := $(addprefix _clean_, $(clean-dirs))
1768PHONY += $(clean-dirs) clean
1769$(clean-dirs):
1770 $(Q)$(MAKE) $(clean)=$(patsubst _clean_%,%,$@)
1771
1772clean: $(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
1773 $(call cmd,rmfiles)
1774 @find $(if $(KBUILD_EXTMOD), $(KBUILD_EXTMOD), .) $(RCS_FIND_IGNORE) \
1775 \( -name '*.[aios]' -o -name '*.ko' -o -name '.*.cmd' \
1776 -o -name '*.ko.*' \
1777 -o -name '*.dtb' -o -name '*.dtb.S' -o -name '*.dt.yaml' \
1778 -o -name '*.dwo' -o -name '*.lst' \
1779 -o -name '*.su' -o -name '*.mod' \
1780 -o -name '.*.d' -o -name '.*.tmp' -o -name '*.mod.c' \

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

1859tools/: FORCE
1860 $(Q)mkdir -p $(objtree)/tools
1861 $(Q)$(MAKE) LDFLAGS= MAKEFLAGS="$(tools_silent) $(filter --j% -j,$(MAKEFLAGS))" O=$(abspath $(objtree)) subdir=tools -C $(srctree)/tools/
1862
1863tools/%: FORCE
1864 $(Q)mkdir -p $(objtree)/tools
1865 $(Q)$(MAKE) LDFLAGS= MAKEFLAGS="$(tools_silent) $(filter --j% -j,$(MAKEFLAGS))" O=$(abspath $(objtree)) subdir=tools -C $(srctree)/tools/ $*
1866
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)))
1867quiet_cmd_rmfiles = $(if $(wildcard $(rm-files)),CLEAN $(wildcard $(rm-files)))
1841 cmd_rmfiles = rm -f $(rm-files)
1868 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 ---
1869
1870# Run depmod only if we have System.map and depmod is executable
1871quiet_cmd_depmod = DEPMOD $(KERNELRELEASE)
1872 cmd_depmod = $(CONFIG_SHELL) $(srctree)/scripts/depmod.sh $(DEPMOD) \
1873 $(KERNELRELEASE)
1874
1875# read saved command lines for existing targets
1876existing-targets := $(wildcard $(sort $(targets)))

--- 13 unchanged lines hidden ---