[Top][All Lists]

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

Re: make doesn't complain if target cannot be built

From: Paul Smith
Subject: Re: make doesn't complain if target cannot be built
Date: Mon, 13 Jan 2014 17:20:43 -0500

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.


reply via email to

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