#******************************************************************************
#
#       Copyright:      2005-2010 Paul Obermeier (obermeier@tcl3d.org)
#                       2006 Daniel A. Steffen (das@users.sourceforge.net)
#
#                       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_Darwin
#
#       Author:         Paul Obermeier, Daniel A. Steffen
#
#       Description:    Configuration file for Darwin/TkAqua based systems using
#                       the GNU C++ compiler gcc.
#                       This file is included from the global Makefile.
#                       The syntax is based on GNU make.
#
#******************************************************************************

# 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

INSTDIR = /usr/local
TCLDIR  = /Library/Frameworks/Tcl.framework
TKDIR   = /Library/Frameworks/Tk.framework

TCLMAJOR     = 8
TCLMINOR     = 5

INSTBIN  = $(INSTDIR)/bin
INSTLIB  = $(INSTDIR)/lib
INSTINC  = $(INSTDIR)/include

# Do not print out unused variables or functions, as this occurs very often
# in the auto-generated SWIG code.
WARNINGS = -Wall -Wno-unused-variable -Wno-unused-function
ARCH     = -arch $(MACHINE)

ifdef WITH_DEBUG
OPT = $(WARNINGS) -g
DEBUG_SUFFIX=d
else
OPT = $(WARNINGS) -O -Wuninitialized -DNDEBUG
DEBUG_SUFFIX=
endif

PPSTUBS   = -DUSE_TCL_STUBS -DUSE_TK_STUBS
PPNOSTUBS = -D$(OS_TYPE)
ifeq (yes,$(HAVE_DARWIN_10_4))
    PPNOSTUBS = -DDarwin_10_4
endif

CC           = gcc -c $(ARCH)
CXX          = g++ -c $(ARCH)
MAKE         = make
LDOUT        = -o 
SHLIB_LD     = gcc -dynamiclib -Wl,-single_module $(ARCH)
SHLIB_LDXX   = g++ -dynamiclib -Wl,-single_module $(ARCH)
SHLIB_CFLAGS = -fno-common

OBJEXT   = .o
LIBEXT   = .a
SHLIBEXT = .dylib
BINEXT   =
DSEP     = /

GLLIBS = -framework OpenGL

SYSLIBS = -framework AGL -framework ApplicationServices

TCLVERSION   = $(TCLMAJOR).$(TCLMINOR)
TCLINCDIR    = $(TCLDIR)/Headers
TKINCDIR     = $(TKDIR)/Headers
TCLSTUBLIBS  = $(TKDIR)/libtkstub$(TCLVERSION)$(LIBEXT) $(TCLDIR)/libtclstub$(TCLVERSION)$(LIBEXT)
TCLSTDLIBS   = $(TKDIR)/Tk $(TCLDIR)/Tcl
TCLSH        = tclsh$(TCLVERSION)

RM           = rm -f
RMDIR        = rm -rf
CP           = cp -p
CPDIR        = cpdir
MKDIR        = mkdir -p

INCL   = -I. -I$(TCLINCDIR) -I$(TKINCDIR) -I$(TKDIR)/PrivateHeaders

ifdef WITH_STUBS
TCLLIBS = $(TCLSTUBLIBS)
PPDEFS  = $(PPNOSTUBS) $(PPSTUBS)
else
TCLLIBS = $(TCLSTDLIBS)
PPDEFS  = $(PPNOSTUBS)
endif
# Defines needed for Togl.
PPDEFS += -DTOGL_AGL
# Defines needed for ODE.
PPDEFS += -D__APPLE__ -D__MACH__
PPDEFS += -DMAC_OSX_TCL=1 -DMAC_OSX_TK=1 -DHAVE_UNISTD_H=1 -DHAVE_LIMITS_H=1 -DHAVE_SYS_TIME_H=1 -DTIME_WITH_SYS_TIME=1

# Additional debugging options

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