#----------------------------------------------------------------------
#
# Modify the following defines as necessary
#

#
#  Compiler defines:
#
#  CC 		which compiler to use. By default, use gcc. 
#		You may also try 'CC = cc' to use your regular 
#		Unix C compiler.
#
#  CFLAGS	what compiler options to enable. By default, generate
#		optimized code ('CFLAGS = -C'). You might want to turn on
#		debugging by specifying 'CFLAGS = -g'. Also, some
#		compiler/system combinations may require additional 
#		settings like '-ansi' or '-DBSD'. 
#

CC = gcc
CFLAGS = -O -DLINUX

#
#  OpenGL libraries and include files:
#
#  OGLLIBDIR	where the OpenGL library files reside. Make expects to find
#		either libGL.* and libGLU.* in this directory or, if you are
#   	        compiling with Mesa, libMesaGL.* and libMesaGLU.*.
#  OGLINCDIR	where the OpenGL include files reside. Make expects to find
#		files GL/gl.h, GL/glu.h and GL/glx.h in this directory.
#  OGLLIBS	which OpenGL libraries to use when linking. By default,
#		'OGLLIBS = -lGLU -lGL'. If you are using Mesa, replace
#		that line with 'OGLLIBS = -lMesaGLU -lMesaGL'
#

OGLLIBDIR = /usr/local/lib
OGLINCDIR = /usr/local/include
OGLLIBS = -lMesaGLU -lMesaGL

#
#  Tcl/Tk libraries and include files:
#
#  TCLTKLIBDIR 	where the Tcl and Tk library files reside. Make expects to
#		find libtcl.* and libtk.* in this directory.
#  TCLTKINCDIR	where the Tcl and Tk include files reside. Make expects to 
#		find files tcl.h and tk.h in this directory.
#  TCLTKLIBS	which tcl/tk libraries to use. By default Tcl v7.5 and Tk 
#		v 4.1 are used, and so this line usually reads
#		'TCLTKLIBS = -ltk4.1 -ltcl7.5'. If you are trying to
# 		use newer versions of tcl/tk, update the version numbers
#		accordingly.
#

TCLTKLIBDIR = /usr/local/lib
TCLTKINCDIR = /usr/local/include
TCLTKLIBS = -ltk4.1 -ltcl7.5

#
#  X libraries and include files:
#
#  XLIBDIR 	where X libraries such as libX.* libXext.* etc. are
#	        to be found. 
#  XINCDIR	where X include files such as X11/Xlib.h and X11/X.h 
#		are to be found.
#  XLIBS 	which X libraries to link in. 
#

XLIBDIR = /usr/lib
XINCDIR = /usr/include
XLIBS = -lXmu -lX11 -lXext 

#
#  Other libraries
#
#  OTHERLIBS	libraries which do not fit in any of the previous 
#		categories. In general, only the math library (libm.*) is
#		required, but in some systems, mainly those supporting
#		dynamic loading, other libraries may have to be specified.
# 		Also, be warned that using Tcl/Tk in
#		some systems requires that some additional libraries be
#		linked in. For instance, under Solaris, the socket and
#		nsl libraries are also needed and dynamic loading requires
#		a library called dll; thus, this line
#		would read  'OTHERLIBS = -lsocket -lnsl -ldl -lm'
#
#

OTHERLIBS = -lm

#
#  End of user modifiable defines. In normal circumstances, the rest of
#  this file should be left as it is.
# 
#----------------------------------------------------------------------

LIBS =  -L$(OGLLIBDIR) -L$(TCLTKLIBDIR) -L$(XLIBDIR) 

INCS = -I$(OGLINCDIR) -I$(TCLTKINCDIR) -I$(XINCDIR) 

glwish: tkogl.a 
	$(CC) $(CFLAGS) $(LIBS) -o glwish tkogl.a \
	$(OGLLIBS) $(TCLTKLIBS) $(XLIBS) $(OTHERLIBS)

tkogl.a: tkogl.o tkoglparse.o load3ds.o gencyl.o tkAppInit.o tess.o quadric.o\
	 nurbs.o get.o printstr.o
	ar r tkogl.a tkogl.o tkoglparse.o load3ds.o gencyl.o tkAppInit.o \
	tess.o quadric.o nurbs.o get.o printstr.o
	@if which ranlib ; then ranlib tkogl.a ; fi 

tkogl.o: tkogl.h tkoglparse.h \
	load3ds.h tess.h quadric.h nurbs.h get.h gencyl.h \
	tkogl.c
	$(CC) $(CFLAGS) $(INCS) -c tkogl.c
	
tkAppInit.o: tkogl.h tkAppInit.c 
	$(CC) $(CFLAGS) $(INCS) -c tkAppInit.c

get.o: get.h get.c
	$(CC) $(CFLAGS) $(INCS) -c get.c

printstr.o: printstr.c printstr.h
	$(CC) $(CFLAGS) $(INCS) -c printstr.c

tess.o: tkogl.h tess.h tess.c
	$(CC) $(CFLAGS) $(INCS) -c tess.c

nurbs.o: tkogl.h nurbs.h nurbs.c
	$(CC) $(CFLAGS) $(INCS) -c nurbs.c

quadric.o: tkogl.h quadric.h quadric.c
	$(CC) $(CFLAGS) $(INCS) -c quadric.c

load3ds.o: tkogl.h load3ds.h load3ds.c
	$(CC) $(CFLAGS) $(INCS) -c load3ds.c

gencyl.o: tkogl.h gencyl.h gencyl.c
	$(CC) $(CFLAGS) $(INCS) -c gencyl.c

tkoglparse.o: tkoglparse.h tkoglparse.c
	$(CC) $(CFLAGS) $(INCS) -c tkoglparse.c
	
