dropbear: better object cleanup
authorKonstantin Demin <rockdrilla@gmail.com>
Tue, 9 Jan 2024 00:40:01 +0000 (03:40 +0300)
committerRui Salvaterra <rsalvaterra@gmail.com>
Fri, 9 Feb 2024 09:13:05 +0000 (09:13 +0000)
improves b78aae79

Signed-off-by: Konstantin Demin <rockdrilla@gmail.com>
package/network/services/dropbear/Makefile

index 1859aab7f48cdf42b7f2c81314589ce70e25c258..75dee77af0e30cc193534e86a9a3b90d081c538e 100644 (file)
@@ -165,6 +165,11 @@ define Build/Configure/dropbear_headers
        ))
 endef
 
+define Build/Configure/dropbear_objects
+       grep -ERZl -e '($(subst $(space),|,$(strip $(sort $(patsubst !!%,%,$(foreach s,$(DB_OPT_COMMON) $(DB_OPT_CONFIG),$(word 1,$(subst $(comma),$(space),$(s)))))))))' \
+       $(PKG_BUILD_DIR)/ | sed -zE 's/^(.+)\.[^.]+$$$$/\1.o/' | sort -uV | xargs -0 -r rm -fv || :
+endef
+
 define Build/Configure
        rm -f $(PKG_BUILD_DIR)/localoptions.h
        $(Build/Configure/Default)
@@ -172,8 +177,8 @@ define Build/Configure
        : > $(PKG_BUILD_DIR)/localoptions.h
        $(Build/Configure/dropbear_headers)
 
-       # Enforce rebuild of svr-chansession.c
-       rm -f $(PKG_BUILD_DIR)/svr-chansession.o
+       # Enforce rebuild of files depending on configured options
+       $(Build/Configure/dropbear_objects)
 
        # Rebuild them on config change
        +$(MAKE) -C $(PKG_BUILD_DIR)/libtomcrypt clean