aboutsummaryrefslogtreecommitdiffstats
path: root/Makefile
diff options
context:
space:
mode:
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile42
1 files changed, 28 insertions, 14 deletions
diff --git a/Makefile b/Makefile
index ad0533b9a0d..f6fcad704d2 100644
--- a/Makefile
+++ b/Makefile
@@ -925,7 +925,9 @@ ifneq ($(KBUILD_SRC),)
925 /bin/false; \ 925 /bin/false; \
926 fi; 926 fi;
927 $(Q)if [ ! -d include2 ]; then mkdir -p include2; fi; 927 $(Q)if [ ! -d include2 ]; then mkdir -p include2; fi;
928 $(Q)ln -fsn $(srctree)/include/asm-$(SRCARCH) include2/asm 928 $(Q)if [ -e $(srctree)/include/asm-$(SRCARCH)/system.h ]; then \
929 ln -fsn $(srctree)/include/asm-$(SRCARCH) include2/asm; \
930 fi
929endif 931endif
930 932
931# prepare2 creates a makefile if using a separate output directory 933# prepare2 creates a makefile if using a separate output directory
@@ -951,22 +953,34 @@ export CPPFLAGS_vmlinux.lds += -P -C -U$(ARCH)
951 953
952# The asm symlink changes when $(ARCH) changes. 954# The asm symlink changes when $(ARCH) changes.
953# Detect this and ask user to run make mrproper 955# Detect this and ask user to run make mrproper
954 956define check-symlink
955include/asm: FORCE 957 set -e; \
956 $(Q)set -e; asmlink=`readlink include/asm | cut -d '-' -f 2`; \ 958 if [ -L include/asm ]; then \
957 if [ -L include/asm ]; then \ 959 asmlink=`readlink include/asm | cut -d '-' -f 2`; \
958 if [ "$$asmlink" != "$(SRCARCH)" ]; then \ 960 if [ "$$asmlink" != "$(SRCARCH)" ]; then \
959 echo "ERROR: the symlink $@ points to asm-$$asmlink but asm-$(SRCARCH) was expected"; \ 961 echo "ERROR: the symlink $@ points to asm-$$asmlink but asm-$(SRCARCH) was expected"; \
960 echo " set ARCH or save .config and run 'make mrproper' to fix it"; \ 962 echo " set ARCH or save .config and run 'make mrproper' to fix it"; \
961 exit 1; \ 963 exit 1; \
962 fi; \ 964 fi; \
963 else \ 965 fi
964 echo ' SYMLINK $@ -> include/asm-$(SRCARCH)'; \ 966endef
965 if [ ! -d include ]; then \ 967
966 mkdir -p include; \ 968# We create the target directory of the symlink if it does
967 fi; \ 969# not exist so the test in chack-symlink works and we have a
968 ln -fsn asm-$(SRCARCH) $@; \ 970# directory for generated filesas used by some architectures.
971define create-symlink
972 if [ ! -L include/asm ]; then \
973 echo ' SYMLINK $@ -> include/asm-$(SRCARCH)'; \
974 if [ ! -d include/asm-$(SRCARCH) ]; then \
975 mkdir -p include/asm-$(SRCARCH); \
976 fi; \
977 ln -fsn asm-$(SRCARCH) $@; \
969 fi 978 fi
979endef
980
981include/asm: FORCE
982 $(Q)$(check-symlink)
983 $(Q)$(create-symlink)
970 984
971# Generate some files 985# Generate some files
972# --------------------------------------------------------------------------- 986# ---------------------------------------------------------------------------