]> nv-tegra.nvidia Code Review - linux-2.6.git/blobdiff - Makefile
CRED: Wrap task credential accesses in the JFS filesystem
[linux-2.6.git] / Makefile
index feca34c26145a8eb3b354cedf2e311fb1061279e..29abe62ccbad27d9ebb7ac45460cc2ef42e54c5a 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -1,8 +1,8 @@
 VERSION = 2
 PATCHLEVEL = 6
-SUBLEVEL = 23
-EXTRAVERSION =
-NAME = Arr Matey! A Hairy Bilge Rat!
+SUBLEVEL = 28
+EXTRAVERSION = -rc3
+NAME = Killer Bat of Doom
 
 # *DOCUMENTATION*
 # To see a list of typical targets execute "make help"
@@ -12,7 +12,7 @@ NAME = Arr Matey! A Hairy Bilge Rat!
 
 # Do not:
 # o  use make's built-in rules and variables
-#    (this increases performance and avoid hard-to-debug behavour);
+#    (this increases performance and avoids hard-to-debug behaviour);
 # o  print "Entering directory ...";
 MAKEFLAGS += -rR --no-print-directory
 
@@ -108,6 +108,9 @@ endif
 PHONY := _all
 _all:
 
+# Cancel implicit rules on top Makefile
+$(CURDIR)/Makefile Makefile: ;
+
 ifneq ($(KBUILD_OUTPUT),)
 # Invoke a second make in the output directory, passing relevant variables
 # check that the output directory actually exists
@@ -115,13 +118,10 @@ saved-output := $(KBUILD_OUTPUT)
 KBUILD_OUTPUT := $(shell cd $(KBUILD_OUTPUT) && /bin/pwd)
 $(if $(KBUILD_OUTPUT),, \
      $(error output directory "$(saved-output)" does not exist))
-# Check that OUTPUT directory is not the same as where we have kernel src
-$(if $(filter-out $(KBUILD_OUTPUT),$(shell /bin/pwd)),, \
-     $(error Output directory (O=...) specifies kernel src dir))
 
 PHONY += $(MAKECMDGOALS) sub-make
 
-$(filter-out _all sub-make,$(MAKECMDGOALS)) _all: sub-make
+$(filter-out _all sub-make $(CURDIR)/Makefile, $(MAKECMDGOALS)) _all: sub-make
        $(Q)@:
 
 sub-make: FORCE
@@ -168,7 +168,8 @@ export srctree objtree VPATH TOPDIR
 SUBARCH := $(shell uname -m | sed -e s/i.86/i386/ -e s/sun4u/sparc64/ \
                                  -e s/arm.*/arm/ -e s/sa110/arm/ \
                                  -e s/s390x/s390/ -e s/parisc64/parisc/ \
-                                 -e s/ppc.*/powerpc/ -e s/mips.*/mips/ )
+                                 -e s/ppc.*/powerpc/ -e s/mips.*/mips/ \
+                                 -e s/sh.*/sh/ )
 
 # Cross compiling and selecting different set of gcc/bin-utils
 # ---------------------------------------------------------------------------
@@ -188,7 +189,7 @@ SUBARCH := $(shell uname -m | sed -e s/i.86/i386/ -e s/sun4u/sparc64/ \
 # Alternatively CROSS_COMPILE can be set in the environment.
 # Default value for CROSS_COMPILE is not to prefix executables
 # Note: Some architectures assign CROSS_COMPILE in their arch/*/Makefile
-
+export KBUILD_BUILDHOST := $(SUBARCH)
 ARCH           ?= $(SUBARCH)
 CROSS_COMPILE  ?=
 
@@ -196,6 +197,21 @@ CROSS_COMPILE      ?=
 UTS_MACHINE    := $(ARCH)
 SRCARCH        := $(ARCH)
 
+# Additional ARCH settings for x86
+ifeq ($(ARCH),i386)
+        SRCARCH := x86
+endif
+ifeq ($(ARCH),x86_64)
+        SRCARCH := x86
+endif
+
+# Where to locate arch specific headers
+ifeq ($(ARCH),sparc64)
+       hdr-arch  := sparc
+else
+       hdr-arch  := $(SRCARCH)
+endif
+
 KCONFIG_CONFIG ?= .config
 
 # SHELL used by kbuild
@@ -282,7 +298,8 @@ export quiet Q KBUILD_VERBOSE
 # Look for make include files relative to root of kernel src
 MAKEFLAGS += --include-dir=$(srctree)
 
-# We need some generic definitions.
+# We need some generic definitions (do not try to remake the file).
+$(srctree)/scripts/Kbuild.include: ;
 include $(srctree)/scripts/Kbuild.include
 
 # Make variables (CC, etc...)
@@ -316,7 +333,8 @@ AFLAGS_KERNEL       =
 # Needed to be compatible with the O= option
 LINUXINCLUDE    := -Iinclude \
                    $(if $(KBUILD_SRC),-Iinclude2 -I$(srctree)/include) \
-                  -include include/linux/autoconf.h
+                   -I$(srctree)/arch/$(hdr-arch)/include               \
+                   -include include/linux/autoconf.h
 
 KBUILD_CPPFLAGS := -D__KERNEL__ $(LINUXINCLUDE)
 
@@ -418,8 +436,8 @@ ifeq ($(config-targets),1)
 # Read arch specific Makefile to set KBUILD_DEFCONFIG as needed.
 # KBUILD_DEFCONFIG may point out an alternative default configuration
 # used for 'make defconfig'
-include $(srctree)/arch/$(ARCH)/Makefile
-export KBUILD_DEFCONFIG
+include $(srctree)/arch/$(SRCARCH)/Makefile
+export KBUILD_DEFCONFIG KBUILD_KCONFIG
 
 config %config: scripts_basic outputmakefile FORCE
        $(Q)mkdir -p include/linux include/config
@@ -440,7 +458,7 @@ scripts: scripts_basic include/config/auto.conf
 
 # Objects we will link into vmlinux / subdirs we need to visit
 init-y         := init/
-drivers-y      := drivers/ sound/
+drivers-y      := drivers/ sound/ firmware/
 net-y          := net/
 libs-y         := lib/
 core-y         := usr/
@@ -497,7 +515,15 @@ else
 KBUILD_CFLAGS  += -O2
 endif
 
-include $(srctree)/arch/$(ARCH)/Makefile
+include $(srctree)/arch/$(SRCARCH)/Makefile
+
+ifneq (CONFIG_FRAME_WARN,0)
+KBUILD_CFLAGS += $(call cc-option,-Wframe-larger-than=${CONFIG_FRAME_WARN})
+endif
+
+# Force gcc to behave correct even for buggy distributions
+# Arch Makefiles may override this setting
+KBUILD_CFLAGS += $(call cc-option, -fno-stack-protector)
 
 ifdef CONFIG_FRAME_POINTER
 KBUILD_CFLAGS  += -fno-omit-frame-pointer -fno-optimize-sibling-calls
@@ -510,8 +536,14 @@ KBUILD_CFLAGS      += -g
 KBUILD_AFLAGS  += -gdwarf-2
 endif
 
-# Force gcc to behave correct even for buggy distributions
-KBUILD_CFLAGS         += $(call cc-option, -fno-stack-protector)
+ifdef CONFIG_FUNCTION_TRACER
+KBUILD_CFLAGS  += -pg
+endif
+
+# We trigger additional mismatches with less inlining
+ifdef CONFIG_DEBUG_SECTION_MISMATCH
+KBUILD_CFLAGS += $(call cc-option, -fno-inline-functions-called-once)
+endif
 
 # arch Makefile may override CC so keep this after arch Makefile is included
 NOSTDINC_FLAGS += -nostdinc -isystem $(shell $(CC) -print-file-name=include)
@@ -524,9 +556,22 @@ KBUILD_CFLAGS += $(call cc-option,-Wdeclaration-after-statement,)
 KBUILD_CFLAGS += $(call cc-option,-Wno-pointer-sign,)
 
 # Add user supplied CPPFLAGS, AFLAGS and CFLAGS as the last assignments
-KBUILD_CPPFLAGS += $(CPPFLAGS)
-KBUILD_AFLAGS   += $(AFLAGS)
-KBUILD_CFLAGS   += $(CFLAGS)
+# But warn user when we do so
+warn-assign = \
+$(warning "WARNING: Appending $$K$(1) ($(K$(1))) from $(origin K$(1)) to kernel $$$(1)")
+
+ifneq ($(KCPPFLAGS),)
+        $(call warn-assign,CPPFLAGS)
+        KBUILD_CPPFLAGS += $(KCPPFLAGS)
+endif
+ifneq ($(KAFLAGS),)
+        $(call warn-assign,AFLAGS)
+        KBUILD_AFLAGS += $(KAFLAGS)
+endif
+ifneq ($(KCFLAGS),)
+        $(call warn-assign,CFLAGS)
+        KBUILD_CFLAGS += $(KCFLAGS)
+endif
 
 # Use --build-id when available.
 LDFLAGS_BUILD_ID = $(patsubst -Wl$(comma)%,%,\
@@ -761,7 +806,7 @@ endif # ifdef CONFIG_KALLSYMS
 quiet_cmd_vmlinux-modpost = LD      $@
       cmd_vmlinux-modpost = $(LD) $(LDFLAGS) -r -o $@                          \
         $(vmlinux-init) --start-group $(vmlinux-main) --end-group             \
-        $(filter-out $(vmlinux-init) $(vmlinux-main) $(vmlinux-lds) FORCE ,$^)
+        $(filter-out $(vmlinux-init) $(vmlinux-main) FORCE ,$^)
 define rule_vmlinux-modpost
        :
        +$(call cmd,vmlinux-modpost)
@@ -770,15 +815,27 @@ define rule_vmlinux-modpost
 endef
 
 # vmlinux image - including updated kernel symbols
-vmlinux: $(vmlinux-lds) $(vmlinux-init) $(vmlinux-main) $(kallsyms.o) vmlinux.o FORCE
+vmlinux: $(vmlinux-lds) $(vmlinux-init) $(vmlinux-main) vmlinux.o $(kallsyms.o) FORCE
 ifdef CONFIG_HEADERS_CHECK
        $(Q)$(MAKE) -f $(srctree)/Makefile headers_check
+endif
+ifdef CONFIG_SAMPLES
+       $(Q)$(MAKE) $(build)=samples
+endif
+ifdef CONFIG_BUILD_DOCSRC
+       $(Q)$(MAKE) $(build)=Documentation
 endif
        $(call vmlinux-modpost)
        $(call if_changed_rule,vmlinux__)
        $(Q)rm -f .old_version
 
-vmlinux.o: $(vmlinux-lds) $(vmlinux-init) $(vmlinux-main) $(kallsyms.o) FORCE
+# build vmlinux.o first to catch section mismatch errors early
+ifdef CONFIG_KALLSYMS
+.tmp_vmlinux1: vmlinux.o
+endif
+
+modpost-init := $(filter-out init/built-in.o, $(vmlinux-init))
+vmlinux.o: $(modpost-init) $(vmlinux-main) FORCE
        $(call if_changed_rule,vmlinux-modpost)
 
 # The actual objects are generated when descending, 
@@ -875,8 +932,10 @@ ifneq ($(KBUILD_SRC),)
                echo "  in the '$(srctree)' directory.";\
                /bin/false; \
        fi;
-       $(Q)if [ ! -d include2 ]; then mkdir -p include2; fi;
-       $(Q)ln -fsn $(srctree)/include/asm-$(SRCARCH) include2/asm
+       $(Q)if [ ! -d include2 ]; then                                  \
+           mkdir -p include2;                                          \
+           ln -fsn $(srctree)/include/asm-$(SRCARCH) include2/asm;     \
+       fi
 endif
 
 # prepare2 creates a makefile if using a separate output directory
@@ -884,10 +943,7 @@ prepare2: prepare3 outputmakefile
 
 prepare1: prepare2 include/linux/version.h include/linux/utsrelease.h \
                    include/asm include/config/auto.conf
-ifneq ($(KBUILD_MODULES),)
-       $(Q)mkdir -p $(MODVERDIR)
-       $(Q)rm -f $(MODVERDIR)/*
-endif
+       $(cmd_crmodverdir)
 
 archprepare: prepare1 scripts_basic
 
@@ -905,22 +961,39 @@ export CPPFLAGS_vmlinux.lds += -P -C -U$(ARCH)
 
 # The asm symlink changes when $(ARCH) changes.
 # Detect this and ask user to run make mrproper
-
-include/asm: FORCE
-       $(Q)set -e; asmlink=`readlink include/asm | cut -d '-' -f 2`;   \
-       if [ -L include/asm ]; then                                     \
-               if [ "$$asmlink" != "$(SRCARCH)" ]; then                \
+# If asm is a stale symlink (point to dir that does not exist) remove it
+define check-symlink
+       set -e;                                                            \
+       if [ -L include/asm ]; then                                        \
+               asmlink=`readlink include/asm | cut -d '-' -f 2`;          \
+               if [ "$$asmlink" != "$(SRCARCH)" ]; then                   \
                        echo "ERROR: the symlink $@ points to asm-$$asmlink but asm-$(SRCARCH) was expected"; \
                        echo "       set ARCH or save .config and run 'make mrproper' to fix it";             \
-                       exit 1;                                         \
-               fi;                                                     \
-       else                                                            \
-               echo '  SYMLINK $@ -> include/asm-$(SRCARCH)';          \
-               if [ ! -d include ]; then                               \
-                       mkdir -p include;                               \
-               fi;                                                     \
-               ln -fsn asm-$(SRCARCH) $@;                              \
+                       exit 1;                                            \
+               fi;                                                        \
+               test -e $$asmlink || rm include/asm;                       \
+       elif [ -d include/asm ]; then                                      \
+               echo "ERROR: $@ is a directory but a symlink was expected";\
+               exit 1;                                                    \
+       fi
+endef
+
+# We create the target directory of the symlink if it does
+# not exist so the test in chack-symlink works and we have a
+# directory for generated filesas used by some architectures.
+define create-symlink
+       if [ ! -L include/asm ]; then                                      \
+                       echo '  SYMLINK $@ -> include/asm-$(SRCARCH)';     \
+                       if [ ! -d include/asm-$(SRCARCH) ]; then           \
+                               mkdir -p include/asm-$(SRCARCH);           \
+                       fi;                                                \
+                       ln -fsn asm-$(SRCARCH) $@;                         \
        fi
+endef
+
+include/asm: FORCE
+       $(Q)$(check-symlink)
+       $(Q)$(create-symlink)
 
 # Generate some files
 # ---------------------------------------------------------------------------
@@ -955,38 +1028,55 @@ PHONY += depend dep
 depend dep:
        @echo '*** Warning: make $@ is unnecessary now.'
 
+# ---------------------------------------------------------------------------
+# Firmware install
+INSTALL_FW_PATH=$(INSTALL_MOD_PATH)/lib/firmware
+export INSTALL_FW_PATH
+
+PHONY += firmware_install
+firmware_install: FORCE
+       @mkdir -p $(objtree)/firmware
+       $(Q)$(MAKE) -f $(srctree)/scripts/Makefile.fwinst obj=firmware __fw_install
+
 # ---------------------------------------------------------------------------
 # Kernel headers
-INSTALL_HDR_PATH=$(objtree)/usr
-export INSTALL_HDR_PATH
 
-HDRFILTER=generic i386 x86_64
-HDRARCHES=$(filter-out $(HDRFILTER),$(patsubst $(srctree)/include/asm-%/Kbuild,%,$(wildcard $(srctree)/include/asm-*/Kbuild)))
+#Default location for installed headers
+export INSTALL_HDR_PATH = $(objtree)/usr
 
-PHONY += headers_install_all
-headers_install_all: include/linux/version.h scripts_basic FORCE
+hdr-inst := -rR -f $(srctree)/scripts/Makefile.headersinst obj
+# Find out where the Kbuild file is located to support
+# arch/$(ARCH)/include/asm
+hdr-dir = $(strip                                                         \
+          $(if $(wildcard $(srctree)/arch/$(hdr-arch)/include/asm/Kbuild), \
+               arch/$(hdr-arch)/include/asm, include/asm-$(hdr-arch)))
+
+# If we do an all arch process set dst to asm-$(hdr-arch)
+hdr-dst = $(if $(KBUILD_HEADERS), dst=include/asm-$(hdr-arch), dst=include/asm)
+
+PHONY += __headers
+__headers: include/linux/version.h scripts_basic FORCE
        $(Q)$(MAKE) $(build)=scripts scripts/unifdef
-       $(Q)for arch in $(HDRARCHES); do \
-        $(MAKE) ARCH=$$arch -f $(srctree)/scripts/Makefile.headersinst obj=include BIASMDIR=-bi-$$arch ;\
-        done
+
+PHONY += headers_install_all
+headers_install_all:
+       $(Q)$(CONFIG_SHELL) $(srctree)/scripts/headers.sh install
 
 PHONY += headers_install
-headers_install: include/linux/version.h scripts_basic FORCE
-       @if [ ! -r $(srctree)/include/asm-$(SRCARCH)/Kbuild ]; then \
-         echo '*** Error: Headers not exportable for this architecture ($(SRCARCH))'; \
-         exit 1 ; fi
-       $(Q)$(MAKE) $(build)=scripts scripts/unifdef
-       $(Q)$(MAKE) -f $(srctree)/scripts/Makefile.headersinst ARCH=$(SRCARCH) obj=include
+headers_install: __headers
+       $(if $(wildcard $(srctree)/$(hdr-dir)/Kbuild),, \
+       $(error Headers not exportable for the $(SRCARCH) architecture))
+       $(Q)$(MAKE) $(hdr-inst)=include
+       $(Q)$(MAKE) $(hdr-inst)=$(hdr-dir) $(hdr-dst)
 
 PHONY += headers_check_all
 headers_check_all: headers_install_all
-       $(Q)for arch in $(HDRARCHES); do \
-        $(MAKE) ARCH=$$arch -f $(srctree)/scripts/Makefile.headersinst obj=include BIASMDIR=-bi-$$arch HDRCHECK=1 ;\
-        done
+       $(Q)$(CONFIG_SHELL) $(srctree)/scripts/headers.sh check
 
 PHONY += headers_check
 headers_check: headers_install
-       $(Q)$(MAKE) -f $(srctree)/scripts/Makefile.headersinst ARCH=$(SRCARCH) obj=include HDRCHECK=1
+       $(Q)$(MAKE) $(hdr-inst)=include HDRCHECK=1
+       $(Q)$(MAKE) $(hdr-inst)=$(hdr-dir) $(hdr-dst) HDRCHECK=1
 
 # ---------------------------------------------------------------------------
 # Modules
@@ -998,11 +1088,17 @@ ifdef CONFIG_MODULES
 all: modules
 
 #      Build modules
+#
+#      A module can be listed more than once in obj-m resulting in
+#      duplicate lines in modules.order files.  Those are removed
+#      using awk while concatenating to the final file.
 
 PHONY += modules
 modules: $(vmlinux-dirs) $(if $(KBUILD_BUILTIN),vmlinux)
+       $(Q)$(AWK) '!x[$$0]++' $(vmlinux-dirs:%=$(objtree)/%/modules.order) > $(objtree)/modules.order
        @echo '  Building modules, stage 2.';
        $(Q)$(MAKE) -f $(srctree)/scripts/Makefile.modpost
+       $(Q)$(MAKE) -f $(srctree)/scripts/Makefile.fwinst obj=firmware __fw_modbuild
 
 
 # Target to prepare building external modules
@@ -1028,21 +1124,16 @@ _modinst_:
                rm -f $(MODLIB)/build ; \
                ln -s $(objtree) $(MODLIB)/build ; \
        fi
+       @cp -f $(objtree)/modules.order $(MODLIB)/
        $(Q)$(MAKE) -f $(srctree)/scripts/Makefile.modinst
 
-# If System.map exists, run depmod.  This deliberately does not have a
-# dependency on System.map since that would run the dependency tree on
-# vmlinux.  This depmod is only for convenience to give the initial
+# This depmod is only for convenience to give the initial
 # boot a modules.dep even before / is mounted read-write.  However the
 # boot script depmod is the master version.
-ifeq "$(strip $(INSTALL_MOD_PATH))" ""
-depmod_opts    :=
-else
-depmod_opts    := -b $(INSTALL_MOD_PATH) -r
-endif
 PHONY += _modinst_post
 _modinst_post: _modinst_
-       if [ -r System.map -a -x $(DEPMOD) ]; then $(DEPMOD) -ae -F System.map $(depmod_opts) $(KERNELRELEASE); fi
+       $(Q)$(MAKE) -f $(srctree)/scripts/Makefile.fwinst obj=firmware __fw_modinst
+       $(call cmd,depmod)
 
 else # CONFIG_MODULES
 
@@ -1076,13 +1167,14 @@ MRPROPER_DIRS  += include/config include2 usr/include
 MRPROPER_FILES += .config .config.old include/asm .version .old_version \
                   include/linux/autoconf.h include/linux/version.h      \
                   include/linux/utsrelease.h                            \
-                 Module.symvers tags TAGS cscope*
+                  include/linux/bounds.h include/asm*/asm-offsets.h     \
+                 Module.symvers Module.markers tags TAGS cscope*
 
 # clean - Delete most, but leave enough to build external modules
 #
 clean: rm-dirs  := $(CLEAN_DIRS)
 clean: rm-files := $(CLEAN_FILES)
-clean-dirs      := $(addprefix _clean_,$(srctree) $(vmlinux-alldirs))
+clean-dirs      := $(addprefix _clean_,$(srctree) $(vmlinux-alldirs) Documentation)
 
 PHONY += $(clean-dirs) clean archclean
 $(clean-dirs):
@@ -1094,7 +1186,8 @@ clean: archclean $(clean-dirs)
        @find . $(RCS_FIND_IGNORE) \
                \( -name '*.[oas]' -o -name '*.ko' -o -name '.*.cmd' \
                -o -name '.*.d' -o -name '.*.tmp' -o -name '*.mod.c' \
-               -o -name '*.symtypes' \) \
+               -o -name '*.symtypes' -o -name 'modules.order' \
+               -o -name 'Module.markers' -o -name '.tmp_*.o.*' \) \
                -type f -print | xargs rm -f
 
 # mrproper - Delete all generated files, including .config
@@ -1138,8 +1231,10 @@ rpm: include/config/kernel.release FORCE
 # Brief documentation of the typical targets used
 # ---------------------------------------------------------------------------
 
-boards := $(wildcard $(srctree)/arch/$(ARCH)/configs/*_defconfig)
+boards := $(wildcard $(srctree)/arch/$(SRCARCH)/configs/*_defconfig)
 boards := $(notdir $(boards))
+board-dirs := $(dir $(wildcard $(srctree)/arch/$(SRCARCH)/configs/*/*_defconfig))
+board-dirs := $(sort $(notdir $(board-dirs:/=)))
 
 help:
        @echo  'Cleaning targets:'
@@ -1156,41 +1251,46 @@ help:
        @echo  '* vmlinux         - Build the bare kernel'
        @echo  '* modules         - Build all modules'
        @echo  '  modules_install - Install all modules to INSTALL_MOD_PATH (default: /)'
+       @echo  '  firmware_install- Install all firmware to INSTALL_FW_PATH'
+       @echo  '                    (default: $$(INSTALL_MOD_PATH)/lib/firmware)'
        @echo  '  dir/            - Build all files in dir and below'
        @echo  '  dir/file.[ois]  - Build specified target only'
        @echo  '  dir/file.ko     - Build module including final link'
-       @echo  '  rpm             - Build a kernel as an RPM package'
+       @echo  '  prepare         - Set up for building external modules'
        @echo  '  tags/TAGS       - Generate tags file for editors'
        @echo  '  cscope          - Generate cscope index'
        @echo  '  kernelrelease   - Output the release version string'
        @echo  '  kernelversion   - Output the version stored in Makefile'
-       @if [ -r $(srctree)/include/asm-$(SRCARCH)/Kbuild ]; then \
-        echo  '  headers_install - Install sanitised kernel headers to INSTALL_HDR_PATH'; \
+       @echo  '  headers_install - Install sanitised kernel headers to INSTALL_HDR_PATH'; \
         echo  '                    (default: $(INSTALL_HDR_PATH))'; \
-        fi
-       @echo  ''
+        echo  ''
        @echo  'Static analysers'
        @echo  '  checkstack      - Generate a list of stack hogs'
        @echo  '  namespacecheck  - Name space analysis on compiled kernel'
+       @echo  '  versioncheck    - Sanity check on version.h usage'
+       @echo  '  includecheck    - Check for duplicate included header files'
        @echo  '  export_report   - List the usages of all exported symbols'
-       @if [ -r $(srctree)/include/asm-$(SRCARCH)/Kbuild ]; then \
-        echo  '  headers_check   - Sanity check on exported headers'; \
-        fi
-       @echo  ''
+       @echo  '  headers_check   - Sanity check on exported headers'; \
+        echo  ''
        @echo  'Kernel packaging:'
        @$(MAKE) $(build)=$(package-dir) help
        @echo  ''
        @echo  'Documentation targets:'
        @$(MAKE) -f $(srctree)/Documentation/DocBook/Makefile dochelp
        @echo  ''
-       @echo  'Architecture specific targets ($(ARCH)):'
+       @echo  'Architecture specific targets ($(SRCARCH)):'
        @$(if $(archhelp),$(archhelp),\
-               echo '  No architecture specific help defined for $(ARCH)')
+               echo '  No architecture specific help defined for $(SRCARCH)')
        @echo  ''
        @$(if $(boards), \
                $(foreach b, $(boards), \
                printf "  %-24s - Build for %s\\n" $(b) $(subst _defconfig,,$(b));) \
                echo '')
+       @$(if $(board-dirs), \
+               $(foreach b, $(board-dirs), \
+               printf "  %-16s - Show %s-specific targets\\n" help-$(b) $(b);) \
+               printf "  %-16s - Show all of the above\\n" help-boards; \
+               echo '')
 
        @echo  '  make V=0|1 [targets] 0 => quiet build (default), 1 => verbose build'
        @echo  '  make V=2   [targets] 2 => give reason for rebuild of target'
@@ -1202,6 +1302,20 @@ help:
        @echo  'For further info see the ./README file'
 
 
+help-board-dirs := $(addprefix help-,$(board-dirs))
+
+help-boards: $(help-board-dirs)
+
+boards-per-dir = $(notdir $(wildcard $(srctree)/arch/$(SRCARCH)/configs/$*/*_defconfig))
+
+$(help-board-dirs): help-%:
+       @echo  'Architecture specific targets ($(SRCARCH) $*):'
+       @$(if $(boards-per-dir), \
+               $(foreach b, $(boards-per-dir), \
+               printf "  %-24s - Build for %s\\n" $*/$(b) $(subst _defconfig,,$(b));) \
+               echo '')
+
+
 # Documentation targets
 # ---------------------------------------------------------------------------
 %docs: scripts_basic FORCE
@@ -1230,8 +1344,7 @@ else # KBUILD_EXTMOD
 KBUILD_MODULES := 1
 PHONY += crmodverdir
 crmodverdir:
-       $(Q)mkdir -p $(MODVERDIR)
-       $(Q)rm -f $(MODVERDIR)/*
+       $(cmd_crmodverdir)
 
 PHONY += $(objtree)/Module.symvers
 $(objtree)/Module.symvers:
@@ -1259,15 +1372,6 @@ _emodinst_:
        $(Q)mkdir -p $(MODLIB)/$(install-dir)
        $(Q)$(MAKE) -f $(srctree)/scripts/Makefile.modinst
 
-# Run depmod only is we have System.map and depmod is executable
-quiet_cmd_depmod = DEPMOD  $(KERNELRELEASE)
-      cmd_depmod = if [ -r System.map -a -x $(DEPMOD) ]; then \
-                      $(DEPMOD) -ae -F System.map             \
-                      $(if $(strip $(INSTALL_MOD_PATH)),      \
-                     -b $(INSTALL_MOD_PATH) -r)              \
-                     $(KERNELRELEASE);                       \
-                   fi
-
 PHONY += _emodinst_post
 _emodinst_post: _emodinst_
        $(call cmd,depmod)
@@ -1323,21 +1427,17 @@ else
 ALLINCLUDE_ARCHS := $(SRCARCH)
 endif
 else
-#Allow user to specify only ALLSOURCE_PATHS on the command line, keeping existing behavour.
+#Allow user to specify only ALLSOURCE_PATHS on the command line, keeping existing behaviour.
 ALLINCLUDE_ARCHS := $(ALLSOURCE_ARCHS)
 endif
 
-# Take care of arch/x86
-ifeq ($(ARCH), $(SRCARCH))
-ALLSOURCE_ARCHS := $(ARCH)
-else
-ALLSOURCE_ARCHS := $(ARCH) $(SRCARCH)
-endif
+ALLSOURCE_ARCHS := $(SRCARCH)
 
 define find-sources
         ( for arch in $(ALLSOURCE_ARCHS) ; do \
               find $(__srctree)arch/$${arch} $(RCS_FIND_IGNORE) \
-                   -name $1 -print; \
+                   -wholename $(__srctree)arch/$${arch}/include/asm -type d -prune \
+                   -o -name $1 -print; \
          done ; \
          find $(__srctree)security/selinux/include $(RCS_FIND_IGNORE) \
               -name $1 -print; \
@@ -1345,13 +1445,17 @@ define find-sources
               \( -name config -o -name 'asm-*' \) -prune \
               -o -name $1 -print; \
          for arch in $(ALLINCLUDE_ARCHS) ; do \
-              find $(__srctree)include/asm-$${arch} $(RCS_FIND_IGNORE) \
+              test -e $(__srctree)include/asm-$${arch} && \
+                 find $(__srctree)include/asm-$${arch} $(RCS_FIND_IGNORE) \
+                   -name $1 -print; \
+              test -e $(__srctree)arch/$${arch}/include/asm && \
+                find $(__srctree)arch/$${arch}/include/asm $(RCS_FIND_IGNORE) \
                    -name $1 -print; \
          done ; \
          find $(__srctree)include/asm-generic $(RCS_FIND_IGNORE) \
               -name $1 -print; \
          find $(__srctree) $(RCS_FIND_IGNORE) \
-              \( -name include -o -name arch \) -prune -o \
+              \( -name include -o -name arch -o -name '.tmp_*' \) -prune -o \
               -name $1 -print; \
          )
 endef
@@ -1370,13 +1474,14 @@ define xtags
        if $1 --version 2>&1 | grep -iq exuberant; then \
            $(all-sources) | xargs $1 -a \
                -I __initdata,__exitdata,__acquires,__releases \
+               -I __read_mostly,____cacheline_aligned,____cacheline_aligned_in_smp,____cacheline_internodealigned_in_smp \
                -I EXPORT_SYMBOL,EXPORT_SYMBOL_GPL \
                --extra=+f --c-kinds=+px \
                --regex-asm='/^ENTRY\(([^)]*)\).*/\1/'; \
            $(all-kconfigs) | xargs $1 -a \
                --langdef=kconfig \
                --language-force=kconfig \
-               --regex-kconfig='/^[[:blank:]]*config[[:blank:]]+([[:alnum:]_]+)/\1/'; \
+               --regex-kconfig='/^[[:blank:]]*(menu|)config[[:blank:]]+([[:alnum:]_]+)/\2/'; \
            $(all-defconfigs) | xargs -r $1 -a \
                --langdef=dotconfig \
                --language-force=dotconfig \
@@ -1384,7 +1489,7 @@ define xtags
        elif $1 --version 2>&1 | grep -iq emacs; then \
            $(all-sources) | xargs $1 -a; \
            $(all-kconfigs) | xargs $1 -a \
-               --regex='/^[ \t]*config[ \t]+\([a-zA-Z0-9_]+\)/\1/'; \
+               --regex='/^[ \t]*\(\(menu\)*config\)[ \t]+\([a-zA-Z0-9_]+\)/\3/'; \
            $(all-defconfigs) | xargs -r $1 -a \
                --regex='/^#?[ \t]?\(CONFIG_[a-zA-Z0-9_]+\)/\1/'; \
        else \
@@ -1396,7 +1501,7 @@ quiet_cmd_cscope-file = FILELST cscope.files
       cmd_cscope-file = (echo \-k; echo \-q; $(all-sources)) > cscope.files
 
 quiet_cmd_cscope = MAKE    cscope.out
-      cmd_cscope = cscope -b
+      cmd_cscope = cscope -b -f cscope.out
 
 cscope: FORCE
        $(call cmd,cscope-file)
@@ -1427,12 +1532,12 @@ tags: FORCE
 includecheck:
        find * $(RCS_FIND_IGNORE) \
                -name '*.[hcS]' -type f -print | sort \
-               | xargs $(PERL) -w scripts/checkincludes.pl
+               | xargs $(PERL) -w $(srctree)/scripts/checkincludes.pl
 
 versioncheck:
        find * $(RCS_FIND_IGNORE) \
                -name '*.[hcS]' -type f -print | sort \
-               | xargs $(PERL) -w scripts/checkversion.pl
+               | xargs $(PERL) -w $(srctree)/scripts/checkversion.pl
 
 namespacecheck:
        $(PERL) $(srctree)/scripts/namespace.pl
@@ -1467,7 +1572,7 @@ kernelversion:
 # Single targets
 # ---------------------------------------------------------------------------
 # Single targets are compatible with:
-# - build whith mixed source and output
+# - build with mixed source and output
 # - build with separate output dir 'make O=...'
 # - external modules
 #
@@ -1500,9 +1605,11 @@ endif
 
 # Modules
 / %/: prepare scripts FORCE
+       $(cmd_crmodverdir)
        $(Q)$(MAKE) KBUILD_MODULES=$(if $(CONFIG_MODULES),1) \
        $(build)=$(build-dir)
 %.ko: prepare scripts FORCE
+       $(cmd_crmodverdir)
        $(Q)$(MAKE) KBUILD_MODULES=$(if $(CONFIG_MODULES),1)   \
        $(build)=$(build-dir) $(@:.ko=.o)
        $(Q)$(MAKE) -f $(srctree)/scripts/Makefile.modpost
@@ -1516,6 +1623,19 @@ quiet_cmd_rmdirs = $(if $(wildcard $(rm-dirs)),CLEAN   $(wildcard $(rm-dirs)))
 quiet_cmd_rmfiles = $(if $(wildcard $(rm-files)),CLEAN   $(wildcard $(rm-files)))
       cmd_rmfiles = rm -f $(rm-files)
 
+# Run depmod only if we have System.map and depmod is executable
+quiet_cmd_depmod = DEPMOD  $(KERNELRELEASE)
+      cmd_depmod = \
+       if [ -r System.map -a -x $(DEPMOD) ]; then                              \
+               $(DEPMOD) -ae -F System.map                                     \
+               $(if $(strip $(INSTALL_MOD_PATH)), -b $(INSTALL_MOD_PATH) -r)   \
+               $(KERNELRELEASE);                                               \
+       fi
+
+# Create temporary dir for module support files
+# clean it up only when building all modules
+cmd_crmodverdir = $(Q)mkdir -p $(MODVERDIR) \
+                  $(if $(KBUILD_MODULES),; rm -f $(MODVERDIR)/*)
 
 a_flags = -Wp,-MD,$(depfile) $(KBUILD_AFLAGS) $(AFLAGS_KERNEL) \
          $(NOSTDINC_FLAGS) $(KBUILD_CPPFLAGS) \
@@ -1544,9 +1664,6 @@ endif     # skip-makefile
 PHONY += FORCE
 FORCE:
 
-# Cancel implicit rules on top Makefile, `-rR' will apply to sub-makes.
-Makefile: ;
-
 # Declare the contents of the .PHONY variable as phony.  We keep that
 # information in a variable se we can use it in if_changed and friends.
 .PHONY: $(PHONY)