summary refs log tree commit diff
path: root/Makefile
diff options
context:
space:
mode:
authorSam Ravnborg <sam@ravnborg.org>2008-10-25 22:58:23 +0200
committerSam Ravnborg <sam@ravnborg.org>2008-10-29 22:02:07 +0100
commitdcc2da1a9693807096e9ac5137b499a829c51268 (patch)
tree996353cc1fc108d593381cb6c2d1e5afe985ec49 /Makefile
parent46dca86cb93db80992a45e4b55737ff2b2f61cd0 (diff)
downloadlinux-dcc2da1a9693807096e9ac5137b499a829c51268.tar.gz
kbuild: improve check-symlink
o if include/asm point to a nonexisting directory remove the asm symlink
o if include/asm is a directory error out

This fixes a situation where one could be left with a symlink
to asm-x86 but that directory no longer exist and thus the build
would error out.

include/asm may be a directory if the kernel tree has been copied

Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile5
1 files changed, 5 insertions, 0 deletions
diff --git a/Makefile b/Makefile
index a7f20687d8e5..ffac7126c944 100644
--- a/Makefile
+++ b/Makefile
@@ -961,6 +961,7 @@ export CPPFLAGS_vmlinux.lds += -P -C -U$(ARCH)
 
 # The asm symlink changes when $(ARCH) changes.
 # Detect this and ask user to run make mrproper
+# 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                                        \
@@ -970,6 +971,10 @@ define check-symlink
 			echo "       set ARCH or save .config and run 'make mrproper' to fix it";             \
 			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