help-make
[Top][All Lists]
Advanced

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

Capturing and parsing make's output


From: Travis Spencer
Subject: Capturing and parsing make's output
Date: Tue, 30 Aug 2005 08:44:07 -0700

Hey All,

We are developing an application that requires that we capture the
output of make into various formats (XML and two home-grown formats). 
Proceeding isn't very straight forward because the output isn't a
language, so I was wondering if I could get some input from the make
experts.

One thought I had was to get the source code and modify it to output
what we need in the format we want; however, my research adviser wants
the capture utility to be written in python, so our project is using a
single language (and a few other reasons).

Since patching make to work the way we need is out, the other thought
I had was this:

1. In the capture script, run `make -p' to find out what the name of
the compilers are (e.g., perhaps mpicc is being used instead of cc). 
Stash this info away in an environment variable (e.g., ORIG_CC).

2. Set CC, CXX, etc. to a second python script that will be invoked
for each source code that is compiled.  This would allow us to capture
the command line arguments and their values that we are curious about.

3. From within this second script, all of the command line arguments
would be passed to the original compilers (using ORIG_CC, ORIG_CXX,
etc.)

4.  Each invocation of the original compiler would then be parsed in some way.

Some problems with this idea are that if a Makefile sets CC to
something, it will ignore the CC environment variable; thus, our
second script described in step two above would never be called. 
Another problem is how should the information from the pseudo-compiler
script communicate its parsed data back to the actual script?  One
idea that may work is a named pipe.  I'm sure there are many, many
more problems.

Building a robust system seems very difficult.  Does anyone have any
advice that may help?  I would really appreciate it.

-- 

Regards,

Travis Spencer




reply via email to

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