diff --git a/main/Makefile b/main/Makefile
index a287e13334c93dcfcdd1d42998c5d5c9cc7360bb..feedf224bca83c89acc2f4fed8ce63fd15e89593 100644
--- a/main/Makefile
+++ b/main/Makefile
@@ -278,7 +278,10 @@ ifneq ($(LDCONFIG),)
 endif
 
 clean::
-	rm -f asterisk libasteriskssl.o $(ASTSSL_LIB) $(ASTSSL_LIB).*
+	rm -f asterisk libasteriskssl.o
+ifeq ($(AST_ASTERISKSSL),yes)
+	rm -f $(ASTSSL_LIB) $(ASTSSL_LIB).*
+endif
 	rm -f asterisk.exports libasteriskssl.exports
 	@if [ -f editline/Makefile ]; then $(MAKE) -C editline distclean ; fi
 	@$(MAKE) -C stdtime clean