# Sample Makefile for a VRG3D project.  The key lines to modify start with
# PROJECT_NAME= and SRC=  See $G/help/gbuild-documentation.txt for more 
# info on writing Makefiles with gbuild.

TMPDIR=/tmp

GBUILD_DIR=$(G)/lib

include $(GBUILD_DIR)/Makefile.gbuild.init

ifeq ($(GARCH), linux)
  G_COMPILER_VER = gcc3
endif

include $(GBUILD_DIR)/Makefile.gbuild.compilers



PROJECT_NAME=swordplay
OBJDIR=obj
SRC=main.C HUD.C EnchantSpell.C



DEFINES=NO_SDL_MAIN USE_VRPN

VRPN_VER=-7.07-b5
# Check to see if compiling on a machine whose name starts with cs-
# If so, then assume we're in the Cave and use an older version of VRPN
ifneq ($(findstring cs-, $(HOST)),)
  VRPN_VER=-6.02
endif
ifneq ($(findstring depthcube, $(HOST)),)
  VRPN_VER=-6.02
endif
ifneq ($(findstring audio-cave, $(HOST)),)
  VRPN_VER=-6.02
endif

G_INCLUDE_DIRS=G3D SDL vrpn$(VRPN_VER) VRG3D 3dsmodel

LIBS = SDL 3ds pthread

# Static libs to link in the debugging/opt/profiling cases
DEBUG_LIBS =  G3D$(G_COMPILER_SUFFIX)-d GLG3D$(G_COMPILER_SUFFIX)-d VRG3D$(G_COMPILER_SUFFIX)-d
OPT_LIBS   =  G3D$(G_COMPILER_SUFFIX)   GLG3D$(G_COMPILER_SUFFIX)   VRG3D$(G_COMPILER_SUFFIX)  
PROF_LIBS  =  G3D$(G_COMPILER_SUFFIX)-p GLG3D$(G_COMPILER_SUFFIX)-p VRG3D$(G_COMPILER_SUFFIX)-p


ifeq ($(GARCH), WIN32)
  DEBUG_LIBS := $(DEBUG_LIBS) /NODEFAULTLIB:G3D-debug /NODEFAULTLIB:GLG3D-debug 
  OPT_LIBS   := $(OPT_LIBS) /NODEFAULTLIB:G3D /NODEFAULTLIB:GLG3D 
  PROF_LIBS  := $(PROF_LIBS) /NODEFAULTLIB:G3D /NODEFAULTLIB:GLG3D 
endif

ifneq ($(findstring USE_VRPN,$(DEFINES)),) 
  ifeq ($(GARCH), WIN32)
    LIBS := $(LIBS) vrpn$(VRPN_VER)$(G_COMPILER_SUFFIX) /NODEFAULTLIB:vrpn
  else
    LIBS := $(LIBS) vrpn$(VRPN_VER)$(G_COMPILER_SUFFIX)
  endif
endif

ifneq ($(findstring USE_GLUT,$(DEFINES)),)
  LIBS := $(LIBS) glut
  ifneq ($(GARCH), WIN32)
    LIBS := $(LIBS) Xmu Xi
  endif
else
  ifeq ($(GARCH), WIN32)
    LIBS := $(LIBS) /NODEFAULTLIB:glut32
  endif
endif

# Architecture specific settings
ifeq ($(GARCH),linux)
  # Force gcc3 version compiler on linux
  G_COMPILER_VER=gcc3
  LIB_DIRS := $(LIB_DIRS) /usr/X11R6/lib
  LIBS     := dl X11 Xext pthread GLU GL z jpeg netpbm $(LIBS)
else
ifeq ($(GARCH),WIN32)
  LIBS     := $(LIBS) zlib comctl32 user32 gdi32 ws2_32
endif
endif


# The cluster-sync library can be used for the server/client connection,
# but it's not the default.
ifneq ($(findstring USE_CLUSTERSYNC,$(DEFINES)),)
  ifeq ($(GARCH),WIN32)
    G_INCLUDE_DIRS := $(G_INCLUDE_DIRS) cluster-sync pthreads-win32
    DEBUG_LIBS :=  $(DEBUG_LIBS) cluster-sync$(G_COMPILER_SUFFIX)-d
    OPT_LIBS   :=  $(OPT_LIBS) cluster-sync$(G_COMPILER_SUFFIX)
    PROF_LIBS  :=  $(PROF_LIBS) cluster-sync$(G_COMPILER_SUFFIX)-p 
    LIBS     := $(LIBS) pthreadVC2
  endif
endif





#added dignatof
LIBS	:=	$(LIBS)








include $(GBUILD_DIR)/Makefile.gbuild.defines



all: progg

debug: progg

opt: progo


include $(GBUILD_DIR)/Makefile.gbuild.rules

runcave: progg
	vrg3d-runcave obj/swordplay-gcc3-d
