Suppose you have a program of five source files and the makefile:
manythreads.cc
Makefilemany.cc
thr.cc
misc.h
defines.h
The target files are many, manythreads, and thrI.
all: many manythreads thrI many: many.cc CC -o many many.cc -g -D_REENTRANT -lm -lnsl -lsocket -lthread thrI: thr.cc CC -o thrI thr.cc -g -D_REENTRANT -lm -lnsl -lsocket -lthread manythreads: manythreads.cc CC -o manythreads -g -D_REENTRANT manythreads.cc -lnsl \ -lsocket -lthread
The first line of this makefile groups a set of targets with the label all. The succeeding lines give the commands for making the three targets, each of which has a dependency on one of the source files.