[Top][All Lists]

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

Re: Filename with whitespace

From: Jens Schweikhardt
Subject: Re: Filename with whitespace
Date: Wed, 5 May 2004 17:00:35 +0200
User-agent: Mutt/

On Wed, May 05, 2004 at 09:00:08AM -0400, 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?

Historical accident. Make has always used whitespace as a delimiter
in various places, e.g. rules like

t1 t2 t3: dep1 dep2 dep3

Is this three targets with three dependencies or one target with one
dependency? Or some combination thereof? There is no make mechanism to
disambiguate the situation with some sort of quoting or escape
character saying "this space not a delimiter, but part of a file name".

# 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.

This ignores make's Unix heritage. Files with spaces are troublesome
on Unix to this day. It's also not unusual to have backslashes in
filenames on certain OSs. Using those on Unix is simply asking for

# Is the problem with whitespace really just in the wildcard expansion 
# routines?

No, see above. It's make's input grammar spec. From SUSv3:

 "Target entries are specified by a <blank>-separated, non-null list of
 targets, then a colon, then a <blank>-separated, possibly empty list of

Note also, that the space character is not in the SUSv3 Portable
Character Set for filenames. If you want portability, do not use
whitespace in file names. Like so often, just because you can does not
mean it's a good idea.


Jens Schweikhardt
SIGSIG -- signature too long (core dumped)

reply via email to

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