All of lore.kernel.org
 help / color / mirror / Atom feed
From: Romain Naour <romain.naour@gmail.com>
To: buildroot@busybox.net
Subject: [Buildroot] [PATCH 25/30] toolchain/toolchain-external: move the definition of various variables into a separate file
Date: Sun, 23 Oct 2016 22:48:26 +0200	[thread overview]
Message-ID: <1477255711-28603-26-git-send-email-romain.naour@gmail.com> (raw)
In-Reply-To: <1477255711-28603-1-git-send-email-romain.naour@gmail.com>

Use pkg-toolchain-external-vars.mk for the definition of various variables:
list of libraries to copy to the target, wrapper arguments and cflags

Signed-off-by: Romain Naour <romain.naour@gmail.com>
---
 .../pkg-toolchain-external-vars.mk                 | 120 +++++++++++++++++++++
 toolchain/toolchain-external/toolchain-external.mk | 101 -----------------
 2 files changed, 120 insertions(+), 101 deletions(-)
 create mode 100644 toolchain/toolchain-external/pkg-toolchain-external-vars.mk

diff --git a/toolchain/toolchain-external/pkg-toolchain-external-vars.mk b/toolchain/toolchain-external/pkg-toolchain-external-vars.mk
new file mode 100644
index 0000000..af8c146
--- /dev/null
+++ b/toolchain/toolchain-external/pkg-toolchain-external-vars.mk
@@ -0,0 +1,120 @@
+#
+# This file contains various variable definitions that are used by the
+# external toolchain infrastructure:
+#
+#  - Definitions of the list of libraries that should be copied to the
+#    target.
+#  - Definition of the CFLAGS to use with the external toolchain, as
+#    well as the common toolchain wrapper build arguments
+#
+
+#
+# Define the list of libraries to copy
+#
+
+ifeq ($(BR2_TOOLCHAIN_EXTERNAL_GLIBC)$(BR2_TOOLCHAIN_EXTERNAL_UCLIBC),y)
+LIB_EXTERNAL_LIBS += libatomic.so.* libc.so.* libcrypt.so.* libdl.so.* libgcc_s.so.* libm.so.* libnsl.so.* libresolv.so.* librt.so.* libutil.so.*
+ifeq ($(BR2_TOOLCHAIN_EXTERNAL_GLIBC)$(BR2_ARM_EABIHF),yy)
+LIB_EXTERNAL_LIBS += ld-linux-armhf.so.*
+else
+LIB_EXTERNAL_LIBS += ld*.so.*
+endif
+ifeq ($(BR2_TOOLCHAIN_HAS_THREADS),y)
+LIB_EXTERNAL_LIBS += libpthread.so.*
+ifneq ($(BR2_PACKAGE_GDB)$(BR2_TOOLCHAIN_EXTERNAL_GDB_SERVER_COPY),)
+LIB_EXTERNAL_LIBS += libthread_db.so.*
+endif # gdbserver
+endif # ! no threads
+endif
+
+ifeq ($(BR2_TOOLCHAIN_EXTERNAL_GLIBC),y)
+LIB_EXTERNAL_LIBS += libnss_files.so.* libnss_dns.so.*
+endif
+
+ifeq ($(BR2_TOOLCHAIN_EXTERNAL_MUSL),y)
+LIB_EXTERNAL_LIBS += libc.so libgcc_s.so.*
+endif
+
+ifeq ($(BR2_INSTALL_LIBSTDCPP),y)
+USR_LIB_EXTERNAL_LIBS += libstdc++.so.*
+endif
+
+ifeq ($(BR2_TOOLCHAIN_HAS_FORTRAN),y)
+USR_LIB_EXTERNAL_LIBS += libgfortran.so.*
+# fortran needs quadmath on x86 and x86_64
+ifeq ($(BR2_TOOLCHAIN_HAS_LIBQUADMATH),y)
+USR_LIB_EXTERNAL_LIBS += libquadmath.so*
+endif
+endif
+
+LIB_EXTERNAL_LIBS += $(call qstrip,$(BR2_TOOLCHAIN_EXTRA_EXTERNAL_LIBS))
+
+#
+# Calculate the common CFLAGS and wrapper arguments
+#
+
+ifeq ($(call qstrip,$(BR2_GCC_TARGET_CPU_REVISION)),)
+CC_TARGET_CPU_ := $(call qstrip,$(BR2_GCC_TARGET_CPU))
+else
+CC_TARGET_CPU_ := $(call qstrip,$(BR2_GCC_TARGET_CPU)-$(BR2_GCC_TARGET_CPU_REVISION))
+endif
+
+CC_TARGET_ARCH_ := $(call qstrip,$(BR2_GCC_TARGET_ARCH))
+CC_TARGET_ABI_ := $(call qstrip,$(BR2_GCC_TARGET_ABI))
+CC_TARGET_FPU_ := $(call qstrip,$(BR2_GCC_TARGET_FPU))
+CC_TARGET_FLOAT_ABI_ := $(call qstrip,$(BR2_GCC_TARGET_FLOAT_ABI))
+CC_TARGET_MODE_ := $(call qstrip,$(BR2_GCC_TARGET_MODE))
+
+# march/mtune/floating point mode needs to be passed to the external toolchain
+# to select the right multilib variant
+ifeq ($(BR2_x86_64),y)
+TOOLCHAIN_EXTERNAL_CFLAGS += -m64
+TOOLCHAIN_EXTERNAL_COMMON_WRAPPER_ARGS += -DBR_64
+endif
+ifneq ($(CC_TARGET_ARCH_),)
+TOOLCHAIN_EXTERNAL_CFLAGS += -march=$(CC_TARGET_ARCH_)
+TOOLCHAIN_EXTERNAL_COMMON_WRAPPER_ARGS += -DBR_ARCH='"$(CC_TARGET_ARCH_)"'
+endif
+ifneq ($(CC_TARGET_CPU_),)
+TOOLCHAIN_EXTERNAL_CFLAGS += -mcpu=$(CC_TARGET_CPU_)
+TOOLCHAIN_EXTERNAL_COMMON_WRAPPER_ARGS += -DBR_CPU='"$(CC_TARGET_CPU_)"'
+endif
+ifneq ($(CC_TARGET_ABI_),)
+TOOLCHAIN_EXTERNAL_CFLAGS += -mabi=$(CC_TARGET_ABI_)
+TOOLCHAIN_EXTERNAL_COMMON_WRAPPER_ARGS += -DBR_ABI='"$(CC_TARGET_ABI_)"'
+endif
+ifneq ($(CC_TARGET_FPU_),)
+TOOLCHAIN_EXTERNAL_CFLAGS += -mfpu=$(CC_TARGET_FPU_)
+TOOLCHAIN_EXTERNAL_COMMON_WRAPPER_ARGS += -DBR_FPU='"$(CC_TARGET_FPU_)"'
+endif
+ifneq ($(CC_TARGET_FLOAT_ABI_),)
+TOOLCHAIN_EXTERNAL_CFLAGS += -mfloat-abi=$(CC_TARGET_FLOAT_ABI_)
+TOOLCHAIN_EXTERNAL_COMMON_WRAPPER_ARGS += -DBR_FLOAT_ABI='"$(CC_TARGET_FLOAT_ABI_)"'
+endif
+ifneq ($(CC_TARGET_MODE_),)
+TOOLCHAIN_EXTERNAL_CFLAGS += -m$(CC_TARGET_MODE_)
+TOOLCHAIN_EXTERNAL_COMMON_WRAPPER_ARGS += -DBR_MODE='"$(CC_TARGET_MODE_)"'
+endif
+ifeq ($(BR2_BINFMT_FLAT),y)
+TOOLCHAIN_EXTERNAL_CFLAGS += -Wl,-elf2flt
+TOOLCHAIN_EXTERNAL_COMMON_WRAPPER_ARGS += -DBR_BINFMT_FLAT
+endif
+ifeq ($(BR2_mipsel)$(BR2_mips64el),y)
+TOOLCHAIN_EXTERNAL_COMMON_WRAPPER_ARGS += -DBR_MIPS_TARGET_LITTLE_ENDIAN
+TOOLCHAIN_EXTERNAL_CFLAGS += -EL
+endif
+ifeq ($(BR2_mips)$(BR2_mips64),y)
+TOOLCHAIN_EXTERNAL_COMMON_WRAPPER_ARGS += -DBR_MIPS_TARGET_BIG_ENDIAN
+TOOLCHAIN_EXTERNAL_CFLAGS += -EB
+endif
+ifeq ($(BR2_arceb),y)
+TOOLCHAIN_EXTERNAL_COMMON_WRAPPER_ARGS += -DBR_ARC_TARGET_BIG_ENDIAN
+TOOLCHAIN_EXTERNAL_CFLAGS += -EB
+endif
+
+TOOLCHAIN_EXTERNAL_CFLAGS += $(call qstrip,$(BR2_TARGET_OPTIMIZATION))
+
+ifeq ($(BR2_SOFT_FLOAT),y)
+TOOLCHAIN_EXTERNAL_CFLAGS += -msoft-float
+TOOLCHAIN_EXTERNAL_COMMON_WRAPPER_ARGS += -DBR_SOFTFLOAT=1
+endif
diff --git a/toolchain/toolchain-external/toolchain-external.mk b/toolchain/toolchain-external/toolchain-external.mk
index ea8bc36..f56f049 100644
--- a/toolchain/toolchain-external/toolchain-external.mk
+++ b/toolchain/toolchain-external/toolchain-external.mk
@@ -63,43 +63,6 @@
 #  $(HOST_DIR)/usr/bin like for the internal toolchains, and the rest
 #  of Buildroot is handled identical for the 2 toolchain types.
 
-ifeq ($(BR2_TOOLCHAIN_EXTERNAL_GLIBC)$(BR2_TOOLCHAIN_EXTERNAL_UCLIBC),y)
-TOOLCHAIN_EXTERNAL_LIBS += libatomic.so.* libc.so.* libcrypt.so.* libdl.so.* libgcc_s.so.* libm.so.* libnsl.so.* libresolv.so.* librt.so.* libutil.so.*
-ifeq ($(BR2_TOOLCHAIN_EXTERNAL_GLIBC)$(BR2_ARM_EABIHF),yy)
-TOOLCHAIN_EXTERNAL_LIBS += ld-linux-armhf.so.*
-else
-TOOLCHAIN_EXTERNAL_LIBS += ld*.so.*
-endif
-ifeq ($(BR2_TOOLCHAIN_HAS_THREADS),y)
-TOOLCHAIN_EXTERNAL_LIBS += libpthread.so.*
-ifneq ($(BR2_PACKAGE_GDB)$(BR2_TOOLCHAIN_EXTERNAL_GDB_SERVER_COPY),)
-TOOLCHAIN_EXTERNAL_LIBS += libthread_db.so.*
-endif # gdbserver
-endif # ! no threads
-endif
-
-ifeq ($(BR2_TOOLCHAIN_EXTERNAL_GLIBC),y)
-TOOLCHAIN_EXTERNAL_LIBS += libnss_files.so.* libnss_dns.so.*
-endif
-
-ifeq ($(BR2_TOOLCHAIN_EXTERNAL_MUSL),y)
-TOOLCHAIN_EXTERNAL_LIBS += libc.so libgcc_s.so.*
-endif
-
-ifeq ($(BR2_INSTALL_LIBSTDCPP),y)
-TOOLCHAIN_EXTERNAL_LIBS += libstdc++.so.*
-endif
-
-ifeq ($(BR2_TOOLCHAIN_HAS_FORTRAN),y)
-TOOLCHAIN_EXTERNAL_LIBS += libgfortran.so.*
-# fortran needs quadmath on x86 and x86_64
-ifeq ($(BR2_TOOLCHAIN_HAS_LIBQUADMATH),y)
-TOOLCHAIN_EXTERNAL_LIBS += libquadmath.so*
-endif
-endif
-
-TOOLCHAIN_EXTERNAL_LIBS += $(call qstrip,$(BR2_TOOLCHAIN_EXTRA_EXTERNAL_LIBS))
-
 # Details about sysroot directory selection.
 #
 # To find the sysroot directory, we use the trick of looking for the
@@ -183,70 +146,6 @@ TOOLCHAIN_EXTERNAL_TOOLCHAIN_WRAPPER_ARGS += \
 	-DBR_CROSS_PATH_REL='"$(TOOLCHAIN_EXTERNAL_BIN:$(HOST_DIR)/%=%)"'
 endif
 
-ifeq ($(call qstrip,$(BR2_GCC_TARGET_CPU_REVISION)),)
-CC_TARGET_CPU_ := $(call qstrip,$(BR2_GCC_TARGET_CPU))
-else
-CC_TARGET_CPU_ := $(call qstrip,$(BR2_GCC_TARGET_CPU)-$(BR2_GCC_TARGET_CPU_REVISION))
-endif
-CC_TARGET_ARCH_ := $(call qstrip,$(BR2_GCC_TARGET_ARCH))
-CC_TARGET_ABI_ := $(call qstrip,$(BR2_GCC_TARGET_ABI))
-CC_TARGET_FPU_ := $(call qstrip,$(BR2_GCC_TARGET_FPU))
-CC_TARGET_FLOAT_ABI_ := $(call qstrip,$(BR2_GCC_TARGET_FLOAT_ABI))
-CC_TARGET_MODE_ := $(call qstrip,$(BR2_GCC_TARGET_MODE))
-
-# march/mtune/floating point mode needs to be passed to the external toolchain
-# to select the right multilib variant
-ifeq ($(BR2_x86_64),y)
-TOOLCHAIN_EXTERNAL_CFLAGS += -m64
-TOOLCHAIN_EXTERNAL_TOOLCHAIN_WRAPPER_ARGS += -DBR_64
-endif
-ifneq ($(CC_TARGET_ARCH_),)
-TOOLCHAIN_EXTERNAL_CFLAGS += -march=$(CC_TARGET_ARCH_)
-TOOLCHAIN_EXTERNAL_TOOLCHAIN_WRAPPER_ARGS += -DBR_ARCH='"$(CC_TARGET_ARCH_)"'
-endif
-ifneq ($(CC_TARGET_CPU_),)
-TOOLCHAIN_EXTERNAL_CFLAGS += -mcpu=$(CC_TARGET_CPU_)
-TOOLCHAIN_EXTERNAL_TOOLCHAIN_WRAPPER_ARGS += -DBR_CPU='"$(CC_TARGET_CPU_)"'
-endif
-ifneq ($(CC_TARGET_ABI_),)
-TOOLCHAIN_EXTERNAL_CFLAGS += -mabi=$(CC_TARGET_ABI_)
-TOOLCHAIN_EXTERNAL_TOOLCHAIN_WRAPPER_ARGS += -DBR_ABI='"$(CC_TARGET_ABI_)"'
-endif
-ifneq ($(CC_TARGET_FPU_),)
-TOOLCHAIN_EXTERNAL_CFLAGS += -mfpu=$(CC_TARGET_FPU_)
-TOOLCHAIN_EXTERNAL_TOOLCHAIN_WRAPPER_ARGS += -DBR_FPU='"$(CC_TARGET_FPU_)"'
-endif
-ifneq ($(CC_TARGET_FLOAT_ABI_),)
-TOOLCHAIN_EXTERNAL_CFLAGS += -mfloat-abi=$(CC_TARGET_FLOAT_ABI_)
-TOOLCHAIN_EXTERNAL_TOOLCHAIN_WRAPPER_ARGS += -DBR_FLOAT_ABI='"$(CC_TARGET_FLOAT_ABI_)"'
-endif
-ifneq ($(CC_TARGET_MODE_),)
-TOOLCHAIN_EXTERNAL_CFLAGS += -m$(CC_TARGET_MODE_)
-TOOLCHAIN_EXTERNAL_TOOLCHAIN_WRAPPER_ARGS += -DBR_MODE='"$(CC_TARGET_MODE_)"'
-endif
-ifeq ($(BR2_BINFMT_FLAT),y)
-TOOLCHAIN_EXTERNAL_CFLAGS += -Wl,-elf2flt
-TOOLCHAIN_EXTERNAL_TOOLCHAIN_WRAPPER_ARGS += -DBR_BINFMT_FLAT
-endif
-ifeq ($(BR2_mipsel)$(BR2_mips64el),y)
-TOOLCHAIN_EXTERNAL_TOOLCHAIN_WRAPPER_ARGS += -DBR_MIPS_TARGET_LITTLE_ENDIAN
-TOOLCHAIN_EXTERNAL_CFLAGS += -EL
-endif
-ifeq ($(BR2_mips)$(BR2_mips64),y)
-TOOLCHAIN_EXTERNAL_TOOLCHAIN_WRAPPER_ARGS += -DBR_MIPS_TARGET_BIG_ENDIAN
-TOOLCHAIN_EXTERNAL_CFLAGS += -EB
-endif
-ifeq ($(BR2_arceb),y)
-TOOLCHAIN_EXTERNAL_TOOLCHAIN_WRAPPER_ARGS += -DBR_ARC_TARGET_BIG_ENDIAN
-TOOLCHAIN_EXTERNAL_CFLAGS += -EB
-endif
-
-TOOLCHAIN_EXTERNAL_CFLAGS += $(call qstrip,$(BR2_TARGET_OPTIMIZATION))
-
-ifeq ($(BR2_SOFT_FLOAT),y)
-TOOLCHAIN_EXTERNAL_CFLAGS += -msoft-float
-TOOLCHAIN_EXTERNAL_TOOLCHAIN_WRAPPER_ARGS += -DBR_SOFTFLOAT=1
-endif
 
 # musl does not provide an implementation for sys/queue.h or sys/cdefs.h.
 # So, add the musl-compat-headers package that will install those files,
-- 
2.5.5

  parent reply	other threads:[~2016-10-23 20:48 UTC|newest]

Thread overview: 44+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-10-23 20:48 [Buildroot] [PATCH 00/30] Splitting the toolchain-external package Romain Naour
2016-10-23 20:48 ` [Buildroot] [PATCH 01/30] toolchain-external: pass CC and CFLAGS as arguments Romain Naour
2016-10-25 10:50   ` Arnout Vandecappelle
2016-10-23 20:48 ` [Buildroot] [PATCH 02/30] " Romain Naour
2016-10-25 11:07   ` Arnout Vandecappelle
2016-10-25 11:44     ` Thomas Petazzoni
2016-10-25 12:46       ` Arnout Vandecappelle
2016-10-25 12:48         ` Thomas Petazzoni
2016-10-25 12:57           ` Arnout Vandecappelle
2016-10-23 20:48 ` [Buildroot] [PATCH 03/30] toolchain-external: pass arguments CROSS to install wrapper Romain Naour
2016-10-23 20:48 ` [Buildroot] [PATCH 04/30] toolchain-external: pass arguments CC, CFLAGS, INSTALL_DIR while installing gdbserver Romain Naour
2016-10-23 20:48 ` [Buildroot] [PATCH 05/30] toolchain-external-blackfin-uclinux: new package Romain Naour
2016-10-23 20:48 ` [Buildroot] [PATCH 06/30] toolchain-external-arago-armv7a: " Romain Naour
2016-10-23 20:48 ` [Buildroot] [PATCH 07/30] toolchain-external-arago-armv5te: " Romain Naour
2016-10-23 20:48 ` [Buildroot] [PATCH 08/30] toolchain-external-custom: " Romain Naour
2016-10-23 20:48 ` [Buildroot] [PATCH 09/30] toolchain-external-linaro-aarch64: " Romain Naour
2016-10-23 20:48 ` [Buildroot] [PATCH 10/30] toolchain-external-linaro-arm: " Romain Naour
2016-10-23 20:48 ` [Buildroot] [PATCH 11/30] toolchain-external-linaro-armeb: " Romain Naour
2016-10-23 20:48 ` [Buildroot] [PATCH 12/30] toolchain-external-musl-cross: " Romain Naour
2016-10-23 20:48 ` [Buildroot] [PATCH 13/30] toolchain-external-codesourcery-aarch64: " Romain Naour
2016-10-23 20:48 ` [Buildroot] [PATCH 14/30] toolchain-external-codesourcery-arm: " Romain Naour
2016-10-23 20:48 ` [Buildroot] [PATCH 15/30] toolchain-external-codesourcery-mips: " Romain Naour
2016-10-23 20:48 ` [Buildroot] [PATCH 16/30] toolchain-external-codesourcery-niosII: " Romain Naour
2016-10-23 20:48 ` [Buildroot] [PATCH 17/30] toolchain-external-codesourcery-sh: " Romain Naour
2016-10-23 20:48 ` [Buildroot] [PATCH 18/30] toolchain-external-codesourcery-x86: " Romain Naour
2016-10-23 20:48 ` [Buildroot] [PATCH 19/30] toolchain-external-codesourcery-amd64: " Romain Naour
2016-10-23 20:48 ` [Buildroot] [PATCH 20/30] toolchain-external-synopsys-arc: " Romain Naour
2016-10-23 20:48 ` [Buildroot] [PATCH 21/30] toolchain-external-codescape-img-mips: " Romain Naour
2016-10-23 20:48 ` [Buildroot] [PATCH 22/30] toolchain-external-codescape-mti-mips: " Romain Naour
2016-10-23 20:48 ` [Buildroot] [PATCH 23/30] toolchain/toolchain-external: move functions and utility logic into a separate file Romain Naour
2016-10-23 20:48 ` [Buildroot] [PATCH 24/30] toolchain/toolchain-external: move wrapper " Romain Naour
2016-10-23 20:48 ` Romain Naour [this message]
2016-10-23 20:48 ` [Buildroot] [PATCH 26/30] toolchain/toolchain-external: move uClibc specific " Romain Naour
2016-10-23 20:48 ` [Buildroot] [PATCH 27/30] toolchain/toolchain-external: move musl " Romain Naour
2016-10-23 20:48 ` [Buildroot] [PATCH 28/30] toolchain/toolchain-external: move bfin " Romain Naour
2016-10-23 20:48 ` [Buildroot] [PATCH 29/30] toolchain/toolchain-external: move external toolchain definition " Romain Naour
2016-10-25  9:55   ` Thomas Petazzoni
2016-10-23 20:48 ` [Buildroot] [PATCH 30/30] toolchain-external: introduce and use external toolchain infra Romain Naour
2016-10-25 10:38 ` [Buildroot] [PATCH 00/30] Splitting the toolchain-external package Thomas Petazzoni
2016-10-25 14:26 ` Arnout Vandecappelle
2016-10-25 14:54   ` Thomas Petazzoni
2016-10-25 15:11     ` Arnout Vandecappelle
2016-10-25 15:38       ` Thomas Petazzoni
2016-10-25 18:03         ` Romain Naour

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1477255711-28603-26-git-send-email-romain.naour@gmail.com \
    --to=romain.naour@gmail.com \
    --cc=buildroot@busybox.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.