delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2001/02/23/16:26:33

Mailing-List: contact cygwin-help AT sourceware DOT cygnus DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT sources DOT redhat DOT com>
List-Archive: <http://sources.redhat.com/ml/cygwin/>
List-Post: <mailto:cygwin AT sources DOT redhat DOT com>
List-Help: <mailto:cygwin-help AT sources DOT redhat DOT com>, <http://sources.redhat.com/ml/#faqs>
Sender: cygwin-owner AT sources DOT redhat DOT com
Delivered-To: mailing list cygwin AT sources DOT redhat DOT com
Message-ID: <3A96D4A9.E406F3ED@comco.com>
Date: Fri, 23 Feb 2001 15:22:49 -0600
From: Tadeusz Liszka <tad AT comco DOT com>
Organization: Altair Engineering, Inc.
X-Mailer: Mozilla 4.07 [en] (X11; U; IRIX 5.3 IP22)
MIME-Version: 1.0
To: Marco van de Voort <marcov AT stack DOT nl>
CC: cygwin AT cygwin DOT com
Subject: Re: makefile that doesn't work
References: <3A91177F DOT 58177362 AT stack DOT nl>

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

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019