help-make
[Top][All Lists]
Advanced

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

RE: Catching errors during $(shell ...) function


From: BShah
Subject: RE: Catching errors during $(shell ...) function
Date: Wed, 24 Jul 2002 08:31:11 +0100

I don't know exactly why the $(shell ) isn't causing an error exactly - I
suspect its something to do with the point at which $(shell) is run.

HOWEVER

Depending on what you are testing, you could use the following technique:

BLAH=$(shell <something that outputs an error string>)
foox:
        $(if $(BLAH), $(error $(BLAH)))

That <something that outputs an error string> could be a shell script that
wraps and detects a non-zero return status from whatever program you want to
run.

This only works with gmake 3.79 and greater, as $(if ) and $(error ) were
introduced in that release.

B.

-----Original Message-----
From: address@hidden [mailto:address@hidden
Sent: 24 July 2002 01:02
To: address@hidden
Subject: Catching errors during $(shell ...) function


I'd like make to terminate with an error if 
the program run by $(shell ) exits with a nonzero status,
but make seems to blindly run on.  Example:

BLAH=$(shell /bin/false)
foox:
        echo $(BLAH)

Running this should abort, but it doesn't.  Help!
- Dan

_______________________________________________
Help-make mailing list
address@hidden
http://mail.gnu.org/mailman/listinfo/help-make



reply via email to

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