help-make
[Top][All Lists]
Advanced

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

Re: Kicking myself w/ Target specific variables on gmake 3.79.1


From: Paul D. Smith
Subject: Re: Kicking myself w/ Target specific variables on gmake 3.79.1
Date: Mon, 9 Apr 2001 23:54:36 -0400

%% address@hidden writes:

  c> Well, here's what I've done explicitly in the past, and am now trying to
  c> find some clean rules to do instead.  Sure, there are other ways to do
  c> this, 

  c> > make install-host1
  c> building in /somedir/host1/
  c> [etc...]

  c> So if I have:

  c> HOSTS := host1 host2 host3
  c> INSTALL_HOSTS := $(addprefix install-,$(HOSTS))

  c> # Here's my "goal"
  c> $(INSTALL_HOSTS) : $(INSTALL_DIR) := $(subst install-,$(NULL),$@)
  c> $(INSTALL_HOSTS) : install-all

  c> install-all:
  c>    copy foobar /somedir/$(INSTALL_DIR)

There's no way you can do this; I can't think of any way you can find
out the parent of a given rule.  Using $@ won't work, as I mentioned
before, because it will either be evaluated during read-in, when it is
empty, or it will be evaluated when the command is to be invoked, when
it has the value of the current target.

I don't see why it has to be so complicated, though, why not just
pattern rules?

  HOSTS := host1 host2 host3
  INSTALL_HOSTS := $(addprefix install-,$(HOSTS))

  install: $(INSTALL_HOSTS)

  install-%:
        copy foobar /somedir/$*

?? (you can do similar stuff with install-% if you want the install to
come first).

-- 
-------------------------------------------------------------------------------
 Paul D. Smith <address@hidden>          Find some GNU make tips at:
 http://www.gnu.org                      http://www.paulandlesley.org/gmake/
 "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]