help-make
[Top][All Lists]
Advanced

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

Re: Filename with whitespace


From: Lars Kellogg-Stedman
Subject: Re: Filename with whitespace
Date: Wed, 05 May 2004 09:00:08 -0400
User-agent: MT-NewsWatcher/3.4 (PPC Mac OS X)

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.

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





reply via email to

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