summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Thompson <daniel@redfelineninja.org.uk>2020-08-02 11:10:47 (GMT)
committerDaniel Thompson <daniel@redfelineninja.org.uk>2020-08-02 11:10:47 (GMT)
commit58fb5d630b9ce00e4552afa19ceb06e3b985a087 (patch)
treef0d57b788261021982fac03fce18b086499c57e9
parentc74d9e296bc6ee9d167efd9dc56e5ea903dce98f (diff)
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 <daniel@redfelineninja.org.uk>
-rw-r--r--Makefile3
1 files changed, 2 insertions, 1 deletions
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