This is the mail archive of the cygwin@sources.redhat.com mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

RE: make --win32 incorrectly handles PATH


Here's another clue into the PATH problem. I've modified my example makefile
to give a fuller view of the subprocess's environment (using set | grep -i
path).

====================
D:\testmake>type makefile
# Filename: makefile
#
PATH := $(PATH):c:/added/in/makefile:PATH
.PHONY : all
all :
	@echo $$PATH=$(PATH)
	@echo -----
	@echo %PATH=%PATH%
	@echo -----
	@echo %Path=%Path%
	@echo -----
	@path
	@echo -----
	@set | grep -i path
#
#EOF

D:\testmake>path
PATH=C:\WINNT\system32;C:\WINNT;c:\bin;c:\cygwin\bin

D:\testmake>make --win32
$PATH=/cygdrive/c/WINNT/system32:/cygdrive/c/WINNT:/cygdrive/c/bin:/usr/bin:
c:/added/in/makefile:PATH
-----
%PATH=C:\WINNT\system32;C:\WINNT;c:\bin;c:\cygwin\bin
-----
%Path=C:\WINNT\system32;C:\WINNT;c:\bin;c:\cygwin\bin
-----
PATH=C:\WINNT\system32;C:\WINNT;c:\bin;c:\cygwin\bin
-----
PATH=C:\WINNT\system32;C:\WINNT;c:\bin;c:\cygwin\bin
PATH=c:\WINNT\system32;c:\WINNT;c:\bin;C:\cygwin\bin;c;c:\cygwin\added\in\ma
kefile;PATH
[ extraneous clutter not shown ]

====================
Note that there are TWO environment variables named PATH ! The value of the
first one is the same as the %PATH% value before running make. The value of
the second one looks a lot like the $PATH value constructed in the makefile.
My guess is that make is constructing the environment for the subprocess,
and inserting a second PATH (or perhaps Path or even path?) variable, when
it should be replacing the previous PATH variable. I think you can have both
PATH and Path variables in a unix environment, but in DOS/WIN, that
shouldn't be possible. I'm further guessing that when a program (or the OS)
read the environment looking for PATH, that it takes the first one it finds.

If I change nothing in the makefile, but shorten my PATH, this is the
output:

====================
D:\testmake>path
PATH=c:\bin;c:\cygwin\bin

D:\testmake>make
$PATH=/cygdrive/c/bin:/usr/bin:c:/added/in/makefile:PATH
-----
%PATH=c:\bin;C:\cygwin\bin;c;c:\cygwin\added\in\makefile;PATH
-----
%Path=c:\bin;C:\cygwin\bin;c;c:\cygwin\added\in\makefile;PATH
-----
PATH=c:\bin;C:\cygwin\bin;c;c:\cygwin\added\in\makefile;PATH
-----
PATH=c:\bin;C:\cygwin\bin;c;c:\cygwin\added\in\makefile;PATH
PATH=c:\bin;c:\cygwin\bi@
[ extraneous clutter not shown ]

====================
This looks very different from the first trial.

Scott Carter
Software Engineer

--
Want to unsubscribe from this list?
Send a message to cygwin-unsubscribe@sourceware.cygnus.com


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]