|
|
There are many programs that consist of a single source file. make handles this case by the null suffix rule. Thus, to maintain the UNIX system program cat, a rule in the makefile of the following form is needed:
.c: $(CC) $(CFLAGS) -o $@ $< $(LDFLAGS)In fact, this .c: rule is internally defined so no makefile is necessary at all. The user only needs to enter
$ make cat dd echo date(these are all UNIX system single-file programs) and all four C language source files are passed through the above shell command line associated with the .c: rule. The internally defined single suffix rules are
.c: .c~: .s: .s~: |
.sh: .sh~: .f: |
.f~: .C: .C~: |
Others may be added in the makefile by the user.