Re: make target / dependency names with spaces

Eli Zaretskii <[email protected]>
Newsgroups gmane.comp.gnu.make.windows
Message-ID <[email protected]>
> Date: Sat, 11 Apr 2009 14:06:09 +0200
> From: grischka <[email protected]>
> CC:  [email protected]
> 
> > > some\ program\ name.exe
> >
> > This will only work in the commands (where simple quoting will also
> > work), but not in targets and dependencies, which is what the OP
> > wants.
> 
> You probably meant: This will only work in targets and dependencies
> but not in commands.

No, I meant what I said, but it looks like I was mistaken, sorry.
Somehow, I remembered Paul saying that file names with blanks cannot
be supported, but my failing memory betrayed me again, or so it seems.

> some\ program\ name.exe : some\ file.c other\ file.c
>          @echo gcc $^ -o $@
> some\ file.c other\ file.c :
>          @echo touch $@
> 
> touch some file.c
> touch other file.c
> gcc some file.c other file.c -o some program name.exe

Of course, in a real-life example, some additional juggling will be
needed, because each file name with spaces needs to be quoted on the
command line, or else:

    touch some file.c
    touch some file.c
    touch other file.c
    touch other file.c
    gcc some file.c other file.c -o some program name.exe
    gcc some file.c other file.c -o some program name.exe
    gcc: program: No such file or directory
    gcc: name.exe: No such file or directory
    make: *** [some program name.exe] Error 1

(And `touch' creates the files `some', `other', and `file.c'.)

Quoting inside $^ is not entirely trivial.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.