[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Make does not throw an error for target without a recipe?
From: |
Paul Smith |
Subject: |
Re: Make does not throw an error for target without a recipe? |
Date: |
Thu, 26 Jun 2014 17:20:39 -0400 |
On Thu, 2014-06-26 at 17:00 -0400, Patrick Donnelly wrote:
> This is a little inconvenient when you're relying on implicit rules.
> e.g.
>
> %.o: %.c
> cc -o $@ $<
> %: %.o
> ld $@ $^
>
> foo: bar.a
>
> Even if foo.c is missing, Make still succeeds. This is actually what
> I'm dealing with and I'd like a method of catching a mistake like a
> missing .c file in the future.
Aha. Now that we have a complete example we can discuss what's going on
here.
The problem--as you can actually see from the debug output you provided:
> No implicit rule found for 'foo'.
is that because the .c file is not present, it means that make decides
that these implicit rules DO NOT MATCH. Make checks the implicit rule
chain, but the chain fails because foo.c doesn't exist, so the %.o:%.c
rule cannot match, which means the %:%.o cannot match, so no implicit
rule matches.
Thus, there is no rule at all to build the target "foo" and make falls
back to the "no recipe provided" behavior.
Re: Make does not throw an error for target without a recipe?, Paul Smith, 2014/06/26
Re: Make does not throw an error for target without a recipe?, Paul Smith, 2014/06/26