help-make
[Top][All Lists]
Advanced

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

Why does redirecting to other makefile execute rules differently?


From: Timo Suoranta
Subject: Why does redirecting to other makefile execute rules differently?
Date: Tue, 09 Feb 2010 16:15:40 +0200
User-agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.1.7) Gecko/20100111 Thunderbird/3.0.1

Short story: "make test1" executes rules twice, why? "make test2" works as expected.

Long story: I'm trying to have a generic Makefile that detects platform using uname and then forwards goals to another Makefile.b. But I am getting targets being built multiple times. This happens when the target Makefile.b calls $(MAKE). Currently these $(MAKE) commands do not specify makefile, and I'd like to keep it that way. So they go to the default Makefile after which they come back to Makefile.b. But why do rules get executed twice?


# Makefile

.DEFAULT:
        $(MAKE) -f Makefile.b $(MAKECMDGOALS)

# Makefile.b

test1:
        $(MAKE) foo bar

test2:
        $(MAKE) -f Makefile.b foo bar

foo:
        @echo foo

bar:
        @echo bar

--
timo




reply via email to

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