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

Stepping through macro expansions #124

Open deliciouslytyped opened 3 years ago

deliciouslytyped commented 3 years ago

Related to https://github.com/rocky/remake/issues/123 ,

I want to debug the following Makefile; the make-dirs call expands to nothing:

define _make-dir
$1/.dum: $(not-dir $1)/.dum
        mkdir $(dir $@)
        touch $(dir $@)/.dum
endef

# we dont try to create/depend on /.dum
define make-dir
$(if $(not-dir $1),$(call _make-dir,$1),)
endef

$(call make-dir,test/)

I've skimmed through the manual earlier and looked through the in-REPL documentation, maybe I'm missing something but

deliciouslytyped commented 3 years ago

I'm currently trying to find a workaround by trying to write a $(call trace,...) function that can be inserted in a nested expansion, similar to trace functions in functional programming languages; it prints the value it is passed and then returns it; but I'm not very good at make programming yet.

deliciouslytyped commented 3 years ago

Another possibility might be to

deliciouslytyped commented 3 years ago

https://github.com/rocky/remake/pull/125 implements the fourth (not explicitly listed previously because I thought it would be a lot harder) option: implementing the trace builtin.

However, having the ability to step through expansions would still be helpful because it doesn't require modifying the Makefile.