Handle deleting non-existant files on Windows

If we try to delete a non-existant file using del on Windows, as
can happen when running make clean, del will throw an error. Make
the Makefiles more robust by only deleting files if they exist.
This commit is contained in:
Darryl Green 2019-08-30 14:51:55 +01:00 committed by Jaeden Amero
parent 31465c6c1f
commit 9b9a790be6
4 changed files with 10 additions and 4 deletions

View file

@ -165,5 +165,7 @@ clean:
ifndef WINDOWS
rm -f *.o libmbed* $(OBJS_CRYPTO)
else
del /Q /F *.o libmbed* $(OBJS_CRYPTO)
if exist *.o del /Q /F *.o
if exist libmbed* del /Q /F libmbed*
if exist $(OBJS_CRYPTO) del /Q /F $(OBJS_CRYPTO)
endif

View file

@ -317,7 +317,8 @@ ifndef WINDOWS
-rm -f ssl/ssl_pthread_server$(EXEXT)
-rm -f test/cpp_dummy_build$(EXEXT)
else
del /S /Q /F *.o *.exe
if exist *.o del /Q /F *.o
if exist *.exe del /Q /F *.exe
endif
$(MAKE) -C fuzz clean

View file

@ -69,5 +69,6 @@ clean:
ifndef WINDOWS
rm -rf $(BINARIES) *.o
else
del /Q /F *.o *.exe
if exist *.o del /Q /F *.o
if exist *.exe del /Q /F *.exe
endif

View file

@ -160,7 +160,9 @@ clean:
ifndef WINDOWS
rm -rf $(BINARIES) *.c *.datax TESTS
else
del /Q /F *.c *.exe *.datax
if exist *.c del /Q /F *.c
if exist *.exe del /Q /F *.exe
if exist *.datax del /Q /F *.datax
ifneq ($(wildcard TESTS/.*),)
rmdir /Q /S TESTS
endif