A Collection of Code Snippets in as Many Programming Languages as Possible
This project is maintained by TheRenegadeCoder
 
  
  Welcome to the Gnu Make page! Here, you'll find a description of the language as well as a list of sample programs in that language.
This article was written by:
According to Wikipedia, make is an automated tool for building software.
It was created in 1976 by Stuart Freedman for Unix systems, and it is
still used today on Unix and Unix-like systems (such as Linux and
MacOS). For such systems, GNU make is the most prevelant.
In general, make gets it instructions on what to build based on a Makefile. The syntax for a Makefile is like this:
target1 [target2 ...]: dependency1 [dependency2 ...]
    command1
    command2
    ...
The "target" is what is being built, "dependencies" are what the target
depends upon, and "commands" are what is executed when the target is built.
It should be noted make is a whitespace-sensitive language. Before each
command, is a tab character. It you try to use spaces, you'll get this error:
*** missing separator.  Stop.
The way make works is that a target will be built if it does not exist
or it is older that its dependencies.
Here's an example of file called Makefile (which is the default filename
that make looks for):
hello: hello.c
    cc hello.c -o hello
It build a single C program called hello.c into a executable called hello.
The command perform this build is this:
make hello
If hello does not exist, or if hello.c was modified after hello was
built, the cc command is executed the builds the code. If the make command
is run again, it will indicate 'hello' is up to date.
In addition to being a build system, GNU make also has a number of other useful features:
Although GNU make is not really intended as a programming language, these features allow it to behave as if it were. It can even similate control flow with certain built-in functions like these:
Loops can be simulated using macros that invoke themselves recursively.
There are 9 articles: