bug-make
[Top][All Lists]
Advanced

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

[bug #18617] Better debugging facilities: tracing rule invocation.


From: anonymous
Subject: [bug #18617] Better debugging facilities: tracing rule invocation.
Date: Thu, 28 Dec 2006 14:46:30 +0000
User-agent: Mozilla/5.0 (X11; U; Linux i686; es-ES; rv:1.8.0.9) Gecko/20060911 SUSE/1.5.0.9-0.1 Firefox/1.5.0.9

URL:
  <http://savannah.gnu.org/bugs/?18617>

                 Summary: Better debugging facilities: tracing rule
invocation.
                 Project: make
            Submitted by: None
            Submitted on: Thursday 12/28/06 at 14:46 UTC
                Severity: 3 - Normal
              Item Group: Enhancement
                  Status: None
                 Privacy: Public
             Assigned to: None
             Open/Closed: Open
         Discussion Lock: Any
       Component Version: 3.81
        Operating System: None
           Fixed Release: None

    _______________________________________________________

Details:

It usually takes a lot of time to debug makefiles written by others. This is
quite frequent when one downloads a program, tries to build it and gets
errors. Perhaps its something small, but tracing what variable or rule is
ultimately responsible for a compilation error is unnecessarily difficult.
Because makefiles can invoke or include other makefiles.

So here I am proposing several flags to make that task more easy.

First: a flag to trace rule invocation.

make --debug=r 

when a rule is invoked, the filename of the Makefile, the line number of the
rule, and the name of the target are printed.

For instance:

Invoking rule at Makefile:83 for target 'clean'

Sometimes it might be difficult to know in what directory is the makefile.
For these cases the flag "d" (directory) is proposed.

For instance, the hacker Miguel is compiling the package guess-lottery which
guesses lottery results. The package has been untarred in directory
/home/miguel/guess-lottery/

make --debug=r,d

When the package is compiling invoke-god.c in directory src/engine, it will
print

>  Invoking rule at /home/miguel/guess-lottery/src/engine/Makefile:83 for
target 'invoke-god.o'

In case the makefile is defined in file rules.mak in directory rules of the
package, make would print something like:

> Invoking rule at /home/miguel/guess-lottery/rules/rules.mak:41 included
from /home/miguel/guess-lottery/src/engine/Makefile:10 for target
'invoke-god.o'


Sometimes make uses implicit rules. For these cases, it should print
something enough to identify the rule. Using the previous example:

> Invoking builting implicit rule for "%c: %o" for target invoke-god.o

Another additional source of problems is assignment of variables.  Even if
one knows the rule that is miscompling something, it might be because of
compilation flags set in a variable. But where is that variable defined?
Since makefile variables are inherited across makefile invocation, and
makefiles can include other makefiles, the problem can be messy.

Therefore, an additional debugging flag is proposed for tracing variable
invocations. Unfortunately, the debugging flag "v" is already used for
"verbose". So the letter "p" (parameter) is proposed.

The proposed behaviour is that make prints all variable assignments when this
flag is set. In addition, the invoking makefile and line number are printed as
well. For example:

setting CFLAGS to "-Wall -fguess-bugs" (compiler.mak:34 included from
rules.mak:2 included from Makefile:10)

make debug




    _______________________________________________________

Reply to this item at:

  <http://savannah.gnu.org/bugs/?18617>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.gnu.org/





reply via email to

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