[Top][All Lists]

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

Re: Bug: make fails to execute .BAT files with space in the path, with S

From: Erik Carstensen
Subject: Re: Bug: make fails to execute .BAT files with space in the path, with SHELL=cmd.exe
Date: Fri, 3 May 2013 10:22:40 +0200

On Thu, May 2, 2013 at 6:50 PM, Eli Zaretskii <address@hidden> wrote:

Make on Windows cannot support escaping with backslash when the shell
is cmd.exe.  And Make in general doesn't support file names with
whitespace too well, you need to introduce blanks via variables, for
it to work reliably.  The only place where it works well is in the
command line itself, but not in variables and certainly not in
dependency lists.

My findings:
- Space in filenames does work very well in variables, as long as the variables are used exclusively in command lines.
- You are right that it can be tricky to introduce a leading space, but not really a big problem. Most people tend to store the space in an intermediate variable (the space=$(empty) $(empty) trick)', but I found that it's sufficient to just write 'foo=$() xyz'
- Dependency lists are not a big problem, you just have to escape spaces and backslashes properly. It is (fairly) easy to write a function that does this. Automatic variables like $@, $< and $^ will be un-escaped, so any uses need to be re-quoted or surrounded by double quotes. This is practically doable, if you have a limited set of directories that may contain space.
- The only big remaining problem is that there is no way to add a path with spaces to VPATH. I have a poor workaround for this (copying needed directories to a space-free path before adding them to VPATH). We should probably be grateful that a VPATH path cannot contain spaces; e.g., it guarantees that %.c always expands to a space-free path.

reply via email to

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