# mogl makefile for GNU/Linux builds with Octave:

# Path to Octave installation folder:
OCTAVEINCLUDE=/usr/include/octave-2.1.73
OCTAVELIBDIR=/usr/lib/octave-2.1.73

# Definition of target operating system:
TARGETOS=-DLINUX

# Build and include GLM into moglcore:
#GLM=-DBUILD_GLM
GLM=

MEXCC=-I${OCTAVEINCLUDE} -I${OCTAVEINCLUDE}/octave \
	${GLM} ${TARGETOS} -DGLEW_STATIC\
	-DPTBOCTAVE -Doctave_idx_type=int -mieee-fp -fPIC -fno-common -fexceptions -O3 -g

MEXLD=-L${OCTAVELIBDIR} -shared -Wl,-Bsymbolic -lstdc++ -loctinterp -loctave -lcruft -ldl

OGLFLAGS=-lc -lGL -lglut
CC=g++


all:  moglcore.oct

moglcore.oct:  moglcore.o mogloctaveglue.o gl_auto.o gl_manual.o glew.o
	$(CC) ${MEXCC} ${MEXLD} ${OGLFLAGS} \
		-o moglcore.oct moglcore.o mogloctaveglue.o gl_auto.o gl_manual.o glew.o \
		/usr/X11R6/lib/libGLU.a
	cp moglcore.oct ../core

.c.o:
	$(CC) -c ${MEXCC} -o $*.o $*.c

.cc.o:
	$(CC) -c ${MEXCC} -o $*.o $*.cc

clean:
	-rm *.o *.oct

