aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorEneas U de Queiroz <cotequeiroz@gmail.com>2020-02-20 18:29:02 -0300
committerJo-Philipp Wich <jo@mein.io>2021-03-19 11:48:28 +0100
commit33df82be36cb44d61ab0285796e78c62fe1fe787 (patch)
tree3084df917feb6fc0e0c1dfd88e41bb7f98730da4 /include
parent34023344134a3abedcb892675bb2d75ec7b104b2 (diff)
downloadupstream-33df82be36cb44d61ab0285796e78c62fe1fe787.tar.gz
upstream-33df82be36cb44d61ab0285796e78c62fe1fe787.tar.bz2
upstream-33df82be36cb44d61ab0285796e78c62fe1fe787.zip
build: package-ipkg: avoid calling wildcard twice
Instead of calling $(wildcard) to check if the removal list is empty, then calling it again to actually remove the files, define a function so that the arguments are expanded only once when it gets called. Signed-off-by: Eneas U de Queiroz <cotequeiroz@gmail.com> (cherry picked from commit 40acc13ca72ca7d2815dc5d94549d5dc48e16e98)
Diffstat (limited to 'include')
-rw-r--r--include/package-ipkg.mk10
1 files changed, 8 insertions, 2 deletions
diff --git a/include/package-ipkg.mk b/include/package-ipkg.mk
index 442d3854f0..00ebb9197f 100644
--- a/include/package-ipkg.mk
+++ b/include/package-ipkg.mk
@@ -19,6 +19,12 @@ IPKG_REMOVE:= \
IPKG_STATE_DIR:=$(TARGET_DIR)/usr/lib/opkg
# 1: package name
+# 2: candidate ipk files
+define remove_ipkg_files
+ $(if $(strip $(2)),$(IPKG_REMOVE) $(1) $(2))
+endef
+
+# 1: package name
# 2: variable name
# 3: variable suffix
# 4: file is a script
@@ -184,7 +190,7 @@ $(_endef)
$$(IPKG_$(1)) : export DESCRIPTION=$$(Package/$(1)/description)
$$(IPKG_$(1)) : export PATH=$$(TARGET_PATH_PKG)
$(PKG_INFO_DIR)/$(1).provides $$(IPKG_$(1)): $(STAMP_BUILT) $(INCLUDE_DIR)/package-ipkg.mk
- @rm -rf $$(IDIR_$(1)) $$(if $$(call opkg_package_files,$(1)*),; $$(IPKG_REMOVE) $(1) $$(call opkg_package_files,$(1)*))
+ @rm -rf $$(IDIR_$(1)); $$(call remove_ipkg_files,$(1),$$(call opkg_package_files,$(1)*))
mkdir -p $(PACKAGE_DIR) $$(IDIR_$(1))/CONTROL $(PKG_INFO_DIR)
$(call Package/$(1)/install,$$(IDIR_$(1)))
$(if $(Package/$(1)/install-overlay),mkdir -p $(PACKAGE_DIR) $$(IDIR_$(1))/rootfs-overlay)
@@ -252,7 +258,7 @@ $(_endef)
@[ -f $$(IPKG_$(1)) ]
$(1)-clean:
- $$(if $$(call opkg_package_files,$(1)*),$$(IPKG_REMOVE) $(1) $$(call opkg_package_files,$(1)*))
+ $$(call remove_ipkg_files,$(1),$$(call opkg_package_files,$(1)*))
clean: $(1)-clean