help-make
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How to detect spaces in paths


From: R. Diez
Subject: Re: How to detect spaces in paths
Date: Wed, 15 Dec 2021 22:11:44 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.14.0


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

[Prev in Thread] Current Thread [Next in Thread]