
SHELL=/bin/sh

all:	comp libs

comp:
	cd kernel; make
	cd gfx; make
	cd callbacks; make
	cd SMS; make
	cd windows; make
	cd navigation; make
	cd objects; make
	cd extras; make



../lib/libmaverikOpenGLX11${OPT_EXT}.so: ${COBJS} ${GOBJS}
	${LD} -o libmaverik${OPT_EXT}.so  ${COBJS} ${GOBJS} ${DLLIBS} ${OPENGLLIBS} ${PNGLIBS} -lm
	cd ../lib; \
	mv ../src/libmaverik${OPT_EXT}.so libmaverikOpenGLX11${OPT_EXT}.so; \
	rm -f libmaverik${OPT_EXT}.so; \
	ln -s libmaverikOpenGLX11${OPT_EXT}.so libmaverik${OPT_EXT}.so	

../lib/libmaverikOpenGLGTK${OPT_EXT}.so: ${COBJS} ${GOBJS}
	${LD} -o libmaverik${OPT_EXT}.so  ${COBJS} ${GOBJS} ${DLLIBS} ${GTKLIBS} ${OPENGLLIBS} ${PNGLIBS} -lm
	cd ../lib; \
	mv ../src/libmaverik${OPT_EXT}.so libmaverikOpenGLGTK${OPT_EXT}.so; \
	rm -f libmaverik${OPT_EXT}.so; \
	ln -s libmaverikOpenGLGTK${OPT_EXT}.so libmaverik${OPT_EXT}.so	

../lib/libmaverikIrisGLX11${OPT_EXT}.so: ${COBJS} ${GOBJS}
	${LD} -o libmaverik${OPT_EXT}.so  ${COBJS} ${GOBJS} ${DLLIBS} ${IRISGLLIBS} ${PNGLIBS} -lm
	cd ../lib; \
	mv ../src/libmaverik${OPT_EXT}.so libmaverikIrisGLX11${OPT_EXT}.so; \
	rm -f libmaverik${OPT_EXT}.so; \
	ln -s libmaverikIrisGLX11${OPT_EXT}.so libmaverik${OPT_EXT}.so	

../lib/libmaverikNone${OPT_EXT}.so: ${COBJS} ${GOBJS}
	${LD} -o libmaverik${OPT_EXT}.so  ${COBJS} ${GOBJS} ${DLLIBS} ${PNGLIBS} -lm
	mv libmaverik${OPT_EXT}.so ../lib/libmaverikNone${OPT_EXT}.so

libs:
	make ../lib/libmaverikOpenGLX11${OPT_EXT}.so "COBJS= `find . -name "*.o" -print | grep -v "/gfx/" | grep -v "/extras/" | paste -s -`" GOBJS="gfx/mav_gfxOpenGL.o gfx/mav_gfxWMOpenGLX11.o"
	if [ -f gfx/mav_gfxWMOpenGLGTK.o ] ; then make ../lib/libmaverikOpenGLGTK${OPT_EXT}.so "COBJS= `find . -name "*.o" -print | grep -v "/gfx/" | grep -v "/extras/" | paste -s -`" GOBJS="gfx/mav_gfxOpenGL.o gfx/mav_gfxWMOpenGLGTK.o" ; fi
	if [ -f gfx/mav_gfxWMIrisGLX11.o ] ; then make ../lib/libmaverikIrisGLX11${OPT_EXT}.so "COBJS= `find . -name "*.o" -print | grep -v "/gfx/" | grep -v "/extras/" | paste -s -`" GOBJS="gfx/mav_gfxIrisGL.o gfx/mav_gfxWMIrisGLX11.o" ; fi
	make ../lib/libmaverikNone${OPT_EXT}.so "COBJS= `find . -name "*.o" -print | grep -v "/gfx/" | grep -v "/extras/" | paste -s -`" GOBJS="gfx/mav_gfxNone.o gfx/mav_gfxWMNone.o"



clean:
	cd kernel; make clean
	cd gfx; make clean	
	cd callbacks; make clean
	cd SMS; make clean
	cd windows; make clean
	cd navigation; make clean
	cd objects; make clean
	cd extras; make clean
