[Top][All Lists]
[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: |
chorn |
Subject: |
Re: Kicking myself w/ Target specific variables on gmake 3.79.1 |
Date: |
Tue, 10 Apr 2001 09:38:43 -0400 |
User-agent: |
Mutt/1.2.5i |
On 2001/04/09 23:54:36 -0400, Paul D. Smith wrote:
> 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).
It's complicated because there are a whole series of rules which use
$(INSTALL_DIR) in my example. If I could get away with one rule just using
a pattern I would...
Consider:
install-%: install-part1 install-part2 install-part3 install-part4
Where you may need to run a specific part without running the rest.