Should handle empty vars:

$(if $(filter-out 1,$(words "$(PATH_TO_CHECK)")),$(error spaces found))

That's a good trick, but I wouldn't use the double-quote character (") for that purpose, because it is misleading, as its meaning is overloaded in the shell etc.

I would add some normal text around the variable expansion and a comment for 
the unwary:

# Adding 'pre' and 'post' caters for an empty variable
# and also checks for leading and trailing whitespace,
# which would otherwise be automatically stripped.
$(if $(filter-out 1,$(words pre$(PATH_TO_CHECK)post)),$(error spaces found))

Regards,
  rdiez

Reply via email to