Makefile: generate config.h more carefully
authorRusty Russell <rusty@rustcorp.com.au>
Wed, 21 Nov 2012 23:38:53 +0000 (10:08 +1030)
committerRusty Russell <rusty@rustcorp.com.au>
Wed, 21 Nov 2012 23:38:53 +0000 (10:08 +1030)
Don't risk reading partially-constructed files.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Makefile

index 0101fe0653b5601bb9c30888a99b57f1718fa799..b36aca6b2a5b020bd483737fb551a74740523f3c 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -129,7 +129,7 @@ FORCE:
 
 # Ensure we don't end up with empty file if configurator fails!
 config.h: tools/configurator/configurator Makefile Makefile-ccan
-       tools/configurator/configurator $(CC) $(CCAN_CFLAGS) > $@ || rm -f $@
+       tools/configurator/configurator $(CC) $(CCAN_CFLAGS) > $@.tmp && mv $@.tmp $@
 
 include tools/Makefile
 -include inter-depends