Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

makefile: how to show line numbers for debugging?

Tags:

makefile

Is there a way to have make display the line number where it declares an error? The -d switch doesn't seem to cut it.

Updated: Example output:

Reaping winning child 0x08aa8648 PID 9381  
/bin/sh: Syntax error: "then" unexpected (expecting "fi")
like image 372
jldupont Avatar asked Mar 16 '26 22:03

jldupont


1 Answers

It gives you the line number by default:

$ make
Makefile:11: *** missing separator.  Stop.

If you are redirecting output into the file, do not forget to redirect stderr then.

Ahh, It's not a make, but sh error. Try to use set -x command to switch the shell in debug mode.

[ctpython]$ set -x
++ pwd
++ kill -STOP 7136
[ctpython]$ make
+ make
Makefile:11: *** missing separator.  Stop.
++ pwd
++ kill -STOP 7136
like image 198
Elalfer Avatar answered Mar 18 '26 13:03

Elalfer



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!