@@ -83,6 +83,20 @@ copy_toolchain_lib_root = \
\
echo -n
+# Calculate the symlink's depth by counting the number of slashs.
+# Then create the symlink to arch sysroot.
+# $1: arch specific subdirectory in the sysroot
+toolchain_create_arch_sysroot_symlink = \
+ ARCH_SUBDIR="$(strip $1)"; \
+ mkdir -p `dirname $(STAGING_DIR)/$${ARCH_SUBDIR}` ; \
+ relpath="./" ; \
+ nbslashs=`echo -n $${ARCH_SUBDIR} | sed 's%[^/]%%g' | wc -c` ; \
+ for slash in `seq 1 $${nbslashs}` ; do \
+ relpath=$${relpath}"../" ; \
+ done ; \
+ ln -s $${relpath} $(STAGING_DIR)/$${ARCH_SUBDIR} ; \
+ echo "Symlinking $(STAGING_DIR)/$${ARCH_SUBDIR} -> $${relpath}"
+
#
# Copy the full external toolchain sysroot directory to the staging
# dir. The operation of this function is rendered a little bit
@@ -148,14 +162,7 @@ copy_toolchain_sysroot = \
if [ ! -d $${ARCH_SYSROOT_DIR}/usr/include ] ; then \
cp -a $${SYSROOT_DIR}/usr/include $(STAGING_DIR)/usr ; \
fi ; \
- mkdir -p `dirname $(STAGING_DIR)/$${ARCH_SUBDIR}` ; \
- relpath="./" ; \
- nbslashs=`echo -n $${ARCH_SUBDIR} | sed 's%[^/]%%g' | wc -c` ; \
- for slash in `seq 1 $${nbslashs}` ; do \
- relpath=$${relpath}"../" ; \
- done ; \
- ln -s $${relpath} $(STAGING_DIR)/$${ARCH_SUBDIR} ; \
- echo "Symlinking $(STAGING_DIR)/$${ARCH_SUBDIR} -> $${relpath}" ; \
+ $(call toolchain_create_arch_sysroot_symlink,$${ARCH_SUBDIR}) ; \
fi ; \
if test -n "$${SUPPORT_LIB_DIR}" ; then \
cp -a $${SUPPORT_LIB_DIR}/* $(STAGING_DIR)/lib/ ; \
The part of copy_toolchain_sysroot function that create the symlink in the staging directory will be used in two different place in the following patch. So factorize this part in a new function called toolchain_create_arch_sysroot_symlink. Signed-off-by: Romain Naour <romain.naour@openwide.fr> --- toolchain/helpers.mk | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-)