#Adaptation of Triangle makefile to compile only the triangle.c file, 
#into a standalone library that can then be used to compile mex modules

AR = ar
CSWITCHES = $(CFLAGS)  -I/usr/X11R6/include -L/usr/X11R6/lib -I$(MATLAB_DIR)/extern/include -fPIC -I$(MATLAB_DIR)/include
TRILIBDEFS = -DTRILIBRARY

all: triangle.a

OBJECTS=triangle.o

triangle.a: $(OBJECTS)
	ar cr  triangle.a $(OBJECTS)
	ranlib triangle.a

triangle.o: triangle.c triangle.h
	$(CC) $(CSWITCHES) $(TRILIBDEFS) -c triangle.c

clean: 
	rm -rf *.a *.o *.LIB *.LST *.obj *.BAK
