How to read a make file in python and access its elements

Dave Angel davea at davea.name
Mon Jul 22 20:39:33 EDT 2013


On 07/22/2013 03:09 PM, san wrote:
> How to read/load  the cmake file in python and access its elements.
> I have a scenario, where i need to load the make file and access its elements.
> I have tried reading the make file as text file and parsing it,but its not the ideal solution
> Please let me know how to load the .mk file and access its elements in python.
>

First, just what do you mean by "make file"?  You refer to cmake, make, 
and .mk in three places in your message.  How about a link to the actual 
tool you're interested in? And a brief list of the other tools you're 
using it with.

Is this it?
http://www.cmake.org/

Once we're talking about the same tool, then the question is what 
"elements" are you interested in?  If your cmake is anything like the 
traditional make program, the format is deceptively simple, and 
enormously complex in usage.

But I suspect that your cmake has very little to do with Unix make 
tools.  The cmake that I gave the link for uses a CMakeLists file, which 
looks nothing like a makefile.


-- 
DaveA




More information about the Python-list mailing list