469,352 Members | 1,835 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,352 developers. It's quick & easy.

How to execute a makefile from LINUX system.

Hi all,
I am using Link-41b parser in my program.
The windows version of it has an .exe file that can be executed using
os.system command
On Linux version,I have a makefile.

so my question is:
How to run the makefile using some python function.

Thanks
Oct 21 '08 #1
3 13793
On Mon, Oct 20, 2008 at 10:32 PM, gaurav kashyap
<ga***********@gmail.comwrote:
Hi all,
I am using Link-41b parser in my program.
The windows version of it has an .exe file that can be executed using
os.system command
On Linux version,I have a makefile.

so my question is:
How to run the makefile using some python function.
Use the 'subprocess' module
(http://docs.python.org/library/subpr...ule-subprocess) to
run the 'make' command in the same working directory as the Makefile
with the appropriate target as an option.

Cheers,
Chris
--
Follow the path of the Iguana...
http://rebertia.com
>
Thanks
--
http://mail.python.org/mailman/listinfo/python-list
Oct 21 '08 #2
Thanks
Oct 21 '08 #3
gaurav kashyap <ga***********@gmail.comwrites:
How to run the makefile using some python function.
A makefile is not a program to be run; it contains a declarative
(*not* procedural) data set for the ‘make’ program. You need to invoke
the ‘make’ command, tell it which file to read, and specify which
target you want it to achieve.

An example:

$ make -f /tmp/foo/makefile spam

where ‘/tmp/foo/makefile’ is the path to the file containing the data
set, and ‘spam’ is the target you want ‘make’ to achieve.

How do you know which target you want? You'll need that information
from the author of the makefile, such as in the documentation that
comes with the makefile.

--
\ “I put contact lenses in my dog's eyes. They had little |
`\ pictures of cats on them. Then I took one out and he ran around |
_o__) in circles.” —Steven Wright |
Ben Finney
Oct 21 '08 #4

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

reply views Thread by John Abel | last post: by
3 posts views Thread by tmponko | last post: by
2 posts views Thread by xuatla | last post: by
4 posts views Thread by Sharp Tool | last post: by
5 posts views Thread by Jacobo Rodriguez Villar | last post: by
6 posts views Thread by dolphin | last post: by
8 posts views Thread by xz | last post: by
1 post views Thread by CARIGAR | last post: by
reply views Thread by zhoujie | last post: by
reply views Thread by suresh191 | last post: by
1 post views Thread by Marylou17 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.