This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Problems properly escaping backslashes in dos pathing in a Makefile
- From: "Chris Nighswonger" <cnighswonger at foundations dot edu>
- To: gcc-help at gcc dot gnu dot org
- Date: Wed, 23 May 2007 17:45:19 -0400
- Subject: Problems properly escaping backslashes in dos pathing in a Makefile
Hi all,
I am not familiar with the finer details of a Makefile. I am having
issues with escaping backslashes in dos paths in the Makefile of an
app I am trying to port to win32 via cygwin. I am compiling the app
using gcc under cygwin, but then moveing it directly into a win32
environment. Things work fine as long as I pass the absolute paths to
conf files in via command line switches. However, the default pathing
in the compiled binary is all messed up. The problem appears to stem
from the backslash desired by dos vs the foreslash by *nix. The
Makefile contains vars which setup the default pathing. These vars
appear to be sub'd into the cpp files at compile time (I'm really
guessing here). I have tried double escaping the backslashes in the
paths because I am told that the Makefile consumes one escape sequence
itself when passing the vars to the compiler. This should leave one
set of escape sequences for the compiler to consume when generating
the binary (if my thinking is correct). But what actually appears in
the binary (visible via a hex editor) is absolute pathing with no
slashes at all... :-(
Here are the vars as they are assigned in the Makefile:
DGBINDIR = c:\\\\dansguardian\\\\sbin
DGCONFDIR = c:\\\\dansguardian\\\\etc\\\\dansguardian
DGCONFFILE = c:\\\\dansguardian\\\\etc\\\\dansguardian\\\\dansguardian.conf
DGDATADIR = c:\\\\dansguardian\\\\share\\\\dansguardian
DGLIBDIR = c:\\\\dansguardian\\\\lib\\\\dansguardian
DGLOGLOCATION = c:\\\\dansguardian\\\\var\\\\log\\\\dansguardian
DGPIDDIR = c:\\\\dansguardian\\\\var\\\\run
Any help would be greatly appriciated. I may be completely off
target here so feel free to correct me.
Thanks,
Chris