From acbef459a663a8349ceb46b5a11ede50fa7909c7 Mon Sep 17 00:00:00 2001
From: Karl Hegbloom <hegbloom@pdx.edu>
Date: Sun, 19 Jun 2005 00:50:47 -0700
Subject: [PATCH] kbuild: make 'cscope -q' play well with cscope.el

I tried the Linux Makefile 'make cscope' target, and found that the
generated database is not compatible with 'cscope.el' under XEmacs.
The thing is that 'cscope.el' does not allow setting the command line
options to the 'cscope' commands it runs, and it errors with a message
about the options not matching the ones used to generate the index.

It turns out the cscope designers already thought of this.  The
options can be written into the "cscope.files".  The included patch
moves the "-q" and "-k" options from the 'cmd_cscope' to the
'cmd_cscope-file', echoing them into the top of the files listing.

Now the index is generated with the "-q" option, and when 'cscope.el'
performs it's search, it uses that argument as well.  Lookups are fast
and everyone is happy.

Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
---
 Makefile | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

(limited to 'Makefile')

diff --git a/Makefile b/Makefile
index 9cf07e7b9f88..8294cd73b3aa 100644
--- a/Makefile
+++ b/Makefile
@@ -1177,10 +1177,10 @@ define all-sources
 endef
 
 quiet_cmd_cscope-file = FILELST cscope.files
-      cmd_cscope-file = $(all-sources) > cscope.files
+      cmd_cscope-file = (echo \-k; echo \-q; $(all-sources)) > cscope.files
 
 quiet_cmd_cscope = MAKE    cscope.out
-      cmd_cscope = cscope -k -b -q
+      cmd_cscope = cscope -b
 
 cscope: FORCE
 	$(call cmd,cscope-file)
-- 
cgit v1.2.3


From a0674e88d9c150e016a69e78e735f48772314c53 Mon Sep 17 00:00:00 2001
From: Ian Campbell <ijc@hellion.org.uk>
Date: Thu, 23 Jun 2005 11:25:54 +0100
Subject: [PATCH] kbuild: allow cscope to index multiple architectures

I have a single source tree which I cross compile for a couple of
different architectures using ARHC=foo O=blah etc.

The existing cscope target is very handy but only indexes the current
$(ARCH), which is a pain since inevitably I'm interested in the other
one at any given time ;-). This patch allows me to pass a list of
architectures for cscope to index. e.g.
	make ALLSOURCE_ARCHS="i386 arm" cscope

This change also works for etags etc, and I presume it is just as useful
there.

Signed-off-by: Ian Campbell <ijc@hellion.org.uk>
Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
---
 Makefile | 14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)

(limited to 'Makefile')

diff --git a/Makefile b/Makefile
index 8294cd73b3aa..206b2833ee6b 100644
--- a/Makefile
+++ b/Makefile
@@ -1159,19 +1159,25 @@ else
 __srctree = $(srctree)/
 endif
 
+ALLSOURCE_ARCHS := $(ARCH)
+
 define all-sources
 	( find $(__srctree) $(RCS_FIND_IGNORE) \
 	       \( -name include -o -name arch \) -prune -o \
 	       -name '*.[chS]' -print; \
-	  find $(__srctree)arch/$(ARCH) $(RCS_FIND_IGNORE) \
-	       -name '*.[chS]' -print; \
+	  for ARCH in $(ALLSOURCE_ARCHS) ; do \
+	       find $(__srctree)arch/$${ARCH} $(RCS_FIND_IGNORE) \
+	            -name '*.[chS]' -print; \
+	  done ; \
 	  find $(__srctree)security/selinux/include $(RCS_FIND_IGNORE) \
 	       -name '*.[chS]' -print; \
 	  find $(__srctree)include $(RCS_FIND_IGNORE) \
 	       \( -name config -o -name 'asm-*' \) -prune \
 	       -o -name '*.[chS]' -print; \
-	  find $(__srctree)include/asm-$(ARCH) $(RCS_FIND_IGNORE) \
-	       -name '*.[chS]' -print; \
+	  for ARCH in $(ALLSOURCE_ARCHS) ; do \
+	       find $(__srctree)include/asm-$${ARCH} $(RCS_FIND_IGNORE) \
+	            -name '*.[chS]' -print; \
+	  done ; \
 	  find $(__srctree)include/asm-generic $(RCS_FIND_IGNORE) \
 	       -name '*.[chS]' -print )
 endef
-- 
cgit v1.2.3


From 33bc25eae40c100238a5abe8472cef0cd40226f1 Mon Sep 17 00:00:00 2001
From: Sam Ravnborg <sam@mars.(none)>
Date: Thu, 14 Jul 2005 20:19:08 +0000
Subject: kbuild: Add target debug_kallsyms

From: Keith Owens <kaos@ocs.com.au>

Make it easier to generate maps for debugging kallsyms problems.
debug_kallsyms is only a debugging target so no help or silent mode.

Signed-off-by: Keith Owens <kaos@ocs.com.au>
Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
---
 Makefile | 10 ++++++++++
 1 file changed, 10 insertions(+)

(limited to 'Makefile')

diff --git a/Makefile b/Makefile
index 206b2833ee6b..5d0ecf11bfa0 100644
--- a/Makefile
+++ b/Makefile
@@ -722,6 +722,16 @@ quiet_cmd_kallsyms = KSYM    $@
 # Needs to visit scripts/ before $(KALLSYMS) can be used.
 $(KALLSYMS): scripts ;
 
+# Generate some data for debugging strange kallsyms problems
+debug_kallsyms: .tmp_map$(last_kallsyms)
+
+.tmp_map%: .tmp_vmlinux% FORCE
+	($(OBJDUMP) -h $< | $(AWK) '/^ +[0-9]/{print $$4 " 0 " $$2}'; $(NM) $<) | sort > $@
+
+.tmp_map3: .tmp_map2
+
+.tmp_map2: .tmp_map1
+
 endif # ifdef CONFIG_KALLSYMS
 
 # vmlinux image - including updated kernel symbols
-- 
cgit v1.2.3


From d80e22460968ec7986c82fd7d207ebe3de59e03d Mon Sep 17 00:00:00 2001
From: Sam Ravnborg <sam@mars.(none)>
Date: Thu, 14 Jul 2005 20:22:39 +0000
Subject: kbuild: Don't fail if include/asm symlink exists

From: Andreas Gruenbacher <agruen@suse.de>

We're having the following situation: There are user-space applications
that include kernel headers directly. With a completely unconfigured
/usr/src/linux tree, including most headers fails because essential
files are not there:

	include/asm
	include/linux/autoconf.h
	include/linux/version.h

So we create these files. On the other hand, we want to use
/usr/src/linux as read-only source for building kernels or additional
modules. Now when building a kernel with a separate output directory
(O=), there is a check in the main makefile for the include/asm symlink.
There is no real need for this check: if we ensure that
$(objdir)/include/asm is always created as the patch does,
$(srctree)/include/asm becomes irrelevant.

Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
---
 Makefile | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

(limited to 'Makefile')

diff --git a/Makefile b/Makefile
index 5d0ecf11bfa0..a8d41b7d549d 100644
--- a/Makefile
+++ b/Makefile
@@ -767,7 +767,7 @@ $(vmlinux-dirs): prepare-all scripts
 prepare2:
 ifneq ($(KBUILD_SRC),)
 	@echo '  Using $(srctree) as source for kernel'
-	$(Q)if [ -h $(srctree)/include/asm -o -f $(srctree)/.config ]; then \
+	$(Q)if [ -f $(srctree)/.config ]; then \
 		echo "  $(srctree) is not clean, please run 'make mrproper'";\
 		echo "  in the '$(srctree)' directory.";\
 		/bin/false; \
@@ -779,7 +779,8 @@ endif
 # prepare1 creates a makefile if using a separate output directory
 prepare1: prepare2 outputmakefile
 
-prepare0: prepare1 include/linux/version.h include/asm include/config/MARKER
+prepare0: prepare1 include/linux/version.h $(objtree)/include/asm \
+                   include/config/MARKER
 ifneq ($(KBUILD_MODULES),)
 	$(Q)rm -rf $(MODVERDIR)
 	$(Q)mkdir -p $(MODVERDIR)
@@ -818,7 +819,7 @@ export CPPFLAGS_vmlinux.lds += -P -C -U$(ARCH)
 #	hard to detect, but I suppose "make mrproper" is a good idea
 #	before switching between archs anyway.
 
-include/asm:
+$(objtree)/include/asm:
 	@echo '  SYMLINK $@ -> include/asm-$(ARCH)'
 	$(Q)if [ ! -d include ]; then mkdir -p include; fi;
 	@ln -fsn asm-$(ARCH) $@
-- 
cgit v1.2.3


From 946dc121d7d1c606f6bbeb8ae778963a1e2ff59c Mon Sep 17 00:00:00 2001
From: Sam Ravnborg <sam@mars.(none)>
Date: Thu, 14 Jul 2005 20:28:49 +0000
Subject: kbuild: fix make O=... build

It fixes the following error:

make[1]: *** No rule to make target `include/asm', needed by `arch/alpha/kernel/asm-offsets.s'.  Stop.

Reported by:
From: Jan Dittmer <j.dittmer@portrix.net>
Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
---
 Makefile | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

(limited to 'Makefile')

diff --git a/Makefile b/Makefile
index a8d41b7d549d..38384f898d61 100644
--- a/Makefile
+++ b/Makefile
@@ -779,7 +779,7 @@ endif
 # prepare1 creates a makefile if using a separate output directory
 prepare1: prepare2 outputmakefile
 
-prepare0: prepare1 include/linux/version.h $(objtree)/include/asm \
+prepare0: prepare1 include/linux/version.h include/asm \
                    include/config/MARKER
 ifneq ($(KBUILD_MODULES),)
 	$(Q)rm -rf $(MODVERDIR)
@@ -819,7 +819,7 @@ export CPPFLAGS_vmlinux.lds += -P -C -U$(ARCH)
 #	hard to detect, but I suppose "make mrproper" is a good idea
 #	before switching between archs anyway.
 
-$(objtree)/include/asm:
+include/asm:
 	@echo '  SYMLINK $@ -> include/asm-$(ARCH)'
 	$(Q)if [ ! -d include ]; then mkdir -p include; fi;
 	@ln -fsn asm-$(ARCH) $@
-- 
cgit v1.2.3


From ce454d4d7278b815dcee957653ce388146484f5f Mon Sep 17 00:00:00 2001
From: Tom Rini <trini@kernel.crashing.org>
Date: Fri, 15 Jul 2005 07:56:36 -0700
Subject: [PATCH] kbuild: When checking depmod version, redirect stderr

When running depmod to check for the correct version number, extra
output we don't need to see, such as "depmod: QM_MODULES: Function not
implemented" may show up.  Redirect stderr to /dev/null as the version
information that we do care about comes to stdout.

Signed-off-by: Tom Rini <trini@kernel.crashing.org>
Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
---
 Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

(limited to 'Makefile')

diff --git a/Makefile b/Makefile
index 38384f898d61..5185c917077b 100644
--- a/Makefile
+++ b/Makefile
@@ -886,7 +886,7 @@ modules_install: _modinst_ _modinst_post
 
 .PHONY: _modinst_
 _modinst_:
-	@if [ -z "`$(DEPMOD) -V | grep module-init-tools`" ]; then \
+	@if [ -z "`$(DEPMOD) -V 2>/dev/null | grep module-init-tools`" ]; then \
 		echo "Warning: you may need to install module-init-tools"; \
 		echo "See http://www.codemonkey.org.uk/docs/post-halloween-2.6.txt";\
 		sleep 1; \
-- 
cgit v1.2.3


From 3c521e06fad4b4b7fe4811fb8363d12cf49f40a2 Mon Sep 17 00:00:00 2001
From: Olaf Hering <olh@suse.de>
Date: Thu, 21 Jul 2005 21:02:09 +0200
Subject: [PATCH] kbuild: add -Wundef to global CFLAGS

A recent change to the aic scsi driver removed two defines to detect
endianness. cpp handles undefined strings as 0. As a result, the test turned
into #if 0 == 0 and the wrong code was selected.
Adding -Wundef to global CFLAGS will catch such errors.

Signed-off-by: Olaf Hering <olh@suse.de>
Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
---
 Makefile | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

(limited to 'Makefile')

diff --git a/Makefile b/Makefile
index 5185c917077b..423397f03921 100644
--- a/Makefile
+++ b/Makefile
@@ -203,7 +203,7 @@ CONFIG_SHELL := $(shell if [ -x "$$BASH" ]; then echo $$BASH; \
 
 HOSTCC  	= gcc
 HOSTCXX  	= g++
-HOSTCFLAGS	= -Wall -Wstrict-prototypes -O2 -fomit-frame-pointer
+HOSTCFLAGS	= -Wall -Wundef -Wstrict-prototypes -O2 -fomit-frame-pointer
 HOSTCXXFLAGS	= -O2
 
 # 	Decide whether to build built-in, modular, or both.
@@ -348,7 +348,7 @@ LINUXINCLUDE    := -Iinclude \
 
 CPPFLAGS        := -D__KERNEL__ $(LINUXINCLUDE)
 
-CFLAGS 		:= -Wall -Wstrict-prototypes -Wno-trigraphs \
+CFLAGS 		:= -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs \
 	  	   -fno-strict-aliasing -fno-common \
 		   -ffreestanding
 AFLAGS		:= -D__ASSEMBLY__
-- 
cgit v1.2.3


From 43af5f23354dbd67d2fd2d523eefad8053ac388b Mon Sep 17 00:00:00 2001
From: Sam Ravnborg <sam@mars.(none)>
Date: Mon, 25 Jul 2005 12:40:34 +0000
Subject: kbuild: drop -Wundef from HOSTCFLAGS for now

-Wundef caused warnings in the bison generated code in kconfig.
Updating to a newer bison (1.875d) did not fix it. The alternatives
was to correct the autogenerated code or drop -Wundef.
For now -Wundef is dropped from HOSTCFLAGS.

Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
---
---
 Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

(limited to 'Makefile')

diff --git a/Makefile b/Makefile
index 423397f03921..77198748ad71 100644
--- a/Makefile
+++ b/Makefile
@@ -203,7 +203,7 @@ CONFIG_SHELL := $(shell if [ -x "$$BASH" ]; then echo $$BASH; \
 
 HOSTCC  	= gcc
 HOSTCXX  	= g++
-HOSTCFLAGS	= -Wall -Wundef -Wstrict-prototypes -O2 -fomit-frame-pointer
+HOSTCFLAGS	= -Wall -Wstrict-prototypes -O2 -fomit-frame-pointer
 HOSTCXXFLAGS	= -O2
 
 # 	Decide whether to build built-in, modular, or both.
-- 
cgit v1.2.3


From 7c6b155fb49fbc63e0b30a1d49552693c0b45be7 Mon Sep 17 00:00:00 2001
From: Sam Ravnborg <sam@mars.(none)>
Date: Mon, 25 Jul 2005 12:51:08 +0000
Subject: kbuild: drop descend - converting existing users

There was only two users left of descend. Fix them so they
use $(clean)= and $(build)=.
Drop definition of descend.

Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
---
---
 Makefile                | 5 -----
 arch/m68knommu/Makefile | 2 +-
 arch/mips/Makefile      | 2 +-
 scripts/Makefile.lib    | 5 -----
 4 files changed, 2 insertions(+), 12 deletions(-)

(limited to 'Makefile')

diff --git a/Makefile b/Makefile
index 77198748ad71..7e4624a14586 100644
--- a/Makefile
+++ b/Makefile
@@ -1356,11 +1356,6 @@ build := -f $(if $(KBUILD_SRC),$(srctree)/)scripts/Makefile.build obj
 # $(Q)$(MAKE) $(clean)=dir
 clean := -f $(if $(KBUILD_SRC),$(srctree)/)scripts/Makefile.clean obj
 
-#	$(call descend,<dir>,<target>)
-#	Recursively call a sub-make in <dir> with target <target>
-# Usage is deprecated, because make does not see this as an invocation of make.
-descend =$(Q)$(MAKE) -f $(if $(KBUILD_SRC),$(srctree)/)scripts/Makefile.build obj=$(1) $(2)
-
 endif	# skip-makefile
 
 FORCE:
diff --git a/arch/m68knommu/Makefile b/arch/m68knommu/Makefile
index a254aa9d4998..58c9fa57ca67 100644
--- a/arch/m68knommu/Makefile
+++ b/arch/m68knommu/Makefile
@@ -109,7 +109,7 @@ libs-y	+= arch/m68knommu/lib/
 prepare: include/asm-$(ARCH)/asm-offsets.h
 
 archclean:
-	$(call descend arch/$(ARCH)/boot, subdirclean)
+	$(Q)$(MAKE) $(clean)=arch/m68knommu/boot
 
 include/asm-$(ARCH)/asm-offsets.h: arch/$(ARCH)/kernel/asm-offsets.s \
 				   include/asm include/linux/version.h \
diff --git a/arch/mips/Makefile b/arch/mips/Makefile
index bc1c44274a58..26528b600b97 100644
--- a/arch/mips/Makefile
+++ b/arch/mips/Makefile
@@ -683,7 +683,7 @@ drivers-$(CONFIG_OPROFILE)	+= arch/mips/oprofile/
 
 ifdef CONFIG_LASAT
 rom.bin rom.sw: vmlinux
-	$(call descend,arch/mips/lasat/image,$@)
+	$(Q)$(MAKE) $(build)=arch/mips/lasat/image $@
 endif
 
 #
diff --git a/scripts/Makefile.lib b/scripts/Makefile.lib
index 7cf75cc4f849..6e079f38a2c6 100644
--- a/scripts/Makefile.lib
+++ b/scripts/Makefile.lib
@@ -229,11 +229,6 @@ if_changed_rule = $(if $(strip $? $(call arg-check, $(cmd_$(1)), $(cmd_$@)) ),\
 
 cmd = @$(if $($(quiet)cmd_$(1)),echo '  $(subst ','\'',$($(quiet)cmd_$(1)))' &&) $(cmd_$(1))
 
-#	$(call descend,<dir>,<target>)
-#	Recursively call a sub-make in <dir> with target <target> 
-# Usage is deprecated, because make do not see this as an invocation of make.
-descend =$(Q)$(MAKE) -f $(if $(KBUILD_SRC),$(srctree)/)scripts/Makefile.build obj=$(1) $(2)
-
 # Shorthand for $(Q)$(MAKE) -f scripts/Makefile.build obj=
 # Usage:
 # $(Q)$(MAKE) $(build)=dir
-- 
cgit v1.2.3


From 8ec4b4ff1c89bb280e662b84eba503ca44abe836 Mon Sep 17 00:00:00 2001
From: Sam Ravnborg <sam@mars.(none)>
Date: Mon, 25 Jul 2005 20:10:36 +0000
Subject: kbuild: introduce Kbuild.include

Kbuild.include is a placeholder for definitions originally present in
both the top-level Makefile and scripts/Makefile.build.
There were a slight difference in the filechk definition, so the most videly
used version was kept and usr/Makefile was adopted for this syntax.

Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
---
---
 Makefile                 | 74 ++-----------------------------------
 scripts/Kbuild.include   | 96 ++++++++++++++++++++++++++++++++++++++++++++++++
 scripts/Makefile.build   |  1 +
 scripts/Makefile.lib     | 94 -----------------------------------------------
 scripts/Makefile.modinst |  2 +-
 scripts/Makefile.modpost |  1 +
 usr/Makefile             |  2 +-
 7 files changed, 103 insertions(+), 167 deletions(-)
 create mode 100644 scripts/Kbuild.include

(limited to 'Makefile')

diff --git a/Makefile b/Makefile
index 7e4624a14586..7c607dc64479 100644
--- a/Makefile
+++ b/Makefile
@@ -309,6 +309,9 @@ cc-version = $(shell $(CONFIG_SHELL) $(srctree)/scripts/gcc-version.sh \
 # Look for make include files relative to root of kernel src
 MAKEFLAGS += --include-dir=$(srctree)
 
+# We need some generic definitions
+include scripts/Kbuild.include
+
 # For maximum performance (+ possibly random breakage, uncomment
 # the following)
 
@@ -367,11 +370,6 @@ export AFLAGS AFLAGS_KERNEL AFLAGS_MODULE
 # even be read-only.
 export MODVERDIR := $(if $(KBUILD_EXTMOD),$(firstword $(KBUILD_EXTMOD))/).tmp_versions
 
-# The temporary file to save gcc -MD generated dependencies must not
-# contain a comma
-comma := ,
-depfile = $(subst $(comma),_,$(@D)/.$(@F).d)
-
 # Files to ignore in find ... statements
 
 RCS_FIND_IGNORE := \( -name SCCS -o -name BitKeeper -o -name .svn -o -name CVS -o -name .pc \) -prune -o
@@ -1285,72 +1283,6 @@ ifneq ($(cmd_files),)
   include $(cmd_files)
 endif
 
-# Execute command and generate cmd file
-if_changed = $(if $(strip $? \
-		          $(filter-out $(cmd_$(1)),$(cmd_$@))\
-			  $(filter-out $(cmd_$@),$(cmd_$(1)))),\
-	@set -e; \
-	$(if $($(quiet)cmd_$(1)),echo '  $(subst ','\'',$($(quiet)cmd_$(1)))';) \
-	$(cmd_$(1)); \
-	echo 'cmd_$@ := $(subst $$,$$$$,$(subst ','\'',$(cmd_$(1))))' > $(@D)/.$(@F).cmd)
-
-
-# execute the command and also postprocess generated .d dependencies
-# file
-if_changed_dep = $(if $(strip $? $(filter-out FORCE $(wildcard $^),$^)\
-		          $(filter-out $(cmd_$(1)),$(cmd_$@))\
-			  $(filter-out $(cmd_$@),$(cmd_$(1)))),\
-	$(Q)set -e; \
-	$(if $($(quiet)cmd_$(1)),echo '  $(subst ','\'',$($(quiet)cmd_$(1)))';) \
-	$(cmd_$(1)); \
-	scripts/basic/fixdep $(depfile) $@ '$(subst $$,$$$$,$(subst ','\'',$(cmd_$(1))))' > $(@D)/.$(@F).tmp; \
-	rm -f $(depfile); \
-	mv -f $(@D)/.$(@F).tmp $(@D)/.$(@F).cmd)
-
-# Usage: $(call if_changed_rule,foo)
-# will check if $(cmd_foo) changed, or any of the prequisites changed,
-# and if so will execute $(rule_foo)
-
-if_changed_rule = $(if $(strip $? \
-		               $(filter-out $(cmd_$(1)),$(cmd_$(@F)))\
-			       $(filter-out $(cmd_$(@F)),$(cmd_$(1)))),\
-	               $(Q)$(rule_$(1)))
-
-# If quiet is set, only print short version of command
-
-cmd = @$(if $($(quiet)cmd_$(1)),echo '  $($(quiet)cmd_$(1))' &&) $(cmd_$(1))
-
-# filechk is used to check if the content of a generated file is updated.
-# Sample usage:
-# define filechk_sample
-#	echo $KERNELRELEASE
-# endef
-# version.h : Makefile
-#	$(call filechk,sample)
-# The rule defined shall write to stdout the content of the new file.
-# The existing file will be compared with the new one.
-# - If no file exist it is created
-# - If the content differ the new file is used
-# - If they are equal no change, and no timestamp update
-
-define filechk
-	@set -e;				\
-	echo '  CHK     $@';			\
-	mkdir -p $(dir $@);			\
-	$(filechk_$(1)) < $< > $@.tmp;		\
-	if [ -r $@ ] && cmp -s $@ $@.tmp; then	\
-		rm -f $@.tmp;			\
-	else					\
-		echo '  UPD     $@';		\
-		mv -f $@.tmp $@;		\
-	fi
-endef
-
-# Shorthand for $(Q)$(MAKE) -f scripts/Makefile.build obj=dir
-# Usage:
-# $(Q)$(MAKE) $(build)=dir
-build := -f $(if $(KBUILD_SRC),$(srctree)/)scripts/Makefile.build obj
-
 # Shorthand for $(Q)$(MAKE) -f scripts/Makefile.clean obj=dir
 # Usage:
 # $(Q)$(MAKE) $(clean)=dir
diff --git a/scripts/Kbuild.include b/scripts/Kbuild.include
new file mode 100644
index 000000000000..9087273abf91
--- /dev/null
+++ b/scripts/Kbuild.include
@@ -0,0 +1,96 @@
+####
+# kbuild: Generic definitions
+
+# Convinient variables
+comma   := ,
+empty   :=
+space   := $(empty) $(empty)
+
+###
+# The temporary file to save gcc -MD generated dependencies must not
+# contain a comma
+depfile = $(subst $(comma),_,$(@D)/.$(@F).d)
+
+###
+# filechk is used to check if the content of a generated file is updated.
+# Sample usage:
+# define filechk_sample
+#	echo $KERNELRELEASE
+# endef
+# version.h : Makefile
+#	$(call filechk,sample)
+# The rule defined shall write to stdout the content of the new file.
+# The existing file will be compared with the new one.
+# - If no file exist it is created
+# - If the content differ the new file is used
+# - If they are equal no change, and no timestamp update
+# - stdin is piped in from the first prerequisite ($<) so one has
+#   to specify a valid file as first prerequisite (often the kbuild file)
+define filechk
+	$(Q)set -e;				\
+	echo '  CHK     $@';			\
+	mkdir -p $(dir $@);			\
+	$(filechk_$(1)) < $< > $@.tmp;		\
+	if [ -r $@ ] && cmp -s $@ $@.tmp; then	\
+		rm -f $@.tmp;			\
+	else					\
+		echo '  UPD     $@';		\
+		mv -f $@.tmp $@;		\
+	fi
+endef
+
+###
+# Shorthand for $(Q)$(MAKE) -f scripts/Makefile.build obj=
+# Usage:
+# $(Q)$(MAKE) $(build)=dir
+build := -f $(if $(KBUILD_SRC),$(srctree)/)scripts/Makefile.build obj
+
+# If quiet is set, only print short version of command
+cmd = @$(if $($(quiet)cmd_$(1)),\
+      echo '  $(subst ','\'',$($(quiet)cmd_$(1)))' &&) $(cmd_$(1))
+
+###
+# if_changed      - execute command if any prerequisite is newer than 
+#                   target, or command line has changed
+# if_changed_dep  - as if_changed, but uses fixdep to reveal dependencies
+#                   including used config symbols
+# if_changed_rule - as if_changed but execute rule instead
+# See Documentation/kbuild/makefiles.txt for more info
+
+ifneq ($(KBUILD_NOCMDDEP),1)
+# Check if both arguments has same arguments. Result in empty string if equal
+# User may override this check using make KBUILD_NOCMDDEP=1
+arg-check = $(strip $(filter-out $(1), $(2)) $(filter-out $(2), $(1)) )
+endif
+
+# echo command. Short version is $(quiet) equals quiet, otherwise full command
+echo-cmd = $(if $($(quiet)cmd_$(1)), \
+	echo '  $(subst ','\'',$($(quiet)cmd_$(1)))';)
+
+# function to only execute the passed command if necessary
+# >'< substitution is for echo to work, >$< substitution to preserve $ when reloading .cmd file
+# note: when using inline perl scripts [perl -e '...$$t=1;...'] in $(cmd_xxx) double $$ your perl vars
+# 
+if_changed = $(if $(strip $? $(call arg-check, $(cmd_$(1)), $(cmd_$@)) ), \
+	@set -e; \
+	$(echo-cmd) \
+	$(cmd_$(1)); \
+	echo 'cmd_$@ := $(subst $$,$$$$,$(subst ','\'',$(cmd_$(1))))' > $(@D)/.$(@F).cmd)
+
+# execute the command and also postprocess generated .d dependencies
+# file
+if_changed_dep = $(if $(strip $? $(filter-out FORCE $(wildcard $^),$^)\
+	$(call arg-check, $(cmd_$(1)), $(cmd_$@)) ),                  \
+	@set -e; \
+	$(echo-cmd) \
+	$(cmd_$(1)); \
+	scripts/basic/fixdep $(depfile) $@ '$(subst $$,$$$$,$(subst ','\'',$(cmd_$(1))))' > $(@D)/.$(@F).tmp; \
+	rm -f $(depfile); \
+	mv -f $(@D)/.$(@F).tmp $(@D)/.$(@F).cmd)
+
+# Usage: $(call if_changed_rule,foo)
+# will check if $(cmd_foo) changed, or any of the prequisites changed,
+# and if so will execute $(rule_foo)
+if_changed_rule = $(if $(strip $? $(call arg-check, $(cmd_$(1)), $(cmd_$@)) ),\
+			@set -e; \
+			$(rule_$(1)))
diff --git a/scripts/Makefile.build b/scripts/Makefile.build
index 282bfb310f5b..ebed6a41bc69 100644
--- a/scripts/Makefile.build
+++ b/scripts/Makefile.build
@@ -12,6 +12,7 @@ __build:
 
 include $(if $(wildcard $(obj)/Kbuild), $(obj)/Kbuild, $(obj)/Makefile)
 
+include scripts/Kbuild.include
 include scripts/Makefile.lib
 
 ifdef host-progs
diff --git a/scripts/Makefile.lib b/scripts/Makefile.lib
index 6e079f38a2c6..0f81dcfd6909 100644
--- a/scripts/Makefile.lib
+++ b/scripts/Makefile.lib
@@ -1,13 +1,3 @@
-# ===========================================================================
-# kbuild: Generic definitions
-# ===========================================================================
-
-# Standard vars
-
-comma   := ,
-empty   :=
-space   := $(empty) $(empty)
-
 # Backward compatibility - to be removed...
 extra-y	+= $(EXTRA_TARGETS)
 # Figure out what we need to build from the various variables
@@ -84,10 +74,6 @@ multi-objs-m	:= $(addprefix $(obj)/,$(multi-objs-m))
 subdir-ym	:= $(addprefix $(obj)/,$(subdir-ym))
 obj-dirs	:= $(addprefix $(obj)/,$(obj-dirs))
 
-# The temporary file to save gcc -MD generated dependencies must not
-# contain a comma
-depfile = $(subst $(comma),_,$(@D)/.$(@F).d)
-
 # 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 
@@ -179,84 +165,4 @@ cmd_objcopy = $(OBJCOPY) $(OBJCOPYFLAGS) $(OBJCOPYFLAGS_$(@F)) $< $@
 quiet_cmd_gzip = GZIP    $@
 cmd_gzip = gzip -f -9 < $< > $@
 
-# ===========================================================================
-# Generic stuff
-# ===========================================================================
-
-ifneq ($(KBUILD_NOCMDDEP),1)
-# Check if both arguments has same arguments. Result in empty string if equal
-# User may override this check using make KBUILD_NOCMDDEP=1
-arg-check = $(strip $(filter-out $(1), $(2)) $(filter-out $(2), $(1)) )
-
-endif
-
-# echo command. Short version is $(quiet) equals quiet, otherwise full command
-echo-cmd = $(if $($(quiet)cmd_$(1)), \
-	echo '  $(subst ','\'',$($(quiet)cmd_$(1)))';)
-
-# function to only execute the passed command if necessary
-# >'< substitution is for echo to work, >$< substitution to preserve $ when reloading .cmd file
-# note: when using inline perl scripts [perl -e '...$$t=1;...'] in $(cmd_xxx) double $$ your perl vars
-# 
-if_changed = $(if $(strip $? $(call arg-check, $(cmd_$(1)), $(cmd_$@)) ), \
-	@set -e; \
-	$(echo-cmd) \
-	$(cmd_$(1)); \
-	echo 'cmd_$@ := $(subst $$,$$$$,$(subst ','\'',$(cmd_$(1))))' > $(@D)/.$(@F).cmd)
-
-
-# execute the command and also postprocess generated .d dependencies
-# file
-
-if_changed_dep = $(if $(strip $? $(filter-out FORCE $(wildcard $^),$^)\
-	$(call arg-check, $(cmd_$(1)), $(cmd_$@)) ),                  \
-	@set -e; \
-	$(echo-cmd) \
-	$(cmd_$(1)); \
-	scripts/basic/fixdep $(depfile) $@ '$(subst $$,$$$$,$(subst ','\'',$(cmd_$(1))))' > $(@D)/.$(@F).tmp; \
-	rm -f $(depfile); \
-	mv -f $(@D)/.$(@F).tmp $(@D)/.$(@F).cmd)
-
-# Usage: $(call if_changed_rule,foo)
-# will check if $(cmd_foo) changed, or any of the prequisites changed,
-# and if so will execute $(rule_foo)
-
-if_changed_rule = $(if $(strip $? $(call arg-check, $(cmd_$(1)), $(cmd_$@)) ),\
-			@set -e; \
-			$(rule_$(1)))
-
-# If quiet is set, only print short version of command
-
-cmd = @$(if $($(quiet)cmd_$(1)),echo '  $(subst ','\'',$($(quiet)cmd_$(1)))' &&) $(cmd_$(1))
-
-# Shorthand for $(Q)$(MAKE) -f scripts/Makefile.build obj=
-# Usage:
-# $(Q)$(MAKE) $(build)=dir
-build := -f $(if $(KBUILD_SRC),$(srctree)/)scripts/Makefile.build obj
-
-# filechk is used to check if the content of a generated file is updated.
-# Sample usage:
-# define filechk_sample
-#	echo $KERNELRELEASE
-# endef
-# version.h : Makefile
-#	$(call filechk,sample)
-# The rule defined shall write to stdout the content of the new file.
-# The existing file will be compared with the new one.
-# - If no file exist it is created
-# - If the content differ the new file is used
-# - If they are equal no change, and no timestamp update
-
-define filechk
-	$(Q)set -e;				\
-	echo '  CHK     $@';			\
-	mkdir -p $(dir $@);			\
-	$(filechk_$(1)) $(2) > $@.tmp;		\
-	if [ -r $@ ] && cmp -s $@ $@.tmp; then	\
-		rm -f $@.tmp;			\
-	else					\
-		echo '  UPD     $@';		\
-		mv -f $@.tmp $@;		\
-	fi
-endef
 
diff --git a/scripts/Makefile.modinst b/scripts/Makefile.modinst
index 85d6494e3c24..23fd1bdc25ce 100644
--- a/scripts/Makefile.modinst
+++ b/scripts/Makefile.modinst
@@ -5,7 +5,7 @@
 .PHONY: __modinst
 __modinst:
 
-include scripts/Makefile.lib
+include scripts/Kbuild.include
 
 #
 
diff --git a/scripts/Makefile.modpost b/scripts/Makefile.modpost
index 94b550e21be8..0c4f3a9f2ea9 100644
--- a/scripts/Makefile.modpost
+++ b/scripts/Makefile.modpost
@@ -36,6 +36,7 @@
 _modpost: __modpost
 
 include .config
+include scripts/Kbuild.include
 include scripts/Makefile.lib
 
 symverfile := $(objtree)/Module.symvers
diff --git a/usr/Makefile b/usr/Makefile
index 248d5551029d..e2129cb570bb 100644
--- a/usr/Makefile
+++ b/usr/Makefile
@@ -27,7 +27,7 @@ quotefixed_initramfs_source := $(shell echo $(CONFIG_INITRAMFS_SOURCE))
 filechk_initramfs_list = $(CONFIG_SHELL) \
  $(srctree)/scripts/gen_initramfs_list.sh $(gen_initramfs_args) $(quotefixed_initramfs_source)
 
-$(obj)/initramfs_list: FORCE
+$(obj)/initramfs_list: $(obj)/Makefile FORCE
 	$(call filechk,initramfs_list)
 
 quiet_cmd_cpio = CPIO    $@
-- 
cgit v1.2.3


From 2a691470345a0024dd7ffaf47ad3d0f5f4f41924 Mon Sep 17 00:00:00 2001
From: Sam Ravnborg <sam@mars.(none)>
Date: Mon, 25 Jul 2005 20:26:04 +0000
Subject: kbuild: fix make O=...

kbuild failed to locate Kbuild.include.
Teach kbuild how to find Kbuild files when using make O=...

Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
---
---
 Makefile               | 2 +-
 scripts/Makefile.build | 4 +++-
 scripts/Makefile.clean | 4 +++-
 3 files changed, 7 insertions(+), 3 deletions(-)

(limited to 'Makefile')

diff --git a/Makefile b/Makefile
index 7c607dc64479..ed1f4b5b714f 100644
--- a/Makefile
+++ b/Makefile
@@ -310,7 +310,7 @@ cc-version = $(shell $(CONFIG_SHELL) $(srctree)/scripts/gcc-version.sh \
 MAKEFLAGS += --include-dir=$(srctree)
 
 # We need some generic definitions
-include scripts/Kbuild.include
+include  $(srctree)/scripts/Kbuild.include
 
 # For maximum performance (+ possibly random breakage, uncomment
 # the following)
diff --git a/scripts/Makefile.build b/scripts/Makefile.build
index ebed6a41bc69..8f4f5a347767 100644
--- a/scripts/Makefile.build
+++ b/scripts/Makefile.build
@@ -10,7 +10,9 @@ __build:
 # Read .config if it exist, otherwise ignore
 -include .config
 
-include $(if $(wildcard $(obj)/Kbuild), $(obj)/Kbuild, $(obj)/Makefile)
+# The filename Kbuild has precedence over Makefile
+include $(if $(wildcard $(srctree)/$(src)/Kbuild), \
+                        $(srctree)/$(src)/Kbuild, $(srctree)/$(src)/Makefile)
 
 include scripts/Kbuild.include
 include scripts/Makefile.lib
diff --git a/scripts/Makefile.clean b/scripts/Makefile.clean
index ff3e87dbf387..9c978b7bbdf1 100644
--- a/scripts/Makefile.clean
+++ b/scripts/Makefile.clean
@@ -7,7 +7,9 @@ src := $(obj)
 .PHONY: __clean
 __clean:
 
-include $(if $(wildcard $(obj)/Kbuild), $(obj)/Kbuild, $(obj)/Makefile)
+# The filename Kbuild has precedence over Makefile
+include $(if $(wildcard $(srctree)/$(src)/Kbuild), \
+                        $(srctree)/$(src)/Kbuild, $(srctree)/$(src)/Makefile)
 
 # Figure out what we need to build from the various variables
 # ==========================================================================
-- 
cgit v1.2.3


From e579d351b4bcea0038f5df08fff7160352b2c365 Mon Sep 17 00:00:00 2001
From: Sam Ravnborg <sam@mars.(none)>
Date: Wed, 27 Jul 2005 08:10:10 +0200
Subject: kbuild: KBUILD_VERBOSE was exported twice

This fixes http://bugzilla.kernel.org/show_bug.cgi?id=4727

Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
---
---
 Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

(limited to 'Makefile')

diff --git a/Makefile b/Makefile
index ed1f4b5b714f..887ba28da765 100644
--- a/Makefile
+++ b/Makefile
@@ -233,7 +233,7 @@ ifeq ($(MAKECMDGOALS),)
   KBUILD_MODULES := 1
 endif
 
-export KBUILD_MODULES KBUILD_BUILTIN KBUILD_VERBOSE
+export KBUILD_MODULES KBUILD_BUILTIN
 export KBUILD_CHECKSRC KBUILD_SRC KBUILD_EXTMOD
 
 # Beautify output
-- 
cgit v1.2.3


From 23a45e2c0a16bfd80eba853b44717d21c37bcf30 Mon Sep 17 00:00:00 2001
From: Sam Ravnborg <sam@mars.(none)>
Date: Wed, 27 Jul 2005 09:12:07 +0200
Subject: kbuild: pass less variables to second make invocation when using make
 O=...

make exports all variables assigned on the command-line, so no need to pass
them explicit.
This fixes http://bugzilla.kernel.org/show_bug.cgi?id=4725

Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
---
---
 Makefile | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

(limited to 'Makefile')

diff --git a/Makefile b/Makefile
index 887ba28da765..2467aa0f6689 100644
--- a/Makefile
+++ b/Makefile
@@ -109,10 +109,9 @@ $(if $(KBUILD_OUTPUT),, \
 .PHONY: $(MAKECMDGOALS)
 
 $(filter-out _all,$(MAKECMDGOALS)) _all:
-	$(if $(KBUILD_VERBOSE:1=),@)$(MAKE) -C $(KBUILD_OUTPUT)		\
-	KBUILD_SRC=$(CURDIR)	     KBUILD_VERBOSE=$(KBUILD_VERBOSE)	\
-	KBUILD_CHECK=$(KBUILD_CHECK) KBUILD_EXTMOD="$(KBUILD_EXTMOD)"	\
-        -f $(CURDIR)/Makefile $@
+	$(if $(KBUILD_VERBOSE:1=),@)$(MAKE) -C $(KBUILD_OUTPUT) \
+	KBUILD_SRC=$(CURDIR) \
+	KBUILD_EXTMOD="$(KBUILD_EXTMOD)" -f $(CURDIR)/Makefile $@
 
 # Leave processing to above invocation of make
 skip-makefile := 1
-- 
cgit v1.2.3


From 72ba47c1b293ae78f7d798b458bb9d3db65c7551 Mon Sep 17 00:00:00 2001
From: Sam Ravnborg <sam@mars.(none)>
Date: Wed, 27 Jul 2005 11:39:37 +0200
Subject: kbuild: silence mystery message

During last phase of the build the following message were displayed:
/bin/sh: +@: command not found

This message appears due to slightly changed semantics
of cmd and if_changed_rule.
The easy fix was to insert a dummy command first in rule_ksym_ld.
The alternative was to redo part of this processing in the top-level
Makefile - a volatile area that I try to avoid.

Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
---
---
 Makefile | 2 ++
 1 file changed, 2 insertions(+)

(limited to 'Makefile')

diff --git a/Makefile b/Makefile
index 2467aa0f6689..06995fe7f57c 100644
--- a/Makefile
+++ b/Makefile
@@ -688,8 +688,10 @@ endef
 
 # Update vmlinux version before link
 # Use + in front of this rule to silent warning about make -j1
+# First command is ':' to allow us to use + in front of this rule
 cmd_ksym_ld = $(cmd_vmlinux__)
 define rule_ksym_ld
+	: 
 	+$(call cmd,vmlinux_version)
 	$(call cmd,vmlinux__)
 	$(Q)echo 'cmd_$@ := $(cmd_vmlinux__)' > $(@D)/.$(@F).cmd
-- 
cgit v1.2.3


From 66d609ec8a4464b5fbe7a0723e3958b98c95991a Mon Sep 17 00:00:00 2001
From: Sam Ravnborg <sam@mars.(none)>
Date: Thu, 28 Jul 2005 23:11:34 +0200
Subject: kbuild: fix make TAGS (for emacs use)

From: bongiojp@clarkson.edu <Jeremy Bongio>
make TAGS does not make source code tags for emacs. It instead
returns an error than "etags -" isn't valid. The problem is
easily remedied.

Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
---
 Makefile | 13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)

(limited to 'Makefile')

diff --git a/Makefile b/Makefile
index 06995fe7f57c..d01b004a2a0e 100644
--- a/Makefile
+++ b/Makefile
@@ -1203,9 +1203,15 @@ cscope: FORCE
 	$(call cmd,cscope)
 
 quiet_cmd_TAGS = MAKE   $@
-cmd_TAGS = $(all-sources) | etags -
+define cmd_TAGS
+	rm -f $@; \
+	ETAGSF=`etags --version | grep -i exuberant >/dev/null && echo "-I __initdata,__exitdata,EXPORT_SYMBOL,EXPORT_SYMBOL_GPL --extra=+f"`; \
+	$(all-sources) | xargs etags $$ETAGSF -a
+endef
+
+TAGS: FORCE
+	$(call cmd,TAGS)
 
-# 	Exuberant ctags works better with -I
 
 quiet_cmd_tags = MAKE   $@
 define cmd_tags
@@ -1214,9 +1220,6 @@ define cmd_tags
 	$(all-sources) | xargs ctags $$CTAGSF -a
 endef
 
-TAGS: FORCE
-	$(call cmd,TAGS)
-
 tags: FORCE
 	$(call cmd,tags)
 
-- 
cgit v1.2.3


From aaebf4332018980fef4e601d1b5a6e52dd9e9ae4 Mon Sep 17 00:00:00 2001
From: Ryan Anderson <ryan@michonline.com>
Date: Sun, 31 Jul 2005 04:57:49 -0400
Subject: [PATCH] kbuild: automatically append a short string to the version
 based upon the git commit

If CONFIG_AUTO_LOCALVERSION is set, the user is using a git-based tree, and the
current HEAD is not referred to by any tags in .git/refs/tags/, append -g and
the first 8 characters of the commit to the version string.  This makes it
easier to use git-bisect, and/or to do a daily build, without trampling on your
older, working builds, or accidentally setting up conflicting sets of modules.

Signed-off-by: Ryan Anderson <ryan@michonline.com>
Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
---
 Makefile                | 20 ++++++++++++++++++
 init/Kconfig            | 16 ++++++++++++++
 scripts/setlocalversion | 56 +++++++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 92 insertions(+)
 create mode 100644 scripts/setlocalversion

(limited to 'Makefile')

diff --git a/Makefile b/Makefile
index d01b004a2a0e..c6aae86a02cd 100644
--- a/Makefile
+++ b/Makefile
@@ -548,6 +548,26 @@ export KBUILD_IMAGE ?= vmlinux
 # images. Default is /boot, but you can set it to other values
 export	INSTALL_PATH ?= /boot
 
+# If CONFIG_LOCALVERSION_AUTO is set, we automatically perform some tests
+# and try to determine if the current source tree is a release tree, of any sort,
+# or if is a pure development tree.
+#
+# A 'release tree' is any tree with a git TAG associated
+# with it.  The primary goal of this is to make it safe for a native
+# git/CVS/SVN user to build a release tree (i.e, 2.6.9) and also to
+# continue developing against the current Linus tree, without having the Linus
+# tree overwrite the 2.6.9 tree when installed.
+#
+# Currently, only git is supported.
+# Other SCMs can edit scripts/setlocalversion and add the appropriate
+# checks as needed.
+
+
+ifdef CONFIG_LOCALVERSION_AUTO
+	localversion-auto := $(shell $(PERL) $(srctree)/scripts/setlocalversion $(srctree))
+	LOCALVERSION := $(LOCALVERSION)$(localversion-auto)
+endif
+
 #
 # INSTALL_MOD_PATH specifies a prefix to MODLIB for module directory
 # relocations required by build roots.  This is not defined in the
diff --git a/init/Kconfig b/init/Kconfig
index eb86972be1c2..f27fc48c1fdc 100644
--- a/init/Kconfig
+++ b/init/Kconfig
@@ -77,6 +77,22 @@ config LOCALVERSION
 	  object and source tree, in that order.  Your total string can
 	  be a maximum of 64 characters.
 
+config LOCALVERSION_AUTO
+	bool "Automatically append version information to the version string"
+	default y
+	help
+	  This will try to automatically determine if the current tree is a
+	  release tree by looking for git tags that
+	  belong to the current top of tree revision.
+
+	  A string of the format -gxxxxxxxx will be added to the localversion
+	  if a git based tree is found.  The string generated by this will be
+	  appended after any matching localversion* files, and after the value
+	  set in CONFIG_LOCALVERSION
+
+	  Note: This requires Perl, and a git repository, but not necessarily
+	  the git or cogito tools to be installed.
+
 config SWAP
 	bool "Support for paging of anonymous memory (swap)"
 	depends on MMU
diff --git a/scripts/setlocalversion b/scripts/setlocalversion
new file mode 100644
index 000000000000..7c805c8fccd2
--- /dev/null
+++ b/scripts/setlocalversion
@@ -0,0 +1,56 @@
+#!/usr/bin/perl
+# Copyright 2004 - Ryan Anderson <ryan@michonline.com>  GPL v2
+
+use strict;
+use warnings;
+use Digest::MD5;
+require 5.006;
+
+if (@ARGV != 1) {
+	print <<EOT;
+Usage: setlocalversion <srctree>
+EOT
+	exit(1);
+}
+
+my ($srctree) = @ARGV;
+chdir($srctree);
+
+my @LOCALVERSIONS = ();
+
+# We are going to use the following commands to try and determine if this
+# repository is at a Version boundary (i.e, 2.6.10 vs 2.6.10 + some patches) We
+# currently assume that all meaningful version boundaries are marked by a tag.
+# We don't care what the tag is, just that something exists.
+
+# Git/Cogito store the top-of-tree "commit" in .git/HEAD
+# A list of known tags sits in .git/refs/tags/
+#
+# The simple trick here is to just compare the two of these, and if we get a
+# match, return nothing, otherwise, return a subset of the SHA-1 hash in
+# .git/HEAD
+
+sub do_git_checks {
+	open(H,"<.git/HEAD") or return;
+	my $head = <H>;
+	chomp $head;
+	close(H);
+
+	opendir(D,".git/refs/tags") or return;
+	foreach my $tagfile (grep !/^\.{1,2}$/, readdir(D)) {
+		open(F,"<.git/refs/tags/" . $tagfile) or return;
+		my $tag = <F>;
+		chomp $tag;
+		close(F);
+		return if ($tag eq $head);
+	}
+	closedir(D);
+
+	push @LOCALVERSIONS, "g" . substr($head,0,8);
+}
+
+if ( -d ".git") {
+	do_git_checks();
+}
+
+printf "-%s\n", join("-",@LOCALVERSIONS) if (scalar @LOCALVERSIONS > 0);
-- 
cgit v1.2.3


From 0572e3da3ff5c3744b2f606ecf296d5f89a4bbdf Mon Sep 17 00:00:00 2001
From: Linus Torvalds <torvalds@g5.osdl.org>
Date: Tue, 23 Aug 2005 20:39:14 -0700
Subject: Linux v2.6.13-rc7

Too many changes to release a final 2.6.13.
---
 Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

(limited to 'Makefile')

diff --git a/Makefile b/Makefile
index 2c1486159d8d..300f61f6f6a2 100644
--- a/Makefile
+++ b/Makefile
@@ -1,7 +1,7 @@
 VERSION = 2
 PATCHLEVEL = 6
 SUBLEVEL = 13
-EXTRAVERSION =-rc6
+EXTRAVERSION =-rc7
 NAME=Woozy Numbat
 
 # *DOCUMENTATION*
-- 
cgit v1.2.3


From 02b3e4e2d71b6058ec11cc01c72ac651eb3ded2b Mon Sep 17 00:00:00 2001
From: Linus Torvalds <torvalds@g5.osdl.org>
Date: Sun, 28 Aug 2005 16:41:01 -0700
Subject: Linux v2.6.13

---
 Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

(limited to 'Makefile')

diff --git a/Makefile b/Makefile
index 300f61f6f6a2..5acd1fc68d17 100644
--- a/Makefile
+++ b/Makefile
@@ -1,7 +1,7 @@
 VERSION = 2
 PATCHLEVEL = 6
 SUBLEVEL = 13
-EXTRAVERSION =-rc7
+EXTRAVERSION =
 NAME=Woozy Numbat
 
 # *DOCUMENTATION*
-- 
cgit v1.2.3


From 5bbe6ab938208bb3d4e16f7a28b11fcddd4f9ff2 Mon Sep 17 00:00:00 2001
From: Benjamin LaHaise <bcrl@linux.intel.com>
Date: Sun, 28 Aug 2005 18:05:17 -0400
Subject: [PATCH] new name for 2.6.14

We've had Woozy Numbat for a while now.  Here's an updated name care of
Jeff Garzik and myself.

Signed-off-by: Benjamin LaHaise <bcrl@linux.intel.com>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
---
 Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

(limited to 'Makefile')

diff --git a/Makefile b/Makefile
index 5acd1fc68d17..3d84df581cf2 100644
--- a/Makefile
+++ b/Makefile
@@ -2,7 +2,7 @@ VERSION = 2
 PATCHLEVEL = 6
 SUBLEVEL = 13
 EXTRAVERSION =
-NAME=Woozy Numbat
+NAME=Affluent Albatross
 
 # *DOCUMENTATION*
 # To see a list of typical targets execute "make help"
-- 
cgit v1.2.3


From 0216f86dafb389c0ad97529fd45e64e883298cfd Mon Sep 17 00:00:00 2001
From: Matt Mackall <mpm@selenic.com>
Date: Sat, 3 Sep 2005 15:54:25 -0700
Subject: [PATCH] kbuild: fix make clean damaging hg repos

Running 'make clean' was quietly deleting files in Mercurial kernel
repositories matching '.*.d', which was corrupting the tags portions of the
repository.  Spotted and fixed by several people.

Signed-off-by: Matt Mackall <mpm@selenic.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
---
 Makefile | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

(limited to 'Makefile')

diff --git a/Makefile b/Makefile
index 3d84df581cf2..2d68adbcfa28 100644
--- a/Makefile
+++ b/Makefile
@@ -374,8 +374,8 @@ depfile = $(subst $(comma),_,$(@D)/.$(@F).d)
 
 # Files to ignore in find ... statements
 
-RCS_FIND_IGNORE := \( -name SCCS -o -name BitKeeper -o -name .svn -o -name CVS -o -name .pc \) -prune -o
-RCS_TAR_IGNORE := --exclude SCCS --exclude BitKeeper --exclude .svn --exclude CVS --exclude .pc
+RCS_FIND_IGNORE := \( -name SCCS -o -name BitKeeper -o -name .svn -o -name CVS -o -name .pc -o -name .hg \) -prune -o
+RCS_TAR_IGNORE := --exclude SCCS --exclude BitKeeper --exclude .svn --exclude CVS --exclude .pc --exclude .hg
 
 # ===========================================================================
 # Rules shared between *config targets and build targets
-- 
cgit v1.2.3


From 86feeaa8120bb1b0ab21efed49e9754039395ef1 Mon Sep 17 00:00:00 2001
From: Sam Ravnborg <sam@mars.(none)>
Date: Fri, 9 Sep 2005 19:28:28 +0200
Subject: kbuild: full dependency check on asm-offsets.h

Building asm-offsets.h has been moved to a seperate Kbuild file
located in the top-level directory. This allow us to share the
functionality across the architectures.

The old rules in architecture specific Makefiles will die
in subsequent patches.

Furhtermore the usual kbuild dependency tracking is now used
when deciding to rebuild asm-offsets.s. So we no longer risk
to fail a rebuild caused by asm-offsets.c dependencies being touched.

With this common rule-set we now force the same name across
all architectures. Following patches will fix the rest.

Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
---
 Kbuild                                | 41 +++++++++++++++++++++++++++++++++++
 Makefile                              | 39 ++++++++++-----------------------
 arch/i386/Makefile                    |  9 --------
 arch/i386/kernel/head.S               |  2 +-
 arch/i386/kernel/vsyscall-sigreturn.S |  2 +-
 arch/i386/kernel/vsyscall.lds.S       |  2 +-
 arch/i386/power/swsusp.S              |  2 +-
 include/asm-i386/thread_info.h        |  2 +-
 8 files changed, 57 insertions(+), 42 deletions(-)
 create mode 100644 Kbuild

(limited to 'Makefile')

diff --git a/Kbuild b/Kbuild
new file mode 100644
index 000000000000..197ece85034b
--- /dev/null
+++ b/Kbuild
@@ -0,0 +1,41 @@
+#
+# Kbuild for top-level directory of the kernel
+# This file takes care of the following:
+# 1) Generate asm-offsets.h
+
+#####
+# 1) Generate asm-offsets.h 
+#
+
+offsets-file := include/asm-$(ARCH)/asm-offsets.h
+
+always  := $(offsets-file)
+targets := $(offsets-file)
+targets += arch/$(ARCH)/kernel/asm-offsets.s
+
+quiet_cmd_offsets = GEN     $@
+define cmd_offsets
+	cat $< | \
+	(set -e; \
+	 echo "#ifndef __ASM_OFFSETS_H__"; \
+	 echo "#define __ASM_OFFSETS_H__"; \
+	 echo "/*"; \
+	 echo " * DO NOT MODIFY."; \
+	 echo " *"; \
+	 echo " * This file was generated by $(srctree)/Kbuild"; \
+	 echo " *"; \
+	 echo " */"; \
+	 echo ""; \
+	 sed -ne "/^->/{s:^->\([^ ]*\) [\$$#]*\([^ ]*\) \(.*\):#define \1 \2 /* \3 */:; s:->::; p;}"; \
+	 echo ""; \
+	 echo "#endif" ) > $@
+endef
+
+# We use internal kbuild rules to avoid the "is up to date" message from make
+arch/$(ARCH)/kernel/asm-offsets.s: arch/$(ARCH)/kernel/asm-offsets.c FORCE
+	$(Q)mkdir -p $(dir $@)
+	$(call if_changed_dep,cc_s_c)
+
+$(srctree)/$(offsets-file): arch/$(ARCH)/kernel/asm-offsets.s Kbuild
+	$(call cmd,offsets)
+
diff --git a/Makefile b/Makefile
index 63e5c9f0bc7a..2402430c87e6 100644
--- a/Makefile
+++ b/Makefile
@@ -776,14 +776,14 @@ $(vmlinux-dirs): prepare-all scripts
 # A multi level approach is used. prepare1 is updated first, then prepare0.
 # prepare-all is the collection point for the prepare targets.
 
-.PHONY: prepare-all prepare prepare0 prepare1 prepare2
+.PHONY: prepare-all prepare prepare0 prepare1 prepare2 prepare3
 
-# prepare2 is used to check if we are building in a separate output directory,
+# prepare3 is used to check if we are building in a separate output directory,
 # and if so do:
 # 1) Check that make has not been executed in the kernel src $(srctree)
 # 2) Create the include2 directory, used for the second asm symlink
 
-prepare2:
+prepare3:
 ifneq ($(KBUILD_SRC),)
 	@echo '  Using $(srctree) as source for kernel'
 	$(Q)if [ -f $(srctree)/.config ]; then \
@@ -795,18 +795,21 @@ ifneq ($(KBUILD_SRC),)
 	$(Q)ln -fsn $(srctree)/include/asm-$(ARCH) include2/asm
 endif
 
-# prepare1 creates a makefile if using a separate output directory
-prepare1: prepare2 outputmakefile
+# prepare2 creates a makefile if using a separate output directory
+prepare2: prepare3 outputmakefile
 
-prepare0: prepare1 include/linux/version.h include/asm \
+prepare1: prepare2 include/linux/version.h include/asm \
                    include/config/MARKER
 ifneq ($(KBUILD_MODULES),)
 	$(Q)rm -rf $(MODVERDIR)
 	$(Q)mkdir -p $(MODVERDIR)
 endif
 
+prepare0: prepare prepare1 FORCE
+	$(Q)$(MAKE) $(build)=$(srctree)
+
 # All the preparing..
-prepare-all: prepare0 prepare
+prepare-all: prepare0
 
 #	Leave this as default for preprocessing vmlinux.lds.S, which is now
 #	done in arch/$(ARCH)/kernel/Makefile
@@ -949,26 +952,6 @@ modules modules_install: FORCE
 
 endif # CONFIG_MODULES
 
-# Generate asm-offsets.h 
-# ---------------------------------------------------------------------------
-
-define filechk_gen-asm-offsets
-	(set -e; \
-	 echo "#ifndef __ASM_OFFSETS_H__"; \
-	 echo "#define __ASM_OFFSETS_H__"; \
-	 echo "/*"; \
-	 echo " * DO NOT MODIFY."; \
-	 echo " *"; \
-	 echo " * This file was generated by arch/$(ARCH)/Makefile"; \
-	 echo " *"; \
-	 echo " */"; \
-	 echo ""; \
-	 sed -ne "/^->/{s:^->\([^ ]*\) [\$$#]*\([^ ]*\) \(.*\):#define \1 \2 /* \3 */:; s:->::; p;}"; \
-	 echo ""; \
-	 echo "#endif" )
-endef
-
-
 ###
 # Cleaning is done on three levels.
 # make clean     Delete most generated files
@@ -991,7 +974,7 @@ MRPROPER_FILES += .config .config.old include/asm .version \
 #
 clean: rm-dirs  := $(CLEAN_DIRS)
 clean: rm-files := $(CLEAN_FILES)
-clean-dirs      := $(addprefix _clean_,$(vmlinux-alldirs))
+clean-dirs      := $(addprefix _clean_,$(srctree) $(vmlinux-alldirs))
 
 .PHONY: $(clean-dirs) clean archclean
 $(clean-dirs):
diff --git a/arch/i386/Makefile b/arch/i386/Makefile
index bf7c9ba709f3..09951990a622 100644
--- a/arch/i386/Makefile
+++ b/arch/i386/Makefile
@@ -156,15 +156,6 @@ install: vmlinux
 install kernel_install:
 	$(Q)$(MAKE) $(build)=$(boot) BOOTIMAGE=$(KBUILD_IMAGE) install
 
-prepare: include/asm-$(ARCH)/asm_offsets.h
-CLEAN_FILES += include/asm-$(ARCH)/asm_offsets.h
-
-arch/$(ARCH)/kernel/asm-offsets.s: include/asm include/linux/version.h \
-				   include/config/MARKER
-
-include/asm-$(ARCH)/asm_offsets.h: arch/$(ARCH)/kernel/asm-offsets.s
-	$(call filechk,gen-asm-offsets)
-
 archclean:
 	$(Q)$(MAKE) $(clean)=arch/i386/boot
 
diff --git a/arch/i386/kernel/head.S b/arch/i386/kernel/head.S
index 0480ca9e9e57..e437fb367498 100644
--- a/arch/i386/kernel/head.S
+++ b/arch/i386/kernel/head.S
@@ -17,7 +17,7 @@
 #include <asm/desc.h>
 #include <asm/cache.h>
 #include <asm/thread_info.h>
-#include <asm/asm_offsets.h>
+#include <asm/asm-offsets.h>
 #include <asm/setup.h>
 
 /*
diff --git a/arch/i386/kernel/vsyscall-sigreturn.S b/arch/i386/kernel/vsyscall-sigreturn.S
index 68afa50dd7cf..fadb5bc3c374 100644
--- a/arch/i386/kernel/vsyscall-sigreturn.S
+++ b/arch/i386/kernel/vsyscall-sigreturn.S
@@ -7,7 +7,7 @@
  */
 
 #include <asm/unistd.h>
-#include <asm/asm_offsets.h>
+#include <asm/asm-offsets.h>
 
 
 /* XXX
diff --git a/arch/i386/kernel/vsyscall.lds.S b/arch/i386/kernel/vsyscall.lds.S
index a7977707c8e5..98699ca6e52d 100644
--- a/arch/i386/kernel/vsyscall.lds.S
+++ b/arch/i386/kernel/vsyscall.lds.S
@@ -3,7 +3,7 @@
  * object prelinked to its virtual address, and with only one read-only
  * segment (that fits in one page).  This script controls its layout.
  */
-#include <asm/asm_offsets.h>
+#include <asm/asm-offsets.h>
 
 SECTIONS
 {
diff --git a/arch/i386/power/swsusp.S b/arch/i386/power/swsusp.S
index c4105286ff26..c893b897217f 100644
--- a/arch/i386/power/swsusp.S
+++ b/arch/i386/power/swsusp.S
@@ -12,7 +12,7 @@
 #include <linux/linkage.h>
 #include <asm/segment.h>
 #include <asm/page.h>
-#include <asm/asm_offsets.h>
+#include <asm/asm-offsets.h>
 
 	.text
 
diff --git a/include/asm-i386/thread_info.h b/include/asm-i386/thread_info.h
index e2cb9fa6f563..8fbf791651bf 100644
--- a/include/asm-i386/thread_info.h
+++ b/include/asm-i386/thread_info.h
@@ -48,7 +48,7 @@ struct thread_info {
 
 #else /* !__ASSEMBLY__ */
 
-#include <asm/asm_offsets.h>
+#include <asm/asm-offsets.h>
 
 #endif
 
-- 
cgit v1.2.3


From 6d12884259ac65f74538b7819f5fadf4ebb0d569 Mon Sep 17 00:00:00 2001
From: Zach Brown <zach.brown@oracle.com>
Date: Wed, 7 Sep 2005 12:08:23 -0700
Subject: [PATCH] kbuild: add kernelrelease to 'make help'

Dunno if there was a conscious decision to leave it out, but if you're
happy with adding some help text for it here's a patch against 2.6.13-mm1..

Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
---
 Makefile | 1 +
 1 file changed, 1 insertion(+)

(limited to 'Makefile')

diff --git a/Makefile b/Makefile
index 2402430c87e6..0d0576a622bf 100644
--- a/Makefile
+++ b/Makefile
@@ -1053,6 +1053,7 @@ help:
 	@echo  '  rpm		  - Build a kernel as an RPM package'
 	@echo  '  tags/TAGS	  - Generate tags file for editors'
 	@echo  '  cscope	  - Generate cscope index'
+	@echo  '  kernelrelease	  - Output the release version string'
 	@echo  ''
 	@echo  'Static analysers'
 	@echo  '  buildcheck      - List dangling references to vmlinux discarded sections'
-- 
cgit v1.2.3


From 7b49bb9aff8b14d15da58111d8908c877c0a525e Mon Sep 17 00:00:00 2001
From: "viro@ZenIV.linux.org.uk" <viro@ZenIV.linux.org.uk>
Date: Fri, 9 Sep 2005 21:14:35 +0100
Subject: [PATCH] kbuild: CF=<arguments> passes arguments to sparse

Allows to add to sparse arguments without mutilating makefiles - just
pass CF=<arguments> and they will be added to CHECKFLAGS.

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
---
 Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

(limited to 'Makefile')

diff --git a/Makefile b/Makefile
index 0d0576a622bf..6a405882b1f7 100644
--- a/Makefile
+++ b/Makefile
@@ -334,7 +334,7 @@ KALLSYMS	= scripts/kallsyms
 PERL		= perl
 CHECK		= sparse
 
-CHECKFLAGS     := -D__linux__ -Dlinux -D__STDC__ -Dunix -D__unix__
+CHECKFLAGS     := -D__linux__ -Dlinux -D__STDC__ -Dunix -D__unix__ $(CF)
 MODFLAGS	= -DMODULE
 CFLAGS_MODULE   = $(MODFLAGS)
 AFLAGS_MODULE   = $(MODFLAGS)
-- 
cgit v1.2.3


From 4e25d8bb9550fb5912165196fe8502cdb831a336 Mon Sep 17 00:00:00 2001
From: Jan Beulich <JBeulich@novell.com>
Date: Thu, 8 Sep 2005 17:07:35 +0200
Subject: [PATCH] kbuild: adjust .version updating

In order to maintain a more correct build number, updates to the
version
number should only be commited after a successful link of vmlinux, not
before (so that errors in the link process don't lead to pointless
increments).

Signed-off-by: Jan Beulich <jbeulich@novell.com>
Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
---
 Makefile | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

(limited to 'Makefile')

diff --git a/Makefile b/Makefile
index 6a405882b1f7..485a11a1985f 100644
--- a/Makefile
+++ b/Makefile
@@ -641,8 +641,13 @@ quiet_cmd_vmlinux__ ?= LD      $@
 # Generate new vmlinux version
 quiet_cmd_vmlinux_version = GEN     .version
       cmd_vmlinux_version = set -e;                     \
-	. $(srctree)/scripts/mkversion > .tmp_version;	\
-	mv -f .tmp_version .version;			\
+	if [ ! -r .version ]; then			\
+	  rm -f .version;				\
+	  echo 1 >.version;				\
+	else						\
+	  mv .version .old_version;			\
+	  expr 0$$(cat .old_version) + 1 >.version;	\
+	fi;						\
 	$(MAKE) $(build)=init
 
 # Generate System.map
@@ -756,6 +761,7 @@ endif # ifdef CONFIG_KALLSYMS
 # vmlinux image - including updated kernel symbols
 vmlinux: $(vmlinux-lds) $(vmlinux-init) $(vmlinux-main) $(kallsyms.o) FORCE
 	$(call if_changed_rule,vmlinux__)
+	$(Q)rm -f .old_version
 
 # The actual objects are generated when descending, 
 # make sure no implicit rule kicks in
-- 
cgit v1.2.3


From cd05e6bdc6001ac6e8ab13720693b7e1302d9848 Mon Sep 17 00:00:00 2001
From: Jan Beulich <JBeulich@novell.com>
Date: Tue, 6 Sep 2005 11:47:04 +0200
Subject: [PATCH] kbuild: fix split-include dependency

Splitting of autoconf.h requires that split-include was built before,
and
needs to be-re-done when split-include changes. This dependency was
previously missing. Additionally, since autoconf.h is (suppoosed to
be)
generated as a side effect of executing config targets, include/linux
should be created prior to running the respective sub-make.

Signed-off-by: Jan Beulich <jbeulich@novell.com>
Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
---
 Makefile | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

(limited to 'Makefile')

diff --git a/Makefile b/Makefile
index 485a11a1985f..524fb48fa334 100644
--- a/Makefile
+++ b/Makefile
@@ -382,6 +382,9 @@ RCS_TAR_IGNORE := --exclude SCCS --exclude BitKeeper --exclude .svn --exclude CV
 scripts_basic:
 	$(Q)$(MAKE) $(build)=scripts/basic
 
+# To avoid any implicit rule to kick in, define an empty command.
+scripts/basic/%: scripts_basic ;
+
 .PHONY: outputmakefile
 # outputmakefile generate a Makefile to be placed in output directory, if
 # using a seperate output directory. This allows convinient use
@@ -444,9 +447,8 @@ ifeq ($(config-targets),1)
 include $(srctree)/arch/$(ARCH)/Makefile
 export KBUILD_DEFCONFIG
 
-config: scripts_basic outputmakefile FORCE
-	$(Q)$(MAKE) $(build)=scripts/kconfig $@
-%config: scripts_basic outputmakefile FORCE
+config %config: scripts_basic outputmakefile FORCE
+	$(Q)mkdir -p include/linux
 	$(Q)$(MAKE) $(build)=scripts/kconfig $@
 
 else
@@ -854,7 +856,7 @@ include/asm:
 
 # 	Split autoconf.h into include/linux/config/*
 
-include/config/MARKER: include/linux/autoconf.h
+include/config/MARKER: scripts/basic/split-include include/linux/autoconf.h
 	@echo '  SPLIT   include/linux/autoconf.h -> include/config/*'
 	@scripts/basic/split-include include/linux/autoconf.h include/config
 	@touch $@
-- 
cgit v1.2.3


From 8d36a62364b6b04dc7b0e9fe09f6968f4e5a1f0a Mon Sep 17 00:00:00 2001
From: Sam Ravnborg <sam@mars.ravnborg.org>
Date: Sat, 10 Sep 2005 21:05:36 +0200
Subject: kbuild: fix generic asm-offsets.h support

iThis fixes a bug where the generated asm-offsets.h file was saved in
the source tree even with make O=.
Thanks to Stephen Rothwell <sfr@canb.auug.org.au> for the report.

Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
---
 Kbuild   | 5 +++--
 Makefile | 2 +-
 2 files changed, 4 insertions(+), 3 deletions(-)

(limited to 'Makefile')

diff --git a/Kbuild b/Kbuild
index 1880e6f760aa..79003918f37f 100644
--- a/Kbuild
+++ b/Kbuild
@@ -4,7 +4,7 @@
 # 1) Generate asm-offsets.h
 
 #####
-# 1) Generate asm-offsets.h 
+# 1) Generate asm-offsets.h
 #
 
 offsets-file := include/asm-$(ARCH)/asm-offsets.h
@@ -22,6 +22,7 @@ sed-$(CONFIG_MIPS) := "/^@@@/s///p"
 
 quiet_cmd_offsets = GEN     $@
 define cmd_offsets
+	mkdir -p $(dir $@); \
 	cat $< | \
 	(set -e; \
 	 echo "#ifndef __ASM_OFFSETS_H__"; \
@@ -43,6 +44,6 @@ arch/$(ARCH)/kernel/asm-offsets.s: arch/$(ARCH)/kernel/asm-offsets.c FORCE
 	$(Q)mkdir -p $(dir $@)
 	$(call if_changed_dep,cc_s_c)
 
-$(srctree)/$(offsets-file): arch/$(ARCH)/kernel/asm-offsets.s Kbuild
+$(obj)/$(offsets-file): arch/$(ARCH)/kernel/asm-offsets.s Kbuild
 	$(call cmd,offsets)
 
diff --git a/Makefile b/Makefile
index 524fb48fa334..382298f37adf 100644
--- a/Makefile
+++ b/Makefile
@@ -814,7 +814,7 @@ ifneq ($(KBUILD_MODULES),)
 endif
 
 prepare0: prepare prepare1 FORCE
-	$(Q)$(MAKE) $(build)=$(srctree)
+	$(Q)$(MAKE) $(build)=.
 
 # All the preparing..
 prepare-all: prepare0
-- 
cgit v1.2.3


From 5bb78269000cf326bfdfa19f79449c02a9158020 Mon Sep 17 00:00:00 2001
From: Sam Ravnborg <sam@mars.ravnborg.org>
Date: Sun, 11 Sep 2005 22:30:22 +0200
Subject: kbuild: rename prepare to archprepare to fix dependency chain

When introducing the generic asm-offsets.h support the dependency
chain for the prepare targets was changed. All build scripts expecting
include/asm/asm-offsets.h to be made when using the prepare target would broke.
With the limited number of prepare targets left in arch Makefiles
the trivial solution was to introduce a new arch specific target: archprepare

The dependency chain looks like this now:

prepare
  |
  +--> prepare0
         |
         +--> archprepare
                |
		+--> scripts_basic
                +--> prepare1
                       |
                       +---> prepare2
                               |
                               +--> prepare3

So prepare 3 is processed before prepare2 etc.
This guaantees that the asm symlink, version.h, scripts_basic
are all updated before archprepare is processed.

prepare0 which build the asm-offsets.h file will need the
actions performed by archprepare.

The head target is now named prepare, because users scripts will most
likely use that target, but prepare-all has been kept for compatibility.
Updated Documentation/kbuild/makefiles.txt.

Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
---
 Documentation/kbuild/makefiles.txt | 14 +++++++-------
 Makefile                           | 23 +++++++++++++++--------
 arch/arm/Makefile                  |  2 +-
 arch/cris/Makefile                 |  2 +-
 arch/ia64/Makefile                 |  2 +-
 arch/ppc/Makefile                  |  2 +-
 arch/sh/Makefile                   |  2 +-
 arch/sh64/Makefile                 |  2 +-
 arch/um/Makefile                   |  2 +-
 arch/xtensa/Makefile               |  2 +-
 10 files changed, 30 insertions(+), 23 deletions(-)

(limited to 'Makefile')

diff --git a/Documentation/kbuild/makefiles.txt b/Documentation/kbuild/makefiles.txt
index 9a1586590d82..d802ce88bedc 100644
--- a/Documentation/kbuild/makefiles.txt
+++ b/Documentation/kbuild/makefiles.txt
@@ -31,7 +31,7 @@ This document describes the Linux kernel Makefiles.
 
 	=== 6 Architecture Makefiles
 	   --- 6.1 Set variables to tweak the build to the architecture
-	   --- 6.2 Add prerequisites to prepare:
+	   --- 6.2 Add prerequisites to archprepare:
 	   --- 6.3 List directories to visit when descending
 	   --- 6.4 Architecture specific boot images
 	   --- 6.5 Building non-kbuild targets
@@ -734,18 +734,18 @@ When kbuild executes the following steps are followed (roughly):
 	for loadable kernel modules.
 
  
---- 6.2 Add prerequisites to prepare:
+--- 6.2 Add prerequisites to archprepare:
 
-	The prepare: rule is used to list prerequisites that needs to be
+	The archprepare: rule is used to list prerequisites that needs to be
 	built before starting to descend down in the subdirectories.
 	This is usual header files containing assembler constants.
 
 		Example:
-		#arch/s390/Makefile
-		prepare: include/asm-$(ARCH)/offsets.h
+		#arch/arm/Makefile
+		archprepare: maketools
 
-	In this example the file include/asm-$(ARCH)/offsets.h will
-	be built before descending down in the subdirectories.
+	In this example the file target maketools will be processed
+	before descending down in the subdirectories.
 	See also chapter XXX-TODO that describe how kbuild supports
 	generating offset header files.
 
diff --git a/Makefile b/Makefile
index 382298f37adf..e90ee6a3eef4 100644
--- a/Makefile
+++ b/Makefile
@@ -776,15 +776,20 @@ $(sort $(vmlinux-init) $(vmlinux-main)) $(vmlinux-lds): $(vmlinux-dirs) ;
 # Error messages still appears in the original language
 
 .PHONY: $(vmlinux-dirs)
-$(vmlinux-dirs): prepare-all scripts
+$(vmlinux-dirs): prepare scripts
 	$(Q)$(MAKE) $(build)=$@
 
 # Things we need to do before we recursively start building the kernel
-# or the modules are listed in "prepare-all".
-# A multi level approach is used. prepare1 is updated first, then prepare0.
-# prepare-all is the collection point for the prepare targets.
+# or the modules are listed in "prepare".
+# A multi level approach is used. prepareN is processed before prepareN-1.
+# archprepare is used in arch Makefiles and when processed asm symlink,
+# version.h and scripts_basic is processed / created.
 
-.PHONY: prepare-all prepare prepare0 prepare1 prepare2 prepare3
+# Listed in dependency order
+.PHONY: prepare archprepare prepare0 prepare1 prepare2 prepare3
+
+# prepare-all is deprecated, use prepare as valid replacement
+.PHONY: prepare-all
 
 # prepare3 is used to check if we are building in a separate output directory,
 # and if so do:
@@ -813,11 +818,13 @@ ifneq ($(KBUILD_MODULES),)
 	$(Q)mkdir -p $(MODVERDIR)
 endif
 
-prepare0: prepare prepare1 FORCE
+archprepare: prepare1 scripts_basic
+
+prepare0: archprepare FORCE
 	$(Q)$(MAKE) $(build)=.
 
 # All the preparing..
-prepare-all: prepare0
+prepare prepare-all: prepare0
 
 #	Leave this as default for preprocessing vmlinux.lds.S, which is now
 #	done in arch/$(ARCH)/kernel/Makefile
@@ -908,7 +915,7 @@ modules: $(vmlinux-dirs) $(if $(KBUILD_BUILTIN),vmlinux)
 
 # Target to prepare building external modules
 .PHONY: modules_prepare
-modules_prepare: prepare-all scripts
+modules_prepare: prepare scripts
 
 # Target to install modules
 .PHONY: modules_install
diff --git a/arch/arm/Makefile b/arch/arm/Makefile
index e625ac66f49b..130e6228b587 100644
--- a/arch/arm/Makefile
+++ b/arch/arm/Makefile
@@ -175,7 +175,7 @@ else
 endif
 	@touch $@
 
-prepare: maketools include/asm-arm/.arch
+archprepare: maketools include/asm-arm/.arch
 
 .PHONY: maketools FORCE
 maketools: include/linux/version.h FORCE
diff --git a/arch/cris/Makefile b/arch/cris/Makefile
index a00043a91f16..ea65d585cf5e 100644
--- a/arch/cris/Makefile
+++ b/arch/cris/Makefile
@@ -107,7 +107,7 @@ archclean:
 	rm -f timage vmlinux.bin decompress.bin rescue.bin cramfs.img
 	rm -rf $(LD_SCRIPT).tmp
 
-prepare: $(SRC_ARCH)/.links $(srctree)/include/asm-$(ARCH)/.arch
+archprepare: $(SRC_ARCH)/.links $(srctree)/include/asm-$(ARCH)/.arch
 
 # Create some links to make all tools happy
 $(SRC_ARCH)/.links:
diff --git a/arch/ia64/Makefile b/arch/ia64/Makefile
index 7ed678cf5e41..70f8ed2748d1 100644
--- a/arch/ia64/Makefile
+++ b/arch/ia64/Makefile
@@ -82,7 +82,7 @@ unwcheck: vmlinux
 archclean:
 	$(Q)$(MAKE) $(clean)=$(boot)
 
-prepare:  include/asm-ia64/.offsets.h.stamp
+archprepare:  include/asm-ia64/.offsets.h.stamp
 
 include/asm-ia64/.offsets.h.stamp:
 	mkdir -p include/asm-ia64
diff --git a/arch/ppc/Makefile b/arch/ppc/Makefile
index 6dd7b50e0669..16e2675f3270 100644
--- a/arch/ppc/Makefile
+++ b/arch/ppc/Makefile
@@ -107,7 +107,7 @@ archclean:
 	# Temporary hack until we have migrated to asm-powerpc
 	$(Q)rm -rf arch/$(ARCH)/include
 
-prepare: checkbin
+archprepare: checkbin
 
 # Temporary hack until we have migrated to asm-powerpc
 include/asm: arch/$(ARCH)/include/asm
diff --git a/arch/sh/Makefile b/arch/sh/Makefile
index 19f00d57acf0..4a3049080b41 100644
--- a/arch/sh/Makefile
+++ b/arch/sh/Makefile
@@ -152,7 +152,7 @@ endif
 	@touch $@
 
 
-prepare: maketools include/asm-sh/.cpu include/asm-sh/.mach
+archprepare: maketools include/asm-sh/.cpu include/asm-sh/.mach
 
 .PHONY: maketools FORCE
 maketools:  include/linux/version.h FORCE
diff --git a/arch/sh64/Makefile b/arch/sh64/Makefile
index 39073734a476..8ca57ffa2b70 100644
--- a/arch/sh64/Makefile
+++ b/arch/sh64/Makefile
@@ -73,7 +73,7 @@ compressed: zImage
 archclean:
 	$(Q)$(MAKE) $(clean)=$(boot)
 
-prepare: arch/$(ARCH)/lib/syscalltab.h
+archprepare: arch/$(ARCH)/lib/syscalltab.h
 
 define filechk_gen-syscalltab
        (set -e; \
diff --git a/arch/um/Makefile b/arch/um/Makefile
index 154803a22698..ce987266dac6 100644
--- a/arch/um/Makefile
+++ b/arch/um/Makefile
@@ -107,7 +107,7 @@ else
 $(shell cd $(ARCH_DIR) && ln -sf Kconfig.$(SUBARCH) Kconfig.arch)
 endif
 
-prepare: $(ARCH_SYMLINKS) $(SYS_HEADERS) $(GEN_HEADERS)
+archprepare: $(ARCH_SYMLINKS) $(SYS_HEADERS) $(GEN_HEADERS)
 
 LINK-$(CONFIG_LD_SCRIPT_STATIC) += -static
 LINK-$(CONFIG_LD_SCRIPT_DYN) += -Wl,-rpath,/lib
diff --git a/arch/xtensa/Makefile b/arch/xtensa/Makefile
index 67ef4cd173b9..98fac8489aed 100644
--- a/arch/xtensa/Makefile
+++ b/arch/xtensa/Makefile
@@ -66,7 +66,7 @@ boot		:= arch/xtensa/boot
 
 archinc		:= include/asm-xtensa
 
-prepare: $(archinc)/.platform
+archprepare: $(archinc)/.platform
 
 # Update machine cpu and platform symlinks if something which affects
 # them changed.
-- 
cgit v1.2.3


From 5011cdd01bedd66b314e330a638c97984c71b53d Mon Sep 17 00:00:00 2001
From: Sam Ravnborg <sam@mars.ravnborg.org>
Date: Sun, 11 Sep 2005 22:32:57 +0200
Subject: kbuild: fix silentoldconfig with make O=

Al Viro reported that sometimes silentoldconfig failed because
output directory was missing.
So create it unconditionally before executing conf

Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
---
 Makefile | 1 +
 1 file changed, 1 insertion(+)

(limited to 'Makefile')

diff --git a/Makefile b/Makefile
index e90ee6a3eef4..45e5a38fbc7a 100644
--- a/Makefile
+++ b/Makefile
@@ -491,6 +491,7 @@ include .config
 # If .config is newer than include/linux/autoconf.h, someone tinkered
 # with it and forgot to run make oldconfig
 include/linux/autoconf.h: .config
+	$(Q)mkdir -p include/linux
 	$(Q)$(MAKE) -f $(srctree)/Makefile silentoldconfig
 else
 # Dummy target needed, because used as prerequisite
-- 
cgit v1.2.3


From 2f4ba45a75d6383b4a1201169a808ffea416ffa0 Mon Sep 17 00:00:00 2001
From: Linus Torvalds <torvalds@g5.osdl.org>
Date: Mon, 12 Sep 2005 20:12:09 -0700
Subject: Linux 2.6.14-rc1

Two weeks after 2.6.13: starting to calm things down.
---
 Makefile | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

(limited to 'Makefile')

diff --git a/Makefile b/Makefile
index 45e5a38fbc7a..4e0d7c68d223 100644
--- a/Makefile
+++ b/Makefile
@@ -1,7 +1,7 @@
 VERSION = 2
 PATCHLEVEL = 6
-SUBLEVEL = 13
-EXTRAVERSION =
+SUBLEVEL = 14
+EXTRAVERSION =-rc1
 NAME=Affluent Albatross
 
 # *DOCUMENTATION*
-- 
cgit v1.2.3