Merge branch 'kbuild' of git://git.kernel.org/pub/scm/linux/kernel/git/mmarek/kbuild-2.6
* 'kbuild' of git://git.kernel.org/pub/scm/linux/kernel/git/mmarek/kbuild-2.6: kbuild: make KBUILD_NOCMDDEP=1 handle empty built-in.o scripts/kallsyms.c: fix potential segfault scripts/gen_initramfs_list.sh: Convert to a /bin/sh script kbuild: Fix GNU make v3.80 compatibility kbuild: Fix passing -Wno-* options to gcc 4.4+ kbuild: move scripts/basic/docproc.c to scripts/docproc.c kbuild: Fix Makefile.asm-generic for um kbuild: Allow to combine multiple W= levels kbuild: Disable -Wunused-but-set-variable for gcc 4.6.0 Fix handling of backlash character in LINUX_COMPILE_BY name kbuild: asm-generic support kbuild: implement several W= levels kbuild: Fix build with binutils <= 2.19 initramfs: Use KBUILD_BUILD_TIMESTAMP for generated entries kbuild: Allow to override LINUX_COMPILE_BY and LINUX_COMPILE_HOST macros kbuild: Drop unused LINUX_COMPILE_TIME and LINUX_COMPILE_DOMAIN macros kbuild: Use the deterministic mode of ar kbuild: Call gzip with -n kbuild: move KALLSYMS_EXTRA_PASS from Kconfig to Makefile Kconfig: improve KALLSYMS_ALL documentation Fix up trivial conflict in Makefile
This commit is contained in:
1
scripts/.gitignore
vendored
1
scripts/.gitignore
vendored
@ -8,3 +8,4 @@ bin2c
|
||||
unifdef
|
||||
ihex2fw
|
||||
recordmcount
|
||||
docproc
|
||||
|
@ -118,6 +118,11 @@ cc-option-yn = $(call try-run,\
|
||||
cc-option-align = $(subst -functions=0,,\
|
||||
$(call cc-option,-falign-functions=0,-malign-functions=0))
|
||||
|
||||
# cc-disable-warning
|
||||
# Usage: cflags-y += $(call cc-disable-warning,unused-but-set-variable)
|
||||
cc-disable-warning = $(call try-run,\
|
||||
$(CC) $(KBUILD_CPPFLAGS) $(KBUILD_CFLAGS) -W$(strip $(1)) -c -xc /dev/null -o "$$TMP",-Wno-$(strip $(1)))
|
||||
|
||||
# cc-version
|
||||
# Usage gcc-ver := $(call cc-version)
|
||||
cc-version = $(shell $(CONFIG_SHELL) $(srctree)/scripts/gcc-version.sh $(CC))
|
||||
@ -141,6 +146,11 @@ cc-ldoption = $(call try-run,\
|
||||
ld-option = $(call try-run,\
|
||||
$(CC) /dev/null -c -o "$$TMPO" ; $(LD) $(1) "$$TMPO" -o "$$TMP",$(1),$(2))
|
||||
|
||||
# ar-option
|
||||
# Usage: KBUILD_ARFLAGS := $(call ar-option,D)
|
||||
# Important: no spaces around options
|
||||
ar-option = $(call try-run, $(AR) rc$(1) "$$TMP",$(1),$(2))
|
||||
|
||||
######
|
||||
|
||||
###
|
||||
@ -187,6 +197,8 @@ ifneq ($(KBUILD_NOCMDDEP),1)
|
||||
# User may override this check using make KBUILD_NOCMDDEP=1
|
||||
arg-check = $(strip $(filter-out $(cmd_$(1)), $(cmd_$@)) \
|
||||
$(filter-out $(cmd_$@), $(cmd_$(1))) )
|
||||
else
|
||||
arg-check = $(if $(strip $(cmd_$@)),,1)
|
||||
endif
|
||||
|
||||
# >'< substitution is for echo to work,
|
||||
|
@ -6,6 +6,7 @@
|
||||
# pnmttologo: Convert pnm files to logo files
|
||||
# conmakehash: Create chartable
|
||||
# conmakehash: Create arrays for initializing the kernel console tables
|
||||
# docproc: Used in Documentation/DocBook
|
||||
|
||||
hostprogs-$(CONFIG_KALLSYMS) += kallsyms
|
||||
hostprogs-$(CONFIG_LOGO) += pnmtologo
|
||||
@ -16,12 +17,14 @@ hostprogs-$(BUILD_C_RECORDMCOUNT) += recordmcount
|
||||
always := $(hostprogs-y) $(hostprogs-m)
|
||||
|
||||
# The following hostprogs-y programs are only build on demand
|
||||
hostprogs-y += unifdef
|
||||
hostprogs-y += unifdef docproc
|
||||
|
||||
# This target is used internally to avoid "is up to date" messages
|
||||
# These targets are used internally to avoid "is up to date" messages
|
||||
PHONY += build_unifdef
|
||||
build_unifdef: scripts/unifdef FORCE
|
||||
@:
|
||||
build_docproc: scripts/docproc FORCE
|
||||
@:
|
||||
|
||||
subdir-$(CONFIG_MODVERSIONS) += genksyms
|
||||
subdir-y += mod
|
||||
|
23
scripts/Makefile.asm-generic
Normal file
23
scripts/Makefile.asm-generic
Normal file
@ -0,0 +1,23 @@
|
||||
# include/asm-generic contains a lot of files that are used
|
||||
# verbatim by several architectures.
|
||||
#
|
||||
# This Makefile reads the file arch/$(SRCARCH)/include/asm/Kbuild
|
||||
# and for each file listed in this file with generic-y creates
|
||||
# a small wrapper file in $(obj) (arch/$(SRCARCH)/include/generated/asm)
|
||||
|
||||
kbuild-file := $(srctree)/arch/$(SRCARCH)/include/asm/Kbuild
|
||||
-include $(kbuild-file)
|
||||
|
||||
include scripts/Kbuild.include
|
||||
|
||||
# Create output directory if not already present
|
||||
_dummy := $(shell [ -d $(obj) ] || mkdir -p $(obj))
|
||||
|
||||
quiet_cmd_wrap = WRAP $@
|
||||
cmd_wrap = echo "\#include <asm-generic/$*.h>" >$@
|
||||
|
||||
all: $(patsubst %, $(obj)/%, $(generic-y))
|
||||
|
||||
$(obj)/%.h:
|
||||
$(call cmd,wrap)
|
||||
|
@ -51,36 +51,52 @@ ifeq ($(KBUILD_NOPEDANTIC),)
|
||||
endif
|
||||
|
||||
#
|
||||
# make W=1 settings
|
||||
# make W=... settings
|
||||
#
|
||||
# $(call cc-option... ) handles gcc -W.. options which
|
||||
# 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
|
||||
KBUILD_EXTRA_WARNINGS := -Wextra
|
||||
KBUILD_EXTRA_WARNINGS += -Wunused -Wno-unused-parameter
|
||||
KBUILD_EXTRA_WARNINGS += -Waggregate-return
|
||||
KBUILD_EXTRA_WARNINGS += -Wbad-function-cast
|
||||
KBUILD_EXTRA_WARNINGS += -Wcast-qual
|
||||
KBUILD_EXTRA_WARNINGS += -Wcast-align
|
||||
KBUILD_EXTRA_WARNINGS += -Wconversion
|
||||
KBUILD_EXTRA_WARNINGS += -Wdisabled-optimization
|
||||
KBUILD_EXTRA_WARNINGS += -Wlogical-op
|
||||
KBUILD_EXTRA_WARNINGS += -Wmissing-declarations
|
||||
KBUILD_EXTRA_WARNINGS += -Wmissing-format-attribute
|
||||
KBUILD_EXTRA_WARNINGS += $(call cc-option, -Wmissing-include-dirs,)
|
||||
KBUILD_EXTRA_WARNINGS += -Wmissing-prototypes
|
||||
KBUILD_EXTRA_WARNINGS += -Wnested-externs
|
||||
KBUILD_EXTRA_WARNINGS += -Wold-style-definition
|
||||
KBUILD_EXTRA_WARNINGS += $(call cc-option, -Woverlength-strings,)
|
||||
KBUILD_EXTRA_WARNINGS += -Wpacked
|
||||
KBUILD_EXTRA_WARNINGS += -Wpacked-bitfield-compat
|
||||
KBUILD_EXTRA_WARNINGS += -Wpadded
|
||||
KBUILD_EXTRA_WARNINGS += -Wpointer-arith
|
||||
KBUILD_EXTRA_WARNINGS += -Wredundant-decls
|
||||
KBUILD_EXTRA_WARNINGS += -Wshadow
|
||||
KBUILD_EXTRA_WARNINGS += -Wswitch-default
|
||||
KBUILD_EXTRA_WARNINGS += $(call cc-option, -Wvla,)
|
||||
KBUILD_CFLAGS += $(KBUILD_EXTRA_WARNINGS)
|
||||
warning- := $(empty)
|
||||
|
||||
warning-1 := -Wextra -Wunused -Wno-unused-parameter
|
||||
warning-1 += -Wmissing-declarations
|
||||
warning-1 += -Wmissing-format-attribute
|
||||
warning-1 += -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-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-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
|
||||
@ -351,7 +367,7 @@ quiet_cmd_link_o_target = LD $@
|
||||
cmd_link_o_target = $(if $(strip $(obj-y)),\
|
||||
$(LD) $(ld_flags) -r -o $@ $(filter $(obj-y), $^) \
|
||||
$(cmd_secanalysis),\
|
||||
rm -f $@; $(AR) rcs $@)
|
||||
rm -f $@; $(AR) rcs$(KBUILD_ARFLAGS) $@)
|
||||
|
||||
$(builtin-target): $(obj-y) FORCE
|
||||
$(call if_changed,link_o_target)
|
||||
@ -377,7 +393,7 @@ $(modorder-target): $(subdir-ym) FORCE
|
||||
#
|
||||
ifdef lib-target
|
||||
quiet_cmd_link_l_target = AR $@
|
||||
cmd_link_l_target = rm -f $@; $(AR) rcs $@ $(lib-y)
|
||||
cmd_link_l_target = rm -f $@; $(AR) rcs$(KBUILD_ARFLAGS) $@ $(lib-y)
|
||||
|
||||
$(lib-target): $(lib-y) FORCE
|
||||
$(call if_changed,link_l_target)
|
||||
|
@ -27,8 +27,13 @@ header-y := $(filter-out %/, $(header-y))
|
||||
install-file := $(install)/.install
|
||||
check-file := $(install)/.check
|
||||
|
||||
# generic-y list all files an architecture uses from asm-generic
|
||||
# Use this to build a list of headers which require a wrapper
|
||||
wrapper-files := $(filter $(header-y), $(generic-y))
|
||||
|
||||
# all headers files for this dir
|
||||
all-files := $(header-y) $(objhdr-y)
|
||||
header-y := $(filter-out $(generic-y), $(header-y))
|
||||
all-files := $(header-y) $(objhdr-y) $(wrapper-files)
|
||||
input-files := $(addprefix $(srctree)/$(obj)/,$(header-y)) \
|
||||
$(addprefix $(objtree)/$(obj)/,$(objhdr-y))
|
||||
output-files := $(addprefix $(install)/, $(all-files))
|
||||
@ -47,6 +52,9 @@ quiet_cmd_install = INSTALL $(printdir) ($(words $(all-files))\
|
||||
cmd_install = \
|
||||
$(PERL) $< $(srctree)/$(obj) $(install) $(SRCARCH) $(header-y); \
|
||||
$(PERL) $< $(objtree)/$(obj) $(install) $(SRCARCH) $(objhdr-y); \
|
||||
for F in $(wrapper-files); do \
|
||||
echo "\#include <asm-generic/$$F>" > $(install)/$$F; \
|
||||
done; \
|
||||
touch $@
|
||||
|
||||
quiet_cmd_remove = REMOVE $(unwanted)
|
||||
|
@ -197,7 +197,7 @@ cmd_objcopy = $(OBJCOPY) $(OBJCOPYFLAGS) $(OBJCOPYFLAGS_$(@F)) $< $@
|
||||
# ---------------------------------------------------------------------------
|
||||
|
||||
quiet_cmd_gzip = GZIP $@
|
||||
cmd_gzip = (cat $(filter-out FORCE,$^) | gzip -f -9 > $@) || \
|
||||
cmd_gzip = (cat $(filter-out FORCE,$^) | gzip -n -f -9 > $@) || \
|
||||
(rm -f $@ ; false)
|
||||
|
||||
# DTC
|
||||
|
2
scripts/basic/.gitignore
vendored
2
scripts/basic/.gitignore
vendored
@ -1,3 +1 @@
|
||||
hash
|
||||
fixdep
|
||||
docproc
|
||||
|
@ -7,9 +7,8 @@
|
||||
# .config is included by main Makefile.
|
||||
# ---------------------------------------------------------------------------
|
||||
# fixdep: Used to generate dependency information during build process
|
||||
# docproc: Used in Documentation/DocBook
|
||||
|
||||
hostprogs-y := fixdep docproc
|
||||
hostprogs-y := fixdep
|
||||
always := $(hostprogs-y)
|
||||
|
||||
# fixdep is needed to compile other host programs
|
||||
|
@ -1,4 +1,4 @@
|
||||
#!/bin/bash
|
||||
#!/bin/sh
|
||||
# Copyright (C) Martin Schlemmer <azarah@nosferatu.za.org>
|
||||
# Copyright (C) 2006 Sam Ravnborg <sam@ravnborg.org>
|
||||
#
|
||||
@ -105,9 +105,9 @@ list_parse() {
|
||||
# for links, devices etc the format differs. See gen_init_cpio for details
|
||||
parse() {
|
||||
local location="$1"
|
||||
local name="${location/${srcdir}//}"
|
||||
local name="/${location#${srcdir}}"
|
||||
# change '//' into '/'
|
||||
name="${name//\/\///}"
|
||||
name=$(echo "$name" | sed -e 's://*:/:g')
|
||||
local mode="$2"
|
||||
local uid="$3"
|
||||
local gid="$4"
|
||||
@ -117,8 +117,8 @@ parse() {
|
||||
[ "$root_gid" = "squash" ] && gid=0 || [ "$gid" -eq "$root_gid" ] && gid=0
|
||||
local str="${mode} ${uid} ${gid}"
|
||||
|
||||
[ "${ftype}" == "invalid" ] && return 0
|
||||
[ "${location}" == "${srcdir}" ] && return 0
|
||||
[ "${ftype}" = "invalid" ] && return 0
|
||||
[ "${location}" = "${srcdir}" ] && return 0
|
||||
|
||||
case "${ftype}" in
|
||||
"file")
|
||||
@ -192,7 +192,7 @@ input_file() {
|
||||
if [ -f "$1" ]; then
|
||||
${dep_list}header "$1"
|
||||
is_cpio="$(echo "$1" | sed 's/^.*\.cpio\(\..*\)\?/cpio/')"
|
||||
if [ $2 -eq 0 -a ${is_cpio} == "cpio" ]; then
|
||||
if [ $2 -eq 0 -a ${is_cpio} = "cpio" ]; then
|
||||
cpio_file=$1
|
||||
echo "$1" | grep -q '^.*\.cpio\..*' && is_cpio_compressed="compressed"
|
||||
[ ! -z ${dep_list} ] && echo "$1"
|
||||
@ -204,7 +204,7 @@ input_file() {
|
||||
else
|
||||
echo "$1 \\"
|
||||
cat "$1" | while read type dir file perm ; do
|
||||
if [ "$type" == "file" ]; then
|
||||
if [ "$type" = "file" ]; then
|
||||
echo "$file \\";
|
||||
fi
|
||||
done
|
||||
@ -226,7 +226,7 @@ cpio_list=
|
||||
output="/dev/stdout"
|
||||
output_file=""
|
||||
is_cpio_compressed=
|
||||
compr="gzip -9 -f"
|
||||
compr="gzip -n -9 -f"
|
||||
|
||||
arg="$1"
|
||||
case "$arg" in
|
||||
@ -240,7 +240,7 @@ case "$arg" in
|
||||
output_file="$1"
|
||||
cpio_list="$(mktemp ${TMPDIR:-/tmp}/cpiolist.XXXXXX)"
|
||||
output=${cpio_list}
|
||||
echo "$output_file" | grep -q "\.gz$" && compr="gzip -9 -f"
|
||||
echo "$output_file" | grep -q "\.gz$" && compr="gzip -n -9 -f"
|
||||
echo "$output_file" | grep -q "\.bz2$" && compr="bzip2 -9 -f"
|
||||
echo "$output_file" | grep -q "\.lzma$" && compr="lzma -9 -f"
|
||||
echo "$output_file" | grep -q "\.xz$" && \
|
||||
@ -287,8 +287,15 @@ done
|
||||
# we are careful to delete tmp files
|
||||
if [ ! -z ${output_file} ]; then
|
||||
if [ -z ${cpio_file} ]; then
|
||||
timestamp=
|
||||
if test -n "$KBUILD_BUILD_TIMESTAMP"; then
|
||||
timestamp="$(date -d"$KBUILD_BUILD_TIMESTAMP" +%s || :)"
|
||||
if test -n "$timestamp"; then
|
||||
timestamp="-t $timestamp"
|
||||
fi
|
||||
fi
|
||||
cpio_tfile="$(mktemp ${TMPDIR:-/tmp}/cpiofile.XXXXXX)"
|
||||
usr/gen_init_cpio ${cpio_list} > ${cpio_tfile}
|
||||
usr/gen_init_cpio $timestamp ${cpio_list} > ${cpio_tfile}
|
||||
else
|
||||
cpio_tfile=${cpio_file}
|
||||
fi
|
||||
|
@ -500,6 +500,8 @@ static void optimize_result(void)
|
||||
|
||||
/* find the token with the breates profit value */
|
||||
best = find_best_token();
|
||||
if (token_profit[best] == 0)
|
||||
break;
|
||||
|
||||
/* place it in the "best" table */
|
||||
best_table_len[i] = 2;
|
||||
|
@ -42,6 +42,16 @@ if [ -z "$KBUILD_BUILD_TIMESTAMP" ]; then
|
||||
else
|
||||
TIMESTAMP=$KBUILD_BUILD_TIMESTAMP
|
||||
fi
|
||||
if test -z "$KBUILD_BUILD_USER"; then
|
||||
LINUX_COMPILE_BY=$(whoami | sed 's/\\/\\\\/')
|
||||
else
|
||||
LINUX_COMPILE_BY=$KBUILD_BUILD_USER
|
||||
fi
|
||||
if test -z "$KBUILD_BUILD_HOST"; then
|
||||
LINUX_COMPILE_HOST=`hostname`
|
||||
else
|
||||
LINUX_COMPILE_HOST=$KBUILD_BUILD_HOST
|
||||
fi
|
||||
|
||||
UTS_VERSION="#$VERSION"
|
||||
CONFIG_FLAGS=""
|
||||
@ -63,20 +73,8 @@ UTS_TRUNCATE="cut -b -$UTS_LEN"
|
||||
|
||||
echo \#define UTS_VERSION \"`echo $UTS_VERSION | $UTS_TRUNCATE`\"
|
||||
|
||||
echo \#define LINUX_COMPILE_TIME \"`date +%T`\"
|
||||
echo \#define LINUX_COMPILE_BY \"`whoami`\"
|
||||
echo \#define LINUX_COMPILE_HOST \"`hostname | $UTS_TRUNCATE`\"
|
||||
|
||||
domain=`dnsdomainname 2> /dev/null`
|
||||
if [ -z "$domain" ]; then
|
||||
domain=`domainname 2> /dev/null`
|
||||
fi
|
||||
|
||||
if [ -n "$domain" ]; then
|
||||
echo \#define LINUX_COMPILE_DOMAIN \"`echo $domain | $UTS_TRUNCATE`\"
|
||||
else
|
||||
echo \#define LINUX_COMPILE_DOMAIN
|
||||
fi
|
||||
echo \#define LINUX_COMPILE_BY \"`echo $LINUX_COMPILE_BY | $UTS_TRUNCATE`\"
|
||||
echo \#define LINUX_COMPILE_HOST \"`echo $LINUX_COMPILE_HOST | $UTS_TRUNCATE`\"
|
||||
|
||||
echo \#define LINUX_COMPILER \"`$CC -v 2>&1 | tail -n 1`\"
|
||||
) > .tmpcompile
|
||||
@ -91,8 +89,8 @@ UTS_TRUNCATE="cut -b -$UTS_LEN"
|
||||
# first line.
|
||||
|
||||
if [ -r $TARGET ] && \
|
||||
grep -v 'UTS_VERSION\|LINUX_COMPILE_TIME' $TARGET > .tmpver.1 && \
|
||||
grep -v 'UTS_VERSION\|LINUX_COMPILE_TIME' .tmpcompile > .tmpver.2 && \
|
||||
grep -v 'UTS_VERSION' $TARGET > .tmpver.1 && \
|
||||
grep -v 'UTS_VERSION' .tmpcompile > .tmpver.2 && \
|
||||
cmp -s .tmpver.1 .tmpver.2; then
|
||||
rm -f .tmpcompile
|
||||
else
|
||||
|
Reference in New Issue
Block a user