Mail Archives: djgpp/1996/09/08/03:32:57
On Fri, 6 Sep 1996, John M. Aldrich wrote:
> Unix, the backslash is an escape character, and thus if you just do
> something like this:
>
> foo.exe : foo.o
> ...
> gcc -I..\..\include\sys ...
>
> Then what gcc will actually _get_ is "-I....includesys", which is
> meaningless. The fix is to use '\\' each time you want '\' to appear
> in your command lines. I was going to post an example of this with
That is not entirely correct. The DJGPP port of GNU Make supports
backslashes in commands, so the command line above will work unaltered
(i.e. with a single backslash). But you cannot use single backslashes in
rules, like so:
foo.exe: ..\src\foo.c
The above rule won't work; you will have to say this instead:
foo.exe: ..\\src\\foo.c
Also, the built-in file functions, like $D, don't know at all about
backslashes being directory separators on MSDOS.
The bottom line: always use forward slashes as much as possible. This
will also make your Makefiles more portable. Try to avoid using DOS
programs which don't know about forward slashes, and if you can't, convert
the forward slashes to backslashes with $(subst) or $(patsubst) buil-ins.
- Raw text -