BMET Wiki
Advertisement

About[]

In software development, make is a utility for automatically building executable programs and libraries from source code. Files called makefiles specify how to derive the target program from each of its dependencies. Make can decide where to start through topological sorting. Though Integrated Development Environments and language-specific compiler features can also be used to manage the build process in modern systems, make remains widely used, especially in Unix-based platforms.

Example makefile[]

Below is a very simple makefile that would compile a source called "helloworld.c" using cc, a C compiler. The PHONY tag is a technicality that tells make that a particular target name does not produce an actual file. The $@ and $< are two of the so-called internal macros and stand for the target name and "implicit" source, respectively. There are a number of other internal macros.[1][2]

helloworld: helloworld.o
	cc -o $@ $<
 
helloworld.o: helloworld.c
	cc -c -o $@ $<
 
.PHONY: clean
 
clean:
	rm -f helloworld helloworld.o
 

Reference[]

  1. Cite error: Invalid <ref> tag; no text was provided for refs named whitespace
  2. http://www.opengroup.org/onlinepubs/009695399/utilities/make.html#tag_04_84_13_07

Link[]

Advertisement