Re: VPATH of the form C:/foo

Greg Chicares <[email protected]>
Newsgroups gmane.comp.gnu.make.windows
Message-ID <[email protected]>
On 2007-12-02 17:41Z, Benoit Sigoure wrote:
> On Dec 2, 2007, at 6:13 PM, Christopher Faylor wrote:
>> On Sun, Dec 02, 2007 at 11:52:41AM +0100, Benoit Sigoure wrote:
>>> On Dec 2, 2007, at 3:37 AM, Christopher Faylor wrote:
>>>> This does raise the question of why you'd be using a cygwin  
>>>> version of
>>>> make if you need to use colon paths.
>>>
>>> Good question.  The VPATH variable is set by a script that calls  
>>> `make'.
>>> This variable is also used to invoke native Windows tools, so it's  
>>> more
>>> convenient to use the C:/Foo/Bar notation, which has the advantage of
>>> working with both native applications and Cygwin ones (while being  
>>> nice
>>> with the shell by avoiding backslashes).
>>
>> Why not convert the VPATH to UNIX format with cygpath ?
> 
> That's the workaround we use ATM, but I still consider this as a bug  
> that the Windows port of make doesn't deal nicely with Windows paths  
> for this particular feature.  I would prefer to avoid this sort of  
> hack in my scripts:
> 
> case `uname -s` in
>    CYGWIN*) # fix VPATH for b0rken port of make
>     save_IFS=$IFS
>     IFS=';'
>     for p in $vpath; do
>       IFS=$save_IFS
>       vpath_tmp="$vpath_tmp:"`cygpath "$p"`
>     done
>     vpath=$vpath_tmp;;
> esac

I have a similar need: I use native msw compilers in Cygwin 'bash'.
I prefer to 'mount' my base source directory and refer to it with
pure posix notation "/opt/my_source" meaning "C:\opt\my_source".
Then no workaround is needed for 'bash', 'make', or anything else.
The same makefiles work with a native msw port of a *nix shell;
in fact, the following example even works in CMD.EXE :

/tmp[0]$cat Makefile
VPATH := /WINDOWS

.PHONY: all
all: WIN.INI
	@echo VPATH is $(VPATH)
	@echo Prerequisites: $^

/tmp[0]$make
make: *** No rule to make target `WIN.INI', needed by `all'.  Stop.

/tmp[2]$mount --force "C:/WINDOWS" "/WINDOWS"
/tmp[0]$make
VPATH is /WINDOWS
Prerequisites: /WINDOWS/WIN.INI
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.