# Make is an arcane and powerful tool. While this Makefile will accomplish # the purpose for which it was written, there are many possible variations # and optimizations that one could use even for a project this small. # See the documentation on make for more information. # Tell make which C compiler to use. CC = gcc # The first rule is executed if you run make without any parameters. # This line says that to make all, we should make the 'queens' rule below. all: queens # These lines establish dependencies. We need make to know that the # object file queens.o depends on both queens.c and queens.h queens.o: queens.c queens.h # This line tells make how to build the object file. It is not required. $(CC) -c queens.c printboard.o: printboard.c queens.h $(CC) -c printboard.c checkboard.o: checkboard.c queens.h $(CC) -c checkboard.c # This line says that the queens executable depends on the object files. queens: queens.o printboard.o checkboard.o # This line tells make how to link the .o files into an executable. # (Note: the tab at the beginning of the next line is essential.) $(CC) queens.o printboard.o checkboard.o -o queens # This line deletes the executable, all object files, and all core files. # Type "make clean" when you are preparing to turnin your code. clean: rm -rf *.o queens core*