Escaping $ in Makefile Define
Had an annoying bug that didn't seem to show up on google... so maybe this will resolve some issues.
I have a makefile where a build is attempted, but because the build tool is buggy, sometimes it fails for no reason. So I invoke it with a timeout, then test to see if it errored out, and if so I rerun the build. The error code in bash is
; but inside of a makefile the
needs to be escaped, so I write
However, if you need to stick this into a makefile
block, you need to escape the escaped
. If you don't, you'll get this error:
-ne: unary operator expected
. So you'll have to do this:
in order to escape things properly.
February 26, 2017