toolchain: copy_toolchain_lib_root: clarify logic
authorThomas De Schampheleire <thomas.de_schampheleire@nokia.com>
Tue, 7 Feb 2017 21:56:47 +0000 (22:56 +0100)
committerThomas Petazzoni <thomas.petazzoni@free-electrons.com>
Wed, 5 Apr 2017 19:33:04 +0000 (21:33 +0200)
copy_toolchain_lib_root has slightly different logic depending on the type
of library object: file or link. All actions related to links are not
relevant in case you are working with a file. Hence, try to increase clarity
by not executing unnecessary lines in the 'file' case.

Signed-off-by: Thomas De Schampheleire <thomas.de_schampheleire@nokia.com>
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
toolchain/helpers.mk

index 319fbd44190f0886351dee80b71b6aaafc060d09..0ec9da42f2732952a80a61a5e5f4e360ed309b20 100644 (file)
@@ -17,19 +17,17 @@ copy_toolchain_lib_root = \
                mkdir -p $(TARGET_DIR)/$${DESTDIR}; \
                while true ; do \
                        LIBNAME=`basename $${LIBPATH}`; \
-                       LINKTARGET=`readlink $${LIBPATH}` ; \
                        rm -fr $(TARGET_DIR)/$${DESTDIR}/$${LIBNAME}; \
                        if test -h $${LIBPATH} ; then \
+                               LINKTARGET=`readlink $${LIBPATH}` ; \
                                ln -sf `basename $${LINKTARGET}` $(TARGET_DIR)/$${DESTDIR}/$${LIBNAME} ; \
+                               LIBPATH="`readlink -f $${LIBPATH}`"; \
                        elif test -f $${LIBPATH}; then \
                                $(INSTALL) -D -m0755 $${LIBPATH} $(TARGET_DIR)/$${DESTDIR}/$${LIBNAME}; \
+                               break ; \
                        else \
                                exit -1; \
                        fi; \
-                       if test -z "$${LINKTARGET}" ; then \
-                               break ; \
-                       fi ; \
-                       LIBPATH="`readlink -f $${LIBPATH}`"; \
                done; \
        done