A Makefile is a text file that is referenced by the make command and controls how the make command compiles and links a program. The Makefile consists of rules for when to carry out an action and contains information such as source-level and build-order dependencies. To determine the sequence of the compilation commands, the Makefile checks the timestamps of dependent files. The following example shows how to write Makefiles.