LinuxQuestions.org
Visit the LQ Articles and Editorials section
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices



Reply
 
Search this Thread
Old 06-01-2011, 07:36 AM   #1
ganabot
LQ Newbie
 
Registered: Jun 2011
Posts: 2

Rep: Reputation: Disabled
Smile compile using Makefile


hi
I am new to Linux. learn t basic command and how to compile single file in Linux environment using gcc. Now i dont know how to use make file to compile multiple file. please can any body help me........
 
Old 06-01-2011, 10:04 AM   #2
MTK358
LQ 5k Club
 
Registered: Sep 2009
Posts: 6,443
Blog Entries: 3

Rep: Reputation: 714Reputation: 714Reputation: 714Reputation: 714Reputation: 714Reputation: 714Reputation: 714
http://www.google.com/search?q=makef...UTF-8&oe=UTF-8

You might also want to check out something like CMake.
 
1 members found this post helpful.
Old 06-01-2011, 11:12 AM   #3
theNbomr
LQ 5k Club
 
Registered: Aug 2005
Distribution: OpenSuse, Fedora, Redhat, Debian
Posts: 5,396
Blog Entries: 2

Rep: Reputation: 903Reputation: 903Reputation: 903Reputation: 903Reputation: 903Reputation: 903Reputation: 903Reputation: 903
To compile a single file using make almost never even requires a Makefile. make has built-in knowledge of how to create object code from source code for most common compilers. If you have a C source file that can be compiled to an executable binary, you can most often use simply
Code:
make helloWorld
In the above example, make would look in the current working directory for a source code file that it knows how to compile and link to an executable. Since you refer to using gcc, if you had the C source file helloWorld.c in the current working directory, make would try to compile and link it using its built-in rules. Assuming your source file was compilable, it would result in a runnable binary, 'helloWorld'.
--- rod.
 
1 members found this post helpful.
Old 06-03-2011, 08:39 AM   #4
ganabot
LQ Newbie
 
Registered: Jun 2011
Posts: 2

Original Poster
Rep: Reputation: Disabled
could u please focus more light on Makefile use by giving an example how to use the makefile how to give the reference of all the files in a project
 
Old 06-03-2011, 09:01 AM   #6
TheIndependentAquarius
Senior Member
 
Registered: Dec 2008
Posts: 4,633
Blog Entries: 29

Rep: Reputation: 897Reputation: 897Reputation: 897Reputation: 897Reputation: 897Reputation: 897Reputation: 897
Quote:
Originally Posted by ganabot View Post
could u please focus more light on Makefile use by giving an example how to use the makefile how to give the reference of all the files in a project
Check out the 9th link in Knud's post above. That has the easiest explanations of them all.

Last edited by TheIndependentAquarius; 06-03-2011 at 09:20 AM. Reason: sick typo in Knud's name
 
  


Reply

Tags
makefile


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Makefile to compile in C++ in 64-bit memory/mode wweiy Programming 2 10-23-2007 01:17 AM
compile multiple modules in Makefile sharathkv25 Programming 1 04-11-2007 04:28 PM
configure Makefile to compile for multiple platforms StargateSteve Programming 0 03-26-2007 12:54 PM
makefile to compile kernel? RIgimp75 Slackware 7 07-19-2006 02:42 AM
How to compile the program with the makefile? Nishant Desai Programming 2 07-19-2006 01:07 AM


All times are GMT -5. The time now is 08:11 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration