Copyright © tutorialspoint.com

Unix Makefile

Makefile   

A file that instructs the program make how to compile and link a program.

The default name of the makefile is literally Makefile, but the name can be specified with a command-line option. 

The make program aids you in developing your large programs by keeping track of which portions of the entire program have been changed, compiling only those parts of the program which have changed since the last compile.

previous next


Advertisements


About Compilation Stages

Compiling a small C program requires at least a single .c file, with .h files as appropriate. Although the command to perform this task is simply cc file.c, there are 3 steps to obtain the final executable program, as shown:

  1. Compiler Stage: All C language code in the .c file is converted into a lower-level language called Assembly language; making .s files.

  2. Assembler Stage: The assembly language code made by the previous stage is then converted into object code which are fragments of code which the computer understands directly. An object code file ends with .o.

  3. Linker Stage: The final stage in compiling a program involves linking the object code to code libraries which contain certain "built-in" functions, such as printf. This stage produces an executable program, which is named a.out by default.


previous next

Copyright © tutorialspoint.com