• Masahiro Yamada's avatar
    kbuild: remove the target in signal traps when interrupted · 6d1aef17
    Masahiro Yamada authored
    [ Upstream commit a7f3257d ]
    
    When receiving some signal, GNU Make automatically deletes the target if
    it has already been changed by the interrupted recipe.
    
    If the target is possibly incomplete due to interruption, it must be
    deleted so that it will be remade from scratch on the next run of make.
    Otherwise, the target would remain corrupted permanently because its
    timestamp had already been updated.
    
    Thanks to this behavior of Make, you can stop the build any time by
    pressing Ctrl-C, and just run 'make' to resume it.
    
    Kbuild also relies on this feature, but it is equivalently important
    for any build systems that make decisions based on timestamps (if you
    want to support Ctrl-C reliably).
    
    However, this does not always work as claimed; Make immediately dies
    with Ctrl-C if its stderr goes into a pipe.
    
      [Test Makefile]
    
        foo:
                echo hello > $@
                sleep 3
                echo world >> $@
    
      [Test R...
    6d1aef17
Kbuild.include 12.8 KB