## Makefile for Project 1, Polynomial
## by Chris Horn
##
## This makefile will build a binary called poly_proj that
## can add, subtract and multiply polynomials together.
##
## source: linked_list.h linked_list.cpp
##         polynomial.h  polynomial.cpp
##         poly_proj.cpp

# define some macros
CXX=g++
CPPFLAGS=-Wall

# this is the default target and will build the project binary
#
# when specifying the order of the .o files, you should specify the
# files that have dependencies on later files first.  This is so that
# unresolved symbols are kept track of until their definition can be found
all: poly_proj.o linked_list.o polynomial.o
	$(CXX) $(CPPFLAGS) -o poly_proj poly_proj.o polynomial.o linked_list.o

poly_proj.cpp: polynomial.h linked_list.h
poly_proj.o: poly_proj.cpp
	$(CXX) $(CPPFLAGS) -c poly_proj.cpp 

polynomial.h: linked_list.h
polynomial.o: polynomial.h polynomial.cpp
	$(CXX) $(CPPFLAGS) -c polynomial.cpp 

linked_list.o: linked_list.h linked_list.cpp
	$(CXX) $(CPPFLAGS) -c linked_list.cpp

clean:
	-rm *.o poly_proj
