make: Introduction

1 
1 2 An Introduction to Makefiles
1 ******************************
1 
1 You need a file called a "makefile" to tell 'make' what to do.  Most
1 often, the makefile tells 'make' how to compile and link a program.
1 
1    In this chapter, we will discuss a simple makefile that describes how
1 to compile and link a text editor which consists of eight C source files
1 and three header files.  The makefile can also tell 'make' how to run
1 miscellaneous commands when explicitly asked (for example, to remove
1 certain files as a clean-up operation).  To see a more complex example
1 of a makefile, see ⇒Complex Makefile.
1 
1    When 'make' recompiles the editor, each changed C source file must be
1 recompiled.  If a header file has changed, each C source file that
1 includes the header file must be recompiled to be safe.  Each
1 compilation produces an object file corresponding to the source file.
1 Finally, if any source file has been recompiled, all the object files,
1 whether newly made or saved from previous compilations, must be linked
1 together to produce the new executable editor.
1 

Menu