LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
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 11-02-2003, 01:45 PM   #1
linorg
Member
 
Registered: Nov 2003
Location: delhi
Distribution: redhat 8.0 ,fedora
Posts: 32

Rep: Reputation: 15
what is a make file


hi
can sombody plz tell what a make file is and how is it created


thanxs
linorg
 
Old 11-02-2003, 01:53 PM   #2
Tinkster
Moderator
 
Registered: Apr 2002
Location: earth
Distribution: slackware by choice, others too :} ... android.
Posts: 23,067
Blog Entries: 11

Rep: Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928
A makefile is a file that contains instructions
for tools to do repetitive tasks on files, when
involved repeatedly it will only touch files
that have a newer date than their related
resulting file. I.e. gcc test.c -o test in a makefile
will only execute gcc if you modified the
source after you last compiled it.

You create them using your favourite editor.


Cheers,
Tink
 
Old 11-02-2003, 02:02 PM   #3
exodist
Senior Member
 
Registered: Aug 2003
Location: Portland, Oregon
Distribution: Arch
Posts: 1,374

Rep: Reputation: 47
it is used to compile a program from source, it is made by the developers for everyones benefit.
 
Old 11-02-2003, 02:09 PM   #4
linorg
Member
 
Registered: Nov 2003
Location: delhi
Distribution: redhat 8.0 ,fedora
Posts: 32

Original Poster
Rep: Reputation: 15
so is it somewhat similar to batch file in dos
how do i execute a makefile
what extension does it have
 
Old 11-02-2003, 02:13 PM   #5
exodist
Senior Member
 
Registered: Aug 2003
Location: Portland, Oregon
Distribution: Arch
Posts: 1,374

Rep: Reputation: 47
rofl, the equivilent of a batch from dos is a shell script, makefile is differnet, but at basic level I cannot say you are wrong...

you do not execute a makefile, it is called from another executable.

first off see if there is a file called "configure" in the directory with the makefile, if so type:
./configure

when that is finished or if there is not one type this:
make
that will call the makefile and compile the software.
then to install type:
make install
that calls the makefile section for installing the program.
 
Old 11-02-2003, 02:15 PM   #6
Tinkster
Moderator
 
Registered: Apr 2002
Location: earth
Distribution: slackware by choice, others too :} ... android.
Posts: 23,067
Blog Entries: 11

Rep: Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928
And no, it's not like a batch. It's way
smarter :} and serves a completely
different purpose. It's primarily targeted
at programmers, to cut down on compile
times by only recompiling things that
have been modified.

You call it Makefile (no extension)
and you invoke it by typing make<ENTER>

Cheers,
Tink
 
Old 11-03-2003, 03:50 PM   #7
linorg
Member
 
Registered: Nov 2003
Location: delhi
Distribution: redhat 8.0 ,fedora
Posts: 32

Original Poster
Rep: Reputation: 15
does this means a single directory can have only one makefile..
to create a makefile i should just put the commands to be executed in a file called makefile
and just call make from the promt in the same directory...

consider the following makefile for compiling the kernel module i'm learnimg to write
(taken from a tutorial frm tldp.org)

Makefile for a basic kernel module

TARGET := hello-1
WARN := -W -Wall -Wstrict-prototypes -Wmissing-prototypes
INCLUDE := -isystem /lib/modules/`uname -r`/build/include
CFLAGS := -O2 -DMODULE -D__KERNEL__ ${WARN} ${INCLUDE}
CC := gcc-3.0

${TARGET}.o: ${TARGET}.c

.PHONY: clean

clean:
rm -rf {TARGET}.o

are all the labels used here (target,clean ...) preefined.
 
Old 11-03-2003, 09:40 PM   #8
Tinkster
Moderator
 
Registered: Apr 2002
Location: earth
Distribution: slackware by choice, others too :} ... android.
Posts: 23,067
Blog Entries: 11

Rep: Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928
Quote:
Originally posted by linorg
does this means a single directory can have only one makefile..
No, just the invocation gets more complex :)

if you called your makefile
my_makefile.txt
you'd invoke it with
make -f my_makefile.txt

Quote:
from man make
Code:
       make  executes  commands  in the makefile to update one or
       more target names, where name is typically a program.   If
       no  -f option is present, make will look for the makefiles
       GNUmakefile, makefile, and Makefile, in that order.

Cheers,
Tink
 
  


Reply



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
how to make nonblocking FILE *fp? Thinking Programming 1 09-14-2005 05:07 AM
when creating a *.iso file, how to make the file size smaller? minm Linux - Newbie 8 12-26-2004 09:58 PM
Make file help rajesh_b Programming 1 11-25-2004 04:39 AM
I accidentally deleted make file in /usr/local/bin, now cannot use make command.... Niceman2005 Linux - Software 2 11-17-2004 07:55 PM
why can't i do 'make' on this file!? ambelos Linux - Software 6 02-04-2004 10:19 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 10:32 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
Open Source Consulting | Domain Registration