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: PATTON, BILLY \(SBCSI\)
Subject: RE: Can't see the trees for the forests, can't see the simple problem
Date: Mon, 10 Apr 2006 10:32:41 -0500

Why does this work:
define refresh_proj_bb_sub
$(1)+$(2)+$(3)+$(4) :
        @cdir='$(CURDIR)' ; \
        for X in $($(call merge,+,$(call uc,$(1)) $(2) $(3) $(4))) ; do
\
          if test -f $$$$X ; then \
            echo "cdir = '$$$$cdir'" ; \
          fi ; \
        done
endef

but this fails with syntax error:  diff is the echo vs $(CD)
CD              := cd
define refresh_proj_bb_sub
$(1)+$(2)+$(3)+$(4) :
        @cdir='$(CURDIR)' ; \
        for X in $($(call merge,+,$(call uc,$(1)) $(2) $(3) $(4))) ; do
\
          if test -f $$$$X ; then \
            $(CD) $$$$cdir ; \
          fi ; \
        done
endef
> -----Original Message-----
> From: Paul Smith [mailto:address@hidden On Behalf Of Paul D. Smith
> Sent: Monday, April 10, 2006 9:52 AM
> To: PATTON, BILLY (SBCSI)
> Cc: address@hidden
> Subject: Re: Can't see the trees for the forests, can't see 
> the simple problem
> 
> 
> %% "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]