Thu 11 Jul 2002 10:06:02 PM UTC, comment #1:
[ This is not really a bug, it's more a question of how to use make--these kinds of things are most productively discussed on one of the mailing lists, not through the bug tracking system. Thx. ]
It is not make that's confused, it's the commands that make invokes. If you properly escape the $'s by doubling them in the make syntax, then they will be passed to whatever interpreter make invokes properly.
If your interpreter (by default, the Bourne shell /bin/sh) also treats some characters as special, whether it be $ or any other character, then that's up to you to handle in your rules. Make does not and cannot contain a complete parser for your interpreter, so it cannot know which characters are special and how to treat them. If you replace "$", which just happens to be special to make, with "*", which is not special to make but still special to the shell, you'll see the dilemma.
Using backslashes is only one way to handle special characters in the shell; a much simpler way is to use quotes. For example, try:
$$foo:
touch '$@'
This works regardless of where the $ is. If you don't want to do that, then you should use subst rather than complex dir/notdir stuff:
foo/$$foo:
touch $(subst $$,\$$,$@)
|