# Comment lines can appear anywhere Macros section (will be discussed later if time permits) Rules section |
|
We will discuss macros later in this webpage
|
|
targetName : depend-on-file1 depend-on-file2 ....
<TAB> UNIX-command-1 # List of commands
<TAB> UNIX-command-2 # used to create the
... # target file
<TAB> UNIX-command-N
|
Explanation:
|
|
hello.o: hello.c # Meaning: target hello.o depends of hello.c <TAB> gcc -c hello.c # Command to keep the target up to date |
Explanation:
|
File: "hello.c" #include <stdio.h> int main( int argc, char* argv[] ) { printf( "Hello World !\n" ); } |
The file dependencies and maintenance commands were as follows:
Command: gcc -c hello.c Result: hello.c ----> hello.o Command: gcc -o hello hello.o Result: hello.o ----> hello (executable command in UNIX) |
hello: hello.o # Meaning: target hello depends of hello.o <TAB> gcc -o hello hello.o # Command to update the target hello hello.o: hello.c # Meaning: target hello.o depends of hello.c <TAB> gcc -c hello.c # Command to update the target hello.o |
Comment:
|
The Make file must be stored in the directory where you store your C program files and header files
|
The lecture notes in on the next webpage.....