toolchain-external: extract installation of gdbserver to separate define

The installation of the gdbserver binary has no relation to the installation
of the target libraries. Moving it to a separate define improves the
understandability of the code and makes later refactoring easier.

Signed-off-by: Thomas De Schampheleire <thomas.de.schampheleire@gmail.com>
[Thomas:
 - move the BR2_TOOLCHAIN_EXTERNAL_GDB_SERVER_COPY condition as a make
   condition rather than a shell condition, as suggested by Romain
   Naour.
 - rename the TOOLCHAIN_EXTERNAL_INSTALL_GDBSERVER variable to
   TOOLCHAIN_EXTERNAL_INSTALL_TARGET_GDBSERVER as suggested by Arnout.]
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
2016.08.x
Thomas De Schampheleire 2016-02-12 20:20:24 +01:00 committed by Thomas Petazzoni
parent 38040b2e1f
commit 10e905f83d
1 changed files with 24 additions and 18 deletions

View File

@ -634,27 +634,32 @@ define TOOLCHAIN_EXTERNAL_INSTALL_TARGET_LIBS
for libs in $(USR_LIB_EXTERNAL_LIBS); do \
$(call copy_toolchain_lib_root,$${ARCH_SYSROOT_DIR},$${SUPPORT_LIB_DIR},$${ARCH_LIB_DIR},$$libs,/usr/lib); \
done ; \
fi ; \
if test "$(BR2_TOOLCHAIN_EXTERNAL_GDB_SERVER_COPY)" = "y"; then \
$(call MESSAGE,"Copying gdbserver") ; \
gdbserver_found=0 ; \
for d in $${ARCH_SYSROOT_DIR}/usr \
$${ARCH_SYSROOT_DIR}/../debug-root/usr \
$${ARCH_SYSROOT_DIR}/usr/$${ARCH_LIB_DIR} \
$(TOOLCHAIN_EXTERNAL_INSTALL_DIR); do \
if test -f $${d}/bin/gdbserver ; then \
install -m 0755 -D $${d}/bin/gdbserver $(TARGET_DIR)/usr/bin/gdbserver ; \
gdbserver_found=1 ; \
break ; \
fi ; \
done ; \
if [ $${gdbserver_found} -eq 0 ] ; then \
echo "Could not find gdbserver in external toolchain" ; \
exit 1 ; \
fi ; \
fi
endef
ifeq ($(BR2_TOOLCHAIN_EXTERNAL_GDB_SERVER_COPY),y)
define TOOLCHAIN_EXTERNAL_INSTALL_TARGET_GDBSERVER
$(Q)ARCH_SYSROOT_DIR="$(call toolchain_find_sysroot,$(TOOLCHAIN_EXTERNAL_CC) $(TOOLCHAIN_EXTERNAL_CFLAGS))" ; \
ARCH_LIB_DIR="$(call toolchain_find_libdir,$(TOOLCHAIN_EXTERNAL_CC) $(TOOLCHAIN_EXTERNAL_CFLAGS))" ; \
$(call MESSAGE,"Copying gdbserver") ; \
gdbserver_found=0 ; \
for d in $${ARCH_SYSROOT_DIR}/usr \
$${ARCH_SYSROOT_DIR}/../debug-root/usr \
$${ARCH_SYSROOT_DIR}/usr/$${ARCH_LIB_DIR} \
$(TOOLCHAIN_EXTERNAL_INSTALL_DIR); do \
if test -f $${d}/bin/gdbserver ; then \
install -m 0755 -D $${d}/bin/gdbserver $(TARGET_DIR)/usr/bin/gdbserver ; \
gdbserver_found=1 ; \
break ; \
fi ; \
done ; \
if [ $${gdbserver_found} -eq 0 ] ; then \
echo "Could not find gdbserver in external toolchain" ; \
exit 1 ; \
fi
endef
endif
define TOOLCHAIN_EXTERNAL_INSTALL_SYSROOT_LIBS
$(Q)SYSROOT_DIR="$(call toolchain_find_sysroot,$(TOOLCHAIN_EXTERNAL_CC))" ; \
if test -z "$${SYSROOT_DIR}" ; then \
@ -804,6 +809,7 @@ endef
define TOOLCHAIN_EXTERNAL_INSTALL_TARGET_CMDS
$(TOOLCHAIN_EXTERNAL_CREATE_TARGET_LIB_SYMLINK)
$(TOOLCHAIN_EXTERNAL_INSTALL_TARGET_LIBS)
$(TOOLCHAIN_EXTERNAL_INSTALL_TARGET_GDBSERVER)
$(TOOLCHAIN_EXTERNAL_INSTALL_BFIN_FDPIC)
$(TOOLCHAIN_EXTERNAL_INSTALL_BFIN_FLAT)
$(TOOLCHAIN_EXTERNAL_FIXUP_UCLIBCNG_LDSO)