Make

The title of this article is incorrect because of technical limitations. The correct title is make.

make is a computer program that automates the compilation of programs whose files are dependent on each other. A program typically consists of several files, and a programmer usually only works on a few of them at a time. Make will only recompile the files that need to be updated (files that have been modified since the last compile, or that depend on modified files), which is much faster than simply recompiling the whole program each time.

Make was originally created by Dr. Stuart I. Feldman in 1977. Dr. Feldman was working at Bell Labs at the time. Since it is old, many derived tools have appeared that work better. Among these are BSD make, GNU make and A-A-P. In 2003 Dr. Feldman received (http://campus.acm.org/public/membernet/storypage.May.2004.cfm?story=4&CFID=23207696&CFTOKEN=28895744) the ACM Software System Award (http://www.acm.org/awards/ssaward.html) for the invention of this important tool.

Other installation and configuration methods are used for programs without dependencies.

Although this is its most typical use, make is also used in other programs as a way of defining what to do when something has changed, and thus triggering appropriate responses within the program.

Makefile utilities are frequently used to handle the compilation and/or installation of large pieces of software. Make reads the makefile at current working directory by default, which is a common practice among computer programmers. If no makefile is explicitly named in the make command, make will first look for the default file named "makefile" and then "makefile" in the current directory. These can be hidden files.

It can be used to compile only certain subsets of an item or suite of software, and can account for dependencies between various parts of the software.

Its input is a list of specifications (usually known as a makefile) describing dependency relationships between the generation of files and programs.

The file commonly is maintained in the base directory of a project during the development process. This file lists all of the files in the project and describes the action that needed to be taken on that file to create it or bring it up to date. The makefile is used by the command 'make'. The 'make' program has some intelligence built in and will not attempt to re-make files that are not out of date. For example it will typically not recompile source that has not changed since its last compile (determined by comparison of dates of files).

A makefile consists of commands like this:

 foo.o: foo.c foo.h bar.h
        gcc -o foo.o foo.c

 logobig.ppm: logo.pov
       $(POVRAY) logo.pov -k0 -o logobig.ppm

The first command means that if foo.c, foo.h, or bar.h is newer than foo.o, then foo.o should be remade by running gcc. foo.o is said to depend on foo.c, foo.h, and bar.h. The second says that logobig.ppm depends on logo.pov and can be made by running POV-Ray.

Most makefiles are used to compile programs, but they can be used in any situation where files are made from one another by programs that can be called from the command line.

Contents

A sample makefile

 # Specify compiler
 CC      ?= gcc

 # Specify compiler options
 CFLAGS  ?= -g 
 LDFLAGS ?= -L/usr/openwin/lib
 LDLIBS  ?= -lX11 -lXext

 # Needed to recognize .c as a file suffix
 .SUFFIXES: $(SUFFIXES) .

 # Executable name
 PROG  = life 

 # List of object file needed for the final program
 OBJS  = main.o window.o Board.o Life.o BoundedBoard.o
 
 all: $(PROG)

 # Program compilation and linking steps
 $(PROG): $(OBJS)
      $(CC) $(CFLAGS) $(LDFLAGS) $(LDLIBS) -o $(PROG) $(OBJS)

 .c.o:
      $(CC) $(CFLAGS) -c $*.c

Obtaining make

FSF GNU/Linux: GNU make (http://www.gnu.org/software/make/) + manual (http://www.gnu.org/software/make/manual/html_chapter/make_toc.html).

Cygwin users should consult their administrator for more information. Individual users without an administrator should consult the Cygwin package search on the cygwin website at www.cygwin.com.

Limitations

make has limitations that may make it unsuitable for some projects. Reasons include:

  • make doesn't scale up to projects well, often encouraging use of recursive makefiles: Recursive make considered harmful (http://www.pcug.org.au/~millerp/rmch/recu-make-cons-harm.html).
  • make's support for target configuration is extremely poor and implemented via global variables. This means that only one configuration exists and there can be no per-target configuration. It also means that targets cannot configure their subtargets, requiring a "fork" of an entire target tree whenever a target at the bottom of the tree needs to be configured in a different way.
  • make's lack of support for configuration-dependency management. When configuration changes, make does not know it needs to rebuild things.
  • make's lack of cache for builds: When changing configurations back and forth, make will rebuild again and again. This can be addressed by installing CCache (http://ccache.samba.org) but that only addresses very specific target-assembly types and is slower.
  • make's lack of command-line abstraction: Configuration is given as specific command line options. Rules are written as specific-tool invocations. This makes makefiles platform-dependent and even specific-tool dependent.
  • When using program generators, one has problems to include the dynamically generated files in make's runtime knowledgebase and bring them in releation to previously existing files.
  • Debugging large makefiles is softly speaking not very efficient.

Nevertheless, despite these limitations and all the alternatives that have been developed, make remains the de facto standard build tool. It is used in the vast majority of free software projects, large and small alike. Make's long-lasting survival can in part be attributed to its extreme portability, that it is one format that can be used for very different types of software projects and the GNU Build Tools which allievates the pain sometimes felt by using make.

Other make-like tools

One can find a very comprehensive list of make replacements (http://www.a-a-p.org/tools_build.html) on the A-A-P Site (http://www.a-a-p.org/).

  • cmake is a portable makefile utility. It requires the Cmake lists file to be present and does not seem at present to support the diving makefile concept.
  • makepp is compatible to (GNU) make, but additionally has an integrated command- and include-parser for determining implicit dependencies automatically. Changed command options and similar influences are recognized. The big make problem of recursion can be elegantly bypassed, so as to guarantee correct builds. Moreover Perl is available at all levels. http://makepp.sf.net
  • SCons: Improved, cross-platform build system which is implemented using Python, which integrates some features of Automake/Autoconf. Its strength is that the 'makefiles' (which are generically called "SConscript" files; the top-level one is named "SConstruct") can use all the features of the Python programming language. Based on Cons. See http://www.scons.org/.
  • Cons - http://www.dsmit.com/cons/
  • Cook (http://www.canb.auug.org.au/~millerp/cook/cook.html) is a make replacement by Peter Miller (http://www.canb.auug.org.au/~millerp/README.html), with many improvements, including support for variables, user-defined functions, and parallellization and distributions of task building.
  • Apache Ant
  • CruiseControl
  • PyBuild - The Pythonic build system
  • Perforce Jam - An enhancement of make, using Jamfiles instead of makefiles.
  • iCompile
  • Rant: A flexible build tool implemented in Ruby. See http://make.ruby-co.de/.
  • Module::Build (http://search.cpan.org/dist/Module-Build/) and ExtUtils::MakeMaker (http://search.cpan.org/dist/ExtUtils-MakeMaker/). Build and install Perl modules. Module::Build is a replacement for ExtUtils::MakeMaker and does not depend on make.
  • A-A-P - http://www.a-a-p.org - executes recipies
  • emake - a commercial GNU Make replacement that automatically breaks makes up for parallel building on a cluster of machines - http://www.electric-cloud.com/
  • mk - developed originally for Plan 9, improved upon make by removing all the vowels from the name, and introducing a completely new syntax that is both easier to read and more powerful. It has been ported to Unix as part of plan9port. [1] (http://plan9.bell-labs.com/sys/doc/mk.html) [2] (http://cm.bell-labs.com/magic/man2html/1/mk)

Most Integrated Development Environments also automate the compilation of large software projects. Dependencies are automatically computed from the programs' source code, freeing the user from the task of specifying dependencies. However, these tools are generally specific to a particular programming language.

References

eo:Make fr:Make ja:Make pl:Make pt:Make

Navigation

  • Art and Cultures
    • Art (https://academickids.com/encyclopedia/index.php/Art)
    • Architecture (https://academickids.com/encyclopedia/index.php/Architecture)
    • Cultures (https://www.academickids.com/encyclopedia/index.php/Cultures)
    • Music (https://www.academickids.com/encyclopedia/index.php/Music)
    • Musical Instruments (http://academickids.com/encyclopedia/index.php/List_of_musical_instruments)
  • Biographies (http://www.academickids.com/encyclopedia/index.php/Biographies)
  • Clipart (http://www.academickids.com/encyclopedia/index.php/Clipart)
  • Geography (http://www.academickids.com/encyclopedia/index.php/Geography)
    • Countries of the World (http://www.academickids.com/encyclopedia/index.php/Countries)
    • Maps (http://www.academickids.com/encyclopedia/index.php/Maps)
    • Flags (http://www.academickids.com/encyclopedia/index.php/Flags)
    • Continents (http://www.academickids.com/encyclopedia/index.php/Continents)
  • History (http://www.academickids.com/encyclopedia/index.php/History)
    • Ancient Civilizations (http://www.academickids.com/encyclopedia/index.php/Ancient_Civilizations)
    • Industrial Revolution (http://www.academickids.com/encyclopedia/index.php/Industrial_Revolution)
    • Middle Ages (http://www.academickids.com/encyclopedia/index.php/Middle_Ages)
    • Prehistory (http://www.academickids.com/encyclopedia/index.php/Prehistory)
    • Renaissance (http://www.academickids.com/encyclopedia/index.php/Renaissance)
    • Timelines (http://www.academickids.com/encyclopedia/index.php/Timelines)
    • United States (http://www.academickids.com/encyclopedia/index.php/United_States)
    • Wars (http://www.academickids.com/encyclopedia/index.php/Wars)
    • World History (http://www.academickids.com/encyclopedia/index.php/History_of_the_world)
  • Human Body (http://www.academickids.com/encyclopedia/index.php/Human_Body)
  • Mathematics (http://www.academickids.com/encyclopedia/index.php/Mathematics)
  • Reference (http://www.academickids.com/encyclopedia/index.php/Reference)
  • Science (http://www.academickids.com/encyclopedia/index.php/Science)
    • Animals (http://www.academickids.com/encyclopedia/index.php/Animals)
    • Aviation (http://www.academickids.com/encyclopedia/index.php/Aviation)
    • Dinosaurs (http://www.academickids.com/encyclopedia/index.php/Dinosaurs)
    • Earth (http://www.academickids.com/encyclopedia/index.php/Earth)
    • Inventions (http://www.academickids.com/encyclopedia/index.php/Inventions)
    • Physical Science (http://www.academickids.com/encyclopedia/index.php/Physical_Science)
    • Plants (http://www.academickids.com/encyclopedia/index.php/Plants)
    • Scientists (http://www.academickids.com/encyclopedia/index.php/Scientists)
  • Social Studies (http://www.academickids.com/encyclopedia/index.php/Social_Studies)
    • Anthropology (http://www.academickids.com/encyclopedia/index.php/Anthropology)
    • Economics (http://www.academickids.com/encyclopedia/index.php/Economics)
    • Government (http://www.academickids.com/encyclopedia/index.php/Government)
    • Religion (http://www.academickids.com/encyclopedia/index.php/Religion)
    • Holidays (http://www.academickids.com/encyclopedia/index.php/Holidays)
  • Space and Astronomy
    • Solar System (http://www.academickids.com/encyclopedia/index.php/Solar_System)
    • Planets (http://www.academickids.com/encyclopedia/index.php/Planets)
  • Sports (http://www.academickids.com/encyclopedia/index.php/Sports)
  • Timelines (http://www.academickids.com/encyclopedia/index.php/Timelines)
  • Weather (http://www.academickids.com/encyclopedia/index.php/Weather)
  • US States (http://www.academickids.com/encyclopedia/index.php/US_States)

Information

  • Home Page (http://academickids.com/encyclopedia/index.php)
  • Contact Us (http://www.academickids.com/encyclopedia/index.php/Contactus)

  • Clip Art (http://classroomclipart.com)
Toolbox
Personal tools