A Collection of Code Snippets in as Many Programming Languages as Possible
This project is maintained by TheRenegadeCoder
Welcome to the Hello World in Gnu Make page! Here, you'll find the source code for this program as well as a description of how the program works.
$(info Hello, World!)
.PHONY: all
all: ;@:
Hello World in Gnu Make was written by:
This article was written by:
If you see anything you'd like to change or update, please consider contributing.
The info function displays the text that follows it, so this just displays "Hello, World!":
$(info Hello, World!)
In general, all functions in GNU Make have this form:
$(function arguments)
Since GNU Make is a build system, it needs something to build, or else it will give this error:
make: *** No targets. Stop.
To give make
something to do, a "do nothing" target called all
is provided
like this:
.PHONY: all
all: ;@:
The .PHONY keyword specifies targets that will always be built, whether or
not they exist. In this case, that is the all
target. This target is written
in the alternate form for brevity:
target: ;command
This means that whenever the target needs to be built, make
will execute the
command following the semicolon. By default, make
echoes each command
that it executes. To suppress this, @
may be used before the command. The
colon (:) command just exits with non-error status.
To run this program, download and install the latest GNU Make using these instructions:
Download a copy of Hello World in GNU Make, and run this command:
make -sf hello-world.mk