Browse Source

Makefile: generate config.h in two stages

This means we don't create an empty file if configurator fails.
Rusty Russell 14 years ago
parent
commit
b175cfcf86
1 changed files with 2 additions and 1 deletions
  1. 2 1
      Makefile

+ 2 - 1
Makefile

@@ -122,8 +122,9 @@ inter-depends: $(ALL_DEPENDS) Makefile
 test-depends: $(ALL_DEPENDS) Makefile
 test-depends: $(ALL_DEPENDS) Makefile
 	for f in $(ALL_DEPENDS); do echo check-`basename \`dirname $$f\``: `sed -n 's,ccan/\(.*\),check-\1,p' < $$f`; done > $@
 	for f in $(ALL_DEPENDS); do echo check-`basename \`dirname $$f\``: `sed -n 's,ccan/\(.*\),check-\1,p' < $$f`; done > $@
 
 
+# Ensure we don't end up with empty file if configurator fails!
 config.h: tools/configurator/configurator Makefile Makefile-ccan
 config.h: tools/configurator/configurator Makefile Makefile-ccan
-	@tools/configurator/configurator $(CC) $(CCAN_CFLAGS) > config.h
+	tools/configurator/configurator $(CC) $(CCAN_CFLAGS) > $@ || rm -f $@
 
 
 include tools/Makefile
 include tools/Makefile
 -include inter-depends
 -include inter-depends