diff options
Diffstat (limited to 'Makefile')
-rw-r--r-- | Makefile | 54 |
1 files changed, 30 insertions, 24 deletions
@@ -442,8 +442,6 @@ export KBUILD_AFLAGS_MODULE KBUILD_CFLAGS_MODULE KBUILD_LDFLAGS_MODULE | |||
442 | export KBUILD_AFLAGS_KERNEL KBUILD_CFLAGS_KERNEL | 442 | export KBUILD_AFLAGS_KERNEL KBUILD_CFLAGS_KERNEL |
443 | export KBUILD_ARFLAGS | 443 | export KBUILD_ARFLAGS |
444 | 444 | ||
445 | export 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 |
515 | endif | 513 | endif |
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. | ||
519 | CC_VERSION_TEXT = $(shell $(CC) --version | head -n 1) | ||
520 | |||
517 | ifeq ($(config-targets),1) | 521 | ifeq ($(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' |
525 | include arch/$(SRCARCH)/Makefile | 529 | include arch/$(SRCARCH)/Makefile |
526 | export KBUILD_DEFCONFIG KBUILD_KCONFIG | 530 | export KBUILD_DEFCONFIG KBUILD_KCONFIG CC_VERSION_TEXT |
527 | 531 | ||
528 | config: scripts_basic outputmakefile FORCE | 532 | config: scripts_basic outputmakefile FORCE |
529 | $(Q)$(MAKE) $(build)=scripts/kconfig $@ | 533 | $(Q)$(MAKE) $(build)=scripts/kconfig $@ |
@@ -585,12 +589,32 @@ virt-y := virt/ | |||
585 | endif # KBUILD_EXTMOD | 589 | endif # KBUILD_EXTMOD |
586 | 590 | ||
587 | ifeq ($(dot-config),1) | 591 | ifeq ($(dot-config),1) |
588 | # Read in config | ||
589 | -include include/config/auto.conf | 592 | -include include/config/auto.conf |
593 | endif | ||
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 | ||
599 | all: vmlinux | ||
600 | |||
601 | CFLAGS_GCOV := -fprofile-arcs -ftest-coverage \ | ||
602 | $(call cc-option,-fno-tree-loop-im) \ | ||
603 | $(call cc-disable-warning,maybe-uninitialized,) | ||
604 | export 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 | ||
608 | ARCH_CPPFLAGS := | ||
609 | ARCH_AFLAGS := | ||
610 | ARCH_CFLAGS := | ||
611 | include arch/$(SRCARCH)/Makefile | ||
590 | 612 | ||
613 | ifeq ($(dot-config),1) | ||
591 | ifeq ($(KBUILD_EXTMOD),) | 614 | ifeq ($(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 | |||
622 | include/config/auto.conf: ; | 646 | include/config/auto.conf: ; |
623 | endif # $(dot-config) | 647 | endif # $(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 | ||
629 | all: vmlinux | ||
630 | |||
631 | CFLAGS_GCOV := -fprofile-arcs -ftest-coverage \ | ||
632 | $(call cc-option,-fno-tree-loop-im) \ | ||
633 | $(call cc-disable-warning,maybe-uninitialized,) | ||
634 | export 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 | ||
638 | ARCH_CPPFLAGS := | ||
639 | ARCH_AFLAGS := | ||
640 | ARCH_CFLAGS := | ||
641 | include arch/$(SRCARCH)/Makefile | ||
642 | |||
643 | KBUILD_CFLAGS += $(call cc-option,-fno-delete-null-pointer-checks,) | 649 | KBUILD_CFLAGS += $(call cc-option,-fno-delete-null-pointer-checks,) |
644 | KBUILD_CFLAGS += $(call cc-disable-warning,frame-address,) | 650 | KBUILD_CFLAGS += $(call cc-disable-warning,frame-address,) |
645 | KBUILD_CFLAGS += $(call cc-disable-warning, format-truncation) | 651 | KBUILD_CFLAGS += $(call cc-disable-warning, format-truncation) |