Mail Archives: cygwin/2005/05/03/21:02:12
Hello,
I am resurrecting a topic that has been discussed before, but there
doesn't seem to be a clear resolution (at least not clear to me!). It
relates to the behaviour of the PWD variable in the case of multiply
nested Makefiles. it was touched upon e.g. here:
http://www.mail-archive.com/cygwin AT sources DOT redhat DOT com/msg16375.html
I'm doing a side by side comparison between Cygwin 1.5.16-1 and Linux
RedHat 8.0, both using bash shell 2.05b.0(1)-release, and make version
3.79.1
Here's my test setup (sorry for dodgy ASCII art)
Maketest
|
+ topdir
|
+ Makefile
|
+ subdir
|
+ Makefile
topdir/Makefile looks like this:
#####
#topdir/Makefile
TOPDIR := $(shell echo $$PWD)
all:
@echo In topdir, TOPDIR=$(TOPDIR)
@echo In topdir, PWD=$$PWD
make -C subdir all
.EXPORT_ALL_VARIABLES:
######
and topdir/subdir/Makefile looks like this:
#####
#topdir/subdir/Makefile
all:
@echo in subdir, TOPDIR=$(TOPDIR)
@echo in subdir, PWD=$$PWD
#####
Now, from the top-top level (Maketest), I run 'make -C topdir'. Under
my Cygwin setup, I get this:
[jwilliams AT JWILLIAMS Maketest]$ make -C topdir
make: Entering directory `/cygdrive/z/Maketest/topdir'
In topdir, TOPDIR=/cygdrive/z/Maketest
In topdir, PWD=/cygdrive/z/Maketest
make -C subdir all
make[1]: Entering directory `/cygdrive/z/Maketest/topdir/subdir'
in subdir, TOPDIR=/cygdrive/z/Maketest
in subdir, PWD=/cygdrive/z/Maketest
make[1]: Leaving directory `/cygdrive/z/Maketest/topdir/subdir'
make: Leaving directory `/cygdrive/z/Maketest/topdir'
[jwilliams AT JWILLIAMS Maketest]$
while under the identical setup on Linux, I get this:
[jwilliam AT g512-9029 Maketest]$ make -C topdir
make: Entering directory `/mnt/home2/jwilliam/Maketest/topdir'
In topdir, TOPDIR=/mnt/home2/jwilliam/Maketest/topdir
In topdir, PWD=/mnt/home2/jwilliam/Maketest/topdir
make -C subdir all
make[1]: Entering directory `/mnt/home2/jwilliam/Maketest/topdir/subdir'
in subdir, TOPDIR=/mnt/home2/jwilliam/Maketest/topdir
in subdir, PWD=/mnt/home2/jwilliam/Maketest/topdir/subdir
make[1]: Leaving directory `/mnt/home2/jwilliam/Maketest/topdir/subdir'
make: Leaving directory `/mnt/home2/jwilliam/Maketest/topdir'
[jwilliam AT g512-9029 Maketest]$
Essentially under Cygwin the PWD variable seems to be "frozen" at its
value upon first launching Make from the commandline, while under Linux
it is being updated for each child process spawned by `make -C XXX`
I know that Cygwin != Linux, however is it a reasonable expectation that
under the same shells, the same behaviour should apply?
The real context for all of this is building the net-tools package,
which uses these sort of constructs to manage its recursive Makefile
structure. I'm sure there are plenty of other GNU-esque packages out
there doing similarly.
Any insights or workarounds would be greatly appreciated.
Thanks,
John
--
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
Problem reports: http://cygwin.com/problems.html
Documentation: http://cygwin.com/docs.html
FAQ: http://cygwin.com/faq/
- Raw text -