diff options
author | Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com> | 2009-10-22 12:12:36 +0200 |
---|---|---|
committer | Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com> | 2009-10-22 12:12:36 +0200 |
commit | e3eb1662f8fc2a2884d630169a4f558f467e3f43 (patch) | |
tree | 5eab1a1349f35e50056051fc245281a8d27f0c83 /Makefile | |
parent | cb438965732e16e401d191a8dc5d0076bc44a32a (diff) | |
download | barebox-e3eb1662f8fc2a2884d630169a4f558f467e3f43.tar.gz barebox-e3eb1662f8fc2a2884d630169a4f558f467e3f43.tar.xz |
kbuild: asm symlink support for arch/$ARCH/include
Adjust the asm symlink support so we do not create the
symlink unless really needed.
We check the precense of include/asm-$ARCH by checking
for the system.h file. We may end up with a stale directory
so it is not enough to check if the directory is present.
Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Diffstat (limited to 'Makefile')
-rw-r--r-- | Makefile | 35 |
1 files changed, 31 insertions, 4 deletions
@@ -168,6 +168,7 @@ CROSS_COMPILE ?= # Architecture as present in compile.h UTS_MACHINE := $(ARCH) +SRCARCH := $(ARCH) KCONFIG_CONFIG ?= .config @@ -749,7 +750,9 @@ ifneq ($(KBUILD_SRC),) /bin/false; \ fi; $(Q)if [ ! -d include2 ]; then mkdir -p include2; fi; - $(Q)ln -fsn $(srctree)/include/asm-$(ARCH) include2/asm + $(Q)if [ -e $(srctree)/include/asm-$(SRCARCH)/u-boot.h ]; then \ + ln -fsn $(srctree)/include/asm-$(SRCARCH) include2/asm; \ + fi endif # prepare2 creates a makefile if using a separate output directory @@ -780,10 +783,34 @@ export CPPFLAGS_uboot.lds += -P -C -U$(ARCH) # hard to detect, but I suppose "make mrproper" is a good idea # before switching between archs anyway. +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; \ + 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: - @echo ' SYMLINK $@ -> include/asm-$(ARCH)' - $(Q)if [ ! -d include ]; then mkdir -p include; fi; - @ln -fsn asm-$(ARCH) $@ + $(Q)$(check-symlink) + $(Q)$(create-symlink) include/config.h: include/config/auto.conf @echo ' SYMLINK $@ -> board/$(board-y)/config.h' |