First of all, you are looking at the contents of a variable that is named after the current path, which is probably not what you want. A simple environment variable reference is $(name)
or ${name}
, not $(${name})
. Due to this, line 13 is always evaluated.
Second, I think it is choking on the indentation of the $(error ...)
expression. While the expression resolves to an empty string, there is still a tab character at the start of the line, which indicates a command, which in turn cannot exist outside a rule.
I think using spaces rather than tabs to indent would work.