Paul D. Smith wrote:
On Monday, 6 November, Martin Sebor ([EMAIL PROTECTED]) wrote:
I must be missing something but I don't see why the trap special
builtin wouldn't work the same in a make rule as in shell. Could
someone enlighten me? I expect the make output below to be 1 but
I get 0 instead.
$ (trap 'echo $?' EXIT && exit 1)
1
$ echo "foo:; trap 'echo \$\$?' EXIT && exit 1" > mf \
&& gmake -f mf foo
trap 'echo $?' EXIT && exit 1
0
gmake: *** [foo] Error 1
It works for me. Maybe it's your shell?
Apparently. I originally ran my code on Solaris. I have tried
/usr/xpg4/bin/sh but got the same results. AIX, HP-UX, IRIX,
and Tru64 all behave the same as well. Bash is the only shell
that produces the result I expect.
Martin
Remember that make uses /bin/sh to
run all of its commands. On my system /bin/sh is really bash but maybe your
/bin/sh is something else. Also, what version of make are you using?
$ echo "foo:; trap 'echo \$\$?' EXIT && exit 1" | make -f -
trap 'echo $?' EXIT && exit 1
1
make: *** [foo] Error 1
_______________________________________________
Help-make mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/help-make