473,804 Members | 3,043 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 14018
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
1319
by: John Abel | last post by:
Hi, I've a small script, which listens to a port on a remote machine. I'm trying to implement makefile. However, the code on Win32 Py 2.2.2 def _Connect( self ): sockConn = socket.socket( socket.AF_INET, socket.SOCK_STREAM ) try: sockConn.connect( ( self.remoteMachine, self.remotePort ) ) except socket.error, ErrorMsg:
3
4086
by: tmponko | last post by:
OK...I'm new to this and I'm sure I'm missing something obvious, so please be kind. I've tried several different approaches to this problem (including various if, ifeq, and case constructs), and I'm about to give up. Can any tell me why this doesn't work? In a nutshell, I want a Makefile that will "include" either a Linux.mk or a SunOS.mk without having to rely on an explicit command line parameter or env var. Here is the segment that...
2
1744
by: xuatla | last post by:
Is it off-topic here or not? If not, please help me. Thanks in advance. X -------------------- I have main.cpp, tfunclib.cpp in the current folder (same as makefile), and "library files" vmclass.cpp, tclass.cpp, newtonsolver.cpp in another folder (mentioned below as OBJDIR). i compile those "library files" and it's ok.
4
2906
by: Sharp Tool | last post by:
Hi I have downloaded a program that is written in C++ that I would like to compile into a Win XP executable. The program contains a Makefile written for Unix/linux/cygwin. I would like to modify it, if neccessary, so that I can compile it using MS Visual C++ 6.0. Here is the code for the Makefile: //START
5
11577
by: Jacobo Rodriguez Villar | last post by:
Hello, Is there any way (or program) to convert and maintain easily a C++ project (vs7.1) to a Makefile file, in order to build it in Linux? Many thanks -- Jacobo Rodrguez Villar TyphoonLabs Lead Programmer
6
1903
by: dolphin | last post by:
Hi! I am learing makefile recently.Now I have a problem. I write a very simple program just like "hello world" I write two makefile for it.One is included in another. the first is makefile include mainmake.mk example:main.o cc -o example main.o clean: rm -f *.o
8
3197
by: xz | last post by:
I am a rookie of C++ and got so confused with the Makefile these days. Could anyone be so kind and give a little sample Makefile for the following particular example? Let's say I have the following files describing 4 classes (A, B, C1, C2) and a test program (test.cpp) which runs a test for classes C1 and C2. A.h A.cpp
1
5046
by: rpjanaka | last post by:
I am using an open source library called IGI_UDP for measure the available bandwidth of a link (http://www.cs.cmu.edu/%7Ehnn/igi/ ). with that library they have provided a "Makefile" which is not an auto generated one. the following is the given Makefile, ***************************************************************** CC = gcc INCS = -I. CFLAGS = -g -Wall $(DEFS) $(INCS)
16
14491
by: tvnaidu | last post by:
Looking for simple Makefile to make shared lib (.so) in Linux (I have two C files file1.c and file2.c, also two static libs slib1.a and slib2.a), can I get Makefile to compile all of them to crate final.so shared lib?. I wrote this to compile using GNU compiler in Linux, this is not working, thanks in advance. CC = gcc AR = ar rc CFLAGS = -Wall -g -O2 -I. -Iinclude -I../common/include -fPIC OBJECTS = file1.o file2.o SHARED_LIB =...
0
9706
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, well explore What is ONU, What Is Router, ONU & Routers main usage, and What is the difference between ONU and Router. Lets take a closer look ! Part I. Meaning of...
0
9579
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10571
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10317
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10075
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7615
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupr who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6851
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5651
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4295
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.