[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
RE: help with sh commands inside a define inside an eval'd rule
From: |
PATTON, BILLY \(SBCSI\) |
Subject: |
RE: help with sh commands inside a define inside an eval'd rule |
Date: |
Fri, 7 Apr 2006 14:00:43 -0500 |
> -----Original Message-----
> From: Paul Smith [mailto:address@hidden On Behalf Of Paul D. Smith
> Sent: Friday, April 07, 2006 1:55 PM
> To: PATTON, BILLY (SBCSI)
> Cc: address@hidden
> Subject: Re: help with sh commands inside a define inside an
> eval'd rule
>
>
> %% "PATTON, BILLY \(SBCSI\)" <address@hidden> writes:
>
> pb> I have this:
> pb> define refresh_proj_bb_pub
> pb> $(1)$(sep)$(2)$(sep)$(3)$(sep)pub :
> pb> for X in $($(call merge,$(sep),$(call uc,$(1))
> $(2) $(3) pub));
> pb> do \
> pb> $(CD) $(SRC_TREE)/$(2)/$(3)/pub ; \
> pb> $(EXEC_LOG) $(PVCS_GET)
> -v$(3)$(PVCS_VER) $$X -proj $(2)
> pb> -bb $(3) ; \
> pb> done
> pb> endef
>
> pb> But when it prints to the screen the location of $$X is blank
> pb> the for X in blabla has from 1 to 100+ items depending
> on the instance.
>
> pb> How do I get the value of X onto the command line?
>
> That's how you do it, with $$X.
>
> Again, I have to urge you to provide a COMPLETE example. You are
> leaving critical aspects of your environment out and it's very hard to
> answer questions in that situation.
complete example is too large. When I try to shorten it works. I'm
shortening
too much.
>
> For example, if you used the macro above directly in a rule:
>
> foo:
> $(refresh_proj_bb_pub)
>
> it would work as you expect (assuming the variables used like $(1),
> $(2), etc. were all set).
>
> However, I'm assuming since this appears inside a define/endef and it
> uses $(1) etc. that you're really passing this to an invocation of
> $(call ...)
>
> In that case you have to escape the $$X, because you want the literal
> string '$$X' to appear on the command line, but $(call ...) will
> evaluate it and remove one layer of indirection.
>
> You'll have to write '$$$$X' instead.
worked perfect :)
>
>
> As always, it's smart to use $(warning ...) (or $(info ...)
> in GNU make
> 3.81) to see what it looks like after $(call ...) is done with it.
>
> --
> --------------------------------------------------------------
> -----------------
> 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
>