On Tue, 2009-11-03 at 15:32 -0800, Mark Galeck (CW) wrote:
> top makefile is
>
> foobar: subdir/sentinel
> echo making foobar
> touch foobar
> subdir/sentinel:
> make -C subdir
>
> subdir makefile is
>
> all:
> # touch sentinel
Well, since you have the touch commented out it will never do anything.
Also, be sure to ALWAYS use the variable $(MAKE), never just "make",
when running sub-makes
> Well, what am I doing wrong - because, with this foobar always gets
> rebuilt. Probably because make attempted to remake subdir/sentinel as
> "target", and even though that file did not get updated, make
> remembers that it remade the target.
The sentinel file has to be created: it has to exist. A non-existent
file is always considered out of date. If it exists but then is not
updated, THEN it is not considered out of date.
> Also, order-only don't work for me either:
>
> Top makefile is
>
> foobar: | subsystem
> echo making foobar
> touch foobar
> subsystem:
> make -C subdir
Here foobar has to depend on the thing that is getting built
(subsystem/subfile), so the foobar knows when it's out of date.
You want this:
foobar: subsystem/subfile
echo making foobar
touch $@
subdsystem/subfile: | subsystem
.PHONY: subsystem
subsystem:
$(MAKE) -C $@
Then keep your subsystem makefile the same:
> all: subfile
> subfile:
> touch subfile
>
> This time, foobar never gets rebuilt.
_______________________________________________
Help-make mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/help-make