02.19.09

Makefile tips

Posted in Colen Stuff, Software at 2:48 pm by Colen

A cunning trick I discovered today. To suppress error reporting for a command in a makefile, prepend it with a dash character. For example, this command will fail and stop the build if the directory already exists:

mkdir c:\somefolder

However, this command will ignore the error and press on – perfect if you don’t care if the directory is there or not, you just want to make sure it gets created:

-mkdir c:\somefolder

The only change is the addition of a dash at the start of the line.

(This doesn’t change the fact that makefiles are horrible and that I hate them.)

Leave a Comment

You must be logged in to post a comment.