Beispiel
Ein Programm foo soll im 90er ANSI C Standard erzeugt werden. Außerdem wird eine Testmethode zur Verfügung gestellt.
Makefile
CC=gcc
CCFLAGS= -Wall -g -ansi
LD=gcc
PROG=foo
SRC=foo.c
all: $(PROGS)
include make.depend
foo: foo.o
$(LD) $(CCFLAGS) foo.o -o list
depend:
$(CC) -MM $(SRC) > make.depend
test: $(PROGS)
./foo
clean:
-/bin/rm *.o $(PROGS)
.SUFFIXES: .o .c .h
%.o : %.c
$(CC) -c $(CCFLAGS) $< -o $@
%.o : %.c %.h
$(CC) -c $(CCFLAGS) $< -o $@