Check out my first novel, midnight's simulacra!

GNU Make

From dankwiki
Revision as of 06:17, 11 June 2009 by Dank (talk | contribs) (Created page with '==.DELETE_ON_ERROR== * Generally, if make fails to build a target, and the target corresponds to a file, you want that file removed. ** Why might this happen? Ctrl-c being presse...')
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

.DELETE_ON_ERROR

  • Generally, if make fails to build a target, and the target corresponds to a file, you want that file removed.
    • Why might this happen? Ctrl-c being pressed during a build. Multiple statements in a build recipe. Memory allocation failure during build. Any number of things.
  • By adding .DELETE_ON_ERROR to the Makefile, this becomes the default behavior.
    • kill -9'ing make will prevent this from happening! :/
  • gcc and some other tools will clean up on error, for some cases. Use .DELETE_ON_ERROR to be safe.

Make and subversion

  • After running make in a pristine tree, the output of svn status ought be empty. Use svn:ignore properties to ignore your generated files.
    • Most importantly, svn status should not show any entries in the 'M'odified state. This indicates either generated files being checked into source control, or the build process modifying source in-place (the same thing, really)
    • If svn:ignore is properly used, the following rule suffices as a project-independent clean target, assuming the presence of xmlstarlet:
      svn --xml --no-ignore status | xmlstarlet sel -t -m //entry -i "wc-status[@item='ignored']" -v @path -n | xargs rm -rf