help-make
[Top][All Lists]
Advanced

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

RE: How does $(error) work?


From: Warlich, Christof
Subject: RE: How does $(error) work?
Date: Thu, 9 Dec 2010 15:12:19 +0100

Chris Cross wrote:
> Trying to understand how $(error) works. The manual says "error is
> generated whenever this function is evaluated."  With the makefile below I
> would expect to see output from line1 of the recipe but only see output
> from $(error).
> # error.mk
> .PHONY: target
> 
> target:
>       @echo recipe line 1
>       $(error debug exit recipe line 2)
> 
> $ make -f error.mk
> error.mk:5: *** debug exit recipe line 2.  Stop.

Make immediately terminates when it sees the $(error) function. And it 
evaluates functions _before_ running any reciepe.

Just replace error with warning: Then, you'll see both the evaluation of the 
$(warning) function (first!), and _then_ the execution of the reciepe.

Cheers,

Christof


reply via email to

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