German,
This is easier than you think. Just remove the $(shell ... ) from around
your shell call and add the call to a target like this:
check_code:
/path/to/my/script.sh
Then put the check_code target in your dependency graph somewhere.
Scripts return values to the shell. If you call these as commands
instead of having the make $(shell) macro invoke them, the exit code
becomes the command status to make.
John
On 6/14/2010 9:34 AM, German Escallon wrote:
> Hello all,
>
> How can I stop a build process based on the outcome of a shell script?
> What I want to do is to run a script that verifies some of my code.
> If the script succeeds, then I would continue to the next step, but if
> it fails, I want to stop the make process.
>
> First things first. How can I know if my script succeeded or not??
> I've tried reading and printing the $? environment variable. Here's
> what I've tried with a script that should always fail.
>
> e.g:
> @$(shell /path/to/my/script.sh)
> @echo "result: $$?"
>
> The line always prints "result: 0", regardless of the result. When I
> run this same script on the console, and then echo the $? variable, I
> always get the error code I'm hoping for.
> If you have any suggestions on how to know the outcome of a script
> w/out using the $? environment variable, please let me know. Thank
> you in advance.
>
>
> German
>
>
> _______________________________________________
> Help-make mailing list
> [email protected]
> http://lists.gnu.org/mailman/listinfo/help-make
>
_______________________________________________
Help-make mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/help-make