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:
@@ -39,4 +39,4 @@ subdir-$(CONFIG_SECURITY_SELINUX) += selinux
|
||||
subdir-$(CONFIG_DTC) += dtc
|
||||
|
||||
# Let clean descend into subdirs
|
||||
subdir- += basic kconfig package selinux
|
||||
subdir- += basic kconfig package
|
||||
|
@@ -50,67 +50,6 @@ ifeq ($(KBUILD_NOPEDANTIC),)
|
||||
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
|
||||
|
||||
ifdef host-progs
|
||||
@@ -342,7 +281,7 @@ $(real-objs-m) : modkern_aflags := $(KBUILD_AFLAGS_MODULE) $(AFLAGS_MODULE)
|
||||
$(real-objs-m:.o=.s): modkern_aflags := $(KBUILD_AFLAGS_MODULE) $(AFLAGS_MODULE)
|
||||
|
||||
quiet_cmd_as_s_S = CPP $(quiet_modtag) $@
|
||||
cmd_as_s_S = $(CPP) $(a_flags) -o $@ $<
|
||||
cmd_as_s_S = $(CPP) $(a_flags) -o $@ $<
|
||||
|
||||
$(obj)/%.s: $(src)/%.S FORCE
|
||||
$(call if_changed_dep,as_s_S)
|
||||
@@ -436,7 +375,7 @@ link_multi_deps = \
|
||||
$(filter $(addprefix $(obj)/, \
|
||||
$($(subst $(obj)/,,$(@:.o=-objs))) \
|
||||
$($(subst $(obj)/,,$(@:.o=-y)))), $^)
|
||||
|
||||
|
||||
quiet_cmd_link_multi-y = LD $@
|
||||
cmd_link_multi-y = $(LD) $(ld_flags) -r -o $@ $(link_multi_deps) $(cmd_secanalysis)
|
||||
|
||||
|
67
scripts/Makefile.extrawarn
Normal file
67
scripts/Makefile.extrawarn
Normal file
@@ -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
|
@@ -18,31 +18,29 @@ include $(srctree)/$(obj)/Makefile
|
||||
include scripts/Makefile.host
|
||||
|
||||
mod-fw := $(fw-shipped-m)
|
||||
# If CONFIG_FIRMWARE_IN_KERNEL isn't set, then install the
|
||||
# If CONFIG_FIRMWARE_IN_KERNEL isn't set, then install the
|
||||
# firmware for in-kernel drivers too.
|
||||
ifndef CONFIG_FIRMWARE_IN_KERNEL
|
||||
mod-fw += $(fw-shipped-y)
|
||||
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-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)/,,$@)
|
||||
cmd_install = $(INSTALL) -m0644 $< $@
|
||||
cmd_install = mkdir -p $(@D); $(INSTALL) -m0644 $< $@
|
||||
|
||||
$(installed-fw-dirs):
|
||||
$(call cmd,mkdir)
|
||||
|
||||
$(installed-fw): $(INSTALL_FW_PATH)/%: $(obj)/% | $(INSTALL_FW_PATH)/$$(dir %)
|
||||
$(installed-fw): $(INSTALL_FW_PATH)/%: $(obj)/%
|
||||
$(call cmd,install)
|
||||
|
||||
PHONY += __fw_install __fw_modinst FORCE
|
||||
|
@@ -166,5 +166,5 @@ $(host-cshlib): $(obj)/%: $(host-cshobjs) FORCE
|
||||
$(call if_changed,host-cshlib)
|
||||
|
||||
targets += $(host-csingle) $(host-cmulti) $(host-cobjs)\
|
||||
$(host-cxxmulti) $(host-cxxobjs) $(host-cshlib) $(host-cshobjs)
|
||||
$(host-cxxmulti) $(host-cxxobjs) $(host-cshlib) $(host-cshobjs)
|
||||
|
||||
|
@@ -27,7 +27,7 @@ lib-y := $(filter-out $(obj-y), $(sort $(lib-y) $(lib-m)))
|
||||
# ---------------------------------------------------------------------------
|
||||
# o if we encounter foo/ in $(obj-y), replace it by foo/built-in.o
|
||||
# and add the directory to the list of dirs to descend into: $(subdir-y)
|
||||
# o if we encounter foo/ in $(obj-m), remove it from $(obj-m)
|
||||
# o if we encounter foo/ in $(obj-m), remove it from $(obj-m)
|
||||
# and add the directory to the list of dirs to descend into: $(subdir-m)
|
||||
|
||||
# Determine modorder.
|
||||
@@ -46,7 +46,7 @@ obj-m := $(filter-out %/, $(obj-m))
|
||||
|
||||
subdir-ym := $(sort $(subdir-y) $(subdir-m))
|
||||
|
||||
# if $(foo-objs) exists, foo.o is a composite object
|
||||
# if $(foo-objs) exists, foo.o is a composite object
|
||||
multi-used-y := $(sort $(foreach m,$(obj-y), $(if $(strip $($(m:.o=-objs)) $($(m:.o=-y))), $(m))))
|
||||
multi-used-m := $(sort $(foreach m,$(obj-m), $(if $(strip $($(m:.o=-objs)) $($(m:.o=-y))), $(m))))
|
||||
multi-used := $(multi-used-y) $(multi-used-m)
|
||||
@@ -91,7 +91,7 @@ obj-dirs := $(addprefix $(obj)/,$(obj-dirs))
|
||||
|
||||
# These flags are needed for modversions and compiling, so we define them here
|
||||
# already
|
||||
# $(modname_flags) #defines KBUILD_MODNAME as the name of the module it will
|
||||
# $(modname_flags) #defines KBUILD_MODNAME as the name of the module it will
|
||||
# end up in (or would, if it gets compiled in)
|
||||
# Note: Files that end up in two or more modules are compiled without the
|
||||
# KBUILD_MODNAME definition. The reason is that any made-up name would
|
||||
@@ -212,7 +212,7 @@ $(obj)/%: $(src)/%_shipped
|
||||
|
||||
# Commands useful for building a boot image
|
||||
# ===========================================================================
|
||||
#
|
||||
#
|
||||
# Use as following:
|
||||
#
|
||||
# target: source(s) FORCE
|
||||
@@ -226,7 +226,7 @@ $(obj)/%: $(src)/%_shipped
|
||||
|
||||
quiet_cmd_ld = LD $@
|
||||
cmd_ld = $(LD) $(LDFLAGS) $(ldflags-y) $(LDFLAGS_$(@F)) \
|
||||
$(filter-out FORCE,$^) -o $@
|
||||
$(filter-out FORCE,$^) -o $@
|
||||
|
||||
# Objcopy
|
||||
# ---------------------------------------------------------------------------
|
||||
|
@@ -104,7 +104,7 @@ int main(int argc, char *argv[])
|
||||
}
|
||||
}
|
||||
|
||||
/* For now we assume the default font is always 256 characters. */
|
||||
/* For now we assume the default font is always 256 characters. */
|
||||
fontlen = 256;
|
||||
|
||||
/* Initialize table */
|
||||
@@ -236,15 +236,15 @@ int main(int argc, char *argv[])
|
||||
}
|
||||
|
||||
/* Okay, we hit EOF, now output hash table */
|
||||
|
||||
|
||||
fclose(ctbl);
|
||||
|
||||
|
||||
|
||||
/* Compute total size of Unicode list */
|
||||
nuni = 0;
|
||||
for ( i = 0 ; i < fontlen ; i++ )
|
||||
nuni += unicount[i];
|
||||
|
||||
|
||||
printf("\
|
||||
/*\n\
|
||||
* Do not edit this file; it was automatically generated by\n\
|
||||
@@ -268,9 +268,9 @@ u8 dfont_unicount[%d] = \n\
|
||||
else
|
||||
printf(", ");
|
||||
}
|
||||
|
||||
|
||||
printf("\nu16 dfont_unitable[%d] = \n{\n\t", nuni);
|
||||
|
||||
|
||||
fp0 = 0;
|
||||
nent = 0;
|
||||
for ( i = 0 ; i < nuni ; i++ )
|
||||
|
@@ -33,11 +33,11 @@ oldconfig: $(obj)/conf
|
||||
$< --$@ $(Kconfig)
|
||||
|
||||
silentoldconfig: $(obj)/conf
|
||||
$(Q)mkdir -p include/generated
|
||||
$(Q)mkdir -p include/config include/generated
|
||||
$< --$@ $(Kconfig)
|
||||
|
||||
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)if [ -f .config ]; then \
|
||||
cmp -s .tmp.config .config || \
|
||||
|
@@ -589,7 +589,7 @@ while ($repeat) {
|
||||
|
||||
# Now we need to see if we have to check selects;
|
||||
loop_select;
|
||||
}
|
||||
}
|
||||
|
||||
my %setconfigs;
|
||||
|
||||
|
@@ -68,7 +68,7 @@ UTS_TRUNCATE="cut -b -$UTS_LEN"
|
||||
|
||||
( echo /\* This file is auto generated, version $VERSION \*/
|
||||
if [ -n "$CONFIG_FLAGS" ] ; then echo "/* $CONFIG_FLAGS */"; fi
|
||||
|
||||
|
||||
echo \#define UTS_MACHINE \"$ARCH\"
|
||||
|
||||
echo \#define UTS_VERSION \"`echo $UTS_VERSION | $UTS_TRUNCATE`\"
|
||||
@@ -84,7 +84,7 @@ UTS_TRUNCATE="cut -b -$UTS_LEN"
|
||||
# recompilations.
|
||||
# We don't consider the file changed if only the date/time changed.
|
||||
# A kernel config change will increase the generation number, thus
|
||||
# causing compile.h to be updated (including date/time) due to the
|
||||
# causing compile.h to be updated (including date/time) due to the
|
||||
# changed comment in the
|
||||
# first line.
|
||||
|
||||
|
@@ -42,18 +42,11 @@ MAKEARGS += O=\$(if \$(patsubst /%,,\$(makedir)),\$(CURDIR)/)\$(patsubst %/,%,\$
|
||||
|
||||
MAKEFLAGS += --no-print-directory
|
||||
|
||||
.PHONY: all \$(MAKECMDGOALS)
|
||||
.PHONY: __sub-make \$(MAKECMDGOALS)
|
||||
|
||||
all := \$(filter-out all Makefile,\$(MAKECMDGOALS))
|
||||
__sub-make:
|
||||
\$(Q)\$(MAKE) \$(MAKEARGS) \$(MAKECMDGOALS)
|
||||
|
||||
all:
|
||||
\$(Q)\$(MAKE) \$(MAKEARGS) \$(all)
|
||||
|
||||
Makefile:;
|
||||
|
||||
\$(all): all
|
||||
@:
|
||||
|
||||
%/: all
|
||||
\$(filter-out __sub-make, \$(MAKECMDGOALS)): __sub-make
|
||||
@:
|
||||
EOF
|
||||
|
@@ -130,7 +130,7 @@ if [ "$ARCH" = "um" ] ; then
|
||||
cp System.map "$tmpdir/usr/lib/uml/modules/$version/System.map"
|
||||
cp $KCONFIG_CONFIG "$tmpdir/usr/share/doc/$packagename/config"
|
||||
gzip "$tmpdir/usr/share/doc/$packagename/config"
|
||||
else
|
||||
else
|
||||
cp System.map "$tmpdir/boot/System.map-$version"
|
||||
cp $KCONFIG_CONFIG "$tmpdir/boot/config-$version"
|
||||
fi
|
||||
|
@@ -27,7 +27,7 @@
|
||||
# Nick Holloway <Nick.Holloway@alfie.demon.co.uk>, 2nd January 1995.
|
||||
#
|
||||
# Added support for handling multiple types of compression. What includes
|
||||
# gzip, bzip, bzip2, zip, compress, and plaintext.
|
||||
# gzip, bzip, bzip2, zip, compress, and plaintext.
|
||||
#
|
||||
# Adam Sulmicki <adam@cfar.umd.edu>, 1st January 1997.
|
||||
#
|
||||
@@ -159,7 +159,7 @@ applyPatch () {
|
||||
fi
|
||||
# Remove backup files
|
||||
find $sourcedir/ '(' -name '*.orig' -o -name '.*.orig' ')' -exec rm -f {} \;
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user