I am using automatic variables with static pattern rules in a Makefile, but I have a problem with filenames with parentheses. The parentheses are not escaped properly for the shell, and I get a syntax error from the shell:
/bin/sh: -c: line 0: syntax error near unexpected token `('
Is there a way to get make
to automatically escape "bad" characters in filenames? I have tried using parentheses, such as $(<)
and $(@)
, but it does not seem to make a difference.
Can you just put some single quotes around the automatic variables when you're passing them to the shell? So, instead of $<
, try '$<'
. If you have to do this with something that equates to more than a single filename, e.g. $+
then you could use $(patsubst %,'%',$+)