On Mon, 2014-01-13 at 22:23 +0100, Christian Eggers wrote:
> In Makefile 2 my intention was to state that foo.o depends on some
> generated header which must be generated first (might be in another
> rule). But I didn't want to change the be behaviour if foo.o cannot be
> built because e.g. there's no foo.c.

Unfortunately, this behavior is correct, and even required by the POSIX
standard (and is implemented by every version of make).

Once a target is listed in the makefile it becomes "known" to 'make'.
When make wants to build a target it will try to find an implicit rule
for it.  However, if there is no implicit rule found it just means that
there were no commands available for that target, not that the target
couldn't be built.

According to the POSIX spec:

        If there are no commands listed for the target, the target shall
        be treated as up-to-date.

This is actually useful behavior and is definitely taken advantage of in
real makefiles.

Cheers!


_______________________________________________
Bug-make mailing list
Bug-make@gnu.org
https://lists.gnu.org/mailman/listinfo/bug-make

Reply via email to