Merge branch 'kbuild' of git://git.kernel.org/pub/scm/linux/kernel/git/mmarek/kbuild
Pull kbuild updates from Michal Marek: "Kbuild changes for v3.16-rc1: - cross-compilation fix so that cc-option is testing the right compiler - Fix for make defconfig all - Using relative paths to the object and source directory where possible, plus fixes for the fallout of the change - several cleanups in the Makefiles and scripts The powerpc fix is from today, because it was only discovered recently. The rest has been in linux-next for some time" * 'kbuild' of git://git.kernel.org/pub/scm/linux/kernel/git/mmarek/kbuild: powerpc: Avoid circular dependency with zImage.% kbuild: create include/config directory in scripts/kconfig/Makefile kbuild: do not create include/linux directory Makefile: Fix unrecognized cross-compiler command line options kbuild: do not add "selinux" to subdir- twice um: Fix for relative objtree when generating x86 headers kbuild: Use relative path when building in a subdir of the source tree kbuild: Use relative path when building in the source tree kbuild: Use relative path for $(objtree) firmware: Use $(quote) in the Makefile firmware: Simplify directory creation kbuild: trivial - fix comment block indent kbuild: trivial - remove trailing spaces kbuild: support simultaneous "make %config" and "make all" kbuild: move extra gcc checks to scripts/Makefile.extrawarn
This commit is contained in:
Коммит
1700ff823b
49
Makefile
49
Makefile
|
@ -105,10 +105,6 @@ ifeq ("$(origin O)", "command line")
|
||||||
KBUILD_OUTPUT := $(O)
|
KBUILD_OUTPUT := $(O)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ifeq ("$(origin W)", "command line")
|
|
||||||
export KBUILD_ENABLE_EXTRA_GCC_CHECKS := $(W)
|
|
||||||
endif
|
|
||||||
|
|
||||||
# That's our default target when none is given on the command line
|
# That's our default target when none is given on the command line
|
||||||
PHONY := _all
|
PHONY := _all
|
||||||
_all:
|
_all:
|
||||||
|
@ -153,8 +149,18 @@ else
|
||||||
_all: modules
|
_all: modules
|
||||||
endif
|
endif
|
||||||
|
|
||||||
srctree := $(if $(KBUILD_SRC),$(KBUILD_SRC),$(CURDIR))
|
ifeq ($(KBUILD_SRC),)
|
||||||
objtree := $(CURDIR)
|
# building in the source tree
|
||||||
|
srctree := .
|
||||||
|
else
|
||||||
|
ifeq ($(KBUILD_SRC)/,$(dir $(CURDIR)))
|
||||||
|
# building in a subdirectory of the source tree
|
||||||
|
srctree := ..
|
||||||
|
else
|
||||||
|
srctree := $(KBUILD_SRC)
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
objtree := .
|
||||||
src := $(srctree)
|
src := $(srctree)
|
||||||
obj := $(objtree)
|
obj := $(objtree)
|
||||||
|
|
||||||
|
@ -346,7 +352,6 @@ $(srctree)/scripts/Kbuild.include: ;
|
||||||
include $(srctree)/scripts/Kbuild.include
|
include $(srctree)/scripts/Kbuild.include
|
||||||
|
|
||||||
# Make variables (CC, etc...)
|
# Make variables (CC, etc...)
|
||||||
|
|
||||||
AS = $(CROSS_COMPILE)as
|
AS = $(CROSS_COMPILE)as
|
||||||
LD = $(CROSS_COMPILE)ld
|
LD = $(CROSS_COMPILE)ld
|
||||||
CC = $(CROSS_COMPILE)gcc
|
CC = $(CROSS_COMPILE)gcc
|
||||||
|
@ -395,8 +400,8 @@ KBUILD_CPPFLAGS := -D__KERNEL__
|
||||||
KBUILD_CFLAGS := -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs \
|
KBUILD_CFLAGS := -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs \
|
||||||
-fno-strict-aliasing -fno-common \
|
-fno-strict-aliasing -fno-common \
|
||||||
-Werror-implicit-function-declaration \
|
-Werror-implicit-function-declaration \
|
||||||
-Wno-format-security \
|
-Wno-format-security
|
||||||
$(call cc-option,-fno-delete-null-pointer-checks,)
|
|
||||||
KBUILD_AFLAGS_KERNEL :=
|
KBUILD_AFLAGS_KERNEL :=
|
||||||
KBUILD_CFLAGS_KERNEL :=
|
KBUILD_CFLAGS_KERNEL :=
|
||||||
KBUILD_AFLAGS := -D__ASSEMBLY__
|
KBUILD_AFLAGS := -D__ASSEMBLY__
|
||||||
|
@ -504,8 +509,16 @@ ifeq ($(mixed-targets),1)
|
||||||
# We're called with mixed targets (*config and build targets).
|
# We're called with mixed targets (*config and build targets).
|
||||||
# Handle them one by one.
|
# Handle them one by one.
|
||||||
|
|
||||||
%:: FORCE
|
PHONY += $(MAKECMDGOALS) __build_one_by_one
|
||||||
$(Q)$(MAKE) -C $(srctree) KBUILD_SRC= $@
|
|
||||||
|
$(filter-out __build_one_by_one, $(MAKECMDGOALS)): __build_one_by_one
|
||||||
|
@:
|
||||||
|
|
||||||
|
__build_one_by_one:
|
||||||
|
$(Q)set -e; \
|
||||||
|
for i in $(MAKECMDGOALS); do \
|
||||||
|
$(MAKE) -f $(srctree)/Makefile $$i; \
|
||||||
|
done
|
||||||
|
|
||||||
else
|
else
|
||||||
ifeq ($(config-targets),1)
|
ifeq ($(config-targets),1)
|
||||||
|
@ -520,11 +533,9 @@ include $(srctree)/arch/$(SRCARCH)/Makefile
|
||||||
export KBUILD_DEFCONFIG KBUILD_KCONFIG
|
export KBUILD_DEFCONFIG KBUILD_KCONFIG
|
||||||
|
|
||||||
config: scripts_basic outputmakefile FORCE
|
config: scripts_basic outputmakefile FORCE
|
||||||
$(Q)mkdir -p include/linux include/config
|
|
||||||
$(Q)$(MAKE) $(build)=scripts/kconfig $@
|
$(Q)$(MAKE) $(build)=scripts/kconfig $@
|
||||||
|
|
||||||
%config: scripts_basic outputmakefile FORCE
|
%config: scripts_basic outputmakefile FORCE
|
||||||
$(Q)mkdir -p include/linux include/config
|
|
||||||
$(Q)$(MAKE) $(build)=scripts/kconfig $@
|
$(Q)$(MAKE) $(build)=scripts/kconfig $@
|
||||||
|
|
||||||
else
|
else
|
||||||
|
@ -594,14 +605,16 @@ endif # $(dot-config)
|
||||||
# Defaults to vmlinux, but the arch makefile usually adds further targets
|
# Defaults to vmlinux, but the arch makefile usually adds further targets
|
||||||
all: vmlinux
|
all: vmlinux
|
||||||
|
|
||||||
|
include $(srctree)/arch/$(SRCARCH)/Makefile
|
||||||
|
|
||||||
|
KBUILD_CFLAGS += $(call cc-option,-fno-delete-null-pointer-checks,)
|
||||||
|
|
||||||
ifdef CONFIG_CC_OPTIMIZE_FOR_SIZE
|
ifdef CONFIG_CC_OPTIMIZE_FOR_SIZE
|
||||||
KBUILD_CFLAGS += -Os $(call cc-disable-warning,maybe-uninitialized,)
|
KBUILD_CFLAGS += -Os $(call cc-disable-warning,maybe-uninitialized,)
|
||||||
else
|
else
|
||||||
KBUILD_CFLAGS += -O2
|
KBUILD_CFLAGS += -O2
|
||||||
endif
|
endif
|
||||||
|
|
||||||
include $(srctree)/arch/$(SRCARCH)/Makefile
|
|
||||||
|
|
||||||
ifdef CONFIG_READABLE_ASM
|
ifdef CONFIG_READABLE_ASM
|
||||||
# Disable optimizations that make assembler listings hard to read.
|
# Disable optimizations that make assembler listings hard to read.
|
||||||
# reorder blocks reorders the control in the function
|
# reorder blocks reorders the control in the function
|
||||||
|
@ -731,6 +744,8 @@ ifeq ($(shell $(CONFIG_SHELL) $(srctree)/scripts/gcc-goto.sh $(CC)), y)
|
||||||
KBUILD_CFLAGS += -DCC_HAVE_ASM_GOTO
|
KBUILD_CFLAGS += -DCC_HAVE_ASM_GOTO
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
include $(srctree)/scripts/Makefile.extrawarn
|
||||||
|
|
||||||
# Add user supplied CPPFLAGS, AFLAGS and CFLAGS as the last assignments
|
# Add user supplied CPPFLAGS, AFLAGS and CFLAGS as the last assignments
|
||||||
KBUILD_CPPFLAGS += $(KCPPFLAGS)
|
KBUILD_CPPFLAGS += $(KCPPFLAGS)
|
||||||
KBUILD_AFLAGS += $(KAFLAGS)
|
KBUILD_AFLAGS += $(KAFLAGS)
|
||||||
|
@ -1054,10 +1069,10 @@ _modinst_:
|
||||||
@rm -rf $(MODLIB)/kernel
|
@rm -rf $(MODLIB)/kernel
|
||||||
@rm -f $(MODLIB)/source
|
@rm -f $(MODLIB)/source
|
||||||
@mkdir -p $(MODLIB)/kernel
|
@mkdir -p $(MODLIB)/kernel
|
||||||
@ln -s $(srctree) $(MODLIB)/source
|
@ln -s `cd $(srctree) && /bin/pwd` $(MODLIB)/source
|
||||||
@if [ ! $(objtree) -ef $(MODLIB)/build ]; then \
|
@if [ ! $(objtree) -ef $(MODLIB)/build ]; then \
|
||||||
rm -f $(MODLIB)/build ; \
|
rm -f $(MODLIB)/build ; \
|
||||||
ln -s $(objtree) $(MODLIB)/build ; \
|
ln -s $(CURDIR) $(MODLIB)/build ; \
|
||||||
fi
|
fi
|
||||||
@cp -f $(objtree)/modules.order $(MODLIB)/
|
@cp -f $(objtree)/modules.order $(MODLIB)/
|
||||||
@cp -f $(objtree)/modules.builtin $(MODLIB)/
|
@cp -f $(objtree)/modules.builtin $(MODLIB)/
|
||||||
|
|
|
@ -333,8 +333,8 @@ $(addprefix $(obj)/, $(initrd-y)): $(obj)/ramdisk.image.gz
|
||||||
$(obj)/zImage.initrd.%: vmlinux $(wrapperbits)
|
$(obj)/zImage.initrd.%: vmlinux $(wrapperbits)
|
||||||
$(call if_changed,wrap,$*,,,$(obj)/ramdisk.image.gz)
|
$(call if_changed,wrap,$*,,,$(obj)/ramdisk.image.gz)
|
||||||
|
|
||||||
$(obj)/zImage.%: vmlinux $(wrapperbits)
|
$(addprefix $(obj)/, $(sort $(filter zImage.%, $(image-y)))): vmlinux $(wrapperbits)
|
||||||
$(call if_changed,wrap,$*)
|
$(call if_changed,wrap,$(subst $(obj)/zImage.,,$@))
|
||||||
|
|
||||||
# dtbImage% - a dtbImage is a zImage with an embedded device tree blob
|
# dtbImage% - a dtbImage is a zImage with an embedded device tree blob
|
||||||
$(obj)/dtbImage.initrd.%: vmlinux $(wrapperbits) $(obj)/%.dtb
|
$(obj)/dtbImage.initrd.%: vmlinux $(wrapperbits) $(obj)/%.dtb
|
||||||
|
|
|
@ -111,8 +111,7 @@ endef
|
||||||
KBUILD_KCONFIG := $(HOST_DIR)/um/Kconfig
|
KBUILD_KCONFIG := $(HOST_DIR)/um/Kconfig
|
||||||
|
|
||||||
archheaders:
|
archheaders:
|
||||||
$(Q)$(MAKE) -C '$(srctree)' KBUILD_SRC= \
|
$(Q)$(MAKE) KBUILD_SRC= ARCH=$(HEADER_ARCH) archheaders
|
||||||
ARCH=$(HEADER_ARCH) O='$(objtree)' archheaders
|
|
||||||
|
|
||||||
archprepare: include/generated/user_constants.h
|
archprepare: include/generated/user_constants.h
|
||||||
|
|
||||||
|
|
|
@ -4,10 +4,10 @@
|
||||||
|
|
||||||
# Create $(fwabs) from $(CONFIG_EXTRA_FIRMWARE_DIR) -- if it doesn't have a
|
# Create $(fwabs) from $(CONFIG_EXTRA_FIRMWARE_DIR) -- if it doesn't have a
|
||||||
# leading /, it's relative to $(srctree).
|
# leading /, it's relative to $(srctree).
|
||||||
fwdir := $(subst ",,$(CONFIG_EXTRA_FIRMWARE_DIR))
|
fwdir := $(subst $(quote),,$(CONFIG_EXTRA_FIRMWARE_DIR))
|
||||||
fwabs := $(addprefix $(srctree)/,$(filter-out /%,$(fwdir)))$(filter /%,$(fwdir))
|
fwabs := $(addprefix $(srctree)/,$(filter-out /%,$(fwdir)))$(filter /%,$(fwdir))
|
||||||
|
|
||||||
fw-external-y := $(subst ",,$(CONFIG_EXTRA_FIRMWARE))
|
fw-external-y := $(subst $(quote),,$(CONFIG_EXTRA_FIRMWARE))
|
||||||
|
|
||||||
# There are three cases to care about:
|
# There are three cases to care about:
|
||||||
# 1. Building kernel with CONFIG_FIRMWARE_IN_KERNEL=y -- $(fw-shipped-y) should
|
# 1. Building kernel with CONFIG_FIRMWARE_IN_KERNEL=y -- $(fw-shipped-y) should
|
||||||
|
@ -138,12 +138,6 @@ fw-shipped-$(CONFIG_YAM) += yam/1200.bin yam/9600.bin
|
||||||
|
|
||||||
fw-shipped-all := $(fw-shipped-y) $(fw-shipped-m) $(fw-shipped-)
|
fw-shipped-all := $(fw-shipped-y) $(fw-shipped-m) $(fw-shipped-)
|
||||||
|
|
||||||
# Directories which we _might_ need to create, so we have a rule for them.
|
|
||||||
firmware-dirs := $(sort $(addprefix $(objtree)/$(obj)/,$(dir $(fw-external-y) $(fw-shipped-all))))
|
|
||||||
|
|
||||||
quiet_cmd_mkdir = MKDIR $(patsubst $(objtree)/%,%,$@)
|
|
||||||
cmd_mkdir = mkdir -p $@
|
|
||||||
|
|
||||||
quiet_cmd_ihex = IHEX $@
|
quiet_cmd_ihex = IHEX $@
|
||||||
cmd_ihex = $(OBJCOPY) -Iihex -Obinary $< $@
|
cmd_ihex = $(OBJCOPY) -Iihex -Obinary $< $@
|
||||||
|
|
||||||
|
@ -184,21 +178,10 @@ wordsize_deps := $(wildcard include/config/64bit.h include/config/32bit.h \
|
||||||
include/config/superh32.h include/config/superh64.h \
|
include/config/superh32.h include/config/superh64.h \
|
||||||
include/config/x86_32.h include/config/x86_64.h)
|
include/config/x86_32.h include/config/x86_64.h)
|
||||||
|
|
||||||
# Workaround for make < 3.81, where .SECONDEXPANSION doesn't work.
|
$(patsubst %,$(obj)/%.gen.S, $(fw-shipped-y)): %: $(wordsize_deps)
|
||||||
# It'll end up depending on these targets, so make them a PHONY rule which
|
|
||||||
# depends on _all_ the directories in $(firmware-dirs), and it'll work out OK.
|
|
||||||
PHONY += $(objtree)/$$(%) $(objtree)/$(obj)/$$(%)
|
|
||||||
$(objtree)/$$(%) $(objtree)/$(obj)/$$(%): $(firmware-dirs)
|
|
||||||
@true
|
|
||||||
|
|
||||||
# For the $$(dir %) trick, where we need % to be expanded first.
|
|
||||||
.SECONDEXPANSION:
|
|
||||||
|
|
||||||
$(patsubst %,$(obj)/%.gen.S, $(fw-shipped-y)): %: $(wordsize_deps) \
|
|
||||||
| $(objtree)/$$(dir %)
|
|
||||||
$(call cmd,fwbin,$(patsubst %.gen.S,%,$@))
|
$(call cmd,fwbin,$(patsubst %.gen.S,%,$@))
|
||||||
$(patsubst %,$(obj)/%.gen.S, $(fw-external-y)): %: $(wordsize_deps) \
|
$(patsubst %,$(obj)/%.gen.S, $(fw-external-y)): %: $(wordsize_deps) \
|
||||||
include/config/extra/firmware/dir.h | $(objtree)/$$(dir %)
|
include/config/extra/firmware/dir.h
|
||||||
$(call cmd,fwbin,$(fwabs)/$(patsubst $(obj)/%.gen.S,%,$@))
|
$(call cmd,fwbin,$(fwabs)/$(patsubst $(obj)/%.gen.S,%,$@))
|
||||||
|
|
||||||
# The .o files depend on the binaries directly; the .S files don't.
|
# The .o files depend on the binaries directly; the .S files don't.
|
||||||
|
@ -207,7 +190,7 @@ $(patsubst %,$(obj)/%.gen.o, $(fw-external-y)): $(obj)/%.gen.o: $(fwdir)/%
|
||||||
|
|
||||||
# .ihex is used just as a simple way to hold binary files in a source tree
|
# .ihex is used just as a simple way to hold binary files in a source tree
|
||||||
# where binaries are frowned upon. They are directly converted with objcopy.
|
# where binaries are frowned upon. They are directly converted with objcopy.
|
||||||
$(obj)/%: $(obj)/%.ihex | $(objtree)/$(obj)/$$(dir %)
|
$(obj)/%: $(obj)/%.ihex
|
||||||
$(call cmd,ihex)
|
$(call cmd,ihex)
|
||||||
|
|
||||||
# Don't depend on ihex2fw if we're installing and it already exists.
|
# Don't depend on ihex2fw if we're installing and it already exists.
|
||||||
|
@ -226,16 +209,13 @@ endif
|
||||||
# is actually meaningful, because the firmware has to be loaded in a certain
|
# is actually meaningful, because the firmware has to be loaded in a certain
|
||||||
# order rather than as a single binary blob. Thus, we convert them into our
|
# order rather than as a single binary blob. Thus, we convert them into our
|
||||||
# more compact binary representation of ihex records (<linux/ihex.h>)
|
# more compact binary representation of ihex records (<linux/ihex.h>)
|
||||||
$(obj)/%.fw: $(obj)/%.HEX $(ihex2fw_dep) | $(objtree)/$(obj)/$$(dir %)
|
$(obj)/%.fw: $(obj)/%.HEX $(ihex2fw_dep)
|
||||||
$(call cmd,ihex2fw)
|
$(call cmd,ihex2fw)
|
||||||
|
|
||||||
# .H16 is our own modified form of Intel HEX, with 16-bit length for records.
|
# .H16 is our own modified form of Intel HEX, with 16-bit length for records.
|
||||||
$(obj)/%.fw: $(obj)/%.H16 $(ihex2fw_dep) | $(objtree)/$(obj)/$$(dir %)
|
$(obj)/%.fw: $(obj)/%.H16 $(ihex2fw_dep)
|
||||||
$(call cmd,h16tofw)
|
$(call cmd,h16tofw)
|
||||||
|
|
||||||
$(firmware-dirs):
|
|
||||||
$(call cmd,mkdir)
|
|
||||||
|
|
||||||
obj-y += $(patsubst %,%.gen.o, $(fw-external-y))
|
obj-y += $(patsubst %,%.gen.o, $(fw-external-y))
|
||||||
obj-$(CONFIG_FIRMWARE_IN_KERNEL) += $(patsubst %,%.gen.o, $(fw-shipped-y))
|
obj-$(CONFIG_FIRMWARE_IN_KERNEL) += $(patsubst %,%.gen.o, $(fw-shipped-y))
|
||||||
|
|
||||||
|
|
|
@ -39,4 +39,4 @@ subdir-$(CONFIG_SECURITY_SELINUX) += selinux
|
||||||
subdir-$(CONFIG_DTC) += dtc
|
subdir-$(CONFIG_DTC) += dtc
|
||||||
|
|
||||||
# Let clean descend into subdirs
|
# Let clean descend into subdirs
|
||||||
subdir- += basic kconfig package selinux
|
subdir- += basic kconfig package
|
||||||
|
|
|
@ -50,67 +50,6 @@ ifeq ($(KBUILD_NOPEDANTIC),)
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
|
|
||||||
#
|
|
||||||
# make W=... settings
|
|
||||||
#
|
|
||||||
# W=1 - warnings that may be relevant and does not occur too often
|
|
||||||
# W=2 - warnings that occur quite often but may still be relevant
|
|
||||||
# W=3 - the more obscure warnings, can most likely be ignored
|
|
||||||
#
|
|
||||||
# $(call cc-option, -W...) handles gcc -W.. options which
|
|
||||||
# are not supported by all versions of the compiler
|
|
||||||
ifdef KBUILD_ENABLE_EXTRA_GCC_CHECKS
|
|
||||||
warning- := $(empty)
|
|
||||||
|
|
||||||
warning-1 := -Wextra -Wunused -Wno-unused-parameter
|
|
||||||
warning-1 += -Wmissing-declarations
|
|
||||||
warning-1 += -Wmissing-format-attribute
|
|
||||||
warning-1 += $(call cc-option, -Wmissing-prototypes)
|
|
||||||
warning-1 += -Wold-style-definition
|
|
||||||
warning-1 += $(call cc-option, -Wmissing-include-dirs)
|
|
||||||
warning-1 += $(call cc-option, -Wunused-but-set-variable)
|
|
||||||
warning-1 += $(call cc-disable-warning, missing-field-initializers)
|
|
||||||
|
|
||||||
# Clang
|
|
||||||
warning-1 += $(call cc-disable-warning, initializer-overrides)
|
|
||||||
warning-1 += $(call cc-disable-warning, unused-value)
|
|
||||||
warning-1 += $(call cc-disable-warning, format)
|
|
||||||
warning-1 += $(call cc-disable-warning, unknown-warning-option)
|
|
||||||
warning-1 += $(call cc-disable-warning, sign-compare)
|
|
||||||
warning-1 += $(call cc-disable-warning, format-zero-length)
|
|
||||||
warning-1 += $(call cc-disable-warning, uninitialized)
|
|
||||||
warning-1 += $(call cc-option, -fcatch-undefined-behavior)
|
|
||||||
|
|
||||||
warning-2 := -Waggregate-return
|
|
||||||
warning-2 += -Wcast-align
|
|
||||||
warning-2 += -Wdisabled-optimization
|
|
||||||
warning-2 += -Wnested-externs
|
|
||||||
warning-2 += -Wshadow
|
|
||||||
warning-2 += $(call cc-option, -Wlogical-op)
|
|
||||||
warning-2 += $(call cc-option, -Wmissing-field-initializers)
|
|
||||||
|
|
||||||
warning-3 := -Wbad-function-cast
|
|
||||||
warning-3 += -Wcast-qual
|
|
||||||
warning-3 += -Wconversion
|
|
||||||
warning-3 += -Wpacked
|
|
||||||
warning-3 += -Wpadded
|
|
||||||
warning-3 += -Wpointer-arith
|
|
||||||
warning-3 += -Wredundant-decls
|
|
||||||
warning-3 += -Wswitch-default
|
|
||||||
warning-3 += $(call cc-option, -Wpacked-bitfield-compat)
|
|
||||||
warning-3 += $(call cc-option, -Wvla)
|
|
||||||
|
|
||||||
warning := $(warning-$(findstring 1, $(KBUILD_ENABLE_EXTRA_GCC_CHECKS)))
|
|
||||||
warning += $(warning-$(findstring 2, $(KBUILD_ENABLE_EXTRA_GCC_CHECKS)))
|
|
||||||
warning += $(warning-$(findstring 3, $(KBUILD_ENABLE_EXTRA_GCC_CHECKS)))
|
|
||||||
|
|
||||||
ifeq ("$(strip $(warning))","")
|
|
||||||
$(error W=$(KBUILD_ENABLE_EXTRA_GCC_CHECKS) is unknown)
|
|
||||||
endif
|
|
||||||
|
|
||||||
KBUILD_CFLAGS += $(warning)
|
|
||||||
endif
|
|
||||||
|
|
||||||
include scripts/Makefile.lib
|
include scripts/Makefile.lib
|
||||||
|
|
||||||
ifdef host-progs
|
ifdef host-progs
|
||||||
|
|
|
@ -0,0 +1,67 @@
|
||||||
|
# ==========================================================================
|
||||||
|
#
|
||||||
|
# make W=... settings
|
||||||
|
#
|
||||||
|
# W=1 - warnings that may be relevant and does not occur too often
|
||||||
|
# W=2 - warnings that occur quite often but may still be relevant
|
||||||
|
# W=3 - the more obscure warnings, can most likely be ignored
|
||||||
|
#
|
||||||
|
# $(call cc-option, -W...) handles gcc -W.. options which
|
||||||
|
# are not supported by all versions of the compiler
|
||||||
|
# ==========================================================================
|
||||||
|
|
||||||
|
ifeq ("$(origin W)", "command line")
|
||||||
|
export KBUILD_ENABLE_EXTRA_GCC_CHECKS := $(W)
|
||||||
|
endif
|
||||||
|
|
||||||
|
ifdef KBUILD_ENABLE_EXTRA_GCC_CHECKS
|
||||||
|
warning- := $(empty)
|
||||||
|
|
||||||
|
warning-1 := -Wextra -Wunused -Wno-unused-parameter
|
||||||
|
warning-1 += -Wmissing-declarations
|
||||||
|
warning-1 += -Wmissing-format-attribute
|
||||||
|
warning-1 += $(call cc-option, -Wmissing-prototypes)
|
||||||
|
warning-1 += -Wold-style-definition
|
||||||
|
warning-1 += $(call cc-option, -Wmissing-include-dirs)
|
||||||
|
warning-1 += $(call cc-option, -Wunused-but-set-variable)
|
||||||
|
warning-1 += $(call cc-disable-warning, missing-field-initializers)
|
||||||
|
|
||||||
|
# Clang
|
||||||
|
warning-1 += $(call cc-disable-warning, initializer-overrides)
|
||||||
|
warning-1 += $(call cc-disable-warning, unused-value)
|
||||||
|
warning-1 += $(call cc-disable-warning, format)
|
||||||
|
warning-1 += $(call cc-disable-warning, unknown-warning-option)
|
||||||
|
warning-1 += $(call cc-disable-warning, sign-compare)
|
||||||
|
warning-1 += $(call cc-disable-warning, format-zero-length)
|
||||||
|
warning-1 += $(call cc-disable-warning, uninitialized)
|
||||||
|
warning-1 += $(call cc-option, -fcatch-undefined-behavior)
|
||||||
|
|
||||||
|
warning-2 := -Waggregate-return
|
||||||
|
warning-2 += -Wcast-align
|
||||||
|
warning-2 += -Wdisabled-optimization
|
||||||
|
warning-2 += -Wnested-externs
|
||||||
|
warning-2 += -Wshadow
|
||||||
|
warning-2 += $(call cc-option, -Wlogical-op)
|
||||||
|
warning-2 += $(call cc-option, -Wmissing-field-initializers)
|
||||||
|
|
||||||
|
warning-3 := -Wbad-function-cast
|
||||||
|
warning-3 += -Wcast-qual
|
||||||
|
warning-3 += -Wconversion
|
||||||
|
warning-3 += -Wpacked
|
||||||
|
warning-3 += -Wpadded
|
||||||
|
warning-3 += -Wpointer-arith
|
||||||
|
warning-3 += -Wredundant-decls
|
||||||
|
warning-3 += -Wswitch-default
|
||||||
|
warning-3 += $(call cc-option, -Wpacked-bitfield-compat)
|
||||||
|
warning-3 += $(call cc-option, -Wvla)
|
||||||
|
|
||||||
|
warning := $(warning-$(findstring 1, $(KBUILD_ENABLE_EXTRA_GCC_CHECKS)))
|
||||||
|
warning += $(warning-$(findstring 2, $(KBUILD_ENABLE_EXTRA_GCC_CHECKS)))
|
||||||
|
warning += $(warning-$(findstring 3, $(KBUILD_ENABLE_EXTRA_GCC_CHECKS)))
|
||||||
|
|
||||||
|
ifeq ("$(strip $(warning))","")
|
||||||
|
$(error W=$(KBUILD_ENABLE_EXTRA_GCC_CHECKS) is unknown)
|
||||||
|
endif
|
||||||
|
|
||||||
|
KBUILD_CFLAGS += $(warning)
|
||||||
|
endif
|
|
@ -24,25 +24,23 @@ ifndef CONFIG_FIRMWARE_IN_KERNEL
|
||||||
mod-fw += $(fw-shipped-y)
|
mod-fw += $(fw-shipped-y)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
ifneq ($(KBUILD_SRC),)
|
||||||
|
# Create output directory if not already present
|
||||||
|
_dummy := $(shell [ -d $(obj) ] || mkdir -p $(obj))
|
||||||
|
|
||||||
|
firmware-dirs := $(sort $(addprefix $(objtree)/$(obj)/,$(dir $(fw-external-y) $(fw-shipped-all))))
|
||||||
|
# Create directories for firmware in subdirectories
|
||||||
|
_dummy := $(foreach d,$(firmware-dirs), $(shell [ -d $(d) ] || mkdir -p $(d)))
|
||||||
|
endif
|
||||||
|
|
||||||
installed-mod-fw := $(addprefix $(INSTALL_FW_PATH)/,$(mod-fw))
|
installed-mod-fw := $(addprefix $(INSTALL_FW_PATH)/,$(mod-fw))
|
||||||
|
|
||||||
installed-fw := $(addprefix $(INSTALL_FW_PATH)/,$(fw-shipped-all))
|
installed-fw := $(addprefix $(INSTALL_FW_PATH)/,$(fw-shipped-all))
|
||||||
installed-fw-dirs := $(sort $(dir $(installed-fw))) $(INSTALL_FW_PATH)/./
|
|
||||||
|
|
||||||
# Workaround for make < 3.81, where .SECONDEXPANSION doesn't work.
|
|
||||||
PHONY += $(INSTALL_FW_PATH)/$$(%) install-all-dirs
|
|
||||||
$(INSTALL_FW_PATH)/$$(%): install-all-dirs
|
|
||||||
@true
|
|
||||||
install-all-dirs: $(installed-fw-dirs)
|
|
||||||
@true
|
|
||||||
|
|
||||||
quiet_cmd_install = INSTALL $(subst $(srctree)/,,$@)
|
quiet_cmd_install = INSTALL $(subst $(srctree)/,,$@)
|
||||||
cmd_install = $(INSTALL) -m0644 $< $@
|
cmd_install = mkdir -p $(@D); $(INSTALL) -m0644 $< $@
|
||||||
|
|
||||||
$(installed-fw-dirs):
|
$(installed-fw): $(INSTALL_FW_PATH)/%: $(obj)/%
|
||||||
$(call cmd,mkdir)
|
|
||||||
|
|
||||||
$(installed-fw): $(INSTALL_FW_PATH)/%: $(obj)/% | $(INSTALL_FW_PATH)/$$(dir %)
|
|
||||||
$(call cmd,install)
|
$(call cmd,install)
|
||||||
|
|
||||||
PHONY += __fw_install __fw_modinst FORCE
|
PHONY += __fw_install __fw_modinst FORCE
|
||||||
|
|
|
@ -33,11 +33,11 @@ oldconfig: $(obj)/conf
|
||||||
$< --$@ $(Kconfig)
|
$< --$@ $(Kconfig)
|
||||||
|
|
||||||
silentoldconfig: $(obj)/conf
|
silentoldconfig: $(obj)/conf
|
||||||
$(Q)mkdir -p include/generated
|
$(Q)mkdir -p include/config include/generated
|
||||||
$< --$@ $(Kconfig)
|
$< --$@ $(Kconfig)
|
||||||
|
|
||||||
localyesconfig localmodconfig: $(obj)/streamline_config.pl $(obj)/conf
|
localyesconfig localmodconfig: $(obj)/streamline_config.pl $(obj)/conf
|
||||||
$(Q)mkdir -p include/generated
|
$(Q)mkdir -p include/config include/generated
|
||||||
$(Q)perl $< --$@ $(srctree) $(Kconfig) > .tmp.config
|
$(Q)perl $< --$@ $(srctree) $(Kconfig) > .tmp.config
|
||||||
$(Q)if [ -f .config ]; then \
|
$(Q)if [ -f .config ]; then \
|
||||||
cmp -s .tmp.config .config || \
|
cmp -s .tmp.config .config || \
|
||||||
|
|
|
@ -42,18 +42,11 @@ MAKEARGS += O=\$(if \$(patsubst /%,,\$(makedir)),\$(CURDIR)/)\$(patsubst %/,%,\$
|
||||||
|
|
||||||
MAKEFLAGS += --no-print-directory
|
MAKEFLAGS += --no-print-directory
|
||||||
|
|
||||||
.PHONY: all \$(MAKECMDGOALS)
|
.PHONY: __sub-make \$(MAKECMDGOALS)
|
||||||
|
|
||||||
all := \$(filter-out all Makefile,\$(MAKECMDGOALS))
|
__sub-make:
|
||||||
|
\$(Q)\$(MAKE) \$(MAKEARGS) \$(MAKECMDGOALS)
|
||||||
|
|
||||||
all:
|
\$(filter-out __sub-make, \$(MAKECMDGOALS)): __sub-make
|
||||||
\$(Q)\$(MAKE) \$(MAKEARGS) \$(all)
|
|
||||||
|
|
||||||
Makefile:;
|
|
||||||
|
|
||||||
\$(all): all
|
|
||||||
@:
|
|
||||||
|
|
||||||
%/: all
|
|
||||||
@:
|
@:
|
||||||
EOF
|
EOF
|
||||||
|
|
Загрузка…
Ссылка в новой задаче