1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
.PHONY: clean,real-clean LD = gcc CC = gcc CFLAGS = -Wall -W -Werror SRC=$(wildcard *.c) OBJ=$(SRC:.c=.o) prog : $(OBJ) $(LD) -o $@ $^ %.o : %.c $(CC) $(CFLAGS) -c $^ clean : rm -f *.o real-clean : clean rm -f prog