%s\r\n\n", s); } tellMe.c : void tellMe(char s[]) tellMe.h : Header file.h : specification Source file.c : implementation Makefile : hello : hello.o tellMe.o gcc -o hello hello.o tellMe.o hello.o : hello.c gcc -c hello.c tellMe.o : tellMe.c gcc -c tellMe.c hello hello.otellMe.o hello.ctellMe.c Dependency graph"> %s\r\n\n", s); } tellMe.c : void tellMe(char s[]) tellMe.h : Header file.h : specification Source file.c : implementation Makefile : hello : hello.o tellMe.o gcc -o hello hello.o tellMe.o hello.o : hello.c gcc -c hello.c tellMe.o : tellMe.c gcc -c tellMe.c hello hello.otellMe.o hello.ctellMe.c Dependency graph">

Presentation is loading. Please wait.

Presentation is loading. Please wait.

0 make (1/3) : Short Description + Example + Syntax Short Description The purpose of the make utility is to determine automatically which pieces of a large.

Similar presentations


Presentation on theme: "0 make (1/3) : Short Description + Example + Syntax Short Description The purpose of the make utility is to determine automatically which pieces of a large."— Presentation transcript:

1 0 make (1/3) : Short Description + Example + Syntax Short Description The purpose of the make utility is to determine automatically which pieces of a large program need to be recompiled, and issue the commands to recompile them. Example of a Makefile (1) progr : main.o sec.o (2) gcc -o progr main.o sec.o (3) main.o : main.c (4) gcc -c main.c (5) sec.o : sec.c (6) gcc -c sec.c Syntax of a Makefile Rule : [ ] # Dependency line # Show how to build the target out of their prerequisites [ ] Common Usage % make progr main.osec.o main.csec.c © Béat Hirsbrunner, University of Fribourg, Switzerland, March 2003

2 1 make (2/3) : Execution Model Dependency checking Remark 1. 'make' echoes each command to the standard output before executing it. Remark 2. If is absent the associated command lines are executed. if (main.o don't exist) then else if ( t main.o // main.o is out-of-date else 1 3 progr main.osec.o 12 3 if (progr don't exist) then else if ((t progr // progr is out-of-date else Execution Tree 2 Similar to 1 (1) progr : main.o sec.o (2) gcc -o progr main.o sec.o (3) main.o : main.c (4) gcc -c main.c (5) sec.o : sec.c (6) gcc -c sec.c

3 2 make (3/3) : Header Files – Hello World revisited hello.c tellMe.c Dependency graph tellMe.h #include "tellMe.h" /* for tellMe() */ main() { tellMe("Hello World"); } hello.c : #include /* for printf() */ #include "tellMe.h" /* for tellMe() */ void tellMe(char s[]) { printf("\n tellMe> %s\r\n\n", s); } tellMe.c : void tellMe(char s[]) tellMe.h : Header file.h : specification Source file.c : implementation Makefile : hello : hello.o tellMe.o gcc -o hello hello.o tellMe.o hello.o : hello.c gcc -c hello.c tellMe.o : tellMe.c gcc -c tellMe.c hello hello.otellMe.o hello.ctellMe.c Dependency graph


Download ppt "0 make (1/3) : Short Description + Example + Syntax Short Description The purpose of the make utility is to determine automatically which pieces of a large."

Similar presentations


Ads by Google