Tom was right. `dirname` is a shell command, while `$(dir )` is a Makefile functions. Sorry.