Noel L Yap wrote:
> 
> With the advent of (idiotic) paths with spaces in them, it's become important to
> deal with them.
> 

Talking about UNIX (vanilla) Make and GNU Make, I'd say that you're in
for some fun and games if you try to make this robust against spaces in
path names by using some general set of rules. It would be possible to
put quotes around all macro expansions where one path name is known to
be expanded (as in "$(CLEARTOOL)" in your example). But what do you do
with $^, for instance?

And: Some manipulation functions work on space separated lists of names
- obviously you'd have to avoid them: $(filter PAT,TEXT), $(addsuffix
SUF,NAMES), and so on.

Another caveat: Sometimes it's a good idea to add some option to the
program name when defining a macro:
   RM = /bin/rm -f
Now, wrapping the expansion in quotes won't do...

Good luck,
-Wolfgang


> I was thinking of the following style rule for calling executables:
> 1. When calling executables, wrap the executable name in double quotes.  This is
> even more important if a macro is being used instead of a hard-coded executable
> name.  For example:
> 
> Instead of:
>      ifeq ($(OS),Windows_NT)
>           CLEARTOOL:=//c/Program Files/Rational/ClearCase/bin/cleartool
>      else
>           CLEARTOOL:=/usr/atria/bin/cleartool
>      endif
> 
>      help:
>           $(CLEARTOOL) help
> 
> You have:
>      ifeq ($(OS),Windows_NT)
>           CLEARTOOL:=//c/Program Files/Rational/ClearCase/bin/cleartool
>      else
>           CLEARTOOL:=/usr/atria/bin/cleartool
>      endif
> 
>      help:
>           "$(CLEARTOOL)" help
> 
> Aside from "preventing" (ie ignoring) the problem, has anyone else found a good
> way to deal with the situation?
> 
> Note that I have considered the alternatives of:
> CLEARTOOL:="//c/Program Files/Rational/ClearCase/bin/cleartool"
> 
> and:
> CLEARTOOL:=//c/Program\ Files/Rational/ClearCase/bin/cleartool
> 
> The former has a problem when using $(CLEARTOOL) within another set of double
> quotes.  The latter has a problem when passing $(CLEARTOOL) to another script.
> However, wrapping the call in double quotes makes the makefile less legible.
> 
> Thanks,
> Noel
> 
> This communication is for informational purposes only.  It is not intended as
> an offer or solicitation for the purchase or sale of any financial instrument
> or as an official confirmation of any transaction. All market prices, data
> and other information are not warranted as to completeness or accuracy and
> are subject to change without notice. Any comments or statements made herein
> do not necessarily reflect those of J.P. Morgan & Co. Incorporated, its
> subsidiaries and affiliates.
> 
>  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
> [ To unsubscribe, send email to [EMAIL PROTECTED] with body
> "unsubscribe cciug" (the subject is ignored).  You can also unsubscribe
> using the sign-up form at  the ClearCase customers-only website
> accessed at http://clearcase.rational.com/cciug/mailing_list.html]

Reply via email to