# Makefile
# See NOTE1, NOTE2, NOTE3

# NOTE 1 ##########################################
# If your GLUT (or freeglut) or GLUI installation is not in /usr/local,
# change the next two macros as appropriate:
GLUTINCLUDEDIR  = /usr/local/include/GL
GLUTLIBDIR      = /usr/local/lib/
GLUIINCLUDEDIR  = /usr/local/include/GL
GLUILIBDIR      = /usr/local/lib/

XLIBS           = -lX11 -lXmu
GLLIBS          = -lGL -lGLU
GLUTLIB         = -lglut
GLUILIB         = -lglui

INCLUDEDIRS     = -I$(GLUIINCLUDEDIR) -I$(GLUTINCLUDEDIR) -I.
LIBDIRS         = -L$(GLUILIBDIR) -L$(GLUTLIBDIR) -L.

# NOTE 2 ##########################################
# Change the next macro to the path to your c++ compiler 
CC      = /usr/bin/g++

CCFLAGS = -O3 -c -Wall
LIBS    = $(XLIBS) $(GLLIBS) $(GLUILIB) $(GLUTLIB)

# all of our OpenGL programs will be named "main"
TARGET = main

# NOTE 3 ##########################################
# List all source files required to build this lab:
SRCS = $(TARGET).cpp object.cpp
###################################################

# list of header files (one for each .cpp file)
HDRS = $(SRCS:.cpp=.h)

# list of object files (one for each .cpp file)
OBJS = $(SRCS:.cpp=.o)

# rule for making a .o file from a .cpp file
.cpp.o:
	$(CC) $(INCLUDEDIRS) $(CCFLAGS) $<

# rule for making the final executable
$(TARGET): $(OBJS) $(HDRS)
	$(CC) $(LIBDIRS) -o $(TARGET) $(OBJS) $(LIBS)

# rule for cleaning up the directory
clean:
	rm -f $(OBJS) $(TARGET)

# rule for building everything
over:
	make clean
	make
