help-make
[Top][All Lists]
Advanced

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

Re: Filename with whitespace


From: wim delvaux
Subject: Re: Filename with whitespace
Date: Wed, 5 May 2004 15:52:38 +0200
User-agent: KMail/1.6.2

On Wednesday 05 May 2004 15:00, Lars Kellogg-Stedman wrote:
> In article <address@hidden>,
>
>  "Paul D. Smith" <address@hidden> wrote:
> > The short answer is that GNU make (no UNIX-based make) can work with
> > filenames containing whitespace.
>
> But why is that?  It's not *that* unusual to encounter filenames with
> spaces these days, even on a Unix filesystem.  Throw in environments
> like Cygwin or MacOS X, and it's positively common.

        Because space is a hard delimiter in the code.

        A workaround I use is to define a variable like so (But this does not 
always 
work)

        spc=$(x) $(x)

        This results in spc being equal to ' '

        and then

        Filename=x${spc}Y...

        and then use 
        
        $(filename)

>
> I just ran into whitespace problems with a batch of XML files from a
> Windows colleague...I naively tried:
>
>   XMLFILES = $(wildcard *.xml)
>
> I was quite surprised when it didn't work.  I figured that since this is
> using internal routines for the wildcard expansion, rather than using
> the shell, that make would know how to properly escape/quote the
> whitespace.  Obviously, files with whitespace can be specified manually:
>
>   XMLFILES = file\ one.xml file\ two.xml
>   HTMLFILES = $(XMLFILES:.xml=.html)
>
>   %.html: %.xml
>     xml2html "$<" > "$@"
>
>   all: $(HTMLFILES)
>
> This works just fine.  The whitespace survives the substitution and two
> expansions without a problem.
>
> Is the problem with whitespace really just in the wildcard expansion
> routines?
>
> -- Lars

        Weird that this works
        
        I tried

        a=x\ u
        $(warning $(a))

        and the result is

        "x\ u" and not "x u"


>
>
>
> _______________________________________________
> Help-make mailing list
> address@hidden
> http://mail.gnu.org/mailman/listinfo/help-make




reply via email to

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