From aa205b37326da2fe2e2b5ce19f4b39c950b8b2f0 Mon Sep 17 00:00:00 2001 From: YAMAMOTO Takashi Date: Tue, 3 Mar 2020 13:59:12 +0900 Subject: [PATCH] mkexport: Deal with ARCHSCRIPT containing multiple files This fixes "make export" for esp32-core. --- tools/mkexport.sh | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/tools/mkexport.sh b/tools/mkexport.sh index 2b1d16abcf..0d78344b1c 100755 --- a/tools/mkexport.sh +++ b/tools/mkexport.sh @@ -198,27 +198,31 @@ cp -f "${TOPDIR}/binfmt/libelf/gnu-elf.ld" "${EXPORTDIR}/scripts/." # Is there a linker script in this configuration? if [ "X${USRONLY}" != "Xy" ]; then - if [ ! -z "${LDPATH}" ]; then + + # LDPATH can contain multiple files. + # The "Copy additional ld scripts" step might copy a file multiple times. + + for LDSCRIPT in ${LDPATH}; do # Apparently so. Verify that the script exists - if [ ! -f "${LDPATH}" ]; then - echo "MK: File ${LDPATH} does not exist" + if [ ! -f "${LDSCRIPT}" ]; then + echo "MK: File ${LDSCRIPT} does not exist" exit 1 fi # Copy the linker script - cp -p "${LDPATH}" "${EXPORTDIR}/scripts/." || \ - { echo "MK: cp ${LDPATH} failed"; exit 1; } + cp -p "${LDSCRIPT}" "${EXPORTDIR}/scripts/." || \ + { echo "MK: cp ${LDSCRIPT} failed"; exit 1; } # Copy additional ld scripts - LDDIR="$(dirname "${LDPATH}")" + LDDIR="$(dirname "${LDSCRIPT}")" for f in "${LDDIR}"/*.ld ; do [ -f "${f}" ] && cp -f "${f}" "${EXPORTDIR}/scripts/." done - fi + done fi # Save the compilation options