Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

makefile

Posted on 2004-08-26
3
Medium Priority
?
414 Views
Last Modified: 2010-04-15
This is a sample makefile. Pls explain

myprog: prog.o func.o
       cc prog.o func.o -o myprog
prog.o: prog.c head.h
       cc -c prog.c
func.o: func.c
       cc -c func.c
clean:
      rm *.o core  
print:
      lpr -Papm2337 *.c *.h
backup:
      cp *.c *.h Makefile backupdir
0
Comment
Question by:manojantony
3 Comments
 
LVL 4

Accepted Solution

by:
pankajtiwary earned 90 total points
ID: 11910116
myprog: prog.o func.o
>> The target myprog(executable, your ultimate target) needs prog.o and func.o as input files.
      cc prog.o func.o -o myprog
>> And above is the command to make myprog from the prog.o an func.o input files.
prog.o: prog.c head.h
>> similarly to produce prog.o you need prog.c and head.h as input files
      cc -c prog.c
>> similarly the command to make prog.o from the input files is above
func.o: func.c
>> To produce func.o you just need func.c and nothing else
      cc -c func.c
>> Above is the command to produce func.o from func.c
clean:
     rm *.o core
>> When you say "ake clean" the above command will be executed which will remove the intermediate files i.e. object files
print:
     lpr -Papm2337 *.c *.h
>> When you say "make print", the above command will be executed and the *.c and *.h files will be sent to the printer device.
backup:
     cp *.c *.h Makefile backupdir
>> When you say make backup, it will execute the above command.

To understand, just remember a make file needs to know which are the targets to make and the rule how to make that target. Each of the section above shows this and nothing else.
0
 
LVL 1

Author Comment

by:manojantony
ID: 11910245
thanx buddy.
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This is a short and sweet, but (hopefully) to the point article. There seems to be some fundamental misunderstanding about the function prototype for the "main" function in C and C++, more specifically what type this function should return. I see so…
Examines three attack vectors, specifically, the different types of malware used in malicious attacks, web application attacks, and finally, network based attacks.  Concludes by examining the means of securing and protecting critical systems and inf…
The goal of this video is to provide viewers with basic examples to understand and use pointers in the C programming language.
The goal of this video is to provide viewers with basic examples to understand recursion in the C programming language.
Suggested Courses

971 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question