On Wed, 17 Jan 2001 10:03:36 -0600, "James L. Peterson"
<[EMAIL PROTECTED]> wrote:

>A major problem that I have with make is being able to debug the
>makefiles.  I end up working on big projects that are supposed to
>be for multiple platforms, so there are a lot of make variables
>and thousands of lines of multiple makefiles.  My difficulty is
>in seeing what everything expands to, so I can understand why
>make is (or isn't) doing what it is doing.

I have faced a similar challenge.

One easy debug technique I figured out was to add a rule to one of the
common makefile include

ifdef _SHOWVAR
.show:
        $(_ECHO)echo show $(_SHOWVAR) = $($(_SHOWVAR))
endif

where _ECHO defaults to @.

Then in any makefile I was studying operations I could do a

make -f xxx.mak .show _SHOWVAR=variable_name

and see what the dynamic name of the variable was during that
instance.

A second debug technique is the equivalent of a printf() in C. To each
rule in a makefile add a

        $(ECHO)echo makefile_name rule_name $(var) etc >> trace.lst

Then run the makefile(s) and you can see a dynamic execution "trace".
This is brute force but very effective when learning a makefile suite.

john alvord

_______________________________________________
Bug-make mailing list
[EMAIL PROTECTED]
http://mail.gnu.org/mailman/listinfo/bug-make

Reply via email to