Subject: Re: makefile that doesn't work
From: Tadeusz Liszka <[email-masked]>
To: Marco van de Voort <[email-masked]>
Cc: [email-masked]
Date: Fri, 23 Feb 2001 15:22:49 -0600

I modified your makefile to print some intermediate results. See below for
the comments on how the makefile works. To find the problem type:
	which pwd
or
	which pwd.exe
in the bash shell (or find it manually if this fails).

My guess is that the $PATH variable is not correct (I recall that on
Windows it may have Path PATH and path and it somehow concatenates them
together

However for me this single line works and does the same as all your lines
BASEDIR1 := $(shell pwd)

Your code goes long way around to have the same result, and obviously it
fails in some situations.

If you do not know much about make :-) then make sure that the lines with
'echo' start with TAB, not space

Try the following:

all:
	echo BASEDIR $(BASEDIR)
	echo BASEDIR1 $(BASEDIR1)
	echo PWD $(PWD)
	echo PWD1 $(PWD1)
	echo PATH $(PATH)
	echo `pwd`
	echo `which pwd`

Marco van de Voort wrote:
> 
> I have of set of makefiles that donn't work under win NT and 2000, but
> seem to work under '98 ,'95     (and djgpp on those targets), and
> FreeBSD, Linux.
> 
> - Shell (cmd.exe or bash) doesn't seem to matter.
> - I don't have djgpp on the 2000 machine to test.
> 
> I isolated the problem part, this makefile snippet prints the current
> path, but not under
> cygwin on NTish systems.
> 
> It seems to be the line with shell in it, but I don't know enough about
> makefile semantics to hunt it down or locate the problem spot.
> 
> I do monitor the list, but irregularly, so please CC me any replies.
> 
> #
> # Don't edit, this file is generated by fpcmake v1.99.0 [2001/02/02]
> #
> default: all

# change \ in PATH to unix style /
> override PATH:=$(subst \,/,$(PATH))

#addsuffix builds the list of all dirctories in PATH 
#and appends /pwd.exe to each. Then wildcard searches if there 
#exists any file matching it
> PWD:=$(strip $(wildcard $(addsuffix /pwd.exe,$(subst ;, ,$(PATH)))))
> 

#if this fails then the same test is repeated with '/pwd'
# so the above is right on Windows, this below works for Unix
> ifeq ($(PWD),)
> PWD:=$(strip $(wildcard $(addsuffix /pwd,$(subst :, ,$(PATH)))))
> endif
> 

#if there are multiple matches (e.g. duplicate directories in PATH)
# then take the first only
> PWD:=$(firstword $(PWD))

#execute it and send result to variable BASEDIR
> BASEDIR=$(shell $(PWD))
> 
> all:
>     echo $(BASEDIR)
> 
> --
> Want to unsubscribe from this list?
> Check out: http://cygwin.com/ml/#unsubscribe-simple

-- 
Tadeusz
:: The public opinion should be alarmed by its own nonexistence
:: (512)467-0618 ext. 526 ::       Stanislaw J. Lec, trans. TJL

--
Want to unsubscribe from this list?
Check out: http://cygwin.com/ml/#unsubscribe-simple