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

S

san

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.
 
D

Dave Angel

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.
 
A

alex23

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.

Take a look at pymake:

"make.py (and the pymake modules that support it) are an implementation
of the make tool which are mostly compatible with makefiles written for
GNU make."

http://hg.mozilla.org/users/bsmedberg_mozilla.com/pymake/

There is a parser.py file which might be useful to you.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,967
Messages
2,570,148
Members
46,694
Latest member
LetaCadwal

Latest Threads

Top