Make programming is fairly straightforward. Basically, we write a sequence of commands which describes how our program (or system of programs) can be constructed from source files.
The construction sequence is described in makefiles which contain dependency rules and construction rules.
A dependency rule has two parts - a left and right side separated by a :
left side : right side
The left side gives the names of a target(s) (the names of the program or system files) to be built, whilst the right side gives names of files on which the target depends (eg. source files, header files, data files)
If the target is out of date with respect to the constituent parts, construction rules following the dependency rules are obeyed.
So for a typical C program, when a make file is run the following tasks are performed:
NOTE: Make files can obey any commands we type from command line. Therefore we can use makefiles to do more than just compile a system source module. For example, we could make backups of files, run programs if data files have been changed or clean up directories.