From: Ketan S. <ket...@gm...> - 2012-08-31 19:57:03
|
Hello, I am running into an issue using mingw32-make with a makefile that has specified some target dependencies using Windows style directories (IE ..\myDirectory instead of ../myDirectory). It appears that "\" is being treated as a concatenation operator in the dependency name. This is leading to make errors (specified target cannot be found). Here is a simple makefile example that exhibits this behavior: <Start Makefile> # Variables LIBDIRNAME = ..\lib # Targets setup: $(LIBDIRNAME) $(LIBDIRNAME): if not exist $(LIBDIRNAME) mkdir $(LIBDIRNAME) .PHONY: setup <End Makefile> In the Windows command shell I execute: >mingw32-make -f test_make.gcc setup I receive the error: *** No rule to make target '...lib', needed by 'setup'. Stop Note that is has removed the "\" character in the dependency name. It should be looking for a target name '..\lib' instead of '..lib'. If I execute: >mingw32-make -f test_make.gcc ..\lib I do not receive any errors and the directory is created correctly. Do I need to do something additional to tell mingw32-make that I am using Windows style paths? > mingw32-make --version says I have GNU Make 3.82.90 Thanks KS |
From: Eli Z. <el...@gn...> - 2012-08-31 20:11:54
|
> Date: Fri, 31 Aug 2012 15:56:56 -0400 > From: Ketan Surender <ket...@gm...> > > I am running into an issue using mingw32-make with a makefile that has > specified some target dependencies using Windows style directories (IE > ..\myDirectory instead of ../myDirectory). It appears that "\" is being > treated as a concatenation operator in the dependency name. It's not a concatenation operator, it's an escape character. It causes the next character to be interpreted as itself (obviously, redundant for simple characters such as '.'). > # Variables > LIBDIRNAME = ..\lib > > # Targets > > setup: $(LIBDIRNAME) > > $(LIBDIRNAME): > if not exist $(LIBDIRNAME) mkdir $(LIBDIRNAME) > > .PHONY: setup > > <End Makefile> > > In the Windows command shell I execute: > > >mingw32-make -f test_make.gcc setup > > I receive the error: > > *** No rule to make target '...lib', needed by 'setup'. Stop > > Note that is has removed the "\" character in the dependency name. It > should be looking for a target name '..\lib' instead of '..lib'. > > If I execute: > > >mingw32-make -f test_make.gcc ..\lib > > I do not receive any errors and the directory is created correctly. Do I > need to do something additional to tell mingw32-make that I am using > Windows style paths? My advice: don't use backslashes in Makefiles as much as you can. Use forward slashes instead. You will make your life much easier that way. Many Windows commands will accept forward slashes, although sometimes you will need to quote the file name for that to work. When file names with forward slashes absolutely don't work, convert them to backslashes in the command line of the rule you run. For example: <Start Makefile> # Variables LIBDIRNAME = ../lib # Targets setup: $(LIBDIRNAME) $(LIBDIRNAME): if not exist $(subst /,\,$(LIBDIRNAME)) mkdir "$(LIBDIRNAME)" .PHONY: setup <End Makefile> The above shows one instance of using ".." quoting and one instance of converting forward slashes to backslashes when the command needs that. |
From: Ketan S. <ket...@gm...> - 2012-09-01 02:04:59
|
Thanks for the info. Those are definitely good practices when creating makefiles. In this case I am trying to build an existing library from a provided makefile that uses backslashes in file and directory names. I was wondering if this is supported or was previously supported by mingw32-make. Thanks Ketan |
From: Ketan S. <ket...@gm...> - 2012-09-01 05:52:37
|
On Fri, Aug 31, 2012 at 3:56 PM, Ketan Surender <ket...@gm...> wrote: > > Hello, > > I am running into an issue using mingw32-make with a makefile that has specified some target dependencies using Windows style directories (IE ..\myDirectory instead of ../myDirectory). It appears that "\" is being treated as a concatenation operator in the dependency name. This is leading to make errors (specified target cannot be found). > > Here is a simple makefile example that exhibits this behavior: > > <Start Makefile> > > # Variables > LIBDIRNAME = ..\lib > > # Targets > > setup: $(LIBDIRNAME) > > $(LIBDIRNAME): > if not exist $(LIBDIRNAME) mkdir $(LIBDIRNAME) > > .PHONY: setup > > <End Makefile> > > In the Windows command shell I execute: > > >mingw32-make -f test_make.gcc setup > > I receive the error: > > *** No rule to make target '...lib', needed by 'setup'. Stop > > Note that is has removed the "\" character in the dependency name. It should be looking for a target name '..\lib' instead of '..lib'. > > If I execute: > > >mingw32-make -f test_make.gcc ..\lib > > I do not receive any errors and the directory is created correctly. Do I need to do something additional to tell mingw32-make that I am using Windows style paths? > > > mingw32-make --version says I have GNU Make 3.82.90 > > Thanks > > KS mingw32-make 3.82 (instead of 3.82.90) with the above example makefile the runs the setup target without any errors. Ketan |
From: Eli Z. <el...@gn...> - 2012-09-01 07:06:09
|
> Date: Sat, 1 Sep 2012 01:52:31 -0400 > From: Ketan Surender <ket...@gm...> > > mingw32-make 3.82 (instead of 3.82.90) with the above example makefile > the runs the setup target without any errors. As does 3.82.90 I compiled myself from CVS a few months ago. Either this is due to a new feature or some bug in the build process of MinGW Make. In any case, the original question, as I understood it, was what to do when backslashes don't work (and they sometimes don't, because in some contexts they are interpreted as escape characters). |
From: Eli Z. <el...@gn...> - 2012-09-01 07:07:39
|
> Date: Fri, 31 Aug 2012 22:04:53 -0400 > From: Ketan Surender <ket...@gm...> > > In this case I am trying to build an existing library from a provided > makefile that uses backslashes in file and directory names. I was > wondering if this is supported or was previously supported by > mingw32-make. It is supported, but not in every context in a Makefile. |
From: Eli Z. <el...@gn...> - 2012-09-01 07:47:31
|
> Date: Sat, 01 Sep 2012 10:05:57 +0300 > From: Eli Zaretskii <el...@gn...> > > > Date: Sat, 1 Sep 2012 01:52:31 -0400 > > From: Ketan Surender <ket...@gm...> > > > > mingw32-make 3.82 (instead of 3.82.90) with the above example makefile > > the runs the setup target without any errors. > > As does 3.82.90 I compiled myself from CVS a few months ago. > > Either this is due to a new feature or some bug in the build process > of MinGW Make. It's a bug. Fixed with the following change (to be committed to CVS shortly): --- read.c~ 2012-09-01 10:09:16.000000000 +0300 +++ read.c 2012-09-01 10:44:30.098750000 +0300 @@ -2242,8 +2242,8 @@ unescape_char (char *string, int c) /* It is, and there's >1 backslash. Take half of them. */ l /= 2; memcpy (p, s, l); - p += l; } + p += l; s = e; } |
From: Chris S. <ir0...@gm...> - 2012-09-01 20:23:42
|
On 1 September 2012 03:47, Eli Zaretskii wrote: >> Date: Sat, 01 Sep 2012 10:05:57 +0300 >> From: Eli Zaretskii <el...@gn...> >> >> > Date: Sat, 1 Sep 2012 01:52:31 -0400 >> > From: Ketan Surender <ket...@gm...> >> > >> > mingw32-make 3.82 (instead of 3.82.90) with the above example makefile >> > the runs the setup target without any errors. >> >> As does 3.82.90 I compiled myself from CVS a few months ago. >> >> Either this is due to a new feature or some bug in the build process >> of MinGW Make. > > It's a bug. Fixed with the following change (to be committed to CVS > shortly): > > --- read.c~ 2012-09-01 10:09:16.000000000 +0300 > +++ read.c 2012-09-01 10:44:30.098750000 +0300 > @@ -2242,8 +2242,8 @@ unescape_char (char *string, int c) > /* It is, and there's >1 backslash. Take half of them. */ > l /= 2; > memcpy (p, s, l); > - p += l; > } > + p += l; > s = e; > } I'll create a new release with this fix included. Chris -- Chris Sutcliffe http://emergedesktop.org http://www.google.com/profiles/ir0nh34d |