Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com Message-ID: <4278209B.1050903@itee.uq.edu.au> Date: Wed, 04 May 2005 11:08:43 +1000 From: John Williams Reply-To: jwilliams AT itee DOT uq DOT edu DOT au User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7b) Gecko/20040316 MIME-Version: 1.0 To: cygwin AT cygwin DOT com Subject: pwd vs $PWD, bash, cygwin vs Linux Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Checked: This message probably not SPAM X-Spam-Score: 0 X-IsSubscribed: yes Note-from-DJ: This may be spam 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/