summaryrefslogtreecommitdiffstats
path: root/Makefile
diff options
context:
space:
mode:
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile54
1 files changed, 30 insertions, 24 deletions
diff --git a/Makefile b/Makefile
index 019a5a020606..747edaf11559 100644
--- a/Makefile
+++ b/Makefile
@@ -442,8 +442,6 @@ export KBUILD_AFLAGS_MODULE KBUILD_CFLAGS_MODULE KBUILD_LDFLAGS_MODULE
442export KBUILD_AFLAGS_KERNEL KBUILD_CFLAGS_KERNEL 442export KBUILD_AFLAGS_KERNEL KBUILD_CFLAGS_KERNEL
443export KBUILD_ARFLAGS 443export KBUILD_ARFLAGS
444 444
445export CC_VERSION_TEXT := $(shell $(CC) --version | head -n 1)
446
447# When compiling out-of-tree modules, put MODVERDIR in the module 445# When compiling out-of-tree modules, put MODVERDIR in the module
448# tree rather than in the kernel tree. The kernel tree might 446# tree rather than in the kernel tree. The kernel tree might
449# even be read-only. 447# even be read-only.
@@ -514,6 +512,12 @@ ifeq ($(shell $(CONFIG_SHELL) $(srctree)/scripts/cc-can-link.sh $(CC)), y)
514 export CC_CAN_LINK 512 export CC_CAN_LINK
515endif 513endif
516 514
515# The expansion should be delayed until arch/$(SRCARCH)/Makefile is included.
516# Some architectures define CROSS_COMPILE in arch/$(SRCARCH)/Makefile.
517# CC_VERSION_TEXT is referenced from Kconfig (so it needs export),
518# and from include/config/auto.conf.cmd to detect the compiler upgrade.
519CC_VERSION_TEXT = $(shell $(CC) --version | head -n 1)
520
517ifeq ($(config-targets),1) 521ifeq ($(config-targets),1)
518# =========================================================================== 522# ===========================================================================
519# *config targets only - make sure prerequisites are updated, and descend 523# *config targets only - make sure prerequisites are updated, and descend
@@ -523,7 +527,7 @@ ifeq ($(config-targets),1)
523# KBUILD_DEFCONFIG may point out an alternative default configuration 527# KBUILD_DEFCONFIG may point out an alternative default configuration
524# used for 'make defconfig' 528# used for 'make defconfig'
525include arch/$(SRCARCH)/Makefile 529include arch/$(SRCARCH)/Makefile
526export KBUILD_DEFCONFIG KBUILD_KCONFIG 530export KBUILD_DEFCONFIG KBUILD_KCONFIG CC_VERSION_TEXT
527 531
528config: scripts_basic outputmakefile FORCE 532config: scripts_basic outputmakefile FORCE
529 $(Q)$(MAKE) $(build)=scripts/kconfig $@ 533 $(Q)$(MAKE) $(build)=scripts/kconfig $@
@@ -585,12 +589,32 @@ virt-y := virt/
585endif # KBUILD_EXTMOD 589endif # KBUILD_EXTMOD
586 590
587ifeq ($(dot-config),1) 591ifeq ($(dot-config),1)
588# Read in config
589-include include/config/auto.conf 592-include include/config/auto.conf
593endif
594
595# The all: target is the default when no target is given on the
596# command line.
597# This allow a user to issue only 'make' to build a kernel including modules
598# Defaults to vmlinux, but the arch makefile usually adds further targets
599all: vmlinux
600
601CFLAGS_GCOV := -fprofile-arcs -ftest-coverage \
602 $(call cc-option,-fno-tree-loop-im) \
603 $(call cc-disable-warning,maybe-uninitialized,)
604export CFLAGS_GCOV CFLAGS_KCOV
605
606# The arch Makefile can set ARCH_{CPP,A,C}FLAGS to override the default
607# values of the respective KBUILD_* variables
608ARCH_CPPFLAGS :=
609ARCH_AFLAGS :=
610ARCH_CFLAGS :=
611include arch/$(SRCARCH)/Makefile
590 612
613ifeq ($(dot-config),1)
591ifeq ($(KBUILD_EXTMOD),) 614ifeq ($(KBUILD_EXTMOD),)
592# Read in dependencies to all Kconfig* files, make sure to run 615# Read in dependencies to all Kconfig* files, make sure to run syncconfig if
593# oldconfig if changes are detected. 616# changes are detected. This should be included after arch/$(SRCARCH)/Makefile
617# because some architectures define CROSS_COMPILE there.
594-include include/config/auto.conf.cmd 618-include include/config/auto.conf.cmd
595 619
596# To avoid any implicit rule to kick in, define an empty command 620# To avoid any implicit rule to kick in, define an empty command
@@ -622,24 +646,6 @@ else
622include/config/auto.conf: ; 646include/config/auto.conf: ;
623endif # $(dot-config) 647endif # $(dot-config)
624 648
625# The all: target is the default when no target is given on the
626# command line.
627# This allow a user to issue only 'make' to build a kernel including modules
628# Defaults to vmlinux, but the arch makefile usually adds further targets
629all: vmlinux
630
631CFLAGS_GCOV := -fprofile-arcs -ftest-coverage \
632 $(call cc-option,-fno-tree-loop-im) \
633 $(call cc-disable-warning,maybe-uninitialized,)
634export CFLAGS_GCOV CFLAGS_KCOV
635
636# The arch Makefile can set ARCH_{CPP,A,C}FLAGS to override the default
637# values of the respective KBUILD_* variables
638ARCH_CPPFLAGS :=
639ARCH_AFLAGS :=
640ARCH_CFLAGS :=
641include arch/$(SRCARCH)/Makefile
642
643KBUILD_CFLAGS += $(call cc-option,-fno-delete-null-pointer-checks,) 649KBUILD_CFLAGS += $(call cc-option,-fno-delete-null-pointer-checks,)
644KBUILD_CFLAGS += $(call cc-disable-warning,frame-address,) 650KBUILD_CFLAGS += $(call cc-disable-warning,frame-address,)
645KBUILD_CFLAGS += $(call cc-disable-warning, format-truncation) 651KBUILD_CFLAGS += $(call cc-disable-warning, format-truncation)