help-make
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Can't see the trees for the forests, can't see the simple problem


From: Paul D. Smith
Subject: Re: Can't see the trees for the forests, can't see the simple problem
Date: Mon, 10 Apr 2006 10:51:59 -0400

%% "PATTON, BILLY \(SBCSI\)" <address@hidden> writes:

  pb> I have :
  pb> all :
  pb>         @cdir=$(PWD) ; \
  pb>         echo "cdir = '$(cdir)'" ;

  pb> cdir comes up empty every time.

Definitely.  You're still having problems visualizing the distinction
between the shell and make.

First, $(PWD) is not a standard make variable.  It may be set in your
makefile _IF_ your shell sets it before make is invoked (because make
inherits all the invoking program's environment variables as make
variables).  But this is not portable as not all shells set PWD.  The
make variable containing the working directory is $(CURDIR), not $(PWD).


Second, in the first line you set the SHELL variable "cdir".

In the second line you echo the MAKE variable $(cdir).

These are not the same _at all_.  Rewrite:

> all :
>         @cdir='$(CURDIR)' ; \
>         echo "cdir = '$$cdir'" ;

-- 
-------------------------------------------------------------------------------
 Paul D. Smith <address@hidden>          Find some GNU make tips at:
 http://www.gnu.org                      http://make.paulandlesley.org
 "Please remain calm...I may be mad, but I am a professional." --Mad Scientist




reply via email to

[Prev in Thread] Current Thread [Next in Thread]