Build to tmp file so nextpnr errors don't confuse make
authorMichael Neuling <mikey@neuling.org>
Mon, 22 Jun 2020 03:09:09 +0000 (13:09 +1000)
committerMichael Neuling <mikey@neuling.org>
Thu, 2 Jul 2020 04:54:08 +0000 (14:54 +1000)
nextpnr will leave an output file around even when it errors out, so
build to a tmp file and move it when we succeed so we don't confuse
make.

Signed-off-by: Michael Neuling <mikey@neuling.org>
Makefile

index b4dab318d3c47b6b644cf6d7a9b22b1121ee0f76..3365293ed1e13a0aaae272f20bb576eeb9bfe1bd 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -187,7 +187,8 @@ microwatt-verilator: microwatt.v verilator/microwatt-verilator.cpp verilator/uar
        @cp -f obj_dir/microwatt-verilator microwatt-verilator
 
 microwatt_out.config: microwatt.json $(LPF)
-       $(NEXTPNR) --json $< --lpf $(LPF) --textcfg $@ $(NEXTPNR_FLAGS) --package $(PACKAGE)
+       $(NEXTPNR) --json $< --lpf $(LPF) --textcfg $@.tmp $(NEXTPNR_FLAGS) --package $(PACKAGE)
+       mv -f $@.tmp $@
 
 microwatt.bit: microwatt_out.config
        $(ECPPACK) --svf microwatt.svf $< $@