help-make
[Top][All Lists]
Advanced

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

Re: interrupt make


From: Stephan Beal
Subject: Re: interrupt make
Date: Mon, 22 Jun 2009 18:23:45 +0200

On Mon, Jun 22, 2009 at 2:50 PM, Fritz Code<address@hidden> wrote:
> ifneq ($(shell ./error_check),0)
>   address@hidden "error";
>    $(error ...)
> else
>    @echo "no error";
> endif

i don't think that will work how you want it to. "echo" can only
appear in target rules, not outside of target rules. $(error) is
(AFAIK) only useful outside of rules. Thus you cannot use $(error) to
report shell-level errors. The correct way to check inside a target is
something like:

target:
    @do .something; x=$$?; test x0 != x$$x && {echo "Error! RC=$$x!";
exit $$x; }; \
    true

The last "true" bit is so that the rule will exit with 0 if the second
&& part is not triggered.

In summary: you're trying to mix shell and make constructs
interchangeably, and that won't work - they are separate beasts and
have separate rules regarding when they can be used.

-- 
----- stephan beal
http://wanderinghorse.net/home/stephan/




reply via email to

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