help-make
[Top][All Lists]
Advanced

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

Re: whitespace in filenames


From: Brian Dessent
Subject: Re: whitespace in filenames
Date: Thu, 25 Sep 2008 11:59:22 -0700

> Patrick Horgan wrote:

> but VAR := "foo\ bar" works.

No, it doesn't:

$ touch 'file name.flac'

$ cat Makefile
VAR := "file\ name.flac"

all: $(VAR:.flac=.mp3)

%.mp3: %.flac
        cp "$<" "$@"

$ make
make: *** No rule to make target `"file name.flac"', needed by `all'. 
Stop.

If you remove the double quotes but leave the space backslash-quoted, it
still fails:

$ make 
make: *** No rule to make target `file name.mp3', needed by `all'. 
Stop.

If you look at the debug output you see that the pattern rule was
incapable of dealing with the space when trying to match %.flac against
'file name.flac' because it thinks it names two prerequisites:

 No implicit rule found for `all'.
  Considering target file `file name.mp3'.
   File `file name.mp3' does not exist.
   Looking for an implicit rule for `file name.mp3'.
   Trying pattern rule with stem `file name'.
   Trying implicit prerequisite `file'.
   Trying pattern rule with stem `file name'.
   Trying implicit prerequisite `file'.
   Looking for a rule with intermediate file `file'.
    Avoiding implicit rule recursion.
   No implicit rule found for `file name.mp3'.
   Finished prerequisites of target file `file name.mp3'.
  Must remake target `file name.mp3'.
make: *** No rule to make target `file name.mp3', needed by `all'. 
Stop.

Brian




reply via email to

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