# 
# List of source files
#

GLSL_SRCS=GLSLTutorial.cpp Utilities.cpp
GLSL_OBJS=$(GLSL_SRCS:.cpp=.o)

#
# Compile and link options.  You can change the -g to -O to get
# an optimized, rather than debug, build.
#

CXX=g++
CXXFLAGS=-Wall -I. -g

#
# OpenGL libraries
#
UNAME := $(shell uname)
ifneq (,$(findstring Darwin,$(UNAME)))
	GLLIBS = -framework GLUT -framework OpenGL -lGLEW
else
  ifneq (,$(findstring CYGWIN,$(UNAME)))
	GLLIBS = -lglut32 -lglu32 -lglew32 -lopengl32
  else
	GLLIBS = -lglut -lGLEW -lGLU -lGL
  endif
endif

#
# GNU Make: targets that don't build files
#

.PHONY: all clean distclean

#
# Rules encoding targets and dependencies.  By default, the first of
# these is built, but you can also build any individual target by
# passing it to make - e.g., "make imgpro" or "make clean"
#
# Notice that many of the dependencies are implicit (e.g. a .o depends
# on its corresponding .cpp), as are many of the compilation rules.
#

all: GLSLTutorial

GLSLTutorial: $(GLSL_OBJS)
		rm -f $@ 
	    $(CXX) $(CXXFLAGS) $^ -lm -o $@ $(GLLIBS)
	    
clean:
	    rm -f *.o GLSLTutorial

distclean:  clean

