diff options
author | Ahmad Fatoum <a.fatoum@pengutronix.de> | 2021-09-17 19:41:27 +0200 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2021-10-02 11:12:48 +0200 |
commit | 1c1198a3f252a9af91a128263c9ee25682cf7160 (patch) | |
tree | 52e0060b1f7299081f81a179c5f442f974d4d119 /scripts/imx/Makefile | |
parent | d297e90323f3f129feea237cd48a3fe9a290850b (diff) | |
download | barebox-1c1198a3f252a9af91a128263c9ee25682cf7160.tar.gz barebox-1c1198a3f252a9af91a128263c9ee25682cf7160.tar.xz |
scripts: allow building USB loader tools for target as well
We currently build the USB loader tools only for the host (build) system,
but it can be useful to cross compile them as well for the target.
We already have some target tools, but support for those is easier,
because they don't link against libraries. We use pkg-config to get
cc and ld flags, but we always assume that pkg-config is for the host
system and there is no well-defined way to request pkg-config for the
target system.
Support this by introducing a new CROSS_PKG_CONFIG. This will be
consulted only for target tools and default to
$(CROSS_COMPILE)pkgconfig.
Users can override it as necessary, for example, with Yocto, pkg-config
will be for the cross environment, so target tools can now be built
with:
export ARCH=sandbox CROSS_COMPILE=aarch64-linux-gnu-
export CROSS_PKG_CONFIG=pkg-config scripts
make targettools_defconfig
make scripts
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
Link: https://lore.barebox.org/20210917174127.23345-4-a.fatoum@pengutronix.de
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'scripts/imx/Makefile')
-rw-r--r-- | scripts/imx/Makefile | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/scripts/imx/Makefile b/scripts/imx/Makefile index 029f9ca9f8..a7f487a045 100644 --- a/scripts/imx/Makefile +++ b/scripts/imx/Makefile @@ -4,13 +4,23 @@ hostprogs-always-$(CONFIG_ARCH_IMX_USBLOADER) += imx-usb-loader HOSTCFLAGS_imx-usb-loader.o = `pkg-config --cflags libusb-1.0` HOSTLDLIBS_imx-usb-loader = `pkg-config --libs libusb-1.0` +imx-usb-loader-target-userccflags += `$(CROSS_PKG_CONFIG) --cflags libusb-1.0` +imx-usb-loader-target-userldlibs += `$(CROSS_PKG_CONFIG) --libs libusb-1.0` + HOSTCFLAGS_imx.o = -I$(srctree)/arch/arm/mach-imx/include +imx-target-userccflags += -I$(srctree)/arch/arm/mach-imx/include HOSTCFLAGS_imx-image.o = -I$(srctree) -I$(srctree)/arch/arm/mach-imx/include HOSTCFLAGS_imx-usb-loader.o += -I$(srctree) -I$(srctree)/arch/arm/mach-imx/include +imx-usb-loader-target-userccflags += -I$(srctree) -I$(srctree)/arch/arm/mach-imx/include ifdef CONFIG_ARCH_IMX_IMXIMAGE_SSL_SUPPORT HOSTCFLAGS_imx-image.o += -DIMXIMAGE_SSL_SUPPORT HOSTLDLIBS_imx-image = `pkg-config --libs openssl` endif imx-usb-loader-objs := imx-usb-loader.o imx.o +imx-usb-loader-target-objs := imx-usb-loader-target.o imx-target.o imx-image-objs := imx-image.o imx.o + +userprogs-always-$(CONFIG_ARCH_IMX_USBLOADER_TARGET) += imx-usb-loader-target + +userccflags += -I $(srctree)/$(src)/include -isystem $(srctree)/scripts/include |