Make gets its knowledge of how to build your program from a file called the makefile, which lists each of the non-source files and how to compute it from other files. When you write a program, you should write a makefile for it, so that it is possible to use Make to build and install the program.
As a result, if you change a few source files and then run Make, it does not need to recompile all of your program. It updates only those non-source files that depend directly or indirectly on the source files that you changed.
ar to update a library, or TeX or Makeinfo to format
documentation.
Here is what a simple rule looks like:
target: dependencies ...
commands
...
When you run Make, you can specify particular targets to update; otherwise, Make updates the first target listed in the makefile. Of course, any other target files needed as input for generating these targets must be updated first.
Make uses the makefile to figure out which target files ought to be brought up to date, and then determines which of them actually need to be updated. If a target file is newer than all of its dependencies, then it is already up to date, and it does not need to be regenerated. The other target files do need to be updated, but in the right order: each target file must be regenerated before it is used in regenerating other targets.
GNU Make also has a few simple features that are very convenient. For
example, the -o file option which says ``pretend that
source file file has not changed, even though it has changed.''
This is extremely useful when you add a new macro to a header file.
Most versions of Make will assume they must therefore recompile all the
source files that use the header file; but GNU Make gives you a way to
avoid the recompilation, in the case where you know your change to the
header file does not require it.
However, the most important difference between GNU Make and most versions of Make is that GNU Make is free software.
Alternatively you can browse the online documentation available at www.gnu.org/software/make/manual/make.html
The GNU Make project page on Savannah contains information on the mailing lists, CVS access etc.
You can download GNU Make from the GNU FTP site ftp.gnu.org or one of its mirrors. You can also obtain it by buying the GNU Source Code CD-ROM from the Free Software Foundation; this too helps fund free software development.
You can report problems with GNU Make either through Savannah, or to the bug-make@gnu.org mailing list. You can ask for help writing makefiles or using GNU Make on the help-make@gnu.org mailing list.
GNU Make has been ported to a great many systems. One that poses unique challenges is Microsoft DOS and Windows platforms; because of that there is a GNU Make mailing list dedicated specifically to users of those platforms: make-w32@gnu.org.
All of the above mailing lists are open for posting by non-subscribers. However if you would like to subscribe, or view the archives of the mailing lists, visit the GNU Make mailing lists page on Savannah.
GNU Make was written by Richard Stallman and Roland McGrath. It has been maintained and updated by Paul Smith since version 3.76 (1997).
These conventions are found in the chapter ``Makefile conventions'' (147 k characters) of the GNU Coding Standards (147 k characters).
Please send FSF & GNU inquiries & questions to gnu@gnu.org. There are also other ways to contact the FSF.
Please send comments on these web pages to webmasters@www.gnu.org, send other questions to gnu@gnu.org.
Copyright (C) 1997, 1998, 1999, 2000 Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA
Verbatim copying and distribution of this entire article is permitted in any medium, provided this notice is preserved.
Updated: $Date: 2004/10/18 21:00:09 $ $Author: araujo $