]> git.ozlabs.org Git - ccan/commitdiff
Makefile: generate config.h in two stages
authorRusty Russell <rusty@rustcorp.com.au>
Tue, 27 Mar 2012 03:45:16 +0000 (14:15 +1030)
committerRusty Russell <rusty@rustcorp.com.au>
Tue, 27 Mar 2012 03:45:16 +0000 (14:15 +1030)
This means we don't create an empty file if configurator fails.

Makefile

index 570793c711aaf7634bf4215dd52eedc8f8420a01..13aa195dd0e379187a34d5470d927177f89c7c13 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -122,8 +122,9 @@ inter-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 > $@
 
+# 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) > config.h
+       tools/configurator/configurator $(CC) $(CCAN_CFLAGS) > $@ || rm -f $@
 
 include tools/Makefile
 -include inter-depends