help-make
[Top][All Lists]
Advanced

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

Applying implicit rule to list


From: Nikolaus Hammler
Subject: Applying implicit rule to list
Date: Thu, 14 Jun 2012 12:19:28 +0200
User-agent: Internet Messaging Program (IMP) H3 (4.3.7)

Hi,

I have a list of components, e.g.

CHILDREN := Block1 Block2 Block99 Block1999

Of course, this list is not fixed.
Now I want to have a target "all.*" which to execute an action "*" for all these children blocks. E.g., calling "all.SomeAction" shall do something with "SomeAction" on Block1, Block2, Block99 and Block1999.

I played around and ended up using this approach:

CHILDREN := Block1 Block2 Block99 Block1999

FOO2 = Block1.% Block2.% Block99.% Block1999.%
.PHONY: $(FOO2)
$(FOO2):
        @echo "    I am $@ (replacement: $*)"
        @echo "        Call: $(MAKE) -C Subblocks/$(word 1,$(subst ., ,$@)) $*"

.PHONY: all.%
all.%: $(addsuffix .%,$(CHILDREN))
        @echo "    I am all.% (all.$*)"
        @echo "        Deps: $(addsuffix .$*,$(CHILDREN))"

FOO2 should later be, of course, dynamically built based on $(CHILDREN).

The output is:

$ make all.SomeAction
    I am Block2.SomeAction (replacement: SomeAction)
        Call: make -C Subblocks/Block2 SomeAction
    I am all.% (all.SomeAction)
Deps: Block1.SomeAction Block2.SomeAction Block99.SomeAction Block1999.SomeAction

So I have only the call for the *second* entry in the list.

How can I solve this issue?

Regards
Niki






reply via email to

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