Re-execute target when specified as dependency to multiple rules

Posted by andrew on Stack Overflow See other posts from Stack Overflow or by andrew
Published on 2009-08-02T02:25:43Z Indexed on 2010/05/14 0:04 UTC
Read the original article Hit count: 232

Filed under:
|
|
|
|

I have the following GNU makefile:

.PHONY a b c d

a: b c
b: d
c: d
d:
    echo HI

I would like the target 'd' to be run twice -- since it is specified as a dependency by both b & c. Unfortunately, the target 'd' will be executed only once. The output of running make will simply be 'HI', instead of 'HI HI'.

How can I fix this?

Thanks!

To Clarify, the goal is something like this:

subdirs =  a b c

build: x y

x: target=build
x: $(subdirs)

y: target=prepare
y: $(subdirs)

$(subdirs):
    $(make) -f $@/makefile $(target)

© Stack Overflow or respective owner

Related posts about make

    Related posts about gmake