help-make
[Top][All Lists]
Advanced

[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: Paul D. Smith
Subject: Re: help with sh commands inside a define inside an eval'd rule
Date: Fri, 7 Apr 2006 14:54:31 -0400

%% "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.

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.


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




reply via email to

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