180 Programming
program: source1.o source2.o
cc -o program source1.o source2.o
# I'm debugging source1.c -Dennis
source1.o: source1.c
cc -c -g source1.c
source2.o: source2.c
cc -c source2.c
The line beginning with “#” is a comment. The make program ignores
them. Well, when poor Dennis runs make, the program complains:
Make: Makefile: Must be a separator on line 4.
Stop
And then make quits. He stares at his Makefile for several minutes, then
several hours, but can’t quite figure out what’s wrong with it. He thinks
there might be something wrong with the comment line, but he is not sure.
The problem with Dennis’s Makefile is that when he added the comment
line, he inadvertently inserted a space before the tab character at the begin-
ning of line 2. The tab character is a very important part of the syntax of
Makefiles. All command lines (the lines beginning with cc in our example)
must start with tabs. After he made his change, line 2 didn’t, hence the
error.
“So what?” you ask, “What’s wrong with that?”
There is nothing wrong with it, by itself. It’s just that when you consider
how other programming tools work in Unix, using tabs as part of the syntax
is like one of those pungee stick traps in The Green Berets: the poor kid
from Kansas is walking point in front of John Wayne and doesn’t see the
trip wire. After all, there are no trip wires to watch out for in Kansas corn
fields. WHAM!
You see, the tab character, along with the space character and the newline
character, are commonly known as whitespace characters. Whitespace is a
technical term which means “you should just ignore them,” and most pro-
grams do. Most programs treat spaces and tabs the same way. Except make
(and cu and uucp and a few other programs). And now there’s nothing left
to do with the poor kid from Kansas but shoot him in the head to put him
out of his misery.