bug-make
[Top][All Lists]
Advanced

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

Re: Showing file/line number combinations when executing make


From: Paul Smith
Subject: Re: Showing file/line number combinations when executing make
Date: Sun, 29 Aug 2010 14:13:18 -0400

On Sun, 2010-08-22 at 15:05 +0000, address@hidden wrote:
> Quoting Edward Peschko <address@hidden>:
> > My question - how do you actually trace this back to the target that  
> >  generated this statement? In this case, the ghostscript Makefile is  
> >  so convoluted that it goes through levels of indirection to get to   
> > this point, so grep is of limited help here.
> >
> > So - why can't make add (optionally, of course) a line number/file   
> > name combo to each of the statements that it executes - and as an   
> > additional option show the text of the makefile that is executing at  
> >  the time?
> 
> See recent thread:
> http://lists.gnu.org/archive/html/bug-make/2010-07/msg00159.html
> http://lists.gnu.org/archive/html/bug-make/2010-08/msg00002.html
> 
> Summary:
> The feature you describe would indeed be a nice thing to add.
> It's possible to simulate it at present if your make-files are nicely
> written, but tiresome if you're dealing with someone else's make files
> that didn't contemplate the need to do this.

In GNU make 3.82 if you enable "basic" debugging (that is, any level of
debugging including --debug=b) you will see information on where the
command was defined (makefile and linenumber); for example from a build
of GNU make itself, with --debug=b:

        make[2]: Entering directory `/home/psmith/src/make/make-temp'
              Successfully remade target file `config.h'.
             Prerequisite `job.c' is newer than target `job.o'.
             Prerequisite `job.c' is newer than target `job.o'.
            Must remake target `job.o'.
        Invoking recipe from Makefile:521 to update target `job.o'.
        gcc <...> -MT job.o -MD -MP -MF .deps/job.Tpo -c -o job.o job.c
        job.c: In function 'construct_command_argv_internal':
        job.c:2287: warning: unused parameter 'batch_filename_ptr'
        mv -f .deps/job.Tpo .deps/job.Po
            Successfully remade target file `job.o'.
           Prerequisite `job.o' is newer than target `make'.
          Must remake target `make'.
        Invoking recipe from Makefile:481 to update target `make'.
        gcc <...> -o make <...>
          Successfully remade target file `make'.

Hm.  I think the "Invoking" lines should be indented too.  Also it's odd
that the "newer than target" lines for job.c are printed twice; I'll
have to look into that.

-- 
-------------------------------------------------------------------------------
 Paul D. Smith <address@hidden>          Find some GNU make tips at:
 http://www.gnu.org                      http://make.mad-scientist.net
 "Please remain calm...I may be mad, but I am a professional." --Mad Scientist




reply via email to

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