Gitweb:     
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=fc333b2df388d6e8791b3ee59c0679e4a131555a
Commit:     fc333b2df388d6e8791b3ee59c0679e4a131555a
Parent:     d85714d81cc0408daddb68c10f7fd69eafe7c213
Author:     Sam Ravnborg <[EMAIL PROTECTED]>
AuthorDate: Wed Oct 17 23:30:14 2007 +0200
Committer:  Sam Ravnborg <[EMAIL PROTECTED](none)>
CommitDate: Thu Oct 18 09:06:34 2007 +0200

    kbuild: check asm symlink when building a kernel
    
    We often hit the situation where the asm symlink
    in include/ points to the wrong architecture.
    In 9 out of 10 cases thats because we forgot to set
    ARCH but sometimes we just reused the same tree
    for another ARCH. For the merged x86 tree we need
    to create a new symlink but this is not obvious.
    So with the following patch we check if the symlink
    points to the correct architecture and error
    out if this is not the case.
    
    Signed-off-by: Sam Ravnborg <[EMAIL PROTECTED]>
---
 Makefile |   26 ++++++++++++++++++--------
 1 files changed, 18 insertions(+), 8 deletions(-)

diff --git a/Makefile b/Makefile
index 529b904..feca34c 100644
--- a/Makefile
+++ b/Makefile
@@ -903,14 +903,24 @@ prepare: prepare0
 
 export CPPFLAGS_vmlinux.lds += -P -C -U$(ARCH)
 
-# FIXME: The asm symlink changes when $(ARCH) changes. That's
-# hard to detect, but I suppose "make mrproper" is a good idea
-# before switching between archs anyway.
-
-include/asm:
-       @echo '  SYMLINK $@ -> include/asm-$(SRCARCH)'
-       $(Q)if [ ! -d include ]; then mkdir -p include; fi;
-       @ln -fsn asm-$(SRCARCH) $@
+# 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                \
+                       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) $@;                              \
+       fi
 
 # Generate some files
 # ---------------------------------------------------------------------------
-
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to