on makefile

some notes on makefile:

The basic basic rule: 'target' depends on 'prerequisites' and the relationship is defined by 'command'.
target ... : prerequisites ...
command

version 1
objects = main.o kbd.o command.o display.o \
insert.o search.o files.o utils.o
edit : $(objects)
cc -o edit $(objects)
main.o : defs.h
kbd.o : defs.h command.h
command.o : defs.h command.h
display.o : defs.h buffer.h
insert.o : defs.h buffer.h
search.o : defs.h buffer.h
files.o : defs.h buffer.h command.h
utils.o : defs.h
.PHONY : clean
clean :
rm edit $(objects)

version 2
objects = main.o kbd.o command.o display.o \
insert.o search.o files.o utils.o
edit : $(objects)
cc -o edit $(objects)
$(objects) : defs.h
kbd.o command.o files.o : command.h
display.o insert.o search.o files.o : buffer.h
.PHONY : clean
clean :
rm edit $(objects)

.PHONY is followed by a pseudo target and it only defines a series of action, rather than files dependencies.

.PHONY : clean
clean :
-rm edit $(objects)

The '-' in front of rm means 'go ahead' about the action and do not stop for errors.