This is an automated email from the ASF dual-hosted git repository.

xiaoxiang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx.git


The following commit(s) were added to refs/heads/master by this push:
     new 62661600b2 treewide: add DOWNLOAD variable as unification of curl call
62661600b2 is described below

commit 62661600b2bbc656a57881f26e3b8f8854d79b33
Author: Karel Kočí <[email protected]>
AuthorDate: Tue Mar 7 17:17:54 2023 +0100

    treewide: add DOWNLOAD variable as unification of curl call
    
    This is a followup to the commit
    03b164f59ce40a3f5677b0588af2aee8d9697bf6.
---
 arch/arm/src/nrf52/Make.defs          |  3 +--
 arch/arm/src/nrf53/Make.defs          |  3 +--
 arch/risc-v/src/bl602/Make.defs       |  3 +--
 arch/risc-v/src/esp32c3/Bootloader.mk |  8 +++-----
 arch/risc-v/src/esp32c3/Make.defs     |  3 +--
 arch/risc-v/src/opensbi/Make.defs     |  3 +--
 arch/xtensa/src/esp32/Bootloader.mk   |  8 +++-----
 arch/xtensa/src/esp32/Make.defs       |  3 +--
 arch/xtensa/src/esp32s2/Bootloader.mk |  8 +++-----
 arch/xtensa/src/esp32s3/Bootloader.mk |  8 +++-----
 drivers/segger/Make.defs              |  4 ++--
 fs/littlefs/Make.defs                 |  2 +-
 libs/libc/audio/libsrc/Make.defs      |  2 +-
 libs/libc/zoneinfo/Makefile           |  4 ++--
 libs/libxx/etl.defs                   |  2 +-
 libs/libxx/libcxx.defs                |  2 +-
 libs/libxx/libcxxabi.defs             |  2 +-
 openamp/libmetal.defs                 |  2 +-
 openamp/open-amp.defs                 |  2 +-
 tools/Config.mk                       | 12 ++++++++++++
 20 files changed, 41 insertions(+), 43 deletions(-)

diff --git a/arch/arm/src/nrf52/Make.defs b/arch/arm/src/nrf52/Make.defs
index 9c7f6ff788..bc483963a0 100644
--- a/arch/arm/src/nrf52/Make.defs
+++ b/arch/arm/src/nrf52/Make.defs
@@ -120,8 +120,7 @@ NRFXLIB_TGZ     := $(NRFXLIB_REF).tar.gz
 NRFXLIB_URL     := https://github.com/nrfconnect/sdk-nrfxlib/archive
 
 $(NRFXLIB_TGZ):
-       $(Q) echo "Downloading: NRFXLIB"
-       $(Q) curl -L $(NRFXLIB_URL)/$(NRFXLIB_TGZ) -o chip/$(NRFXLIB_TGZ)
+       $(call DOWNLOAD,$(NRFXLIB_URL),$(NRFXLIB_TGZ),chip/$(NRFXLIB_TGZ))
 
 chip/$(NRFXLIB_UNPACK): $(NRFXLIB_TGZ)
        $(Q) echo "Unpacking: NRXFLIB"
diff --git a/arch/arm/src/nrf53/Make.defs b/arch/arm/src/nrf53/Make.defs
index c3836e7a4c..686f1c5e27 100644
--- a/arch/arm/src/nrf53/Make.defs
+++ b/arch/arm/src/nrf53/Make.defs
@@ -51,8 +51,7 @@ NRFXLIB_TGZ     := $(NRFXLIB_REF).tar.gz
 NRFXLIB_URL     := https://github.com/nrfconnect/sdk-nrfxlib/archive
 
 $(NRFXLIB_TGZ):
-       $(Q) echo "Downloading: NRFXLIB"
-       $(Q) curl -L $(NRFXLIB_URL)/$(NRFXLIB_TGZ) -o chip/$(NRFXLIB_TGZ)
+       $(call DOWNLOAD,$(NRFXLIB_URL),$(NRFXLIB_TGZ),chip/$(NRFXLIB_TGZ))
 
 chip/$(NRFXLIB_UNPACK): $(NRFXLIB_TGZ)
        $(Q) echo "Unpacking: NRXFLIB"
diff --git a/arch/risc-v/src/bl602/Make.defs b/arch/risc-v/src/bl602/Make.defs
index 635a78c9a7..1e27d34c60 100644
--- a/arch/risc-v/src/bl602/Make.defs
+++ b/arch/risc-v/src/bl602/Make.defs
@@ -71,8 +71,7 @@ WIRELESS_DRV_ZIP     = v$(WIRELESS_DRV_VERSION).zip
 WIRELESS_DRV_URL     = 
https://github.com/bouffalolab/bl_blob/archive/refs/heads
 
 $(WIRELESS_DRV_ZIP):
-       $(Q) echo "Downloading: BL602 Wireless Drivers"
-       $(Q) curl -L $(WIRELESS_DRV_URL)/$(WIRELESS_DRV_ZIP) -o 
chip/$(WIRELESS_DRV_ZIP)
+       $(call 
DOWNLOAD,$(WIRELESS_DRV_URL),$(WIRELESS_DRV_ZIP),chip/$(WIRELESS_DRV_ZIP))
 
 chip/$(WIRELESS_DRV_UNPACK): $(WIRELESS_DRV_ZIP)
        $(Q) echo "Unpacking: BL602 Wireless Drivers"
diff --git a/arch/risc-v/src/esp32c3/Bootloader.mk 
b/arch/risc-v/src/esp32c3/Bootloader.mk
index 902725689d..d4cdb4c953 100644
--- a/arch/risc-v/src/esp32c3/Bootloader.mk
+++ b/arch/risc-v/src/esp32c3/Bootloader.mk
@@ -168,8 +168,7 @@ BOOTLOADER_URL     = 
https://github.com/espressif/esp-nuttx-bootloader/releases/
 ifeq ($(CONFIG_ESP32C3_APP_FORMAT_MCUBOOT),y)
 
 bootloader:
-       $(Q) echo "Downloading Bootloader binaries"
-       $(Q) curl -L $(BOOTLOADER_URL)/mcuboot-esp32c3.bin -o 
$(TOPDIR)/mcuboot-esp32c3.bin
+       $(call 
DOWNLOAD,$(BOOTLOADER_URL),mcuboot-esp32c3.bin,$(TOPDIR)/mcuboot-esp32c3.bin)
 
 clean_bootloader:
        $(call DELFILE,$(TOPDIR)/mcuboot-esp32c3.bin)
@@ -177,9 +176,8 @@ clean_bootloader:
 else ifeq ($(CONFIG_ESP32C3_APP_FORMAT_LEGACY),y)
 
 bootloader:
-       $(Q) echo "Downloading Bootloader binaries"
-       $(Q) curl -L $(BOOTLOADER_URL)/bootloader-esp32c3.bin -o 
$(TOPDIR)/bootloader-esp32c3.bin
-       $(Q) curl -L $(BOOTLOADER_URL)/partition-table-esp32c3.bin -o 
$(TOPDIR)/partition-table-esp32c3.bin
+       $(call 
DOWNLOAD,$(BOOTLOADER_URL),mcuboot-esp32c3.bin,$(TOPDIR)/mcuboot-esp32c3.bin)
+       $(call 
DOWNLOAD,$(BOOTLOADER_URL),partition-table-esp32c3.bin,$(TOPDIR)/partition-table-esp32c3.bin)
 
 clean_bootloader:
        $(call DELFILE,$(TOPDIR)/bootloader-esp32c3.bin)
diff --git a/arch/risc-v/src/esp32c3/Make.defs 
b/arch/risc-v/src/esp32c3/Make.defs
index da28f746b8..c24da89dcb 100644
--- a/arch/risc-v/src/esp32c3/Make.defs
+++ b/arch/risc-v/src/esp32c3/Make.defs
@@ -189,8 +189,7 @@ WIRELESS_DRV_ZIP    = $(WIRELESS_DRV_ID).zip
 WIRELESS_DRV_URL    = 
https://github.com/espressif/esp-wireless-drivers-3rdparty/archive
 
 $(WIRELESS_DRV_ZIP):
-       $(Q) echo "Downloading: ESP Wireless Drivers"
-       $(Q) curl -L $(WIRELESS_DRV_URL)/$(WIRELESS_DRV_ZIP) -o 
chip/$(WIRELESS_DRV_ZIP)
+       $(call 
DOWNLOAD,$(WIRELESS_DRV_URL),$(WIRELESS_DRV_ZIP),chip/$(WIRELESS_DRV_ZIP))
 
 chip/$(WIRELESS_DRV_UNPACK): $(WIRELESS_DRV_ZIP)
        $(Q) echo "Unpacking: ESP Wireless Drivers"
diff --git a/arch/risc-v/src/opensbi/Make.defs 
b/arch/risc-v/src/opensbi/Make.defs
index 0d51253f4b..d267f3ff48 100644
--- a/arch/risc-v/src/opensbi/Make.defs
+++ b/arch/risc-v/src/opensbi/Make.defs
@@ -43,8 +43,7 @@ OPENSBI_TARBALL = opensbi.tar.gz
 OPENSBI_DIR     = riscv-software-src-opensbi-4998a71
 
 $(OPENSBI_TARBALL):
-       $(Q) echo "Downloading: OpenSBI"
-       $(Q) curl -L $(OPENSBI_URL)/$(OPENSBI_COMMIT) -o 
opensbi/$(OPENSBI_TARBALL)
+       $(call 
DOWNLOAD,$(OPENSBI_URL),$(OPENSBI_COMMIT),opensbi/$(OPENSBI_TARBALL))
 
 .opensbi_unpack: $(OPENSBI_TARBALL)
        $(Q) echo "Unpacking: OpenSBI"
diff --git a/arch/xtensa/src/esp32/Bootloader.mk 
b/arch/xtensa/src/esp32/Bootloader.mk
index 85505eacd8..fa73a3929f 100644
--- a/arch/xtensa/src/esp32/Bootloader.mk
+++ b/arch/xtensa/src/esp32/Bootloader.mk
@@ -177,8 +177,7 @@ BOOTLOADER_URL     = 
https://github.com/espressif/esp-nuttx-bootloader/releases/
 ifeq ($(CONFIG_ESP32_APP_FORMAT_MCUBOOT),y)
 
 bootloader:
-       $(Q) echo "Downloading Bootloader binaries"
-       $(Q) curl -L $(BOOTLOADER_URL)/mcuboot-esp32.bin -o 
$(TOPDIR)/mcuboot-esp32.bin
+       $(call 
DOWNLOAD,$(BOOTLOADER_URL),mcuboot-esp32.bin,$(TOPDIR)/mcuboot-esp32.bin)
 
 clean_bootloader:
        $(call DELFILE,$(TOPDIR)/mcuboot-esp32.bin)
@@ -186,9 +185,8 @@ clean_bootloader:
 else ifeq ($(CONFIG_ESP32_APP_FORMAT_LEGACY),y)
 
 bootloader:
-       $(Q) echo "Downloading Bootloader binaries"
-       $(Q) curl -L $(BOOTLOADER_URL)/bootloader-esp32.bin -o 
$(TOPDIR)/bootloader-esp32.bin
-       $(Q) curl -L $(BOOTLOADER_URL)/partition-table-esp32.bin -o 
$(TOPDIR)/partition-table-esp32.bin
+       $(call 
DOWNLOAD,$(BOOTLOADER_URL),mcuboot-esp32.bin,$(TOPDIR)/mcuboot-esp32.bin)
+       $(call 
DOWNLOAD,$(BOOTLOADER_URL),partition-table-esp32.bin,$(TOPDIR)/partition-table-esp32.bin)
 
 clean_bootloader:
        $(call DELFILE,$(TOPDIR)/bootloader-esp32.bin)
diff --git a/arch/xtensa/src/esp32/Make.defs b/arch/xtensa/src/esp32/Make.defs
index 1a6f5fc91d..4d43b813ca 100644
--- a/arch/xtensa/src/esp32/Make.defs
+++ b/arch/xtensa/src/esp32/Make.defs
@@ -201,8 +201,7 @@ WIRELESS_DRV_ZIP     = $(WIRELESS_DRV_ID).zip
 WIRELESS_DRV_URL     = 
https://github.com/espressif/esp-wireless-drivers-3rdparty/archive
 
 $(WIRELESS_DRV_ZIP):
-       $(Q) echo "Downloading: ESP Wireless Drivers"
-       $(Q) curl -L $(WIRELESS_DRV_URL)/$(WIRELESS_DRV_ZIP) -o 
chip/$(WIRELESS_DRV_ZIP)
+       $(call 
DOWNLOAD,$(WIRELESS_DRV_URL),$(WIRELESS_DRV_ZIP),chip/$(WIRELESS_DRV_ZIP))
 
 chip/$(WIRELESS_DRV_UNPACK): $(WIRELESS_DRV_ZIP)
        $(Q) echo "Unpacking: ESP Wireless Drivers"
diff --git a/arch/xtensa/src/esp32s2/Bootloader.mk 
b/arch/xtensa/src/esp32s2/Bootloader.mk
index 54248dfe50..5bfa9caec4 100644
--- a/arch/xtensa/src/esp32s2/Bootloader.mk
+++ b/arch/xtensa/src/esp32s2/Bootloader.mk
@@ -166,8 +166,7 @@ BOOTLOADER_URL     = 
https://github.com/espressif/esp-nuttx-bootloader/releases/
 ifeq ($(CONFIG_ESP32S2_APP_FORMAT_MCUBOOT),y)
 
 bootloader:
-       $(Q) echo "Downloading Bootloader binaries"
-       $(Q) curl -L $(BOOTLOADER_URL)/mcuboot-esp32s2.bin -o 
$(TOPDIR)/mcuboot-esp32s2.bin
+       $(call 
DOWNLOAD,$(BOOTLOADER_URL),mcuboot-esp32s2.bin,$(TOPDIR)/mcuboot-esp32s2.bin)
 
 clean_bootloader:
        $(call DELFILE,$(TOPDIR)/mcuboot-esp32s2.bin)
@@ -175,9 +174,8 @@ clean_bootloader:
 else ifeq ($(CONFIG_ESP32S2_APP_FORMAT_LEGACY),y)
 
 bootloader:
-       $(Q) echo "Downloading Bootloader binaries"
-       $(Q) curl -L $(BOOTLOADER_URL)/bootloader-esp32s2.bin -o 
$(TOPDIR)/bootloader-esp32s2.bin
-       $(Q) curl -L $(BOOTLOADER_URL)/partition-table-esp32s2.bin -o 
$(TOPDIR)/partition-table-esp32s2.bin
+       $(call 
DOWNLOAD,$(BOOTLOADER_URL),mcuboot-esp32s2.bin,$(TOPDIR)/mcuboot-esp32s2.bin)
+       $(call 
DOWNLOAD,$(BOOTLOADER_URL),partition-table-esp32s2.bin,$(TOPDIR)/partition-table-esp32s2.bin)
 
 clean_bootloader:
        $(call DELFILE,$(TOPDIR)/bootloader-esp32s2.bin)
diff --git a/arch/xtensa/src/esp32s3/Bootloader.mk 
b/arch/xtensa/src/esp32s3/Bootloader.mk
index 6d6455e52a..e5fc43457b 100644
--- a/arch/xtensa/src/esp32s3/Bootloader.mk
+++ b/arch/xtensa/src/esp32s3/Bootloader.mk
@@ -110,8 +110,7 @@ BOOTLOADER_URL     = 
https://github.com/espressif/esp-nuttx-bootloader/releases/
 ifeq ($(CONFIG_ESP32S3_APP_FORMAT_MCUBOOT),y)
 
 bootloader:
-       $(Q) echo "Downloading Bootloader binaries"
-       $(Q) curl -L $(BOOTLOADER_URL)/mcuboot-esp32s3.bin -o 
$(TOPDIR)/mcuboot-esp32s3.bin
+       $(call 
DOWNLOAD,$(BOOTLOADER_URL),mcuboot-esp32s3.bin,$(TOPDIR)/mcuboot-esp32s3.bin)
 
 clean_bootloader:
        $(call DELFILE,$(TOPDIR)/mcuboot-esp32s3.bin)
@@ -119,9 +118,8 @@ clean_bootloader:
 else ifeq ($(CONFIG_ESP32S3_APP_FORMAT_LEGACY),y)
 
 bootloader:
-       $(Q) echo "Downloading Bootloader binaries"
-       $(Q) curl -L $(BOOTLOADER_URL)/bootloader-esp32s3.bin -o 
$(TOPDIR)/bootloader-esp32s3.bin
-       $(Q) curl -L $(BOOTLOADER_URL)/partition-table-esp32s3.bin -o 
$(TOPDIR)/partition-table-esp32s3.bin
+       $(call 
DOWNLOAD,$(BOOTLOADER_URL),mcuboot-esp32s3.bin,$(TOPDIR)/mcuboot-esp32s3.bin)
+       $(call 
DOWNLOAD,$(BOOTLOADER_URL),partition-table-esp32s3.bin,$(TOPDIR)/partition-table-esp32s3.bin)
 
 clean_bootloader:
        $(call DELFILE,$(TOPDIR)/bootloader-esp32s3.bin)
diff --git a/drivers/segger/Make.defs b/drivers/segger/Make.defs
index 2d819328e6..8db4b5d307 100644
--- a/drivers/segger/Make.defs
+++ b/drivers/segger/Make.defs
@@ -47,7 +47,7 @@ ifeq ($(CONFIG_SEGGER_RTT),y)
 # Download and unpack tarball if no git repo found
 ifeq ($(wildcard $(SGDIR)/RTT/.git),)
 $(SGDIR)/RTT.zip:
-       $(Q) curl -L 
https://github.com/SEGGERMicro/RTT/archive/refs/tags/V$(RTT_VERSION).zip -o 
$(SGDIR)/RTT.zip
+       $(call 
DOWNLOAD,https://github.com/SEGGERMicro/RTT/archive/refs/tags,V$(RTT_VERSION).zip,$(SGDIR)/RTT.zip)
        $(Q) unzip -o $(SGDIR)/RTT.zip -d $(SGDIR)
        $(Q) mv $(SGDIR)/RTT-$(RTT_VERSION) $(SGDIR)/RTT
        $(Q) patch -p0 < 
segger/0001-segger-RTT-include-the-SEGGER_RTT_Conf.h-from-custom.patch
@@ -78,7 +78,7 @@ ifeq ($(CONFIG_SEGGER_SYSVIEW),y)
 # Download and unpack tarball if no git repo found
 ifeq ($(wildcard $(SGDIR)/SystemView/.git),)
 $(SGDIR)/SystemView.zip:
-       $(Q) curl -L 
https://github.com/SEGGERMicro/SystemView/archive/refs/tags/V$(SYSVIEW_VERSION).zip
 -o $(SGDIR)/SystemView.zip
+       $(call 
DOWNLOAD,https://github.com/SEGGERMicro/SystemView/archive/refs/tags,V$(SYSVIEW_VERSION).zip,$(SGDIR)/SystemView.zip)
        $(Q) unzip -o $(SGDIR)/SystemView.zip -d $(SGDIR)
        $(Q) mv $(SGDIR)/SystemView-$(SYSVIEW_VERSION) $(SGDIR)/SystemView
 
diff --git a/fs/littlefs/Make.defs b/fs/littlefs/Make.defs
index ef4b07ce8a..7a67fa5ecf 100644
--- a/fs/littlefs/Make.defs
+++ b/fs/littlefs/Make.defs
@@ -45,7 +45,7 @@ LITTLEFS_VERSION ?= 2.4.0
 LITTLEFS_TARBALL = v$(LITTLEFS_VERSION).tar.gz
 
 $(LITTLEFS_TARBALL):
-       $(Q) curl -L -o littlefs/$(LITTLEFS_TARBALL) 
https://github.com/ARMmbed/littlefs/archive/$(LITTLEFS_TARBALL)
+       $(call 
DOWNLOAD,https://github.com/ARMmbed/littlefs/archive,$(LITTLEFS_TARBALL),littlefs/$(LITTLEFS_TARBALL))
 
 .littlefsunpack: $(LITTLEFS_TARBALL)
        $(Q) tar zxf littlefs/$(LITTLEFS_TARBALL) -C littlefs
diff --git a/libs/libc/audio/libsrc/Make.defs b/libs/libc/audio/libsrc/Make.defs
index 1238c781b7..4fdbabafdf 100644
--- a/libs/libc/audio/libsrc/Make.defs
+++ b/libs/libc/audio/libsrc/Make.defs
@@ -26,7 +26,7 @@ VERSION=0.1.9
 # Download and unpack tarball if no git repo found
 ifeq ($(wildcard libsamplerate/.git),)
 libsamplerate:
-       $(Q) curl -L 
https://codeload.github.com/libsndfile/libsamplerate/zip/master -o 
libsamplerate.zip
+       $(call 
DOWNLOAD,https://codeload.github.com/libsndfile/libsamplerate/zip,master,libsamplerate.zip)
        $(Q) unzip -o libsamplerate.zip
        $(Q) mv libsamplerate-master libsamplerate
 endif
diff --git a/libs/libc/zoneinfo/Makefile b/libs/libc/zoneinfo/Makefile
index c1c178588a..c3c46d93ab 100644
--- a/libs/libc/zoneinfo/Makefile
+++ b/libs/libc/zoneinfo/Makefile
@@ -83,10 +83,10 @@ tzbin:
        mkdir tzbin
 
 tzcode-latest.tar.gz:
-       $(Q) curl -L -O ftp://ftp.iana.org/tz/tzcode-latest.tar.gz
+       $(call DOWNLOAD,ftp://ftp.iana.org/tz,tzcode-latest.tar.gz)
 
 tzdata-latest.tar.gz:
-       $(Q) curl -L -O ftp://ftp.iana.org/tz/tzdata-latest.tar.gz
+       $(call DOWNLOAD,ftp://ftp.iana.org/tz,tzdata-latest.tar.gz)
 
 .tzunpack: tzcode tzcode-latest.tar.gz tzdata-latest.tar.gz
        $(Q) tar zx -C tzcode -f tzcode-latest.tar.gz
diff --git a/libs/libxx/etl.defs b/libs/libxx/etl.defs
index e98d222a73..85e209064e 100644
--- a/libs/libxx/etl.defs
+++ b/libs/libxx/etl.defs
@@ -23,7 +23,7 @@ ETL_VERSION=20.32.1
 # Download and unpack tarball if no git repo found
 ifeq ($(wildcard etl/.git),)
 $(ETL_VERSION).tar.gz:
-       $(Q) curl -O -L 
https://github.com/ETLCPP/etl/archive/refs/tags/$(ETL_VERSION).tar.gz
+       $(call 
DOWNLOAD,https://github.com/ETLCPP/etl/archive/refs/tags,$(ETL_VERSION).tar.gz)
 
 etl: $(ETL_VERSION).tar.gz
        $(Q) tar -xf $(ETL_VERSION).tar.gz
diff --git a/libs/libxx/libcxx.defs b/libs/libxx/libcxx.defs
index 182bf9f5d3..f79c294cf0 100644
--- a/libs/libxx/libcxx.defs
+++ b/libs/libxx/libcxx.defs
@@ -23,7 +23,7 @@ LIBCXX_VERSION=12.0.0
 # Download and unpack tarball if no git repo found
 ifeq ($(wildcard libcxx/.git),)
 libcxx-$(LIBCXX_VERSION).src.tar.xz:
-       $(Q) curl -O -L 
https://github.com/llvm/llvm-project/releases/download/llvmorg-$(LIBCXX_VERSION)/libcxx-$(LIBCXX_VERSION).src.tar.xz
+       $(call 
DOWNLOAD,https://github.com/llvm/llvm-project/releases/download/llvmorg-$(LIBCXX_VERSION),libcxx-$(LIBCXX_VERSION).src.tar.xz)
 
 libcxx: libcxx-$(LIBCXX_VERSION).src.tar.xz
        $(Q) tar -xf libcxx-$(LIBCXX_VERSION).src.tar.xz \
diff --git a/libs/libxx/libcxxabi.defs b/libs/libxx/libcxxabi.defs
index 874f5ddd45..263b658848 100644
--- a/libs/libxx/libcxxabi.defs
+++ b/libs/libxx/libcxxabi.defs
@@ -21,7 +21,7 @@
 LIBCXXABI_VERSION=12.0.0
 
 libcxxabi-$(LIBCXXABI_VERSION).src.tar.xz:
-       $(Q) curl -O -L 
https://github.com/llvm/llvm-project/releases/download/llvmorg-$(LIBCXXABI_VERSION)/libcxxabi-$(LIBCXXABI_VERSION).src.tar.xz
+       $(call 
DOWNLOAD,https://github.com/llvm/llvm-project/releases/download/llvmorg-$(LIBCXXABI_VERSION),libcxxabi-$(LIBCXXABI_VERSION).src.tar.xz)
 
 libcxxabi: libcxxabi-$(LIBCXXABI_VERSION).src.tar.xz
        $(Q) tar -xf libcxxabi-$(LIBCXXABI_VERSION).src.tar.xz
diff --git a/openamp/libmetal.defs b/openamp/libmetal.defs
index 4ed70cd327..b2e9d30424 100644
--- a/openamp/libmetal.defs
+++ b/openamp/libmetal.defs
@@ -70,7 +70,7 @@ LIBMETAL_HDRS_SEDEXP := \
 ifeq ($(wildcard libmetal/.git),)
 libmetal.zip:
 # Download and unpack tarball if no git repo found
-       $(Q) curl -L 
https://github.com/OpenAMP/libmetal/archive/v$(VERSION).zip -o libmetal.zip
+       $(call 
DOWNLOAD,https://github.com/OpenAMP/libmetal/archive,v$(VERSION).zip,libmetal.zip)
        $(Q) unzip -o libmetal.zip
        $(Q) mv libmetal-$(VERSION) libmetal
 
diff --git a/openamp/open-amp.defs b/openamp/open-amp.defs
index 4cb2b88090..e9430aed72 100644
--- a/openamp/open-amp.defs
+++ b/openamp/open-amp.defs
@@ -32,7 +32,7 @@ CSRCS += open-amp/lib/virtio/virtqueue.c
 # Download and unpack tarball if no git repo found
 ifeq ($(wildcard open-amp/.git),)
 open-amp.zip:
-       $(Q) curl -L 
https://github.com/OpenAMP/open-amp/archive/v$(VERSION).zip -o open-amp.zip
+       $(call 
DOWNLOAD,https://github.com/OpenAMP/open-amp/archive,v$(VERSION).zip,open-amp.zip)
        $(Q) unzip -o open-amp.zip
        $(Q) mv open-amp-$(VERSION) open-amp
        $(Q) patch -p0 < 0001-ns-acknowledge-the-received-creation-message.patch
diff --git a/tools/Config.mk b/tools/Config.mk
index bdcca55c2f..61e600baa9 100644
--- a/tools/Config.mk
+++ b/tools/Config.mk
@@ -555,6 +555,18 @@ define FINDSCRIPT
        $(if $(wildcard 
$(BOARD_DIR)$(DELIM)scripts$(DELIM)$(1)),$(BOARD_DIR)$(DELIM)scripts$(DELIM)$(1),$(BOARD_COMMON_DIR)$(DELIM)scripts$(DELIM)$(1))
 endef
 
+# DOWNLOAD - Download file. The URL base is joined with TARBALL by '/' and
+#            downloaded to the TARBALL file.
+#            The third argument is an output path. The second argument is used
+#            if it is not provided or is empty.
+# Example: $(call DOWNLOAD,$(FOO_URL_BASE),$(FOO_TARBALL),foo.out,foo-)
+
+define DOWNLOAD
+       $(ECHO_BEGIN)"Downloading: $(if $3,$3,$2) "
+       $(Q) curl -L $(if $(V),,-Ss) $(1)/$(2) -o $(if $(3),$(3),$(2))
+       $(ECHO_END)
+endef
+
 # CLEAN - Default clean target
 
 ifeq ($(CONFIG_ARCH_COVERAGE),y)

Reply via email to