CC = g++
C = cpp
H = h
PROJECT = makegrid

# path to directory holding the ezdraw.h file
IDIR = ~/ezdraw/
# path to the directory holding the libezdraw.a files
LDIR = ~/ezdraw/

# loader flags showing where to find the SDL libraries
LDFLAGS = `sdl2-config --libs`

# non SDL libraries to load: ezdraw and math library
LIBS = -lezdraw -lm

# compiler flags for maximum warnings, debugger information,
# and where to find SDL include files
CFLAGS = `sdl2-config --cflags` -g -W -Wall -Wextra -pedantic -O0 -I `sdl2-config --prefix`/include/

HFILES = Grid.${H}
OFILES = Grid.o

${PROJECT}:	${PROJECT}.o ${OFILES}
	${CC} -g -o ${PROJECT} ${PROJECT}.o ${OFILES} -L $(LDIR) $(LIBS) $(LDFLAGS)

${PROJECT}.o: ${PROJECT}.${C} ${HFILES}
	${CC} ${CFLAGS} -c -I $(IDIR) ${PROJECT}.${C}
	
Grid.o:  Grid.$(C) Grid.${H}
	${CC} ${CFLAGS} -c -I $(IDIR) Grid.${C}

clean:
	rm -f *.o *~ ${PROJECT}
