[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Better Debugging

From: John Alvord
Subject: Re: Better Debugging
Date: Thu, 18 Jan 2001 15:52:15 GMT

On Wed, 17 Jan 2001 10:03:36 -0600, "James L. Peterson"
<address@hidden> 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
        $(_ECHO)echo show $(_SHOWVAR) = $($(_SHOWVAR))

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

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

reply via email to

[Prev in Thread] Current Thread [Next in Thread]