diff options
Diffstat (limited to 'Makefile')
-rw-r--r-- | Makefile | 219 |
1 files changed, 105 insertions, 114 deletions
@@ -15,19 +15,6 @@ NAME = Shy Crocodile | |||
15 | PHONY := _all | 15 | PHONY := _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) | ||
20 | MAKEFLAGS += -rR | ||
21 | |||
22 | # Avoid funny character set dependencies | ||
23 | unexport LC_ALL | ||
24 | LC_COLLATE=C | ||
25 | LC_NUMERIC=C | ||
26 | export LC_COLLATE LC_NUMERIC | ||
27 | |||
28 | # Avoid interference with shell env settings | ||
29 | unexport 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 | ||
34 | ifneq ($(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) | ||
38 | MAKEFLAGS += -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 | ||
45 | unexport LC_ALL | ||
46 | LC_COLLATE=C | ||
47 | LC_NUMERIC=C | ||
48 | export LC_COLLATE LC_NUMERIC | ||
49 | |||
50 | # Avoid interference with shell env settings | ||
51 | unexport GREP_OPTIONS | ||
52 | |||
47 | # Beautify output | 53 | # Beautify output |
48 | # --------------------------------------------------------------------------- | 54 | # --------------------------------------------------------------------------- |
49 | # | 55 | # |
@@ -90,7 +96,6 @@ endif | |||
90 | 96 | ||
91 | ifneq ($(findstring s,$(filter-out --%,$(MAKEFLAGS))),) | 97 | ifneq ($(findstring s,$(filter-out --%,$(MAKEFLAGS))),) |
92 | quiet=silent_ | 98 | quiet=silent_ |
93 | tools_silent=s | ||
94 | endif | 99 | endif |
95 | 100 | ||
96 | export quiet Q KBUILD_VERBOSE | 101 | export 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. |
115 | ifeq ($(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) |
121 | endif | 125 | endif |
122 | 126 | ||
123 | # Cancel implicit rules on top Makefile | ||
124 | $(CURDIR)/Makefile Makefile: ; | ||
125 | |||
126 | ifneq ($(words $(subst :, ,$(CURDIR))), 1) | 127 | ifneq ($(words $(subst :, ,$(CURDIR))), 1) |
127 | $(error main directory cannot contain spaces nor colons) | 128 | $(error main directory cannot contain spaces nor colons) |
128 | endif | 129 | endif |
@@ -142,6 +143,13 @@ $(if $(KBUILD_OUTPUT),, \ | |||
142 | # 'sub-make' below. | 143 | # 'sub-make' below. |
143 | MAKEFLAGS += --include-dir=$(CURDIR) | 144 | MAKEFLAGS += --include-dir=$(CURDIR) |
144 | 145 | ||
146 | else | ||
147 | |||
148 | # Do not print "Entering directory ..." at all for in-tree build. | ||
149 | MAKEFLAGS += --no-print-directory | ||
150 | |||
151 | endif # ifneq ($(KBUILD_OUTPUT),) | ||
152 | |||
145 | PHONY += $(MAKECMDGOALS) sub-make | 153 | PHONY += $(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 |
151 | sub-make: | 159 | sub-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 | 164 | else # sub-make-done |
156 | skip-makefile := 1 | ||
157 | endif # ifneq ($(KBUILD_OUTPUT),) | ||
158 | endif # 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 |
161 | ifeq ($(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 := . | |||
215 | src := $(srctree) | 219 | src := $(srctree) |
216 | obj := $(objtree) | 220 | obj := $(objtree) |
217 | 221 | ||
218 | VPATH := $(srctree)$(if $(KBUILD_EXTMOD),:$(KBUILD_EXTMOD)) | 222 | VPATH := $(srctree) |
219 | 223 | ||
220 | export srctree objtree VPATH | 224 | export srctree objtree VPATH |
221 | 225 | ||
@@ -300,8 +304,6 @@ __build_one_by_one: | |||
300 | 304 | ||
301 | else | 305 | else |
302 | 306 | ||
303 | # We need some generic definitions (do not try to remake the file). | ||
304 | scripts/Kbuild.include: ; | ||
305 | include scripts/Kbuild.include | 307 | include 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 | |||
390 | LEX = flex | 392 | LEX = flex |
391 | YACC = bison | 393 | YACC = bison |
392 | AWK = awk | 394 | AWK = awk |
393 | GENKSYMS = scripts/genksyms/genksyms | ||
394 | INSTALLKERNEL := installkernel | 395 | INSTALLKERNEL := installkernel |
395 | DEPMOD = /sbin/depmod | 396 | DEPMOD = /sbin/depmod |
396 | PERL = perl | 397 | PERL = perl |
@@ -429,7 +430,7 @@ LINUXINCLUDE := \ | |||
429 | KBUILD_AFLAGS := -D__ASSEMBLY__ -fno-PIE | 430 | KBUILD_AFLAGS := -D__ASSEMBLY__ -fno-PIE |
430 | KBUILD_CFLAGS := -Wall -Wundef -Werror=strict-prototypes -Wno-trigraphs \ | 431 | KBUILD_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 |
435 | KBUILD_CPPFLAGS := -D__KERNEL__ | 436 | KBUILD_CPPFLAGS := -D__KERNEL__ |
@@ -443,7 +444,7 @@ GCC_PLUGINS_CFLAGS := | |||
443 | 444 | ||
444 | export ARCH SRCARCH CONFIG_SHELL HOSTCC KBUILD_HOSTCFLAGS CROSS_COMPILE AS LD CC | 445 | export ARCH SRCARCH CONFIG_SHELL HOSTCC KBUILD_HOSTCFLAGS CROSS_COMPILE AS LD CC |
445 | export CPP AR NM STRIP OBJCOPY OBJDUMP KBUILD_HOSTLDFLAGS KBUILD_HOSTLDLIBS | 446 | export CPP AR NM STRIP OBJCOPY OBJDUMP KBUILD_HOSTLDFLAGS KBUILD_HOSTLDLIBS |
446 | export MAKE LEX YACC AWK GENKSYMS INSTALLKERNEL PERL PYTHON PYTHON2 PYTHON3 UTS_MACHINE | 447 | export MAKE LEX YACC AWK INSTALLKERNEL PERL PYTHON PYTHON2 PYTHON3 UTS_MACHINE |
447 | export HOSTCXX KBUILD_HOSTCXXFLAGS LDFLAGS_MODULE CHECK CHECKFLAGS | 448 | export HOSTCXX KBUILD_HOSTCXXFLAGS LDFLAGS_MODULE CHECK CHECKFLAGS |
448 | 449 | ||
449 | export KBUILD_CPPFLAGS NOSTDINC_FLAGS LINUXINCLUDE OBJCOPYFLAGS KBUILD_LDFLAGS | 450 | export 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. | ||
480 | scripts/basic/%: scripts_basic ; | ||
481 | |||
482 | PHONY += outputmakefile | 480 | PHONY += 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 | ||
486 | outputmakefile: | 486 | outputmakefile: |
487 | ifneq ($(KBUILD_SRC),) | 487 | ifneq ($(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 | ||
490 | endif | 491 | endif |
491 | 492 | ||
492 | ifneq ($(shell $(CC) --version 2>&1 | head -n 1 | grep clang),) | 493 | ifneq ($(shell $(CC) --version 2>&1 | head -n 1 | grep clang),) |
493 | ifneq ($(CROSS_COMPILE),) | 494 | ifneq ($(CROSS_COMPILE),) |
494 | CLANG_FLAGS := --target=$(notdir $(CROSS_COMPILE:%-=%)) | 495 | CLANG_FLAGS := --target=$(notdir $(CROSS_COMPILE:%-=%)) |
495 | GCC_TOOLCHAIN_DIR := $(dir $(shell which $(LD))) | 496 | GCC_TOOLCHAIN_DIR := $(dir $(shell which $(CROSS_COMPILE)elfedit)) |
496 | CLANG_FLAGS += --prefix=$(GCC_TOOLCHAIN_DIR) | 497 | CLANG_FLAGS += --prefix=$(GCC_TOOLCHAIN_DIR) |
497 | GCC_TOOLCHAIN := $(realpath $(GCC_TOOLCHAIN_DIR)/..) | 498 | GCC_TOOLCHAIN := $(realpath $(GCC_TOOLCHAIN_DIR)/..) |
498 | endif | 499 | endif |
@@ -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). |
633 | include/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 |
635 | else | 645 | else |
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 | ||
659 | ifdef CONFIG_CC_OPTIMIZE_FOR_SIZE | 669 | ifdef CONFIG_CC_OPTIMIZE_FOR_SIZE |
660 | KBUILD_CFLAGS += $(call cc-option,-Oz,-Os) | 670 | KBUILD_CFLAGS += $(call cc-option,-Oz,-Os) |
661 | KBUILD_CFLAGS += $(call cc-disable-warning,maybe-uninitialized,) | ||
662 | else | ||
663 | ifdef CONFIG_PROFILE_ALL_BRANCHES | ||
664 | KBUILD_CFLAGS += -O2 $(call cc-disable-warning,maybe-uninitialized,) | ||
665 | else | 671 | else |
666 | KBUILD_CFLAGS += -O2 | 672 | KBUILD_CFLAGS += -O2 |
667 | endif | 673 | endif |
668 | endif | ||
669 | 674 | ||
670 | KBUILD_CFLAGS += $(call cc-ifversion, -lt, 0409, \ | 675 | ifdef CONFIG_CC_DISABLE_WARN_MAYBE_UNINITIALIZED |
671 | $(call cc-disable-warning,maybe-uninitialized,)) | 676 | KBUILD_CFLAGS += -Wno-maybe-uninitialized |
677 | endif | ||
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 |
674 | KBUILD_CFLAGS += $(call cc-option,--param=allow-store-data-races=0) | 680 | KBUILD_CFLAGS += $(call cc-option,--param=allow-store-data-races=0) |
@@ -729,25 +735,28 @@ KBUILD_CFLAGS += -fomit-frame-pointer | |||
729 | endif | 735 | endif |
730 | endif | 736 | endif |
731 | 737 | ||
732 | KBUILD_CFLAGS += $(call cc-option, -fno-var-tracking-assignments) | 738 | DEBUG_CFLAGS := $(call cc-option, -fno-var-tracking-assignments) |
733 | 739 | ||
734 | ifdef CONFIG_DEBUG_INFO | 740 | ifdef CONFIG_DEBUG_INFO |
735 | ifdef CONFIG_DEBUG_INFO_SPLIT | 741 | ifdef CONFIG_DEBUG_INFO_SPLIT |
736 | KBUILD_CFLAGS += $(call cc-option, -gsplit-dwarf, -g) | 742 | DEBUG_CFLAGS += -gsplit-dwarf |
737 | else | 743 | else |
738 | KBUILD_CFLAGS += -g | 744 | DEBUG_CFLAGS += -g |
739 | endif | 745 | endif |
740 | KBUILD_AFLAGS += -Wa,-gdwarf-2 | 746 | KBUILD_AFLAGS += -Wa,-gdwarf-2 |
741 | endif | 747 | endif |
742 | ifdef CONFIG_DEBUG_INFO_DWARF4 | 748 | ifdef CONFIG_DEBUG_INFO_DWARF4 |
743 | KBUILD_CFLAGS += $(call cc-option, -gdwarf-4,) | 749 | DEBUG_CFLAGS += -gdwarf-4 |
744 | endif | 750 | endif |
745 | 751 | ||
746 | ifdef CONFIG_DEBUG_INFO_REDUCED | 752 | ifdef CONFIG_DEBUG_INFO_REDUCED |
747 | KBUILD_CFLAGS += $(call cc-option, -femit-struct-debug-baseonly) \ | 753 | DEBUG_CFLAGS += $(call cc-option, -femit-struct-debug-baseonly) \ |
748 | $(call cc-option,-fno-var-tracking) | 754 | $(call cc-option,-fno-var-tracking) |
749 | endif | 755 | endif |
750 | 756 | ||
757 | KBUILD_CFLAGS += $(DEBUG_CFLAGS) | ||
758 | export DEBUG_CFLAGS | ||
759 | |||
751 | ifdef CONFIG_FUNCTION_TRACER | 760 | ifdef CONFIG_FUNCTION_TRACER |
752 | ifdef CONFIG_FTRACE_MCOUNT_RECORD | 761 | ifdef 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 | |||
922 | endif # CONFIG_MODULE_COMPRESS | 931 | endif # CONFIG_MODULE_COMPRESS |
923 | export mod_compress_cmd | 932 | export 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 | # | ||
928 | INITRD_COMPRESS-y := gzip | ||
929 | INITRD_COMPRESS-$(CONFIG_RD_BZIP2) := bzip2 | ||
930 | INITRD_COMPRESS-$(CONFIG_RD_LZMA) := lzma | ||
931 | INITRD_COMPRESS-$(CONFIG_RD_XZ) := xz | ||
932 | INITRD_COMPRESS-$(CONFIG_RD_LZO) := lzo | ||
933 | INITRD_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 | |||
938 | ifdef CONFIG_MODULE_SIG_ALL | 934 | ifdef 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))) | |||
976 | virt-y := $(patsubst %/, %/built-in.a, $(virt-y)) | 972 | virt-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) |
979 | export KBUILD_VMLINUX_INIT := $(head-y) $(init-y) | 975 | export KBUILD_VMLINUX_OBJS := $(head-y) $(init-y) $(core-y) $(libs-y2) \ |
980 | export KBUILD_VMLINUX_MAIN := $(core-y) $(libs-y2) $(drivers-y) $(net-y) $(virt-y) | 976 | $(drivers-y) $(net-y) $(virt-y) |
981 | export KBUILD_VMLINUX_LIBS := $(libs-y1) | 977 | export KBUILD_VMLINUX_LIBS := $(libs-y1) |
982 | export KBUILD_LDS := arch/$(SRCARCH)/kernel/vmlinux.lds | 978 | export KBUILD_LDS := arch/$(SRCARCH)/kernel/vmlinux.lds |
983 | export LDFLAGS_vmlinux | 979 | export LDFLAGS_vmlinux |
984 | # used by scripts/package/Makefile | 980 | # used by scripts/package/Makefile |
985 | export KBUILD_ALLDIRS := $(sort $(filter-out arch/%,$(vmlinux-alldirs)) arch Documentation include samples scripts tools) | 981 | export KBUILD_ALLDIRS := $(sort $(filter-out arch/%,$(vmlinux-alldirs)) arch Documentation include samples scripts tools) |
986 | 982 | ||
987 | vmlinux-deps := $(KBUILD_LDS) $(KBUILD_VMLINUX_INIT) $(KBUILD_VMLINUX_MAIN) $(KBUILD_VMLINUX_LIBS) | 983 | vmlinux-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 |
990 | PHONY += autoksyms_recursive | 986 | PHONY += 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 | ||
1017 | vmlinux: scripts/link-vmlinux.sh autoksyms_recursive $(vmlinux-deps) FORCE | 1013 | vmlinux: scripts/link-vmlinux.sh autoksyms_recursive $(vmlinux-deps) FORCE |
1018 | ifdef CONFIG_GDB_SCRIPTS | ||
1019 | $(Q)ln -fsn $(abspath $(srctree)/scripts/gdb/vmlinux-gdb.py) | ||
1020 | endif | ||
1021 | +$(call if_changed,link-vmlinux) | 1014 | +$(call if_changed,link-vmlinux) |
1022 | 1015 | ||
1023 | targets := vmlinux | 1016 | targets := 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 | ||
1065 | PHONY += prepare archprepare prepare1 prepare2 prepare3 | 1058 | PHONY += 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; |
1078 | endif | 1071 | endif |
1079 | 1072 | ||
1080 | # prepare2 creates a makefile if using a separate output directory. | 1073 | prepare1: 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. | ||
1083 | prepare2: prepare3 outputmakefile asm-generic | ||
1084 | |||
1085 | prepare1: prepare2 $(version_h) $(autoksyms_h) include/generated/utsrelease.h | ||
1086 | $(cmd_crmodverdir) | 1075 | $(cmd_crmodverdir) |
1087 | 1076 | ||
1088 | archprepare: archheaders archscripts prepare1 scripts | 1077 | archprepare: 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 | |||
1512 | PHONY += scripts_gdb | ||
1513 | scripts_gdb: prepare | ||
1514 | $(Q)$(MAKE) $(build)=scripts/gdb | ||
1515 | $(Q)ln -fsn $(abspath $(srctree)/scripts/gdb/vmlinux-gdb.py) | ||
1516 | |||
1517 | ifdef CONFIG_GDB_SCRIPTS | ||
1518 | all: scripts_gdb | ||
1519 | endif | ||
1520 | |||
1520 | else # KBUILD_EXTMOD | 1521 | else # 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 | |||
1673 | ifeq ($(quiet),silent_) | ||
1674 | tools_silent=s | ||
1675 | endif | ||
1676 | |||
1671 | tools/: FORCE | 1677 | tools/: 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 | ||
1689 | ifeq ($(KBUILD_EXTMOD),) | 1695 | build-target = $(if $(KBUILD_EXTMOD), $(KBUILD_EXTMOD)/)$@ |
1690 | build-dir = $(patsubst %/,%,$(dir $@)) | 1696 | build-dir = $(patsubst %/,%,$(dir $(build-target))) |
1691 | target-dir = $(dir $@) | 1697 | |
1692 | else | 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) |
1696 | endif | 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 | 1714 | PHONY += / |
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 |
1720 | Documentation/ samples/: headers_install | 1718 | Documentation/ 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 |
1749 | existing-targets := $(wildcard $(sort $(targets))) | 1742 | existing-targets := $(wildcard $(sort $(targets))) |
1750 | 1743 | ||
1751 | cmd_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 | ||
1755 | endif # ifeq ($(config-targets),1) | 1746 | endif # ifeq ($(config-targets),1) |
1756 | endif # ifeq ($(mixed-targets),1) | 1747 | endif # ifeq ($(mixed-targets),1) |
1757 | endif # skip-makefile | 1748 | endif # sub-make-done |
1758 | 1749 | ||
1759 | PHONY += FORCE | 1750 | PHONY += FORCE |
1760 | FORCE: | 1751 | FORCE: |