CXX = gcc CFLAGS = -Wall -g ifeq ($(shell uname), Darwin) LIBS = -framework GLUT -framework OpenGL -framework Cocoa else LIBS = -lglut -lGL -lGLU -lGLEW endif FREEGLUT = /afs/nd.edu/user37/ccl/software/external/freeglut ifneq "$(wildcard $(FREEGLUT))" "" INCPATH += -I$(FREEGLUT)/include LIBPATH += -L$(FREEGLUT)/lib -Wl,--rpath -Wl,$(FREEGLUT)/lib endif GLEW = /afs/nd.edu/user37/ccl/software/external/glew ifneq "$(wildcard $(GLEW))" "" INCPATH += -I$(GLEW)/include LIBPATH += -L$(GLEW)/lib -Wl,--rpath -Wl,$(GLEW)/lib endif all: shader_demo clean: rm -f *.o shader_demo depend: rm -f Makefile.bak mv Makefile Makefile.bak sed '/^# DEPENDENCIES/,$$d' Makefile.bak > Makefile echo '# DEPENDENCIES' >> Makefile $(CXX) -MM *.c >> Makefile .c.o: $(CXX) $(CFLAGS) $(INCPATH) -c -o $@ $< .cc.o: $(CXX) $(CFLAGS) $(INCPATH) -c -o $@ $< .cpp.o: $(CXX) $(CFLAGS) $(INCPATH) -c -o $@ $< shader_demo: shader_demo.o ssg.o $(CXX) $(CFLAGS) $(INCPATH) -o $@ $^ $(LIBPATH) $(LIBS) # DEPENDENCIES shader_demo.o: shader_demo.c ssg.h ssg.o: ssg.c ssg.h