#******************************************************************************
#
#       Copyright:      2005-2010 Paul Obermeier (obermeier@tcl3d.org)
#
#                       See the file "Tcl3D_License.txt" for information on
#                       usage and redistribution of this file, and for a
#                       DISCLAIMER OF ALL WARRANTIES.
#
#       Module:         Tcl3D
#       Filename:       config_cygwin
#
#       Author:         Paul Obermeier
#
#       Description:    Configuration file for Windows based systems using
#                       the Cygwin emulation layer with gcc compiler.
#                       This file is included from the global Makefile.
#                       The syntax is based on GNU make.
#
#                       Note: Support for Cygwin has been deprecated with Tcl3D
#                             version 0.4.
#
#******************************************************************************

# Set the following variable to 1, if compiling with stubs.
WITH_STUBS = 1

# Set the following variable to 1, if compiling with debugging information.
# WITH_DEBUG = 1

# Set the following variable to 1, if using Cygwin's Tcl implementation.
CYGWIN_TCL = 1

TCLMAJOR     = 8
TCLMINOR     = 5
TCLVERSION   = $(TCLMAJOR)$(TCLMINOR)

ifdef CYGWIN_TCL
# If using Tcl as distributed with CygWin, 
# adapt the following lines according to your needs.
CYGDIR    = C:\cygwin
INSTDIR   = $(CYGDIR)\usr\share
INSTBIN   = $(CYGDIR)\bin
INSTLIB   = $(INSTDIR)
INSTINC   = $(CYGDIR)\include
TCLINCDIR = $(CYGDIR)\usr\include
TCLLIBDIR = $(CYGDIR)\lib
LIBEXT    = .a
TCLSTUBLIBS  = $(TCLLIBDIR)\libtkstub$(TCLVERSION)$(LIBEXT) $(TCLLIBDIR)\libtclstub$(TCLVERSION)$(LIBEXT)
TCLSTDLIBS   = $(TCLLIBDIR)\libtk$(TCLVERSION)$(LIBEXT) $(TCLLIBDIR)\libtcl$(TCLVERSION)$(LIBEXT)
else
# If using Tcl as distributed from ActiveState, 
# adapt the following lines according to your needs.
INSTDIR   = C:\Programme\Tcl
INSTBIN   = $(INSTDIR)\bin
INSTLIB   = $(INSTDIR)\lib
INSTINC   = $(INSTDIR)\include
TCLDIR    = C:\Programme\Tcl
TCLINCDIR = $(TCLDIR)\include
TCLLIBDIR = $(TCLDIR)\lib
LIBEXT    = .lib
TCLSTUBLIBS  = $(TCLLIBDIR)\tkstub$(TCLVERSION)$(LIBEXT) $(TCLLIBDIR)\tclstub$(TCLVERSION)$(LIBEXT)
TCLSTDLIBS   = $(TCLLIBDIR)\tk$(TCLVERSION)$(LIBEXT) $(TCLLIBDIR)\tcl$(TCLVERSION)$(LIBEXT)
endif

ifdef WITH_DEBUG
# Debug version
OPT = -g -Wall -mieee-fp -ffloat-store
LDOPT =
else
# Optimized version
OPT = -O2 -Wall -Wuninitialized -mieee-fp -ffloat-store -DNDEBUG
LDOPT =
endif

PPSTUBS   = -DUSE_TCL_STUBS -DUSE_TK_STUBS
PPNOSTUBS = -D$(OS_TYPE) -DWIN32 -D_WIN32

CC           = gcc -c
CXX          = g++ -c
MAKE         = make
LD           = gcc $(LDOPT)
LDOUT        = -o
SHLIB_LD     = gcc -shared $(LDOPT)
SHLIB_LDXX   = g++ -shared $(LDOPT)
SHLIB_CFLAGS = -fpic

OBJEXT   = .o
SHLIBEXT = .dll
BINEXT   = .exe
DSEP     = \\

GLLIBS = -lglu32 -lopengl32

SYSLIBS = -luser32 -lgdi32 -lws2_32

TCLSH        = tclsh$(TCLVERSION)

RM           = rm -f
RMDIR        = rm -rf
CP           = cp
CPDIR        = xcopy /E /I /Y /Q
MKDIR        = mkdir

INCL   = -I. -I$(TCLINCDIR)

ifdef WITH_STUBS
TCLLIBS = $(TCLSTUBLIBS)
PPDEFS  = $(PPNOSTUBS) $(PPSTUBS)
else
TCLLIBS = $(TCLSTDLIBS)
PPDEFS  = $(PPNOSTUBS)
endif

# Needed for Togl to identify platform
PPDEFS += -DTOGL_WGL

# Compile GLEW as static version.
PPDEFS += -DGLEW_STATIC

# Additional debugging options

# Debug tcl3dVector allocation and destruction.
# PPDEFS += -DDEBUG_VECTOR=1
