########################################################-*-mode:Makefile-*-
##                                                                       ##
##  Edinburgh Speech Tools: local configuration file                     ##
##                                                                       ##
###########################################################################
##
##  Specific config file for local installation
##
##  This file will be included by all Makefiles in the system
##  The variables TOP, DIRNAME and FILES will always be set
##  when this file is included
##

## Select one of these compilers

COMPILER=GCC
# COMPILER=SUN_CC

## turn on some of these options to control compilation.
## OPTIMISE=4 turns off DEBUG

OPTIMISE=3
WARN=1
# VERBOSE=1
DEBUG=1

## options

## NCD's network audio system, you will probably have to 
## fix the locations of NAS libraries later in the file
INCLUDE_NAS=1

## To include (Proprietary) ESPS support
# INCLUDE_ESPS=1

## descriptions of different compiling environments. 

ifeq ($(COMPILER),GCC)
## GNU gcc (G++) available on most systems
	CC=gcc
	CXX =gcc

	CFLAGS  = 
	CXXFLAGS  =  
	DEBUG_CCFLAGS = -g
	DEBUG_CXXFLAGS =  -g
	WARN_CCFLAGS = -Wall
	WARN_CXXFLAGS =-Wall
	VERBOSE_CCFLAGS =
	VERBOSE_CXXFLAGS = 
	OPTIMISE_CCFLAGS = -O$(OPTIMISE)
	OPTIMISE_CXXFLAGS = -O$(OPTIMISE)

        TEMPLATE_SPECIFIC = -DINSTANTIATE_TEMPLATES # -fno-implicit-templates
	TEMPLATE_ARGS= 

	## special ways of doing things, blank means default

	MAKE_DEPEND = 
	BUILD_LIB = 
	INDEX_LIB = 

	COMPILERLIBS= -lstdc++
else
ifeq ($(COMPILER),SUN_CC)
## Sun's CC/cc available on Solaris and SunOS
	CC = cc
	CXX = CC 

	CFLAGS =
	CXXFLAGS = -D__svr4__

	DEBUG_CCFLAGS = -g
	DEBUG_CXXFLAGS =  -g
	WARN_CCFLAGS = +w +w2
	WARN_CXXFLAGS = +w +w2
	VERBOSE_CCFLAGS =
	VERBOSE_CXXFLAGS = -ptv
	OPTIMISE_CCFLAGS = -xO4
	OPTIMISE_CXXFLAGS = -O4

	TEMPLATE_ARGS= $(TEMPLATE_DIRS:%=-pti$(TOP)/%) -ptr$(TOP) 

	## special ways of doing things, blank means default

	MAKE_DEPEND = $(CXX) $(INCLUDES) $(TEMPLATES) -xM1
	BUILD_LIB = $(CXX) $(TEMPLATES) -xar -o
	INDEX_LIB = \#

	COMPILERLIBS=
else
error:
	@echo NO COMPILER SELECTED
	@false
all: error
depend: error
endif
endif

AR = ar
# This is used within CSTR for RCS access, if you wont use RCS leave as is
TEST = /usr/local/GNU/bin/test
INSTALL_PROG = install
# On Solaris (and other SYSV) use true, while others need the real thing
RANLIB = ranlib

## Installation directories
prefix=/cstr
BINDIR=$(prefix)/bin
LIBDIR=$(prefix)/lib
INCDIR=$(prefix)/include
MANDIR=$(prefix)/man

# Solaris needs the following
SOCKET_LIBS = -lsocket -lnsl -ldl

## NCD's network audio system, uncomment and change it if required
ifdef INCLUDE_NAS
ifneq ($(INCLUDE_NAS),0)
	NADIR = /cstr
	NAINC = -I$(NADIR)/include
	NALIB = -L$(NADIR)/lib -laudio -L/usr/openwin/lib -lXau  $(SOCKET_LIBS)
	AUDIODEFS += -DUSE_NAS
endif
endif

## Collect together all audio subsystem vars (defined or not)
AUDIOINC  = $(NAINC)
AUDIOLIBS  = $(NALIB)
AUDIOFLAGS = $(AUDIOINC) $(AUDIODEFS)

## To include (Proprietary) ESPS support
ifdef INCLUDE_ESPS
ifneq ($(INCLUDE_ESPS),0)
	ESPS_BASE = /cstr
	ESPSINC = -I$(ESPS_BASE)/include
	ESPSLIBS = -L$(ESPS_BASE)/lib -lhdre -lexv -lespsg $(SOCKET_LIBS)
	FILEFORMATDEFS += -DUSE_PROPRIETARY_ESPS
endif
endif

## Collect together all file format subsystem vars (defined or not)
FILEFORMATLIBS = $(ESPSLIBS)
FILEFORMATINC = $(ESPSINC)
FILEFORMATFLAGS = $(FILEFORMATINC) $(FILEFORMATDEFS)

## SunOS seems to need this
#OSLIBS = -ldl
## Older versions of solaris (2.3 2.4) may need these
#OSLIBS = /usr/ucblib/libucb.a

CSTRLIB = -L$(TOP)/lib -lcstrtools -lcstrstring

INCLUDES = $(LOCAL_INCLUDES) -I$(TOP)/include $(DEFINES)
TEMPLATES= $(LOCAL_TEMPLATES) $(TEMPLATE_ARGS)
LIBS = $(LOCAL_LIBS) $(COMPILERLIBS) $(DEBUG_LIBS) -lm $(OSLIBS)

