FILES = main.o phone.o CC = gcc CFLAGS = -g -Wall -ansi -c # Note that with this setup we can change from gcc compiler to g++ # By altering a single line! # The next line is invoked with "make phone" or just "make" # It causing the forming of the object files and "loads" them # into the executable. phone: $(FILES) $(CC) -o phone $(FILES) # Although will be done automatically if needed, "make main.o" otherwise main.o: phone.h main.c $(CC) $(CFLAGS) main.c # Illustrates the benefits of macros phone.o: phone.c phone.h $(CC) $(CFLAGS) phone.c # To remove unwanted *.o files clean: $(FILES) /usr/bin/rm $(FILES)