How to get the exit status of a Make target script command to return as the Make command exit status itself?

23 Views Asked by At

I have a Make target which runs a shell script that return an exit status 45 (lets say).

After running the Make target as command on shell , I want to check the $? variable value giving me 45 or not. But it is giving me '2'.

For example, below is my Makefile.test:

mytarget:
    test.sh

And test.sh content is as below:

#!/bin/sh
exit 45 

After running make -f Makefile.test mytarget, I am running echo $? which is giving me 2.
How can I get the same exit status as test.sh after running the Make command on prompt?

Thanks

0

There are 0 best solutions below