Make uninstall more robust
authorMathieu Baudier <mbaudier@argeo.org>
Wed, 6 Mar 2024 11:38:10 +0000 (12:38 +0100)
committerMathieu Baudier <mbaudier@argeo.org>
Wed, 6 Mar 2024 11:38:10 +0000 (12:38 +0100)
jni.mk
repackage.mk

diff --git a/jni.mk b/jni.mk
index 98ad5c8b9c4c2631975d5acd1e654f09367cf78c..920ecf478048694dc4ba18b91c23a1575d7c5f55 100644 (file)
--- a/jni.mk
+++ b/jni.mk
@@ -40,6 +40,7 @@ install:
 
 uninstall:
        $(RM) $(A2_NATIVE_INSTALL_TARGET)/$(TARGET_EXEC)
+       @if [ -d $(A2_NATIVE_INSTALL_TARGET) ]; then find $(A2_NATIVE_INSTALL_TARGET) -empty -type d -delete; fi
 
 # Sources
 SRCS := $(shell find $(SRC_DIRS) -name '*.cpp' -or -name '*.c' -or -name '*.s')
index 38197cc1e2cfcbe1e943848fcdaccd3ce2ea64d5..d4766da6598d31a0dc84d0e8599a7dfa93714191 100644 (file)
@@ -39,8 +39,8 @@ uninstall:
         $(foreach libfile, $(wildcard $(A2_OUTPUT)/$(category)/*.so), $(RMDIR) $(A2_NATIVE_INSTALL_TARGET)/$(notdir $(libfile));$(LF)) \
        )
        @echo Uninstalled arch binaries \'$(ARCH_CATEGORIES)\' to $(A2_NATIVE_INSTALL_TARGET)
-       @find $(A2_INSTALL_TARGET) -empty -type d -delete
-       @find $(A2_NATIVE_INSTALL_TARGET) -empty -type d -delete
+       @if [ -d $(A2_INSTALL_TARGET) ]; then find $(A2_INSTALL_TARGET) -empty -type d -delete; fi
+       @if [ -d $(A2_NATIVE_INSTALL_TARGET) ]; then find $(A2_NATIVE_INSTALL_TARGET) -empty -type d -delete; fi
 
 .SECONDEXPANSION:
 # We use .SECONDEXPANSION and CATEGORIES_TO_REPACKAGE instead of directly CATEGORIES