# set up the environment variable like this (in bash): MATLAB=/usr/local/lib/matlab6 make
MATLAB=/usr/local
MATLABDIR=$(MATLAB)

MEX = $(MATLABDIR)/bin/mex

SRC = ../../dputils/debug.c \
../../draw/agbox.c \
../../draw/amgr.c \
../../draw/amxw.c \
../../draw/apict.c \
../../draw/awdut.c \
../../draw/fgraph.c \
../../draw/lingraph.c \
../../draw/lingraphs.c \
../../draw/ongr.c \
../../dset/amcv.c \
../../dset/colshape.c \
../../dset/column.c \
../../dset/compat.c \
../../dset/constraint.c \
../../dset/dex.c \
../../dset/ds.c \
../../dset/dscli.c \
../../dset/dsut.c \
../../dset/freq.c \
../../dset/join.c \
../../dset/nearest.c \
../../dset/pivec.c \
../../dset/query.c \
../../dset/shape.c \
../../dset/dsawdut.c \
../../extra/bayesreg.c \
../../extra/cachedinterp.c \
../../extra/distutils.c \
../../extra/gaussian.c \
../../extra/hrect.c \
../../extra/mapshape.c \
../../extra/motutils.c \
../../extra/qopt.c \
../../extra/sheap.c \
../../utils/amar.c \
../../utils/am_time.c \
../../utils/am_file.c \
../../utils/ambs.c \
../../utils/amdmex.c \
../../utils/amdym.c \
../../utils/amdyv.c \
../../utils/amiv.c \
../../utils/amma.c \
../../utils/ammarep.c \
../../utils/am_string.c \
../../utils/am_string_array.c \
../../utils/amvpv.c \
../../utils/backtrace.c \
../../utils/boolvec.c \
../../utils/command.c \
../../utils/genarray.c \
../../utils/hash.c \
../../utils/imat.c \
../../utils/randomization.c \
../../utils/saarray.c \
../../utils/stack.c \
../../utils/stats.c \
../../utils/svd.c \
../../utils/choose.c \
../../utils/iqueue.c \
../../kmeans/incremental.c \
../../kmeans/kmeans.c \
../../kmeans/simple_kdtree.c \
../../kmeans/split.c \
../../kmeans/traversal.c \
../../kmeans/vctr.c

OBJ = $(addsuffix .o,$(basename $(SRC)))

MEXFLAGS = -g -I../../kmeans -I../../dputils -I../../dset -I../../extra -I../../utils -I../../draw
CFLAGS = $(MEXFLAGS) -Wall

xmeans.mexglx: $(OBJ) xmeans.c 
	$(MEX) CFLAGS='$$CFLAGS -Wall' $(MEXFLAGS) -g xmeans.c $(OBJ)

clean:
	rm -f $(OBJ) xmeans.mexglx
