Cameron Martin Cameron Martin - 3 months ago 18
Android Question

In an AOSP file, how do I execute a command and fail the build if the command fails?

In an file, I have the following line which executes a bash script:

$(info $(shell ($(LOCAL_PATH)/

However, if the command fails the build continues rather than quitting.

How do I make the whole build fail in this situation?


Dump stdout, test the exit status, and error out on failure:

ifneq (0,$(shell >/dev/null command doesnotexist ; echo $$?))
  $(error "not good")

Here's what failure looks like:

[user@host]$ make 
/bin/sh: doesnotexist: command not found
Makefile:6: *** not good.  Stop.