# ########################################################################
#
#  Ubit Library Config File
#  Ubit Project [elc::2003]
#  Author: Eric Lecolinet
#
#  Part of the Ubit Toolkit: A Brick Construction Game Model for Creating GUIs
#
#  (C) 1999-2002 Eric Lecolinet, ENST, 46 rue Barrault, 75013 Paris, France
#  WWW: http://www.enst.fr/~elc/ubit     Email: elc@enst.fr (subject: ubit)
#
# ***********************************************************************
# COPYRIGHT NOTICE : 
# THIS PROGRAM IS DISTRIBUTED WITHOUT ANY WARRANTY AND WITHOUT EVEN THE 
# IMPLIED WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. 
# YOU CAN REDISTRIBUTE IT AND/OR MODIFY IT UNDER THE TERMS OF THE GNU 
# GENERAL PUBLIC LICENSE AS PUBLISHED BY THE FREE SOFTWARE FOUNDATION; 
# EITHER VERSION 2 OF THE LICENSE, OR (AT YOUR OPTION) ANY LATER VERSION.
# SEE FILES 'COPYRIGHT' AND 'COPYING' FOR MORE DETAILS.
# ***********************************************************************

# !!!WARNING: Watch the LD_LIBRARY_PATH variable (or equivalent) !
# (it must refer to the SAME X11 dynamic libraries)

#########################################################################
# AUTOMATIC UPDATE of dependencies (SunOS)
.KEEP_STATE:


# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# compilation options

cxx=g++

## can be: -g, -O etc.
CXXFLAGS= -O2

## OGL
GL= no

## Remus
REMUS= no

# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# default paths; can be overidden below


# Ubit
UBIT_INCS=-I${HOME}/ubit/src
#UBIT_LIBS=-L${HOME}/ubit/lib -lubit_ext -lubit 
UBIT_LIBS= ${HOME}/ubit/src/ext/.libs/libubit_ext.a ${HOME}/ubit/src/.libs/libubit.a 

# XML
#XERCES_INCS= -I/usr/include
XML_LIBS= ${HOME}/ubit/src/xml/.libs/libubit_xml.a -L/usr/lib -lxerces-c -lpthread

# X Window
X_INCS=-I/usr/X11R6/include
X_LIBS=-L/usr/X11R6/lib -lXpm -lXmu -lX11

# OGL
ifeq (${GL},yes)
  GL_INCS=-I/usr/local/include/GL
  GL_LIBS=-L/usr/local/lib -R/usr/local/lib -lGL -lGLU
endif

# Images
ifeq (${cxx},g++3)
  IMA_INCS=                   # NB: -I/usr/local/include pose pbm avec gcc3
  IMA_LIBS=-lungif -ljpeg     # NB: -L/usr/local/lib pose pbm avec gcc3
else
  IMA_INCS= -I/usr/local/include
  IMA_LIBS= -L/usr/local/lib -lungif -ljpeg
endif


# Remus
ifeq (${REMUS},yes)
  REMUS_INC= -DREMUS -I../remus/pnn -I../remus/viewer
  REMUS_LIB= -L../remus/pnn -lRemusCore -L../remus/viewer -lremus_pretraite
endif

# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -


SYSTEM_LIBS= -lm
AR=ar
ARFLAGS=vru
RANLIB=echo

os := ${shell uname}

ifeq (${os},Linux)
        arch := ${shell uname -m}

ifeq (${arch},armv4l)

  ### Linux on Ipaq 
  UBIT_INCS= -I${HOME}/ubiq/src
  UBIT_LIBS= -L${HOME}/ubiq/src -lubit
  X_INCS= -I/opt/ext/usr/X11R6/include
  CXX= g++
  CXXFLAGS+= -Wall

else

  ### Linux on other archs
  CXX= ${cxx}        # si g++2 et g++3 existent 
  #CXX= g++
  CXXFLAGS+= -Wall

endif


else
ifeq (${os},Darwin)

  ### Mac OS X

  IMA_INCS= -I/sw/include
  IMA_LIBS= -L/sw/lib -lgif -ljpeg

ifeq (${GL},yes)
  GL_INCS= -I/usr/X11R6/include/GL
  GL_LIBS= -L/usr/X11R6/lib  -lGL -lGLU
endif

  CXX= ${cxx}        # si g++2 et g++3 existent
#  CXXFLAGS+= -Wall -DHAVE_NO_SOCKLEN_T
  CXXFLAGS+= -Wall
  RANLIB=ranlib

else
ifeq (${os},SunOS)

  ### Solaris

  X_INCS=-I/usr/openwin/include
  X_LIBS=-L/usr/openwin/lib -lXpm -lXmu -lX11
  XERCES_INCS = -I${HOME}/xerces/src
  XERCES_LIBS = -L${HOME}/xerces -R${HOME}/xerces -lxerces-c -lpthread
  SYSTEM_LIBS += -lsocket -lnsl 

ifeq (${GL},yes)
  GL_INCS= -I/usr/openwin/include/GL
  GL_LIBS= -L/usr/openwin/lib -R/usr/openwin/lib -lGL -lGLU
  #GL_LIBS= -L/usr/local/lib -R/usr/local/lib -lMesaGL -lMesaGLU
endif

ifeq (${cxx},CC)
  # no -Wall option for CC
  CXX= CC
  AR = CC
  ARFLAGS=-xar -o
else
  CXX= g++

endif
endif
endif
endif


# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# Final

CCC= ${CXX}
CC= ${CXX}

CXXFLAGS += ${UBIT_INCS} ${IMA_INCS} ${X_INCS} ${GL_INCS} -I.
CCFLAGS= ${CXXFLAGS}

LDFLAGS=
LDLIBS = ${UBIT_LIBS} ${IMA_LIBS} ${X_LIBS} ${GL_LIBS} ${SYSTEM_LIBS}
