[OpenWrt-Devel] [PATCH v2 1/3] build: package-ipkg: avoid calling wildcard twice
Eneas U de Queiroz
cotequeiroz at gmail.com
Thu Feb 20 16:29:02 EST 2020
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 at gmail.com>
diff --git a/include/package-ipkg.mk b/include/package-ipkg.mk
index c4c8f4a36f..cd052698e2 100644
--- a/include/package-ipkg.mk
+++ b/include/package-ipkg.mk
@@ -18,6 +18,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
@@ -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
_______________________________________________
openwrt-devel mailing list
openwrt-devel at lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel
More information about the openwrt-devel
mailing list