diff options
Diffstat (limited to 'Makefile')
| -rw-r--r-- | Makefile | 77 |
1 files changed, 39 insertions, 38 deletions
| @@ -132,7 +132,7 @@ ifneq ($(KBUILD_OUTPUT),) | |||
| 132 | # check that the output directory actually exists | 132 | # check that the output directory actually exists |
| 133 | saved-output := $(KBUILD_OUTPUT) | 133 | saved-output := $(KBUILD_OUTPUT) |
| 134 | KBUILD_OUTPUT := $(shell mkdir -p $(KBUILD_OUTPUT) && cd $(KBUILD_OUTPUT) \ | 134 | KBUILD_OUTPUT := $(shell mkdir -p $(KBUILD_OUTPUT) && cd $(KBUILD_OUTPUT) \ |
| 135 | && /bin/pwd) | 135 | && pwd) |
| 136 | $(if $(KBUILD_OUTPUT),, \ | 136 | $(if $(KBUILD_OUTPUT),, \ |
| 137 | $(error failed to create output directory "$(saved-output)")) | 137 | $(error failed to create output directory "$(saved-output)")) |
| 138 | 138 | ||
| @@ -474,6 +474,38 @@ ifneq ($(KBUILD_SRC),) | |||
| 474 | $(srctree) $(objtree) $(VERSION) $(PATCHLEVEL) | 474 | $(srctree) $(objtree) $(VERSION) $(PATCHLEVEL) |
| 475 | endif | 475 | endif |
| 476 | 476 | ||
| 477 | ifeq ($(cc-name),clang) | ||
| 478 | ifneq ($(CROSS_COMPILE),) | ||
| 479 | CLANG_TARGET := --target=$(notdir $(CROSS_COMPILE:%-=%)) | ||
| 480 | GCC_TOOLCHAIN := $(realpath $(dir $(shell which $(LD)))/..) | ||
| 481 | endif | ||
| 482 | ifneq ($(GCC_TOOLCHAIN),) | ||
| 483 | CLANG_GCC_TC := --gcc-toolchain=$(GCC_TOOLCHAIN) | ||
| 484 | endif | ||
| 485 | KBUILD_CFLAGS += $(CLANG_TARGET) $(CLANG_GCC_TC) | ||
| 486 | KBUILD_AFLAGS += $(CLANG_TARGET) $(CLANG_GCC_TC) | ||
| 487 | KBUILD_CPPFLAGS += $(call cc-option,-Qunused-arguments,) | ||
| 488 | KBUILD_CFLAGS += $(call cc-disable-warning, unused-variable) | ||
| 489 | KBUILD_CFLAGS += $(call cc-disable-warning, format-invalid-specifier) | ||
| 490 | KBUILD_CFLAGS += $(call cc-disable-warning, gnu) | ||
| 491 | KBUILD_CFLAGS += $(call cc-disable-warning, address-of-packed-member) | ||
| 492 | # Quiet clang warning: comparison of unsigned expression < 0 is always false | ||
| 493 | KBUILD_CFLAGS += $(call cc-disable-warning, tautological-compare) | ||
| 494 | # CLANG uses a _MergedGlobals as optimization, but this breaks modpost, as the | ||
| 495 | # source of a reference will be _MergedGlobals and not on of the whitelisted names. | ||
| 496 | # See modpost pattern 2 | ||
| 497 | KBUILD_CFLAGS += $(call cc-option, -mno-global-merge,) | ||
| 498 | KBUILD_CFLAGS += $(call cc-option, -fcatch-undefined-behavior) | ||
| 499 | KBUILD_CFLAGS += $(call cc-option, -no-integrated-as) | ||
| 500 | KBUILD_AFLAGS += $(call cc-option, -no-integrated-as) | ||
| 501 | else | ||
| 502 | |||
| 503 | # These warnings generated too much noise in a regular build. | ||
| 504 | # Use make W=1 to enable them (see scripts/Makefile.extrawarn) | ||
| 505 | KBUILD_CFLAGS += $(call cc-disable-warning, unused-but-set-variable) | ||
| 506 | KBUILD_CFLAGS += $(call cc-disable-warning, unused-const-variable) | ||
| 507 | endif | ||
| 508 | |||
| 477 | ifeq ($(config-targets),1) | 509 | ifeq ($(config-targets),1) |
| 478 | # =========================================================================== | 510 | # =========================================================================== |
| 479 | # *config targets only - make sure prerequisites are updated, and descend | 511 | # *config targets only - make sure prerequisites are updated, and descend |
| @@ -684,38 +716,6 @@ ifdef CONFIG_CC_STACKPROTECTOR | |||
| 684 | endif | 716 | endif |
| 685 | KBUILD_CFLAGS += $(stackp-flag) | 717 | KBUILD_CFLAGS += $(stackp-flag) |
| 686 | 718 | ||
| 687 | ifeq ($(cc-name),clang) | ||
| 688 | ifneq ($(CROSS_COMPILE),) | ||
| 689 | CLANG_TARGET := --target=$(notdir $(CROSS_COMPILE:%-=%)) | ||
| 690 | GCC_TOOLCHAIN := $(realpath $(dir $(shell which $(LD)))/..) | ||
| 691 | endif | ||
| 692 | ifneq ($(GCC_TOOLCHAIN),) | ||
| 693 | CLANG_GCC_TC := --gcc-toolchain=$(GCC_TOOLCHAIN) | ||
| 694 | endif | ||
| 695 | KBUILD_CFLAGS += $(CLANG_TARGET) $(CLANG_GCC_TC) | ||
| 696 | KBUILD_AFLAGS += $(CLANG_TARGET) $(CLANG_GCC_TC) | ||
| 697 | KBUILD_CPPFLAGS += $(call cc-option,-Qunused-arguments,) | ||
| 698 | KBUILD_CFLAGS += $(call cc-disable-warning, unused-variable) | ||
| 699 | KBUILD_CFLAGS += $(call cc-disable-warning, format-invalid-specifier) | ||
| 700 | KBUILD_CFLAGS += $(call cc-disable-warning, gnu) | ||
| 701 | KBUILD_CFLAGS += $(call cc-disable-warning, address-of-packed-member) | ||
| 702 | # Quiet clang warning: comparison of unsigned expression < 0 is always false | ||
| 703 | KBUILD_CFLAGS += $(call cc-disable-warning, tautological-compare) | ||
| 704 | # CLANG uses a _MergedGlobals as optimization, but this breaks modpost, as the | ||
| 705 | # source of a reference will be _MergedGlobals and not on of the whitelisted names. | ||
| 706 | # See modpost pattern 2 | ||
| 707 | KBUILD_CFLAGS += $(call cc-option, -mno-global-merge,) | ||
| 708 | KBUILD_CFLAGS += $(call cc-option, -fcatch-undefined-behavior) | ||
| 709 | KBUILD_CFLAGS += $(call cc-option, -no-integrated-as) | ||
| 710 | KBUILD_AFLAGS += $(call cc-option, -no-integrated-as) | ||
| 711 | else | ||
| 712 | |||
| 713 | # These warnings generated too much noise in a regular build. | ||
| 714 | # Use make W=1 to enable them (see scripts/Makefile.extrawarn) | ||
| 715 | KBUILD_CFLAGS += $(call cc-disable-warning, unused-but-set-variable) | ||
| 716 | KBUILD_CFLAGS += $(call cc-disable-warning, unused-const-variable) | ||
| 717 | endif | ||
| 718 | |||
| 719 | ifdef CONFIG_FRAME_POINTER | 719 | ifdef CONFIG_FRAME_POINTER |
| 720 | KBUILD_CFLAGS += -fno-omit-frame-pointer -fno-optimize-sibling-calls | 720 | KBUILD_CFLAGS += -fno-omit-frame-pointer -fno-optimize-sibling-calls |
| 721 | else | 721 | else |
| @@ -1009,7 +1009,7 @@ $(sort $(vmlinux-deps)): $(vmlinux-dirs) ; | |||
| 1009 | 1009 | ||
| 1010 | PHONY += $(vmlinux-dirs) | 1010 | PHONY += $(vmlinux-dirs) |
| 1011 | $(vmlinux-dirs): prepare scripts | 1011 | $(vmlinux-dirs): prepare scripts |
| 1012 | $(Q)$(MAKE) $(build)=$@ | 1012 | $(Q)$(MAKE) $(build)=$@ need-builtin=1 |
| 1013 | 1013 | ||
| 1014 | define filechk_kernel.release | 1014 | define filechk_kernel.release |
| 1015 | echo "$(KERNELVERSION)$$($(CONFIG_SHELL) $(srctree)/scripts/setlocalversion $(srctree))" | 1015 | echo "$(KERNELVERSION)$$($(CONFIG_SHELL) $(srctree)/scripts/setlocalversion $(srctree))" |
| @@ -1337,8 +1337,9 @@ package-dir := scripts/package | |||
| 1337 | $(Q)$(MAKE) $(build)=$(package-dir) $@ | 1337 | $(Q)$(MAKE) $(build)=$(package-dir) $@ |
| 1338 | %pkg: include/config/kernel.release FORCE | 1338 | %pkg: include/config/kernel.release FORCE |
| 1339 | $(Q)$(MAKE) $(build)=$(package-dir) $@ | 1339 | $(Q)$(MAKE) $(build)=$(package-dir) $@ |
| 1340 | rpm: include/config/kernel.release FORCE | 1340 | rpm: rpm-pkg |
| 1341 | $(Q)$(MAKE) $(build)=$(package-dir) $@ | 1341 | @echo " WARNING: \"rpm\" target will be removed after Linux 4.18" |
| 1342 | @echo " Please use \"rpm-pkg\" instead." | ||
| 1342 | 1343 | ||
| 1343 | 1344 | ||
| 1344 | # Brief documentation of the typical targets used | 1345 | # Brief documentation of the typical targets used |
| @@ -1546,9 +1547,9 @@ clean: $(clean-dirs) | |||
| 1546 | $(call cmd,rmdirs) | 1547 | $(call cmd,rmdirs) |
| 1547 | $(call cmd,rmfiles) | 1548 | $(call cmd,rmfiles) |
| 1548 | @find $(if $(KBUILD_EXTMOD), $(KBUILD_EXTMOD), .) $(RCS_FIND_IGNORE) \ | 1549 | @find $(if $(KBUILD_EXTMOD), $(KBUILD_EXTMOD), .) $(RCS_FIND_IGNORE) \ |
| 1549 | \( -name '*.[oas]' -o -name '*.ko' -o -name '.*.cmd' \ | 1550 | \( -name '*.[aios]' -o -name '*.ko' -o -name '.*.cmd' \ |
| 1550 | -o -name '*.ko.*' -o -name '*.dtb' -o -name '*.dtb.S' \ | 1551 | -o -name '*.ko.*' -o -name '*.dtb' -o -name '*.dtb.S' \ |
| 1551 | -o -name '*.dwo' \ | 1552 | -o -name '*.dwo' -o -name '*.lst' \ |
| 1552 | -o -name '*.su' \ | 1553 | -o -name '*.su' \ |
| 1553 | -o -name '.*.d' -o -name '.*.tmp' -o -name '*.mod.c' \ | 1554 | -o -name '.*.d' -o -name '.*.tmp' -o -name '*.mod.c' \ |
| 1554 | -o -name '*.symtypes' -o -name 'modules.order' \ | 1555 | -o -name '*.symtypes' -o -name 'modules.order' \ |
