aboutsummaryrefslogtreecommitdiffstats
path: root/Makefile
diff options
context:
space:
mode:
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile219
1 files changed, 105 insertions, 114 deletions
diff --git a/Makefile b/Makefile
index f070e0d65186..9ef547fc7ffe 100644
--- a/Makefile
+++ b/Makefile
@@ -15,19 +15,6 @@ NAME = Shy Crocodile
15PHONY := _all 15PHONY := _all
16_all: 16_all:
17 17
18# Do not use make's built-in rules and variables
19# (this increases performance and avoids hard-to-debug behaviour)
20MAKEFLAGS += -rR
21
22# Avoid funny character set dependencies
23unexport LC_ALL
24LC_COLLATE=C
25LC_NUMERIC=C
26export LC_COLLATE LC_NUMERIC
27
28# Avoid interference with shell env settings
29unexport GREP_OPTIONS
30
31# We are using a recursive build, so we need to do a little thinking 18# We are using a recursive build, so we need to do a little thinking
32# to get the ordering right. 19# to get the ordering right.
33# 20#
@@ -44,6 +31,25 @@ unexport GREP_OPTIONS
44# descending is started. They are now explicitly listed as the 31# descending is started. They are now explicitly listed as the
45# prepare rule. 32# prepare rule.
46 33
34ifneq ($(sub-make-done),1)
35
36# Do not use make's built-in rules and variables
37# (this increases performance and avoids hard-to-debug behaviour)
38MAKEFLAGS += -rR
39
40# 'MAKEFLAGS += -rR' does not become immediately effective for old
41# GNU Make versions. Cancel implicit rules for this Makefile.
42$(lastword $(MAKEFILE_LIST)): ;
43
44# Avoid funny character set dependencies
45unexport LC_ALL
46LC_COLLATE=C
47LC_NUMERIC=C
48export LC_COLLATE LC_NUMERIC
49
50# Avoid interference with shell env settings
51unexport GREP_OPTIONS
52
47# Beautify output 53# Beautify output
48# --------------------------------------------------------------------------- 54# ---------------------------------------------------------------------------
49# 55#
@@ -90,7 +96,6 @@ endif
90 96
91ifneq ($(findstring s,$(filter-out --%,$(MAKEFLAGS))),) 97ifneq ($(findstring s,$(filter-out --%,$(MAKEFLAGS))),)
92 quiet=silent_ 98 quiet=silent_
93 tools_silent=s
94endif 99endif
95 100
96export quiet Q KBUILD_VERBOSE 101export quiet Q KBUILD_VERBOSE
@@ -112,7 +117,6 @@ export quiet Q KBUILD_VERBOSE
112 117
113# KBUILD_SRC is not intended to be used by the regular user (for now), 118# KBUILD_SRC is not intended to be used by the regular user (for now),
114# it is set on invocation of make with KBUILD_OUTPUT or O= specified. 119# it is set on invocation of make with KBUILD_OUTPUT or O= specified.
115ifeq ($(KBUILD_SRC),)
116 120
117# OK, Make called in directory where kernel src resides 121# OK, Make called in directory where kernel src resides
118# Do we want to locate output files in a separate directory? 122# Do we want to locate output files in a separate directory?
@@ -120,9 +124,6 @@ ifeq ("$(origin O)", "command line")
120 KBUILD_OUTPUT := $(O) 124 KBUILD_OUTPUT := $(O)
121endif 125endif
122 126
123# Cancel implicit rules on top Makefile
124$(CURDIR)/Makefile Makefile: ;
125
126ifneq ($(words $(subst :, ,$(CURDIR))), 1) 127ifneq ($(words $(subst :, ,$(CURDIR))), 1)
127 $(error main directory cannot contain spaces nor colons) 128 $(error main directory cannot contain spaces nor colons)
128endif 129endif
@@ -142,6 +143,13 @@ $(if $(KBUILD_OUTPUT),, \
142# 'sub-make' below. 143# 'sub-make' below.
143MAKEFLAGS += --include-dir=$(CURDIR) 144MAKEFLAGS += --include-dir=$(CURDIR)
144 145
146else
147
148# Do not print "Entering directory ..." at all for in-tree build.
149MAKEFLAGS += --no-print-directory
150
151endif # ifneq ($(KBUILD_OUTPUT),)
152
145PHONY += $(MAKECMDGOALS) sub-make 153PHONY += $(MAKECMDGOALS) sub-make
146 154
147$(filter-out _all sub-make $(CURDIR)/Makefile, $(MAKECMDGOALS)) _all: sub-make 155$(filter-out _all sub-make $(CURDIR)/Makefile, $(MAKECMDGOALS)) _all: sub-make
@@ -149,16 +157,12 @@ $(filter-out _all sub-make $(CURDIR)/Makefile, $(MAKECMDGOALS)) _all: sub-make
149 157
150# Invoke a second make in the output directory, passing relevant variables 158# Invoke a second make in the output directory, passing relevant variables
151sub-make: 159sub-make:
152 $(Q)$(MAKE) -C $(KBUILD_OUTPUT) KBUILD_SRC=$(CURDIR) \ 160 $(Q)$(MAKE) sub-make-done=1 \
161 $(if $(KBUILD_OUTPUT),-C $(KBUILD_OUTPUT) KBUILD_SRC=$(CURDIR)) \
153 -f $(CURDIR)/Makefile $(filter-out _all sub-make,$(MAKECMDGOALS)) 162 -f $(CURDIR)/Makefile $(filter-out _all sub-make,$(MAKECMDGOALS))
154 163
155# Leave processing to above invocation of make 164else # sub-make-done
156skip-makefile := 1
157endif # ifneq ($(KBUILD_OUTPUT),)
158endif # ifeq ($(KBUILD_SRC),)
159
160# We process the rest of the Makefile if this is the final invocation of make 165# We process the rest of the Makefile if this is the final invocation of make
161ifeq ($(skip-makefile),)
162 166
163# Do not print "Entering directory ...", 167# Do not print "Entering directory ...",
164# but we want to display it when entering to the output directory 168# but we want to display it when entering to the output directory
@@ -215,7 +219,7 @@ objtree := .
215src := $(srctree) 219src := $(srctree)
216obj := $(objtree) 220obj := $(objtree)
217 221
218VPATH := $(srctree)$(if $(KBUILD_EXTMOD),:$(KBUILD_EXTMOD)) 222VPATH := $(srctree)
219 223
220export srctree objtree VPATH 224export srctree objtree VPATH
221 225
@@ -300,8 +304,6 @@ __build_one_by_one:
300 304
301else 305else
302 306
303# We need some generic definitions (do not try to remake the file).
304scripts/Kbuild.include: ;
305include scripts/Kbuild.include 307include scripts/Kbuild.include
306 308
307# Read KERNELRELEASE from include/config/kernel.release (if it exists) 309# Read KERNELRELEASE from include/config/kernel.release (if it exists)
@@ -390,7 +392,6 @@ OBJDUMP = $(CROSS_COMPILE)objdump
390LEX = flex 392LEX = flex
391YACC = bison 393YACC = bison
392AWK = awk 394AWK = awk
393GENKSYMS = scripts/genksyms/genksyms
394INSTALLKERNEL := installkernel 395INSTALLKERNEL := installkernel
395DEPMOD = /sbin/depmod 396DEPMOD = /sbin/depmod
396PERL = perl 397PERL = perl
@@ -429,7 +430,7 @@ LINUXINCLUDE := \
429KBUILD_AFLAGS := -D__ASSEMBLY__ -fno-PIE 430KBUILD_AFLAGS := -D__ASSEMBLY__ -fno-PIE
430KBUILD_CFLAGS := -Wall -Wundef -Werror=strict-prototypes -Wno-trigraphs \ 431KBUILD_CFLAGS := -Wall -Wundef -Werror=strict-prototypes -Wno-trigraphs \
431 -fno-strict-aliasing -fno-common -fshort-wchar -fno-PIE \ 432 -fno-strict-aliasing -fno-common -fshort-wchar -fno-PIE \
432 -Werror-implicit-function-declaration -Werror=implicit-int \ 433 -Werror=implicit-function-declaration -Werror=implicit-int \
433 -Wno-format-security \ 434 -Wno-format-security \
434 -std=gnu89 435 -std=gnu89
435KBUILD_CPPFLAGS := -D__KERNEL__ 436KBUILD_CPPFLAGS := -D__KERNEL__
@@ -443,7 +444,7 @@ GCC_PLUGINS_CFLAGS :=
443 444
444export ARCH SRCARCH CONFIG_SHELL HOSTCC KBUILD_HOSTCFLAGS CROSS_COMPILE AS LD CC 445export ARCH SRCARCH CONFIG_SHELL HOSTCC KBUILD_HOSTCFLAGS CROSS_COMPILE AS LD CC
445export CPP AR NM STRIP OBJCOPY OBJDUMP KBUILD_HOSTLDFLAGS KBUILD_HOSTLDLIBS 446export CPP AR NM STRIP OBJCOPY OBJDUMP KBUILD_HOSTLDFLAGS KBUILD_HOSTLDLIBS
446export MAKE LEX YACC AWK GENKSYMS INSTALLKERNEL PERL PYTHON PYTHON2 PYTHON3 UTS_MACHINE 447export MAKE LEX YACC AWK INSTALLKERNEL PERL PYTHON PYTHON2 PYTHON3 UTS_MACHINE
447export HOSTCXX KBUILD_HOSTCXXFLAGS LDFLAGS_MODULE CHECK CHECKFLAGS 448export HOSTCXX KBUILD_HOSTCXXFLAGS LDFLAGS_MODULE CHECK CHECKFLAGS
448 449
449export KBUILD_CPPFLAGS NOSTDINC_FLAGS LINUXINCLUDE OBJCOPYFLAGS KBUILD_LDFLAGS 450export KBUILD_CPPFLAGS NOSTDINC_FLAGS LINUXINCLUDE OBJCOPYFLAGS KBUILD_LDFLAGS
@@ -476,23 +477,23 @@ scripts_basic:
476 $(Q)$(MAKE) $(build)=scripts/basic 477 $(Q)$(MAKE) $(build)=scripts/basic
477 $(Q)rm -f .tmp_quiet_recordmcount 478 $(Q)rm -f .tmp_quiet_recordmcount
478 479
479# To avoid any implicit rule to kick in, define an empty command.
480scripts/basic/%: scripts_basic ;
481
482PHONY += outputmakefile 480PHONY += outputmakefile
483# outputmakefile generates a Makefile in the output directory, if using a 481# outputmakefile generates a Makefile in the output directory, if using a
484# separate output directory. This allows convenient use of make in the 482# separate output directory. This allows convenient use of make in the
485# output directory. 483# output directory.
484# At the same time when output Makefile generated, generate .gitignore to
485# ignore whole output directory
486outputmakefile: 486outputmakefile:
487ifneq ($(KBUILD_SRC),) 487ifneq ($(KBUILD_SRC),)
488 $(Q)ln -fsn $(srctree) source 488 $(Q)ln -fsn $(srctree) source
489 $(Q)$(CONFIG_SHELL) $(srctree)/scripts/mkmakefile $(srctree) 489 $(Q)$(CONFIG_SHELL) $(srctree)/scripts/mkmakefile $(srctree)
490 $(Q){ echo "# this is build directory, ignore it"; echo "*"; } > .gitignore
490endif 491endif
491 492
492ifneq ($(shell $(CC) --version 2>&1 | head -n 1 | grep clang),) 493ifneq ($(shell $(CC) --version 2>&1 | head -n 1 | grep clang),)
493ifneq ($(CROSS_COMPILE),) 494ifneq ($(CROSS_COMPILE),)
494CLANG_FLAGS := --target=$(notdir $(CROSS_COMPILE:%-=%)) 495CLANG_FLAGS := --target=$(notdir $(CROSS_COMPILE:%-=%))
495GCC_TOOLCHAIN_DIR := $(dir $(shell which $(LD))) 496GCC_TOOLCHAIN_DIR := $(dir $(shell which $(CROSS_COMPILE)elfedit))
496CLANG_FLAGS += --prefix=$(GCC_TOOLCHAIN_DIR) 497CLANG_FLAGS += --prefix=$(GCC_TOOLCHAIN_DIR)
497GCC_TOOLCHAIN := $(realpath $(GCC_TOOLCHAIN_DIR)/..) 498GCC_TOOLCHAIN := $(realpath $(GCC_TOOLCHAIN_DIR)/..)
498endif 499endif
@@ -624,13 +625,22 @@ ifeq ($(may-sync-config),1)
624# because some architectures define CROSS_COMPILE there. 625# because some architectures define CROSS_COMPILE there.
625-include include/config/auto.conf.cmd 626-include include/config/auto.conf.cmd
626 627
627# To avoid any implicit rule to kick in, define an empty command 628$(KCONFIG_CONFIG):
628$(KCONFIG_CONFIG) include/config/auto.conf.cmd: ; 629 @echo >&2 '***'
630 @echo >&2 '*** Configuration file "$@" not found!'
631 @echo >&2 '***'
632 @echo >&2 '*** Please run some configurator (e.g. "make oldconfig" or'
633 @echo >&2 '*** "make menuconfig" or "make xconfig").'
634 @echo >&2 '***'
635 @/bin/false
629 636
630# The actual configuration files used during the build are stored in 637# The actual configuration files used during the build are stored in
631# include/generated/ and include/config/. Update them if .config is newer than 638# include/generated/ and include/config/. Update them if .config is newer than
632# include/config/auto.conf (which mirrors .config). 639# include/config/auto.conf (which mirrors .config).
633include/config/%.conf: $(KCONFIG_CONFIG) include/config/auto.conf.cmd 640#
641# This exploits the 'multi-target pattern rule' trick.
642# The syncconfig should be executed only once to make all the targets.
643%/auto.conf %/auto.conf.cmd %/tristate.conf: $(KCONFIG_CONFIG)
634 $(Q)$(MAKE) -f $(srctree)/Makefile syncconfig 644 $(Q)$(MAKE) -f $(srctree)/Makefile syncconfig
635else 645else
636# External modules and some install targets need include/generated/autoconf.h 646# External modules and some install targets need include/generated/autoconf.h
@@ -658,17 +668,13 @@ KBUILD_CFLAGS += $(call cc-disable-warning, int-in-bool-context)
658 668
659ifdef CONFIG_CC_OPTIMIZE_FOR_SIZE 669ifdef CONFIG_CC_OPTIMIZE_FOR_SIZE
660KBUILD_CFLAGS += $(call cc-option,-Oz,-Os) 670KBUILD_CFLAGS += $(call cc-option,-Oz,-Os)
661KBUILD_CFLAGS += $(call cc-disable-warning,maybe-uninitialized,)
662else
663ifdef CONFIG_PROFILE_ALL_BRANCHES
664KBUILD_CFLAGS += -O2 $(call cc-disable-warning,maybe-uninitialized,)
665else 671else
666KBUILD_CFLAGS += -O2 672KBUILD_CFLAGS += -O2
667endif 673endif
668endif
669 674
670KBUILD_CFLAGS += $(call cc-ifversion, -lt, 0409, \ 675ifdef CONFIG_CC_DISABLE_WARN_MAYBE_UNINITIALIZED
671 $(call cc-disable-warning,maybe-uninitialized,)) 676KBUILD_CFLAGS += -Wno-maybe-uninitialized
677endif
672 678
673# Tell gcc to never replace conditional load with a non-conditional one 679# Tell gcc to never replace conditional load with a non-conditional one
674KBUILD_CFLAGS += $(call cc-option,--param=allow-store-data-races=0) 680KBUILD_CFLAGS += $(call cc-option,--param=allow-store-data-races=0)
@@ -729,25 +735,28 @@ KBUILD_CFLAGS += -fomit-frame-pointer
729endif 735endif
730endif 736endif
731 737
732KBUILD_CFLAGS += $(call cc-option, -fno-var-tracking-assignments) 738DEBUG_CFLAGS := $(call cc-option, -fno-var-tracking-assignments)
733 739
734ifdef CONFIG_DEBUG_INFO 740ifdef CONFIG_DEBUG_INFO
735ifdef CONFIG_DEBUG_INFO_SPLIT 741ifdef CONFIG_DEBUG_INFO_SPLIT
736KBUILD_CFLAGS += $(call cc-option, -gsplit-dwarf, -g) 742DEBUG_CFLAGS += -gsplit-dwarf
737else 743else
738KBUILD_CFLAGS += -g 744DEBUG_CFLAGS += -g
739endif 745endif
740KBUILD_AFLAGS += -Wa,-gdwarf-2 746KBUILD_AFLAGS += -Wa,-gdwarf-2
741endif 747endif
742ifdef CONFIG_DEBUG_INFO_DWARF4 748ifdef CONFIG_DEBUG_INFO_DWARF4
743KBUILD_CFLAGS += $(call cc-option, -gdwarf-4,) 749DEBUG_CFLAGS += -gdwarf-4
744endif 750endif
745 751
746ifdef CONFIG_DEBUG_INFO_REDUCED 752ifdef CONFIG_DEBUG_INFO_REDUCED
747KBUILD_CFLAGS += $(call cc-option, -femit-struct-debug-baseonly) \ 753DEBUG_CFLAGS += $(call cc-option, -femit-struct-debug-baseonly) \
748 $(call cc-option,-fno-var-tracking) 754 $(call cc-option,-fno-var-tracking)
749endif 755endif
750 756
757KBUILD_CFLAGS += $(DEBUG_CFLAGS)
758export DEBUG_CFLAGS
759
751ifdef CONFIG_FUNCTION_TRACER 760ifdef CONFIG_FUNCTION_TRACER
752ifdef CONFIG_FTRACE_MCOUNT_RECORD 761ifdef CONFIG_FTRACE_MCOUNT_RECORD
753 # gcc 5 supports generating the mcount tables directly 762 # gcc 5 supports generating the mcount tables directly
@@ -922,19 +931,6 @@ ifdef CONFIG_MODULE_COMPRESS
922endif # CONFIG_MODULE_COMPRESS 931endif # CONFIG_MODULE_COMPRESS
923export mod_compress_cmd 932export mod_compress_cmd
924 933
925# Select initial ramdisk compression format, default is gzip(1).
926# This shall be used by the dracut(8) tool while creating an initramfs image.
927#
928INITRD_COMPRESS-y := gzip
929INITRD_COMPRESS-$(CONFIG_RD_BZIP2) := bzip2
930INITRD_COMPRESS-$(CONFIG_RD_LZMA) := lzma
931INITRD_COMPRESS-$(CONFIG_RD_XZ) := xz
932INITRD_COMPRESS-$(CONFIG_RD_LZO) := lzo
933INITRD_COMPRESS-$(CONFIG_RD_LZ4) := lz4
934# do not export INITRD_COMPRESS, since we didn't actually
935# choose a sane default compression above.
936# export INITRD_COMPRESS := $(INITRD_COMPRESS-y)
937
938ifdef CONFIG_MODULE_SIG_ALL 934ifdef CONFIG_MODULE_SIG_ALL
939$(eval $(call config_filename,MODULE_SIG_KEY)) 935$(eval $(call config_filename,MODULE_SIG_KEY))
940 936
@@ -976,15 +972,15 @@ libs-y2 := $(patsubst %/, %/built-in.a, $(filter-out %.a, $(libs-y)))
976virt-y := $(patsubst %/, %/built-in.a, $(virt-y)) 972virt-y := $(patsubst %/, %/built-in.a, $(virt-y))
977 973
978# Externally visible symbols (used by link-vmlinux.sh) 974# Externally visible symbols (used by link-vmlinux.sh)
979export KBUILD_VMLINUX_INIT := $(head-y) $(init-y) 975export KBUILD_VMLINUX_OBJS := $(head-y) $(init-y) $(core-y) $(libs-y2) \
980export KBUILD_VMLINUX_MAIN := $(core-y) $(libs-y2) $(drivers-y) $(net-y) $(virt-y) 976 $(drivers-y) $(net-y) $(virt-y)
981export KBUILD_VMLINUX_LIBS := $(libs-y1) 977export KBUILD_VMLINUX_LIBS := $(libs-y1)
982export KBUILD_LDS := arch/$(SRCARCH)/kernel/vmlinux.lds 978export KBUILD_LDS := arch/$(SRCARCH)/kernel/vmlinux.lds
983export LDFLAGS_vmlinux 979export LDFLAGS_vmlinux
984# used by scripts/package/Makefile 980# used by scripts/package/Makefile
985export KBUILD_ALLDIRS := $(sort $(filter-out arch/%,$(vmlinux-alldirs)) arch Documentation include samples scripts tools) 981export KBUILD_ALLDIRS := $(sort $(filter-out arch/%,$(vmlinux-alldirs)) arch Documentation include samples scripts tools)
986 982
987vmlinux-deps := $(KBUILD_LDS) $(KBUILD_VMLINUX_INIT) $(KBUILD_VMLINUX_MAIN) $(KBUILD_VMLINUX_LIBS) 983vmlinux-deps := $(KBUILD_LDS) $(KBUILD_VMLINUX_OBJS) $(KBUILD_VMLINUX_LIBS)
988 984
989# Recurse until adjust_autoksyms.sh is satisfied 985# Recurse until adjust_autoksyms.sh is satisfied
990PHONY += autoksyms_recursive 986PHONY += autoksyms_recursive
@@ -1015,9 +1011,6 @@ cmd_link-vmlinux = \
1015 $(if $(ARCH_POSTLINK), $(MAKE) -f $(ARCH_POSTLINK) $@, true) 1011 $(if $(ARCH_POSTLINK), $(MAKE) -f $(ARCH_POSTLINK) $@, true)
1016 1012
1017vmlinux: scripts/link-vmlinux.sh autoksyms_recursive $(vmlinux-deps) FORCE 1013vmlinux: scripts/link-vmlinux.sh autoksyms_recursive $(vmlinux-deps) FORCE
1018ifdef CONFIG_GDB_SCRIPTS
1019 $(Q)ln -fsn $(abspath $(srctree)/scripts/gdb/vmlinux-gdb.py)
1020endif
1021 +$(call if_changed,link-vmlinux) 1014 +$(call if_changed,link-vmlinux)
1022 1015
1023targets := vmlinux 1016targets := vmlinux
@@ -1062,7 +1055,7 @@ scripts: scripts_basic scripts_dtc
1062# archprepare is used in arch Makefiles and when processed asm symlink, 1055# archprepare is used in arch Makefiles and when processed asm symlink,
1063# version.h and scripts_basic is processed / created. 1056# version.h and scripts_basic is processed / created.
1064 1057
1065PHONY += prepare archprepare prepare1 prepare2 prepare3 1058PHONY += prepare archprepare prepare1 prepare3
1066 1059
1067# prepare3 is used to check if we are building in a separate output directory, 1060# prepare3 is used to check if we are building in a separate output directory,
1068# and if so do: 1061# and if so do:
@@ -1077,12 +1070,8 @@ ifneq ($(KBUILD_SRC),)
1077 fi; 1070 fi;
1078endif 1071endif
1079 1072
1080# prepare2 creates a makefile if using a separate output directory. 1073prepare1: prepare3 outputmakefile asm-generic $(version_h) $(autoksyms_h) \
1081# From this point forward, .config has been reprocessed, so any rules 1074 include/generated/utsrelease.h
1082# that need to depend on updated CONFIG_* values can be checked here.
1083prepare2: prepare3 outputmakefile asm-generic
1084
1085prepare1: prepare2 $(version_h) $(autoksyms_h) include/generated/utsrelease.h
1086 $(cmd_crmodverdir) 1075 $(cmd_crmodverdir)
1087 1076
1088archprepare: archheaders archscripts prepare1 scripts 1077archprepare: archheaders archscripts prepare1 scripts
@@ -1517,6 +1506,18 @@ PHONY += $(DOC_TARGETS)
1517$(DOC_TARGETS): scripts_basic FORCE 1506$(DOC_TARGETS): scripts_basic FORCE
1518 $(Q)$(MAKE) $(build)=Documentation $@ 1507 $(Q)$(MAKE) $(build)=Documentation $@
1519 1508
1509# Misc
1510# ---------------------------------------------------------------------------
1511
1512PHONY += scripts_gdb
1513scripts_gdb: prepare
1514 $(Q)$(MAKE) $(build)=scripts/gdb
1515 $(Q)ln -fsn $(abspath $(srctree)/scripts/gdb/vmlinux-gdb.py)
1516
1517ifdef CONFIG_GDB_SCRIPTS
1518all: scripts_gdb
1519endif
1520
1520else # KBUILD_EXTMOD 1521else # KBUILD_EXTMOD
1521 1522
1522### 1523###
@@ -1668,6 +1669,11 @@ image_name:
1668 @echo $(KBUILD_IMAGE) 1669 @echo $(KBUILD_IMAGE)
1669 1670
1670# Clear a bunch of variables before executing the submake 1671# Clear a bunch of variables before executing the submake
1672
1673ifeq ($(quiet),silent_)
1674tools_silent=s
1675endif
1676
1671tools/: FORCE 1677tools/: FORCE
1672 $(Q)mkdir -p $(objtree)/tools 1678 $(Q)mkdir -p $(objtree)/tools
1673 $(Q)$(MAKE) LDFLAGS= MAKEFLAGS="$(tools_silent) $(filter --j% -j,$(MAKEFLAGS))" O=$(abspath $(objtree)) subdir=tools -C $(src)/tools/ 1679 $(Q)$(MAKE) LDFLAGS= MAKEFLAGS="$(tools_silent) $(filter --j% -j,$(MAKEFLAGS))" O=$(abspath $(objtree)) subdir=tools -C $(src)/tools/
@@ -1686,45 +1692,32 @@ tools/%: FORCE
1686# target-dir => where to store outputfile 1692# target-dir => where to store outputfile
1687# build-dir => directory in kernel source tree to use 1693# build-dir => directory in kernel source tree to use
1688 1694
1689ifeq ($(KBUILD_EXTMOD),) 1695build-target = $(if $(KBUILD_EXTMOD), $(KBUILD_EXTMOD)/)$@
1690 build-dir = $(patsubst %/,%,$(dir $@)) 1696build-dir = $(patsubst %/,%,$(dir $(build-target)))
1691 target-dir = $(dir $@) 1697
1692else 1698%.i: prepare FORCE
1693 zap-slash=$(filter-out .,$(patsubst %/,%,$(dir $@))) 1699 $(Q)$(MAKE) $(build)=$(build-dir) $(build-target)
1694 build-dir = $(KBUILD_EXTMOD)$(if $(zap-slash),/$(zap-slash)) 1700%.ll: prepare FORCE
1695 target-dir = $(if $(KBUILD_EXTMOD),$(dir $<),$(dir $@)) 1701 $(Q)$(MAKE) $(build)=$(build-dir) $(build-target)
1696endif 1702%.lst: prepare FORCE
1697 1703 $(Q)$(MAKE) $(build)=$(build-dir) $(build-target)
1698%.s: %.c prepare FORCE 1704%.o: prepare FORCE
1699 $(Q)$(MAKE) $(build)=$(build-dir) $(target-dir)$(notdir $@) 1705 $(Q)$(MAKE) $(build)=$(build-dir) $(build-target)
1700%.i: %.c prepare FORCE 1706%.s: prepare FORCE
1701 $(Q)$(MAKE) $(build)=$(build-dir) $(target-dir)$(notdir $@) 1707 $(Q)$(MAKE) $(build)=$(build-dir) $(build-target)
1702%.o: %.c prepare FORCE 1708%.symtypes: prepare FORCE
1703 $(Q)$(MAKE) $(build)=$(build-dir) $(target-dir)$(notdir $@) 1709 $(Q)$(MAKE) $(build)=$(build-dir) $(build-target)
1704%.lst: %.c prepare FORCE 1710%.ko: %.o
1705 $(Q)$(MAKE) $(build)=$(build-dir) $(target-dir)$(notdir $@) 1711 $(Q)$(MAKE) -f $(srctree)/scripts/Makefile.modpost
1706%.s: %.S prepare FORCE
1707 $(Q)$(MAKE) $(build)=$(build-dir) $(target-dir)$(notdir $@)
1708%.o: %.S prepare FORCE
1709 $(Q)$(MAKE) $(build)=$(build-dir) $(target-dir)$(notdir $@)
1710%.symtypes: %.c prepare FORCE
1711 $(Q)$(MAKE) $(build)=$(build-dir) $(target-dir)$(notdir $@)
1712%.ll: %.c prepare FORCE
1713 $(Q)$(MAKE) $(build)=$(build-dir) $(target-dir)$(notdir $@)
1714 1712
1715# Modules 1713# Modules
1716/: prepare FORCE 1714PHONY += /
1717 $(Q)$(MAKE) KBUILD_MODULES=$(if $(CONFIG_MODULES),1) \ 1715/: ./
1718 $(build)=$(build-dir) 1716
1719# Make sure the latest headers are built for Documentation 1717# Make sure the latest headers are built for Documentation
1720Documentation/ samples/: headers_install 1718Documentation/ samples/: headers_install
1721%/: prepare FORCE 1719%/: prepare FORCE
1722 $(Q)$(MAKE) KBUILD_MODULES=$(if $(CONFIG_MODULES),1) \ 1720 $(Q)$(MAKE) KBUILD_MODULES=1 $(build)=$(build-dir)
1723 $(build)=$(build-dir)
1724%.ko: prepare FORCE
1725 $(Q)$(MAKE) KBUILD_MODULES=$(if $(CONFIG_MODULES),1) \
1726 $(build)=$(build-dir) $(@:.ko=.o)
1727 $(Q)$(MAKE) -f $(srctree)/scripts/Makefile.modpost
1728 1721
1729# FIXME Should go into a make.lib or something 1722# FIXME Should go into a make.lib or something
1730# =========================================================================== 1723# ===========================================================================
@@ -1748,13 +1741,11 @@ cmd_crmodverdir = $(Q)mkdir -p $(MODVERDIR) \
1748# read saved command lines for existing targets 1741# read saved command lines for existing targets
1749existing-targets := $(wildcard $(sort $(targets))) 1742existing-targets := $(wildcard $(sort $(targets)))
1750 1743
1751cmd_files := $(foreach f,$(existing-targets),$(dir $(f)).$(notdir $(f)).cmd) 1744-include $(foreach f,$(existing-targets),$(dir $(f)).$(notdir $(f)).cmd)
1752$(cmd_files): ; # Do not try to update included dependency files
1753-include $(cmd_files)
1754 1745
1755endif # ifeq ($(config-targets),1) 1746endif # ifeq ($(config-targets),1)
1756endif # ifeq ($(mixed-targets),1) 1747endif # ifeq ($(mixed-targets),1)
1757endif # skip-makefile 1748endif # sub-make-done
1758 1749
1759PHONY += FORCE 1750PHONY += FORCE
1760FORCE: 1751FORCE: