from Wikipedia, the free encyclopedia
Basic data

Maintainer various
developer Stuart Feldman , various
Publishing year 1976
operating system POSIX ( Linux , Unix , ...), ported to various other platforms
programming language C.
category Build management tool
License various

make ( English for make , create ) is a build management tool that performs commands depending on conditions. It is mainly used as a programming tool in software development .

It is used, for example, to automatically control all work steps ( translation , linking , copying files, etc.) in projects that consist of many different files with source code , right through to the finished, executable program. make is designed so flexibly that it can also control any other tasks in which the time dependency of files plays a role.

The utility program makeis part of the POSIX standard, the current name of which is IEEE Std 1003.1, 2008 Edition (equivalent to Single UNIX Specification V3, SUSv3).


makereads a so-called Makefile (note the capitalization, which is differentiated in Unix file systems), in which the dependencies of the compilation process of programs are formally recorded. This formalization describes which source text files are processed in which way by the compiler or by other programs to which object files or results, or which object files are linked by the linker to form program libraries or executable programs . All steps are carried out taking into account the dependencies recorded in the Makefile .

When the Makefile is makeprocessed by the program, a source file, for example , is converted into an object file only if the source file is newer than the existing version of the result file, or if no result file is available. In the development of large software packages with many source files and many executable programs eliminated so the need for all a series of small changes compilations be repeated. The success of this economy measure depends on the correct specification of the file dependencies. All dependencies must be completely and correctly described in the Makefile - which is not easy to implement in large projects. New dependencies can arise, in particular with program changes or extensions. In order to function correctly, these dependencies must be entered in the Makefile. In the early 1980s, utility programs such as mkmfor were often makedependused to do this. Since the mid-1980s there have been methods integrated into the make programs for the automatic generation of the dependency lists (e.g. in SunPro make) or rules integrated into the makefiles for their generation.

The makecommands executed by are not limited to compilers or linkers. Any tool provided by the command line interpreter can be used to achieve the desired file manipulation. So you can z. B. automatically generate images from texts.

makehas established itself in large areas of software development, but had problems until the mid-1980s - especially with large projects - (as long as the automated generation of all dependency rules was not resolved) (see literature ) . Therefore, attempts were made again and again to find and establish a successor (see alternatives ) .


The creation of a file is referred to as a target in the Makefile. The boundary conditions for this are described in an entry.


 A: B C

This line means: Target Adepends on the sources Band C(“Depends on” usually means “will be created from”). If to be Acreated, Band Cconsidered. If either is younger than A, it will cmd_Arun to Arebuild. Is Ayounger than Band C, is Aconsidered current and cmd_Atherefore not executed.

Bor targets from further make rules can be used Cas sources of A:

 B: D E

First is Aconsidered. Because Aof Bdependent, is thus Bconsidered before for Arunning another. Overall, it describes the execution of instructions backwards. The starting point is the ultimate goal A. This consideration must end with sources that are available and for which there are no further educational regulations. These are the actual sources of all generation. If a source does not exist, but it is also found no education provision, the maker only respond with an error message: don't know how to make …. The cause of such an error can either be an error in the Makefile or the actual lack of the source.

Definition of derivation rules : In the above illustration A, Betc. can be named files with directory information. However, it is also possible to define general rules by specifying the file extension:

    $(CC) $(CFLAGS) -c -o $@ $<

In the above example there is a so-called inference rule which is written in the form of a suffix rule .

Example of a Makefile

The present example only shows the simplest form of a Makefile. There are also methods such as B. Pattern rules that make the Makefile more powerful.

A program progshould consist of the two source files foo.cand generated so that little translation and binding operations, whenever possible are required when only one of the two source files is changed.

 1 CC = cc
 2 LD = ld
 4 prog: foo.o bar.o
 5 	$(LD) -o prog foo.o bar.o
 7 foo.o: foo.c
 8 	$(CC) -c foo.c
10 bar.o: bar.c
11 	$(CC) -c bar.c

In the first two lines global variables are defined which contain the program names for the compiler and the linker. Line 4 defines a label in the Makefile, called targets ; the expressions foo.oand first bar.ocall the targets defined in lines 7 and 10 in the specified order before the command in line 5 is finally executed. In line 5 a command is composed of the global variable LDand some parameters. The two files foo.oand bar.oare available because the other two targets that generated these files have already been executed. The next line specifies that it is foo.omade from foo.c, in the eighth line by calling cc, the C compiler. The last two lines are analogous.

There is no mandatory connection between the names of the jump labels and the files processed under them. Instructions that are executed under a jump label always begin with a horizontal tab character .

The process is started on the command line with make prog. If no parameter is given, makethe target defined first (here prog) is executed. In the example above it would have makethe same effect as make prog.


The development of large programs and program packages, which consist of many individual source code files and have dependencies on separate libraries, is makehardly conceivable without or similar tools. In the world of open source it is common that the Makefile is published with the source code of a project in order to simplify the compilation of software.

Recent developments

Especially with larger programs, the Makefile is not always written directly by the developers, but either created using different programs from simpler rules or more powerful systems are used. A method for the automatic generation of complex Makefiles is the use of preprocessors like the GNU autotools ( autoconf and automake ) or also mkmf , qmake or CMake . Methods to reduce the complexity of the Makefiles are based on more powerful systems such as the nmake program by David Korn . This system enables Makefiles that simply list the source files involved in a table.

Alternatives to the make command

GNU Make is usually used in Linux, nmake is available for Windows . As the successor to UNIX make, nmake was written by AT&T ; it enables simple tabular makefiles.

is also a derivative of GNU make, but also offers an integrated, expandable command and include parser to automatically detect implicit dependencies. Changed command options etc. General conditions are recognized. The big makeproblem with recursion can be avoided elegantly in order to guarantee correct structures. In addition, Perl can be integrated at all levels.
(under plan 9 ) is also developed from make , but in the direction of simplification.
Python -implemented, cross-platform system with many improvements over make. Also integrates some features of automake/ autoconf. Its strength comes from the fact that the Makefiles called "SConstruct" can use the entire functionality of the Python programming language.
Apache Ant and Apache Maven
XML -based systems with the same purpose, which can be extended with the help of Java .
is an SCM tool with an integrated build tool.
a build tool from the Boost library, the extension of the C ++ standard library of the C ++ programming language.
A tool implemented in Ruby with rakefiles written in Ruby .
A program written in Python to automate the creation of computer programs, comparable to make or Ant. In addition to the classic automation of the creation process, it also enables the location, download, installation and modification of computer programs as well as troubleshooting. AAP has an integrated connection to CVS .


Web links

Wiktionary: make  - explanations of meanings, word origins, synonyms, translations

Individual evidence

  1. Interview with Stu Feldman, 9-20-89, accessed November 22, 2019.
  2. a b c d GNU Make. Retrieved October 3, 2018 .
  3. ^ GNU Make: What a Rule Looks Like. Retrieved October 3, 2018 .
  4. a b c GNU Make: A Simple Makefile. Retrieved October 3, 2018 .
  5. ^ GNU Make: Old-Fashioned Suffix Rules. Retrieved October 3, 2018 .
  6. ^ An Introduction to the Autotools. Retrieved October 3, 2018 .
  7. qmake manual. Retrieved October 3, 2018 .
  8. About CMake. Retrieved October 3, 2018 .
  9. MS C / C ++: The nmake Command. Retrieved October 3, 2018 .
  10. Makepp home page. Retrieved October 3, 2018 .
  11. Apache Ant About. Retrieved October 3, 2018 .
  12. Welcome to Apache Maven. Retrieved October 3, 2018 .
  13. RAKE - Ruby Make. Retrieved October 3, 2018 .
  14. PyPI: Aap. Retrieved October 3, 2018 .