helloworld: helloworld.ccc helloworld.c -o helloworld # NOTE: Line starts with TAB, not with 8 spaces!
Interprete the Makefile this way:
There is only one target, called helloworld.
(A Makefile normally has several targets.)
The "target" is simply the name of the file we want to create.
In this case, we want to create the executable "helloworld".
We could have called the target whatever we want to, but to take advantage of make's ability to detect timestamp changes, we should. If there has been no changes in the required source code file(s) (in this case "helloworld.c"), make will detect that the executable's timestamp is newer than the source code's. Thus, there is need to recompile
There is one prerequisite for the target helloworld, called helloworld.c
(Each target in a Makefile may have zero or more prerequisites.)
That is, the file helloworld.c must exist if we want to build the target helloworld.
On a separate line (always starting with TAB!), the command to be executed is listed: cc helloworld.c -o helloworld
(Each target may have one or more lines with commands.)
In this case, we only specify one command: how to compile helloworld.c