Trepan-Debuggers / remake

Enhanced GNU Make - tracing, error reporting, debugging, profiling and more
http://bashdb.sf.net/remake
GNU General Public License v3.0
796 stars 75 forks source link

Trace every subprocess created #155

Open rolfbjarne opened 2 months ago

rolfbjarne commented 2 months ago

I have a project with fairly large makefiles, and they tend to grow slower over time (even when nothing needs to be done).

Most of this slowdown is because there are many variables instantiated by executing subprocess:

ANSWER=$(shell echo 1 + 41 | bc)

The fix is typically easy (find another way to do it, or at least assign using :=), but the problem is finding all these (and measuring the impact of each, since 100 echos can be much faster than a single bc)

Unfortunately neither make nor remake seem to provide a way to trace this.

$ cat Makefile
ANSWER=$(shell echo 1 + 41 | bc)
all:
    @echo ANSWER=$(ANSWER)%

$ make --debug=all | grep bc
[no output]

$ remake --trace=full | grep bc
[no output]

So it would be nice if remake provided a way to trace every subprocess created by make (and maybe even how long it took to execute).

rocky commented 2 months ago

Both GNU make and remake are open source. Feel free to address and put in a PR.