www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1996/09/08/03:32:57

Date: Sun, 8 Sep 1996 10:09:57 +0200 (IST)
From: Eli Zaretskii <eliz AT is DOT elta DOT co DOT il>
To: djgpp AT delorie DOT com
Subject: Re: Makefiles on DOS
Message-Id: <Pine.SUN.3.91.960908100928.5416Y-100000@is>
Mime-Version: 1.0

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 -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019