From 58fb5d630b9ce00e4552afa19ceb06e3b985a087 Mon Sep 17 00:00:00 2001 From: Daniel Thompson Date: Sun, 2 Aug 2020 12:10:47 +0100 Subject: [PATCH] Makefile: Clean up empty redirected file on failure If the preprocessor fails for any reason then an empty or partially processed watch.py file is created which will satisfy the dependency checks in any later invocation of make which can silently break the build. Cleaning up on failure prevents this from happening. Signed-off-by: Daniel Thompson --- Makefile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index df9afcf..31ff3f7 100644 --- a/Makefile +++ b/Makefile @@ -5,7 +5,8 @@ all : bootloader reloader micropython ifdef BOARD WASP_WATCH_PY = wasp/boards/$(BOARD)/watch.py $(WASP_WATCH_PY) : $(WASP_WATCH_PY).in - (cd wasp; ../tools/preprocess.py ../$(WASP_WATCH_PY).in > ../$(WASP_WATCH_PY)) + (cd wasp; ../tools/preprocess.py ../$(WASP_WATCH_PY).in > ../$(WASP_WATCH_PY)) \ + || ($(RM) $(WASP_WATCH_PY); false) else BOARD ?= $(error Please set BOARD=) endif