# Agent Tcl
# Bob Gray
# 29 June 1995
#
# This Makefile compiles the transportable agent system.
#
# Copyright 1995, Robert S. Gray, Department of Computer Science, Dartmouth College

  # Change everything to match your environment BEFORE COMPILING

  # TCP/IP port for the server
  # name of the D'Agents interpreter (Tcl-based)
  # name of the D'Agents interpreter (Tk-based)
  # name of the D'Agents server
  # name of the PGP program
  # name of the Unix domain socket

PORT			= 8196
TCL_INTERP_NAME		= agent
TK_INTERP_NAME  	= agent-tk
SCHEME_INTERP_NAME	= test-scheme
SERVER_NAME		= agentd
SERVER_THREADED_NAME	= testd-threads
PGP_NAME		= agpgp
SOCKET_NAME		= agentsocket

  # default directory for PGP keys

PGP_KEY_DIRECTORY 	= ~/.agpgp

  # server log directory, data directory, username, groupname, server's home
  # directory, local machine name and administrator PGP keyname.  The Unix
  # domain socket that the server uses for communication on the local machine
  # is placed in the DATA_DIRECTORY so be sure that you get it right BEFORE
  # COMPILING (otherwise you will have to set the AGENT_UNIX_SOCKET
  # environment variable every time that you run an agent interpreter).  The
  # other items are used to provide a reasonable, default configuration
  # file for the agent server.
  #
  # NOTE: For both performance and security reasons, it is critical that 
  #       both the log and data directories are on the LOCAL DISK.  I can not
  #       emphasize this point strongly enough so I will say it again.  For
  #       both performance and security reasons, it is critical that both the
  #       log and data directories are on the LOCAL DISK.  If you need
  #       help identifying which portions of the machine's filesystem are on
  #       the local disk and which are on remote disks, you should contact
  #       your system administrator.
  #
  #       For best peformance, you should install the ENTIRE SYSTEM on the 
  #       local disk (i.e., all the executables, libraries and scripts).  
  #       Installation directories are set in the next section.

LOG_DIRECTORY		= /usr/agenttcl/logs
DATA_DIRECTORY		= /usr/agenttcl/access
USERNAME		= agenttcl
GROUPNAME		= users
SERVER_HOME		= /usr/agenttcl
LOCAL_MACHINE		= 10.0.0.53
ADMIN_KEYNAME		= Agent Tcl administrator <cs.dartmouth.edu>
TEMP_DIRECTORY		= /usr/agenttcl/temp

  # source and build directories -- must be fully qualified

SOURCE_PREFIX		= /home/rgray/code/dagents/base
BUILD_PREFIX		= ${SOURCE_PREFIX}/build
THREAD_BUILD_PREFIX	= ${BUILD_PREFIX}/thread

  # install directories for Agent Tcl, Agent Tk and the server

PREFIX 			= /usr/agenttcl

BIN_PREFIX		= ${PREFIX}/bin
INC_PREFIX		= ${PREFIX}/include
LIB_PREFIX		= ${PREFIX}/lib

SERV_INSTALL		= ${PREFIX}/server
BIN_INSTALL		= ${BIN_PREFIX}
INC_INSTALL		= ${INC_PREFIX}
LIB_INSTALL		= ${LIB_PREFIX}
PGP_INSTALL		= ${BIN_PREFIX}

TCL_LIBRARY 		= ${LIB_INSTALL}/scripts
TK_LIBRARY		= ${LIB_INSTALL}/tkscripts
EXAMP_LIBRARY		= ${LIB_INSTALL}/examples

  # install directories for Java

JAVA_PREFIX		= ${PREFIX}/java

JAVA_BIN_PREFIX		= ${JAVA_PREFIX}/bin
JAVA_INC_PREFIX		= ${JAVA_PREFIX}/include
JAVA_LIB_PREFIX		= ${JAVA_PREFIX}/lib
JAVA_CLASS_PREFIX	= ${JAVA_PREFIX}/classes

JAVA_BIN_INSTALL	= ${JAVA_BIN_PREFIX}
JAVA_INC_INSTALL	= ${JAVA_INC_PREFIX}
JAVA_LIB_INSTALL	= ${JAVA_LIB_PREFIX}
JAVA_CLASS_INSTALL	= ${JAVA_CLASS_PREFIX}

  # Java include directory

JAVA_BIN_DIR		= ${SOURCE_PREFIX}/jdk1.0.2/jdk/build/bin
JAVA_INCLUDE_DIR	= -I${SOURCE_PREFIX}/agent-java/include-linux \
			  -I${SOURCE_PREFIX}/agent-java/include-linux/linux \
 			  -I${SOURCE_PREFIX}/agent-java/include-linux/CClassHeaders

#JAVA_INCLUDE_DIR	= -I${SOURCE_PREFIX}/agent-java/include-solaris \
#			  -I${SOURCE_PREFIX}/agent-java/include-solaris/solaris \
#			  -I${SOURCE_PREFIX}/agent-java/include-solaris/CClassHeaders

  # thread include and library directories

# Solaris thread flags 

#THREAD_INCLUDE_DIR	=
#THREAD_LIBRARY		= -lpthread -lposix4
#THREAD_PLATFORM		= unix_pthreads_platform
#THREAD_FLAGS		= -DMULTIPLE_THREADS -D_SOLARISTHREADS -D_POSIX_PTHREAD_SEMANTICS -D_REENTRANT

# Linux thread flags

THREAD_INCLUDE_DIR	= 
THREAD_LIBRARY		= -L/home/rgray/threads/linuxthreads-0.71 -lpthread
THREAD_PLATFORM	= unix_pthreads_platform
THREAD_FLAGS		= -DMULTIPLE_THREADS -D_LINUXTHREADS -D_LINUXTHREADS_NO_FAST -D_REENTRANT

  # Optimization level

OPTIMIZATION = -O2
#OPTIMIZATION = -O
#OPTIMIZATION =
#OPTIMIZATION = -g
#OPTIMIZATION = -pg
#OPTIMIZATION = -O2 -DREUSE_INTERPRETER

  # Reverse the following lines if you want to generate static libraries
  # rather than shared libraries -- shared libraries are highly recommended
  # since they minimize memory usage when multiple agents are running at once.
  #
  #
 
CONFIG_FLAGS = --enable-shared
#CONFIG_FLAGS =

  # Reverse the following if you want to generate tcltest and tktest
  # There is no need to do this in normal installation.

GENERATE_TESTS = 0
#GENERATE_TESTS	= 1

  # Reverse the following if you want to generate the standard Tcl
  # interpreters "tclsh" and "wish".  There is no need to do this in a
  # normal installation.

GENERATE_SHELLS = 0
#GENERATE_SHELLS = 1

  # Reverse the following if you do *not* want to generate the Agent Tcl 
  # interpreters "agent" and "agent-tk".  Again there is no need to do this
  # in a normal installation.
  
GENERATE_INTERPS = 1
#GENERATE_INTERPS = 0

  # On a few systems the configure scripts will detect a "ranlib" that
  # actually should not be used.  If you run into problems, uncomment this
  # line.

#RANLIB=touch

  # A few systems require -lbsd which is not detected in the configure scripts.
  # 
  # Sun's C++ Workshop compiler requires libC.so (which on my Solaris machine
  # is in directory /opt/SUNWspro/lib).

  # UNCOMMENT THE -lbsd LINE IF YOU ARE COMPILING UNDER AIX!!!!!!!
  # And, if you know of other platforms where -lbsd is required, please send
  # me mail (rgray@cs.dartmouth.edu).

#BUILTIN_LIBS	= -L/usr/local/lib
#BUILTIN_LIBS	= -L/opt/SUNWspro/lib -lC
#BUILTIN_LIBS	= -lbsd

  # uncomment the appropriate set of three (and comment out the other set)
  #
  # CC     = your C++ compiler
  # TCL_CC = your C compiler
  # CFLAGS = additional flags for the compilers

# compilation flags for "Insure" -- make sure that you uncomment the
#
# OPTIMIZATION = -g
#
# line above.

#CC		= insure
#TCL_CC		= insure
#CFLAGS		= -DSERVER_TCP_PORT=${PORT} -Wall ${OPTIMIZATION}
#TCL_CFLAGS	=
#MAKELIB_FLAGS 	=
#JAVA_CFLAGS	=

# compilation flags for "gcc"

CC		= g++
TCL_CC		= gcc
CFLAGS		= -DSERVER_TCP_PORT=${PORT} -Wall ${OPTIMIZATION}
TCL_CFLAGS	= 
MAKELIB_FLAGS 	=
JAVA_CFLAGS	=

# compilation flags for "CC"

#CC		= CC
#TCL_CC		= cc
#CFLAGS		= -DSERVER_TCP_PORT=${PORT} ${OPTIMIZATION}
#TCL_CFLAGS	=
#MAKELIB_FLAGS 	=
#JAVA_CFLAGS	=

# compilation flags for Solaris 

#CC		= g++
#TCL_CC		= gcc
#CFLAGS		= -DSERVER_TCP_PORT=${PORT} -Wall ${OPTIMIZATION} -D_UINT64_T -D_INT64_T
#TCL_CFLAGS	= 
#MAKELIB_FLAGS 	=
#JAVA_CFLAGS	= -DHAVE_ALIGNED_LONGLONGS -DHAVE_ALIGNED_DOUBLES -D_UINT64_T -D_INT64_T

# compilation flags for the SGI O2's at Dartmouth (e.g., borg1 at Dartmouth)
# We actually only need these flags for the Java part (where we are
# trying to ensure that both the libraries and the Java interpreter are
# compiled in a consistent manner, e.g., both -o32 or both -n32).  We
# should improve the configuration script and Makefiles so that the -n32
# and JAVA_CFLAGS can be auto-detected.

#CC		= CC
#TCL_CC		= cc
#CFLAGS		= -n32 -DSERVER_TCP_PORT=${PORT} ${OPTIMIZATION} 
#TCL_CFLAGS	= -n32
#MAKELIB_FLAGS   = -n32
#JAVA_CFLAGS	= -DHAVE_ALIGNED_LONGLONGS -DHAVE_ALIGNED_DOUBLES

# ----------------------------------------------------------------------------------
# DO NOT CHANGE ANYTHING BELOW HERE!
# ----------------------------------------------------------------------------------

  # Scheme must be compiled as a static library or garbage collection will
  # not work properly

CONFIG_SCHEME_FLAGS =

  # symbolic names for Tcl, Tk, Scheme, Java and Python 

TCL_LANGUAGE_NAME	= STATE-TCL
TK_LANGUAGE_NAME	= STATE-TK
SCHEME_LANGUAGE_NAME	= STATE-SCHEME
JAVA_LANGUAGE_NAME	= STATE-JAVA
PYTHON_LANGUAGE_NAME	= NORMAL-PYTHON

  # test for symbolic link

TEST_COMMAND	= `${SOURCE_PREFIX}/test.sh 2> /dev/null`

  # architecture name

ARCH		= `arch`

  # install programs

INSTALL		= ${SOURCE_PREFIX}/install-sh -c
INSTALL_DATA_U	= ${INSTALL} -m 644
INSTALL_DATA_GU = ${INSTALL} -m 640
INSTALL_DATA_R  = ${INSTALL} -m 600
INSTALL_PROG_U  = ${INSTALL} -m 755
INSTALL_PROG_R  = ${INSTALL} -m 700
 
  # force the use of the Bourne shell on machines such as SGI's

SHELL		= /bin/sh

  # main targets 

all: serv tcl_agent tk_agent java_agent scheme_agent python_agent

support: otcl_stack exp_stack

# -----------------------------------------------------------------------------------
# CONFIGURE SCRIPT
# -----------------------------------------------------------------------------------

configure: configure.in
	/usr/bin/autoconf
	./fix.tcl
 
# -----------------------------------------------------------------------------------
# END CONFIGURE SCRIPT
# -----------------------------------------------------------------------------------

# -----------------------------------------------------------------------------------
# target to remove the configuration caches if we have changed the Makefile
# -----------------------------------------------------------------------------------

cache_stamp: ${BUILD_PREFIX}/obj/cache_stamp
	touch cache_stamp

thread_cache_stamp: ${THREAD_BUILD_PREFIX}/obj/cache_stamp
	touch thread_cache_stamp

${BUILD_PREFIX}/obj/cache_stamp: Makefile configure
	echo "Removing the configuration cache"
	touch ${BUILD_PREFIX}/obj/cache_stamp
	rm -f ${BUILD_PREFIX}/obj/config.cache
	rm -f ${BUILD_PREFIX}/obj/config.log
	rm -f ${BUILD_PREFIX}/obj/config.status
	rm -f ${BUILD_PREFIX}/obj/config.c.cache
	rm -f ${BUILD_PREFIX}/obj/tcl/config.cache
	rm -f ${BUILD_PREFIX}/obj/tcl/config.log
	rm -f ${BUILD_PREFIX}/obj/tcl/config.status
	rm -f ${BUILD_PREFIX}/obj/tk/config.cache
	rm -f ${BUILD_PREFIX}/obj/tk/config.log
	rm -f ${BUILD_PREFIX}/obj/tk/config.status

${THREAD_BUILD_PREFIX}/obj/cache_stamp: Makefile configure
	echo "Removing the configuration cache"
	touch ${THREAD_BUILD_PREFIX}/obj/cache_stamp
	rm -f ${THREAD_BUILD_PREFIX}/obj/config.cache
	rm -f ${THREAD_BUILD_PREFIX}/obj/config.log
	rm -f ${THREAD_BUILD_PREFIX}/obj/config.status
	rm -f ${THREAD_BUILD_PREFIX}/obj/config.c.cache

# -----------------------------------------------------------------------------------
# END OF target to remove the configuration cache if we have changed the Makefile
# -----------------------------------------------------------------------------------

# -----------------------------------------------------------------------------------
# BASE BUILD DIRECTORIES 
# -----------------------------------------------------------------------------------

${BUILD_PREFIX}/stamp:
${BUILD_PREFIX}/bin/stamp:
${BUILD_PREFIX}/lib/stamp:
${BUILD_PREFIX}/obj/stamp:

stamp: ${BUILD_PREFIX}/stamp \
	${BUILD_PREFIX}/bin/stamp \
	${BUILD_PREFIX}/lib/stamp \
	${BUILD_PREFIX}/obj/stamp 
	echo "if [ ! -d ${BUILD_PREFIX} ]; then \
		mkdir ${BUILD_PREFIX}; \
		chmod 755 ${BUILD_PREFIX}; \
		touch ${BUILD_PREFIX}/stamp; \
	      fi; \
	      if [ ! -f ${BUILD_PREFIX}/stamp ]; then \
		touch ${BUILD_PREFIX}/stamp; \
	      fi; \
	      for i in bin lib obj; \
 		do \
		  if [ ! -d ${BUILD_PREFIX}/\$$i ] ; then \
		    mkdir ${BUILD_PREFIX}/\$$i; \
		    chmod 755 ${BUILD_PREFIX}/\$$i; \
		    touch ${BUILD_PREFIX}/\$$i/stamp; \
		  fi; \
		  if [ ! -f ${BUILD_PREFIX}/\$$i/stamp ]; then \
		    touch ${BUILD_PREFIX}/\$$i/stamp; \
		  fi; \
		done; \
		touch stamp" \
	| sh

${THREAD_BUILD_PREFIX}/stamp:
${THREAD_BUILD_PREFIX}/bin/stamp:
${THREAD_BUILD_PREFIX}/lib/stamp:
${THREAD_BUILD_PREFIX}/obj/stamp:

thread_stamp: ${THREAD_BUILD_PREFIX}/stamp \
	${THREAD_BUILD_PREFIX}/bin/stamp \
	${THREAD_BUILD_PREFIX}/lib/stamp \
	${THREAD_BUILD_PREFIX}/obj/stamp \
	stamp
	echo "if [ ! -d ${THREAD_BUILD_PREFIX} ]; then \
		mkdir ${THREAD_BUILD_PREFIX}; \
		chmod 755 ${THREAD_BUILD_PREFIX}; \
		touch ${THREAD_BUILD_PREFIX}/stamp; \
	      fi; \
	      if [ ! -f ${THREAD_BUILD_PREFIX}/stamp ]; then \
		touch ${THREAD_BUILD_PREFIX}/stamp; \
	      fi; \
	      for i in bin lib obj; \
 		do \
		  if [ ! -d ${THREAD_BUILD_PREFIX}/\$$i ] ; then \
		    mkdir ${THREAD_BUILD_PREFIX}/\$$i; \
		    chmod 755 ${THREAD_BUILD_PREFIX}/\$$i; \
		    touch ${THREAD_BUILD_PREFIX}/\$$i/stamp; \
		  fi; \
		  if [ ! -f ${THREAD_BUILD_PREFIX}/\$$i/stamp ]; then \
		    touch ${THREAD_BUILD_PREFIX}/\$$i/stamp; \
		  fi; \
		done; \
		touch thread_stamp" \
	| sh

# -----------------------------------------------------------------------------------
# END OF BASE BUILD DIRECTORIES 
# -----------------------------------------------------------------------------------

# -----------------------------------------------------------------------------------
# CORE
# -----------------------------------------------------------------------------------

${BUILD_PREFIX}/obj/generic/stamp:
${BUILD_PREFIX}/obj/random/stamp:
${BUILD_PREFIX}/obj/platform/stamp:
${BUILD_PREFIX}/obj/support/stamp:
${BUILD_PREFIX}/obj/messaging/stamp:

core_stamp: stamp \
	${BUILD_PREFIX}/obj/generic/stamp \
	${BUILD_PREFIX}/obj/random/stamp \
	${BUILD_PREFIX}/obj/support/stamp \
	${BUILD_PREFIX}/obj/messaging/stamp \
	${BUILD_PREFIX}/obj/platform/stamp
	echo "for i in obj/generic obj/random obj/platform obj/support obj/messaging; \
		do \
		  if [ ! -d ${BUILD_PREFIX}/\$$i ] ; then \
		    mkdir ${BUILD_PREFIX}/\$$i; \
		    chmod 755 ${BUILD_PREFIX}/\$$i; \
		    touch ${BUILD_PREFIX}/\$$i/stamp; \
		  fi; \
		  if [ ! -f ${BUILD_PREFIX}/\$$i/stamp ]; then \
		    touch ${BUILD_PREFIX}/\$$i/stamp; \
		  fi; \
		done; \
		touch core_stamp" \
	| sh

${THREAD_BUILD_PREFIX}/obj/generic/stamp:
${THREAD_BUILD_PREFIX}/obj/random/stamp:
${THREAD_BUILD_PREFIX}/obj/platform/stamp:
${THREAD_BUILD_PREFIX}/obj/support/stamp:
${THREAD_BUILD_PREFIX}/obj/messaging/stamp:

thread_core_stamp: thread_stamp \
	${THREAD_BUILD_PREFIX}/obj/generic/stamp \
	${THREAD_BUILD_PREFIX}/obj/random/stamp \
	${THREAD_BUILD_PREFIX}/obj/support/stamp \
	${THREAD_BUILD_PREFIX}/obj/messaging/stamp \
	${THREAD_BUILD_PREFIX}/obj/platform/stamp
	echo "for i in obj/generic obj/random obj/platform obj/support obj/messaging; \
		do \
		  if [ ! -d ${THREAD_BUILD_PREFIX}/\$$i ] ; then \
		    mkdir ${THREAD_BUILD_PREFIX}/\$$i; \
		    chmod 755 ${THREAD_BUILD_PREFIX}/\$$i; \
		    touch ${THREAD_BUILD_PREFIX}/\$$i/stamp; \
		  fi; \
		  if [ ! -f ${THREAD_BUILD_PREFIX}/\$$i/stamp ]; then \
		    touch ${THREAD_BUILD_PREFIX}/\$$i/stamp; \
		  fi; \
		done; \
		touch thread_core_stamp" \
	| sh


unix_platform: ${BUILD_PREFIX}/obj/platform/Makefile force
	echo "cd ${BUILD_PREFIX}/obj/platform; \
	      make unix_platform \"CFLAGS=${CFLAGS}\"" \
	| sh

unix_java_platform: ${THREAD_BUILD_PREFIX}/obj/platform/Makefile force
	echo "cd ${THREAD_BUILD_PREFIX}/obj/platform; \
	      make unix_java_platform \
		  \"CFLAGS=${CFLAGS}\" \
		  \"THREAD_FLAGS=${THREAD_FLAGS}\" \
	          \"JAVA_INCLUDE_DIR=${JAVA_INCLUDE_DIR}\"" \
	| sh

unix_pthreads_platform: ${THREAD_BUILD_PREFIX}/obj/platform/Makefile force
	echo "cd ${THREAD_BUILD_PREFIX}/obj/platform; \
	      make unix_pthreads_platform \
		  \"CFLAGS=${CFLAGS}\" \
		  \"THREAD_FLAGS=${THREAD_FLAGS}\" \
	          \"THREAD_INCLUDE_DIR=${THREAD_INCLUDE_DIR}\"" \
	| sh

plat: unix_platform

java_plat: unix_java_platform

scheme_plat: unix_platform

python_plat: unix_platform

thread_plat: ${THREAD_PLATFORM}

${BUILD_PREFIX}/obj/platform/Makefile: \
	core_stamp \
	platform/Makefile.in \
	configure \
	Makefile \
	cache_stamp
	echo "cp configure ${BUILD_PREFIX}/obj; \
	      chmod 755 ${BUILD_PREFIX}/obj/configure; \
	      SOURCE_DIR=${SOURCE_PREFIX}; \
	      cd ${BUILD_PREFIX}/obj; \
	      CXX=${CC}; \
	      export CXX; \
	      outputfile=platform/Makefile; \
	      export outputfile; \
	      ./configure --enable-gcc ${CONFIG_FLAGS} --srcdir=\$${SOURCE_DIR}" \
	| sh

${THREAD_BUILD_PREFIX}/obj/platform/Makefile: \
	thread_core_stamp \
	platform/Makefile.in \
	configure \
	Makefile \
	thread_cache_stamp
	echo "cp configure ${THREAD_BUILD_PREFIX}/obj; \
	      chmod 755 ${THREAD_BUILD_PREFIX}/obj/configure; \
	      SOURCE_DIR=${SOURCE_PREFIX}; \
	      cd ${THREAD_BUILD_PREFIX}/obj; \
	      CXX=${CC}; \
	      export CXX; \
	      outputfile=platform/Makefile; \
	      export outputfile; \
	      ./configure --enable-gcc ${CONFIG_FLAGS} --srcdir=\$${SOURCE_DIR}" \
	| sh

rand: ${BUILD_PREFIX}/obj/random/Makefile force
	echo "cd ${BUILD_PREFIX}/obj/random; \
	      make lib \"CFLAGS=${CFLAGS}\" \
		       \"LIBMIDDLE=agrand\" \
		       \"MAKELIB_FLAGS=${MAKELIB_FLAGS}\"" \
	| sh

${BUILD_PREFIX}/obj/random/Makefile: \
	core_stamp \
	${SOURCE_PREFIX}/random/Makefile.in \
	${SOURCE_PREFIX}/configure \
	Makefile \
	cache_stamp
	echo "cp configure ${BUILD_PREFIX}/obj; \
	      chmod 755 ${BUILD_PREFIX}/obj/configure; \
	      SOURCE_DIR=${SOURCE_PREFIX}; \
	      cd ${BUILD_PREFIX}/obj; \
	      CC=${TCL_CC}; \
	      export CC; \
	      CXX=""; \
	      export CXX; \
	      outputfile=random/Makefile; \
	      export outputfile; \
	      ./configure --enable-gcc ${CONFIG_FLAGS} --srcdir=\$${SOURCE_DIR} --cache-file=./config.c.cache; \
	      " \
	| sh

thread_rand: ${THREAD_BUILD_PREFIX}/obj/random/Makefile force
	echo "cd ${THREAD_BUILD_PREFIX}/obj/random; \
	      make lib \
		  \"CFLAGS=${CFLAGS}\" \
		  \"LIBMIDDLE=agtrand\" \
		  \"THREAD_FLAGS=${THREAD_FLAGS}\" \
		  \"MAKELIB_FLAGS=${MAKELIB_FLAGS}\"" \
	| sh

${THREAD_BUILD_PREFIX}/obj/random/Makefile: \
	thread_core_stamp \
	${SOURCE_PREFIX}/random/Makefile.in \
	${SOURCE_PREFIX}/configure \
	Makefile \
	thread_cache_stamp
	echo "cp configure ${THREAD_BUILD_PREFIX}/obj; \
	      chmod 755 ${THREAD_BUILD_PREFIX}/obj/configure; \
	      SOURCE_DIR=${SOURCE_PREFIX}; \
	      cd ${THREAD_BUILD_PREFIX}/obj; \
	      CC=${TCL_CC}; \
	      export CC; \
	      CXX=""; \
	      export CXX; \
	      outputfile=random/Makefile; \
	      export outputfile; \
	      ./configure --enable-gcc ${CONFIG_FLAGS} --srcdir=\$${SOURCE_DIR} --cache-file=./config.c.cache; \
	      " \
	| sh

gen: ${BUILD_PREFIX}/obj/generic/Makefile force
	echo "cd ${BUILD_PREFIX}/obj/generic; \
	      make all \
		   \"CFLAGS=${CFLAGS}\" \
		   \"PGP_EXECUTABLE=${PGP_INSTALL}/${PGP_NAME}\" \
		   \"PGP_KEY_DIRECTORY=${PGP_KEY_DIRECTORY}\" \
		   \"UNIX_SOCKET=${DATA_DIRECTORY}/${SOCKET_NAME}\"" \
	| sh

${BUILD_PREFIX}/obj/generic/Makefile: \
	core_stamp \
	generic/Makefile.in \
	configure \
	Makefile \
	cache_stamp
	echo "cp configure ${BUILD_PREFIX}/obj; \
	      chmod 755 ${BUILD_PREFIX}/obj/configure; \
	      SOURCE_DIR=${SOURCE_PREFIX}; \
	      cd ${BUILD_PREFIX}/obj; \
	      CXX=${CC}; \
	      export CXX; \
	      outputfile=generic/Makefile; \
	      export outputfile; \
	      ./configure --enable-gcc ${CONFIG_FLAGS} --srcdir=\$${SOURCE_DIR}" \
	| sh

thread_gen: ${THREAD_BUILD_PREFIX}/obj/generic/Makefile force
	echo "cd ${THREAD_BUILD_PREFIX}/obj/generic; \
	      make all \
		   \"CFLAGS=${CFLAGS}\" \
		   \"PGP_EXECUTABLE=${PGP_INSTALL}/${PGP_NAME}\" \
		   \"PGP_KEY_DIRECTORY=${PGP_KEY_DIRECTORY}\" \
		   \"THREAD_FLAGS=${THREAD_FLAGS}\" \
		   \"UNIX_SOCKET=${DATA_DIRECTORY}/${SOCKET_NAME}\"" \
	| sh

${THREAD_BUILD_PREFIX}/obj/generic/Makefile: \
	thread_core_stamp \
	generic/Makefile.in \
	configure \
	Makefile \
	thread_cache_stamp
	echo "cp configure ${THREAD_BUILD_PREFIX}/obj; \
	      chmod 755 ${THREAD_BUILD_PREFIX}/obj/configure; \
	      SOURCE_DIR=${SOURCE_PREFIX}; \
	      cd ${THREAD_BUILD_PREFIX}/obj; \
	      CXX=${CC}; \
	      export CXX; \
	      outputfile=generic/Makefile; \
	      export outputfile; \
	      ./configure --enable-gcc ${CONFIG_FLAGS} --srcdir=\$${SOURCE_DIR}" \
	| sh

supp: ${BUILD_PREFIX}/obj/support/Makefile force
	echo "cd ${BUILD_PREFIX}/obj/support; \
	      make all \
		   \"CFLAGS=${CFLAGS}\"" \
	| sh

${BUILD_PREFIX}/obj/support/Makefile: \
	core_stamp \
	support/Makefile.in \
	configure \
	Makefile \
	cache_stamp
	echo "cp configure ${BUILD_PREFIX}/obj; \
	      chmod 755 ${BUILD_PREFIX}/obj/configure; \
	      SOURCE_DIR=${SOURCE_PREFIX}; \
	      cd ${BUILD_PREFIX}/obj; \
	      CXX=${CC}; \
	      export CXX; \
	      outputfile=support/Makefile; \
	      export outputfile; \
	      ./configure --enable-gcc ${CONFIG_FLAGS} --srcdir=\$${SOURCE_DIR}" \
	| sh

thread_supp: ${THREAD_BUILD_PREFIX}/obj/support/Makefile force
	echo "cd ${THREAD_BUILD_PREFIX}/obj/support; \
	      make all \
		   \"CFLAGS=${CFLAGS}\" \
		   \"THREAD_FLAGS=${THREAD_FLAGS}\"" \
	| sh

${THREAD_BUILD_PREFIX}/obj/support/Makefile: \
	thread_core_stamp \
	support/Makefile.in \
	configure \
	Makefile \
	thread_cache_stamp
	echo "cp configure ${THREAD_BUILD_PREFIX}/obj; \
	      chmod 755 ${THREAD_BUILD_PREFIX}/obj/configure; \
	      SOURCE_DIR=${SOURCE_PREFIX}; \
	      cd ${THREAD_BUILD_PREFIX}/obj; \
	      CXX=${CC}; \
	      export CXX; \
	      outputfile=support/Makefile; \
	      export outputfile; \
	      ./configure --enable-gcc ${CONFIG_FLAGS} --srcdir=\$${SOURCE_DIR}" \
	| sh

mesg: ${BUILD_PREFIX}/obj/messaging/Makefile force
	echo "cd ${BUILD_PREFIX}/obj/messaging; \
	      make all \
		   \"CFLAGS=${CFLAGS}\" \
		   \"PGP_EXECUTABLE=${PGP_INSTALL}/${PGP_NAME}\" \
		   \"PGP_KEY_DIRECTORY=${PGP_KEY_DIRECTORY}\"" \
	| sh

${BUILD_PREFIX}/obj/messaging/Makefile: \
	core_stamp \
	messaging/Makefile.in \
	configure \
	Makefile \
	cache_stamp
	echo "cp configure ${BUILD_PREFIX}/obj; \
	      chmod 755 ${BUILD_PREFIX}/obj/configure; \
	      SOURCE_DIR=${SOURCE_PREFIX}; \
	      cd ${BUILD_PREFIX}/obj; \
	      CXX=${CC}; \
	      export CXX; \
	      outputfile=messaging/Makefile; \
	      export outputfile; \
	      ./configure --enable-gcc ${CONFIG_FLAGS} --srcdir=\$${SOURCE_DIR}" \
	| sh

thread_mesg: ${THREAD_BUILD_PREFIX}/obj/messaging/Makefile force
	echo "cd ${THREAD_BUILD_PREFIX}/obj/messaging; \
	      make all \
		   \"CFLAGS=${CFLAGS}\" \
		   \"THREAD_FLAGS=${THREAD_FLAGS}\" \
		   \"PGP_EXECUTABLE=${PGP_INSTALL}/${PGP_NAME}\" \
		   \"PGP_KEY_DIRECTORY=${PGP_KEY_DIRECTORY}\"" \
	| sh

${THREAD_BUILD_PREFIX}/obj/messaging/Makefile: \
	thread_core_stamp \
	messaging/Makefile.in \
	configure \
	Makefile \
	thread_cache_stamp
	echo "cp configure ${THREAD_BUILD_PREFIX}/obj; \
	      chmod 755 ${THREAD_BUILD_PREFIX}/obj/configure; \
	      SOURCE_DIR=${SOURCE_PREFIX}; \
	      cd ${THREAD_BUILD_PREFIX}/obj; \
	      CXX=${CC}; \
	      export CXX; \
	      outputfile=messaging/Makefile; \
	      export outputfile; \
	      ./configure --enable-gcc ${CONFIG_FLAGS} --srcdir=\$${SOURCE_DIR}" \
	| sh

unix_core: plat rand gen supp mesg

unix_threaded_core: thread_plat thread_rand thread_gen thread_supp thread_mesg

java_core: java_plat thread_rand thread_gen thread_supp thread_mesg

scheme_core: scheme_plat rand gen supp mesg

python_core: python_plat rand gen supp mesg

# -----------------------------------------------------------------------------------
# END OF CORE 
# -----------------------------------------------------------------------------------

# -----------------------------------------------------------------------------------
# AGENT SERVER  
# -----------------------------------------------------------------------------------

${BUILD_PREFIX}/obj/server/stamp:
${BUILD_PREFIX}/obj/server-utilities/stamp:

server_utilities_stamp: core_stamp \
	${BUILD_PREFIX}/obj/server-utilities/stamp
	echo "for i in obj/server-utilities; \
		do \
		  if [ ! -d ${BUILD_PREFIX}/\$$i ] ; then \
		    mkdir ${BUILD_PREFIX}/\$$i; \
		    chmod 755 ${BUILD_PREFIX}/\$$i; \
		    touch ${BUILD_PREFIX}/\$$i/stamp; \
		  fi; \
		  if [ ! -f ${BUILD_PREFIX}/\$$i/stamp ]; then \
		    touch ${BUILD_PREFIX}/\$$i/stamp; \
		  fi; \
		done; \
		touch server_utilities_stamp" \
	| sh

server_stamp: core_stamp \
	${BUILD_PREFIX}/obj/server/stamp
	echo "for i in obj/server; \
		do \
		  if [ ! -d ${BUILD_PREFIX}/\$$i ] ; then \
		    mkdir ${BUILD_PREFIX}/\$$i; \
		    chmod 755 ${BUILD_PREFIX}/\$$i; \
		    touch ${BUILD_PREFIX}/\$$i/stamp; \
		  fi; \
		  if [ ! -f ${BUILD_PREFIX}/\$$i/stamp ]; then \
		    touch ${BUILD_PREFIX}/\$$i/stamp; \
		  fi; \
		done; \
		touch server_stamp" \
	| sh

serv_utilities: ${BUILD_PREFIX}/obj/server-utilities/Makefile rand force
	echo "cd ${BUILD_PREFIX}/obj/server-utilities; \
	      make all \"CFLAGS=${CFLAGS}\" \
		       \"LIB_INSTALL_DIR=${LIB_INSTALL}\" \
		       \"BUILTIN_LIBS=${BUILTIN_LIBS}\"" \
	| sh

${BUILD_PREFIX}/obj/server-utilities/Makefile: \
	server_utilities_stamp \
	server-utilities/Makefile.in \
	configure \
	Makefile \
	cache_stamp
	echo "cp configure ${BUILD_PREFIX}/obj; \
	      chmod 755 ${BUILD_PREFIX}/obj/configure; \
	      SOURCE_DIR=${SOURCE_PREFIX}; \
	      cd ${BUILD_PREFIX}/obj; \
	      CXX=${CC}; \
	      export CXX; \
	      if test -n \"${RANLIB}\"; then \
		  RANLIB=\"${RANLIB}\"; \
		  export RANLIB; \
	      fi; \
	      outputfile=server-utilities/Makefile; \
	      export outputfile; \
	      ./configure --enable-gcc ${CONFIG_FLAGS} --srcdir=\$${SOURCE_DIR}" \
	| sh

serv: ${BUILD_PREFIX}/obj/server/Makefile unix_core serv_utilities force
	echo "cd ${BUILD_PREFIX}/obj/server; \
	      make all \"SERVER_NAME=${SERVER_NAME}\" \
	               \"CFLAGS=${CFLAGS}\" \
		       \"MAKELIB_FLAGS=${MAKELIB_FLAGS}\" \
		       \"BUILTIN_LIBS=${BUILTIN_LIBS}\" \
		       \"LIB_INSTALL_DIR=${LIB_INSTALL}\" \
		       \"UNIX_SOCKET=${DATA_DIRECTORY}/${SOCKET_NAME}\"" \
	| sh

${BUILD_PREFIX}/obj/server/Makefile: \
	server_stamp \
	server/Makefile.in \
	configure \
	Makefile \
	cache_stamp
	echo "cp configure ${BUILD_PREFIX}/obj; \
	      chmod 755 ${BUILD_PREFIX}/obj/configure; \
	      SOURCE_DIR=${SOURCE_PREFIX}; \
	      cd ${BUILD_PREFIX}/obj; \
	      CXX=${CC}; \
	      export CXX; \
	      if test -n \"${RANLIB}\"; then \
		  RANLIB=\"${RANLIB}\"; \
		  export RANLIB; \
	      fi; \
	      outputfile=server/Makefile; \
	      export outputfile; \
	      ./configure --enable-gcc ${CONFIG_FLAGS} --srcdir=\$${SOURCE_DIR}" \
	| sh

# -----------------------------------------------------------------------------------
# END OF AGENT SERVER
# -----------------------------------------------------------------------------------

# -----------------------------------------------------------------------------------
# THREADED AGENT SERVER
# -----------------------------------------------------------------------------------

${THREAD_BUILD_PREFIX}/obj/server-threaded/stamp:

server_threaded_stamp: thread_core_stamp \
	${THREAD_BUILD_PREFIX}/obj/server-threaded/stamp
	echo "for i in obj/server-threaded; \
		do \
		  if [ ! -d ${THREAD_BUILD_PREFIX}/\$$i ] ; then \
		    mkdir ${THREAD_BUILD_PREFIX}/\$$i; \
		    chmod 755 ${THREAD_BUILD_PREFIX}/\$$i; \
		    touch ${THREAD_BUILD_PREFIX}/\$$i/stamp; \
		  fi; \
		  if [ ! -f ${THREAD_BUILD_PREFIX}/\$$i/stamp ]; then \
		    touch ${THREAD_BUILD_PREFIX}/\$$i/stamp; \
		  fi; \
		done; \
		touch server_threaded_stamp" \
	| sh

serv_threaded: ${THREAD_BUILD_PREFIX}/obj/server-threaded/Makefile serv_utilities unix_threaded_core force
	echo "cd ${THREAD_BUILD_PREFIX}/obj/server-threaded; \
	      make all \"SERVER_NAME=${SERVER_THREADED_NAME}\" \
	               \"CFLAGS=${CFLAGS}\" \
		       \"THREAD_FLAGS=${THREAD_FLAGS}\" \
		       \"MAKELIB_FLAGS=${MAKELIB_FLAGS}\" \
		       \"BUILTIN_LIBS=${BUILTIN_LIBS}\" \
		       \"LIB_INSTALL_DIR=${LIB_INSTALL}\" \
	               \"THREAD_INCLUDE_DIR=${THREAD_INCLUDE_DIR}\" \
		       \"THREAD_LIBRARY=${THREAD_LIBRARY}\" \
		       \"UNIX_SOCKET=${DATA_DIRECTORY}/${SOCKET_NAME}\"" \
	| sh

${THREAD_BUILD_PREFIX}/obj/server-threaded/Makefile: \
	server_threaded_stamp \
	server-threaded/Makefile.in \
	configure \
	Makefile \
	thread_cache_stamp
	echo "cp configure ${THREAD_BUILD_PREFIX}/obj; \
	      chmod 755 ${THREAD_BUILD_PREFIX}/obj/configure; \
	      SOURCE_DIR=${SOURCE_PREFIX}; \
	      cd ${THREAD_BUILD_PREFIX}/obj; \
	      CXX=${CC}; \
	      export CXX; \
	      if test -n \"${RANLIB}\"; then \
		  RANLIB=\"${RANLIB}\"; \
		  export RANLIB; \
	      fi; \
	      outputfile=server-threaded/Makefile; \
	      export outputfile; \
	      ./configure --enable-gcc ${CONFIG_FLAGS} --srcdir=\$${SOURCE_DIR}" \
	| sh

# -----------------------------------------------------------------------------------
# END OF THREADED AGENT SERVER
# -----------------------------------------------------------------------------------

# -----------------------------------------------------------------------------------
# AGENT TCL 
# -----------------------------------------------------------------------------------

${BUILD_PREFIX}/obj/tcl/stamp:
${BUILD_PREFIX}/obj/generic-tcl/stamp:
${BUILD_PREFIX}/obj/restrict-tcl/stamp:
${BUILD_PREFIX}/obj/agent-tcl/stamp:

tcl_stamp: stamp \
	${BUILD_PREFIX}/obj/tcl/stamp \
	${BUILD_PREFIX}/obj/generic-tcl/stamp \
	${BUILD_PREFIX}/obj/restrict-tcl/stamp \
	${BUILD_PREFIX}/obj/agent-tcl/stamp
	echo "for i in obj/tcl obj/generic-tcl obj/restrict-tcl \
			obj/agent-tcl; \
		do \
		  if [ ! -d ${BUILD_PREFIX}/\$$i ] ; then \
		    mkdir ${BUILD_PREFIX}/\$$i; \
		    chmod 755 ${BUILD_PREFIX}/\$$i; \
		    touch ${BUILD_PREFIX}/\$$i/stamp; \
		  fi; \
		  if [ ! -f ${BUILD_PREFIX}/\$$i/stamp ]; then \
		    touch ${BUILD_PREFIX}/\$$i/stamp; \
		  fi; \
		done; \
		touch tcl_stamp" \
	| sh

tcl_stack: ${BUILD_PREFIX}/obj/tcl/Makefile force
	echo "cd ${BUILD_PREFIX}/obj/tcl; \
	      make lib \"OTHER_CFLAGS=${TCL_CFLAGS}\" \"MAKELIB_FLAGS=${MAKELIB_FLAGS}\" \"TCL_LIBRARY=${TCL_LIBRARY}\" \"OPTIMIZATION=${OPTIMIZATION}\"; \
	      if test \$$? -ne 0; then \
		  exit 1; \
	      fi; \
	      if test ${GENERATE_SHELLS} = 1; then \
		  make ../../bin/tclsh \"OPTIMIZATION=${OPTIMIZATION}\"; \
		  if test \$$? -ne 0; then \
		      exit 1; \
		  fi; \
	      fi; \
	      if test ${GENERATE_TESTS} = 1; then \
		  make ../../bin/tcltest \"OPTIMIZATION=${OPTIMIZATION}\"; \
		  if test \$$? -ne 0; then \
		      exit 1; \
		  fi; \
	      fi; " \
	| sh

${BUILD_PREFIX}/obj/tcl/Makefile: \
	tcl_stamp \
	tcl7.5/unix/Makefile.in \
	tcl7.5/unix/configure \
	Makefile \
	cache_stamp
	echo "cp tcl7.5/unix/configure ${BUILD_PREFIX}/obj/tcl; \
	      chmod 755 ${BUILD_PREFIX}/obj/tcl/configure; \
	      SOURCE_DIR=${SOURCE_PREFIX}/tcl7.5/unix; \
	      cd ${BUILD_PREFIX}/obj/tcl; \
	      CC=${TCL_CC}; \
	      export CC; \
	      CXX=""; \
	      export CXX; \
	      if test -n \"${RANLIB}\"; then \
	  	  RANLIB=\"${RANLIB}\"; \
		  export RANLIB; \
	      fi; \
	      ./configure --enable-gcc ${CONFIG_FLAGS} --srcdir=\$$SOURCE_DIR" \
	| sh

${BUILD_PREFIX}/obj/tcl/tclConfig.sh: \
	tcl_stamp \
	tcl7.5/unix/Makefile.in \
	tcl7.5/unix/configure \
	Makefile \
	cache_stamp
	echo "cp tcl7.5/unix/configure ${BUILD_PREFIX}/obj/tcl; \
	      chmod 755 ${BUILD_PREFIX}/obj/tcl/configure; \
	      SOURCE_DIR=${SOURCE_PREFIX}/tcl7.5/unix; \
	      cd ${BUILD_PREFIX}/obj/tcl; \
	      CC=${TCL_CC}; \
	      export CC; \
	      CXX=""; \
	      export CXX; \
	      if test -n \"${RANLIB}\"; then \
		  RANLIB=\"${RANLIB}\"; \
		  export RANLIB; \
	      fi; \
	      ./configure --enable-gcc ${CONFIG_FLAGS} --srcdir=\$$SOURCE_DIR" \
	| sh

tcl_generic: ${BUILD_PREFIX}/obj/generic-tcl/Makefile force
	echo "cd ${BUILD_PREFIX}/obj/generic-tcl; \
	      make all \"CFLAGS=${CFLAGS}\"" \
	| sh

${BUILD_PREFIX}/obj/generic-tcl/Makefile: \
	tcl_stamp \
	generic-tcl/Makefile.in \
	configure \
	Makefile \
	cache_stamp
	echo "cp configure ${BUILD_PREFIX}/obj; \
	      chmod 755 ${BUILD_PREFIX}/obj/configure; \
	      SOURCE_DIR=${SOURCE_PREFIX}; \
	      cd ${BUILD_PREFIX}/obj; \
	      CXX=${CC}; \
	      export CXX; \
	      outputfile=generic-tcl/Makefile; \
	      export outputfile; \
	      ./configure --enable-gcc ${CONFIG_FLAGS} --srcdir=\$${SOURCE_DIR}" \
	| sh

tcl8_generic: ${BUILD_PREFIX}/obj/generic-tcl/Makefile.tcl8 force
	echo "cd ${BUILD_PREFIX}/obj/generic-tcl; \
	      make -f Makefile.tcl8 all \"CFLAGS=${CFLAGS}\"" \
	| sh

${BUILD_PREFIX}/obj/generic-tcl/Makefile.tcl8: \
	tcl_stamp \
	generic-tcl/Makefile.tcl8.in \
	configure \
	Makefile \
	cache_stamp
	echo "cp configure ${BUILD_PREFIX}/obj; \
	      chmod 755 ${BUILD_PREFIX}/obj/configure; \
	      SOURCE_DIR=${SOURCE_PREFIX}; \
	      cd ${BUILD_PREFIX}/obj; \
	      CXX=${CC}; \
	      export CXX; \
	      outputfile=generic-tcl/Makefile.tcl8; \
	      export outputfile; \
	      ./configure --enable-gcc ${CONFIG_FLAGS} --srcdir=\$${SOURCE_DIR}" \
	| sh

tcl_restrict: ${BUILD_PREFIX}/obj/restrict-tcl/Makefile force
	echo "cd ${BUILD_PREFIX}/obj/restrict-tcl; \
	      make all \"CFLAGS=${CFLAGS}\"" \
	| sh

${BUILD_PREFIX}/obj/restrict-tcl/Makefile: \
	tcl_stamp \
	restrict-tcl/Makefile.in \
	configure \
	Makefile \
	cache_stamp
	echo "cp configure ${BUILD_PREFIX}/obj; \
	      chmod 755 ${BUILD_PREFIX}/obj/configure; \
	      SOURCE_DIR=${SOURCE_PREFIX}; \
	      cd ${BUILD_PREFIX}/obj; \
	      CXX=${CC}; \
	      export CXX; \
	      outputfile=restrict-tcl/Makefile; \
	      export outputfile; \
	      ./configure --enable-gcc ${CONFIG_FLAGS} --srcdir=\$${SOURCE_DIR}" \
	| sh

tcl8_restrict: ${BUILD_PREFIX}/obj/restrict-tcl/Makefile.tcl8 force
	echo "cd ${BUILD_PREFIX}/obj/restrict-tcl; \
	      make -f Makefile.tcl8 all \"CFLAGS=${CFLAGS}\"" \
	| sh

${BUILD_PREFIX}/obj/restrict-tcl/Makefile.tcl8: \
	tcl_stamp \
	restrict-tcl/Makefile.tcl8.in \
	configure \
	Makefile \
	cache_stamp
	echo "cp configure ${BUILD_PREFIX}/obj; \
	      chmod 755 ${BUILD_PREFIX}/obj/configure; \
	      SOURCE_DIR=${SOURCE_PREFIX}; \
	      cd ${BUILD_PREFIX}/obj; \
	      CXX=${CC}; \
	      export CXX; \
	      outputfile=restrict-tcl/Makefile.tcl8; \
	      export outputfile; \
	      ./configure --enable-gcc ${CONFIG_FLAGS} --srcdir=\$${SOURCE_DIR}" \
	| sh

core_tcl: tcl_generic tcl_restrict

core_tcl8: tcl8_generic tcl8_restrict

tcl_agent: ${BUILD_PREFIX}/obj/agent-tcl/Makefile unix_core core_tcl tcl_stack force
	echo "cd ${BUILD_PREFIX}/obj/agent-tcl; \
	      make lib \
		   \"INTERP_NAME=${TCL_INTERP_NAME}\" \
		   \"LANGUAGE_NAME=${TCL_LANGUAGE_NAME}\" \
		   \"MAKELIB_FLAGS=${MAKELIB_FLAGS}\" \
	           \"CFLAGS=${CFLAGS}\" \
		   \"LIB_INSTALL_DIR=${LIB_INSTALL}\" \
		   \"BUILTIN_LIBS=${BUILTIN_LIBS}\"; \
	      if test \$$? -ne 0; then \
		  exit 1; \
	      fi; \
	      if test ${GENERATE_INTERPS} = 1; then \
	          make ../../bin/${TCL_INTERP_NAME} \
		       \"INTERP_NAME=${TCL_INTERP_NAME}\" \
		       \"LANGUAGE_NAME=${TCL_LANGUAGE_NAME}\" \
	               \"CFLAGS=${CFLAGS}\" \
		       \"LIB_INSTALL_DIR=${LIB_INSTALL}\" \
		       \"BUILTIN_LIBS=${BUILTIN_LIBS}\"; \
		  if test \$$? -ne 0; then \
		      exit 1; \
		  fi; \
	      fi" \
	| sh

${BUILD_PREFIX}/obj/agent-tcl/Makefile: \
	tcl_stamp \
	agent-tcl/Makefile.in \
	configure \
	Makefile \
	cache_stamp
	echo "cp configure ${BUILD_PREFIX}/obj; \
	      chmod 755 ${BUILD_PREFIX}/obj/configure; \
	      SOURCE_DIR=${SOURCE_PREFIX}; \
	      cd ${BUILD_PREFIX}/obj; \
	      CXX=${CC}; \
	      export CXX; \
	      if test -n \"${RANLIB}\"; then \
		  RANLIB=\"${RANLIB}\"; \
		  export RANLIB; \
	      fi; \
	      outputfile=agent-tcl/Makefile; \
	      export outputfile; \
	      ./configure --enable-gcc ${CONFIG_FLAGS} --srcdir=\$${SOURCE_DIR}" \
	| sh

tcl8_agent: ${BUILD_PREFIX}/obj/agent-tcl/Makefile.tcl8 unix_core core_tcl8 force
	echo "cd ${BUILD_PREFIX}/obj/agent-tcl; \
	      make -f Makefile.tcl8 lib \
		   \"INTERP_NAME=${TCL_INTERP_NAME}\" \
		   \"LANGUAGE_NAME=${TCL_LANGUAGE_NAME}\" \
		   \"MAKELIB_FLAGS=${MAKELIB_FLAGS}\" \
	           \"CFLAGS=${CFLAGS}\" \
		   \"LIB_INSTALL_DIR=${LIB_INSTALL}\" \
		   \"BUILTIN_LIBS=${BUILTIN_LIBS}\"; \
	      if test \$$? -ne 0; then \
		  exit 1; \
	      fi; \
	      if test ${GENERATE_INTERPS} = 1; then \
	          make -f Makefile.tcl8 ../../bin/${TCL_INTERP_NAME} \
		       \"INTERP_NAME=${TCL_INTERP_NAME}\" \
		       \"LANGUAGE_NAME=${TCL_LANGUAGE_NAME}\" \
	               \"CFLAGS=${CFLAGS}\" \
		       \"LIB_INSTALL_DIR=${LIB_INSTALL}\" \
		       \"BUILTIN_LIBS=${BUILTIN_LIBS}\"; \
		  if test \$$? -ne 0; then \
		      exit 1; \
		  fi; \
	      fi" \
	| sh

${BUILD_PREFIX}/obj/agent-tcl/Makefile.tcl8: \
	tcl_stamp \
	agent-tcl/Makefile.tcl8.in \
	configure \
	Makefile \
	cache_stamp
	echo "cp configure ${BUILD_PREFIX}/obj; \
	      chmod 755 ${BUILD_PREFIX}/obj/configure; \
	      SOURCE_DIR=${SOURCE_PREFIX}; \
	      cd ${BUILD_PREFIX}/obj; \
	      CXX=${CC}; \
	      export CXX; \
	      if test -n \"${RANLIB}\"; then \
		  RANLIB=\"${RANLIB}\"; \
		  export RANLIB; \
	      fi; \
	      outputfile=agent-tcl/Makefile.tcl8; \
	      export outputfile; \
	      ./configure --enable-gcc ${CONFIG_FLAGS} --srcdir=\$${SOURCE_DIR}" \
	| sh

# -----------------------------------------------------------------------------------
# END OF AGENT TCL 
# -----------------------------------------------------------------------------------

# -----------------------------------------------------------------------------------
# AGENT TK
# -----------------------------------------------------------------------------------

${BUILD_PREFIX}/obj/tk/stamp:
${BUILD_PREFIX}/obj/agent-tk/stamp:

tk_stamp: \
	tcl_stamp \
	${BUILD_PREFIX}/obj/tk/stamp \
	${BUILD_PREFIX}/obj/agent-tk/stamp
	echo "for i in obj/tk obj/agent-tk; \
		do \
		  if [ ! -d ${BUILD_PREFIX}/\$$i ] ; then \
		    mkdir ${BUILD_PREFIX}/\$$i; \
		    chmod 755 ${BUILD_PREFIX}/\$$i; \
		    touch ${BUILD_PREFIX}/\$$i/stamp; \
		  fi; \
		  if [ ! -f ${BUILD_PREFIX}/\$$i/stamp ]; then \
		    touch ${BUILD_PREFIX}/\$$i/stamp; \
		  fi; \
		done; \
		touch tk_stamp" \
	| sh

${BUILD_PREFIX}/obj/tk/Makefile: \
	tk_stamp \
	${BUILD_PREFIX}/obj/tcl/tclConfig.sh \
	${SOURCE_PREFIX}/tk4.1/unix/Makefile.in \
	${SOURCE_PREFIX}/tk4.1/unix/configure \
	Makefile \
	cache_stamp
	echo "cp tk4.1/unix/configure ${BUILD_PREFIX}/obj/tk; \
	      chmod 755 ${BUILD_PREFIX}/obj/tk/configure; \
	      SOURCE_DIR=${SOURCE_PREFIX}/tk4.1/unix; \
	      cd ${BUILD_PREFIX}/obj/tk; \
	      CC=${TCL_CC}; \
	      export CC; \
	      CXX=""; \
	      export CXX; \
	      if test -n \"${RANLIB}\"; then \
		  RANLIB=\"${RANLIB}\"; \
		  export RANLIB; \
	      fi; \
	      ./configure --enable-gcc ${CONFIG_FLAGS} --srcdir=\$$SOURCE_DIR" \
	| sh

${BUILD_PREFIX}/obj/tk/tkConfig.sh: \
	tk_stamp \
	${BUILD_PREFIX}/obj/tcl/tclConfig.sh \
	${SOURCE_PREFIX}/tk4.1/unix/Makefile.in \
	${SOURCE_PREFIX}/tk4.1/unix/configure \
	Makefile
	echo "cp tk4.1/unix/configure ${BUILD_PREFIX}/obj/tk; \
	      chmod 755 ${BUILD_PREFIX}/obj/tk/configure; \
	      SOURCE_DIR=${SOURCE_PREFIX}/tk4.1/unix; \
	      cd ${BUILD_PREFIX}/obj/tk; \
	      CC=${TCL_CC}; \
	      export CC; \
	      CXX=""; \
	      export CXX; \
	      if test -n \"${RANLIB}\"; then \
		  RANLIB=\"${RANLIB}\"; \
		  export RANLIB; \
	      fi; \
	      ./configure --enable-gcc ${CONFIG_FLAGS} --srcdir=\$$SOURCE_DIR" \
	| sh

tk_stack: \
	${BUILD_PREFIX}/obj/tk/Makefile \
	force
	echo "cd ${BUILD_PREFIX}/obj/tk; \
	      make lib \"OTHER_CFLAGS=${TCL_CFLAGS}\" \"MAKELIB_FLAGS=${MAKELIB_FLAGS}\" \"TK_LIBRARY=${TK_LIBRARY}\" \"OPTIMIZATION=${OPTIMIZATION}\"; \
	      if test \$$? -ne 0; then \
		  exit 1; \
	      fi; \
	      if test ${GENERATE_SHELLS} = 1; then \
		  make ../../bin/wish \"OPTIMIZATION=${OPTIMIZATION}\"; \
		  if test \$$? -ne 0; then \
		      exit 1; \
		  fi; \
	      fi; \
	      if test ${GENERATE_TESTS} = 1; then \
		  make ../../bin/tktest \"OPTIMIZATION=${OPTIMIZATION}\"; \
		  if test \$$? -ne 0; then \
		      exit 1; \
		  fi; \
	      fi; " \
	| sh

tk_agent: \
	${BUILD_PREFIX}/obj/agent-tk/Makefile \
	tk_stack tcl_agent \
	force
	echo "cd ${BUILD_PREFIX}/obj/agent-tk; \
	      make lib \
		   \"INTERP_NAME=${TK_INTERP_NAME}\" \
		   \"LANGUAGE_NAME=${TK_LANGUAGE_NAME}\" \
		   \"MAKELIB_FLAGS=${MAKELIB_FLAGS}\" \
	           \"CFLAGS=${CFLAGS}\" \
		   \"LIB_INSTALL_DIR=${LIB_INSTALL}\" \
	           \"TK_LIBRARY=${TK_LIBRARY}\" \
		   \"BUILTIN_LIBS=${BUILTIN_LIBS}\"; \
	      if test \$$? -ne 0; then \
		  exit 1; \
	      fi; \
	      if test ${GENERATE_INTERPS} = 1; then \
	          make ../../bin/${TK_INTERP_NAME} \
		       \"INTERP_NAME=${TK_INTERP_NAME}\" \
		       \"LANGUAGE_NAME=${TK_LANGUAGE_NAME}\" \
	               \"CFLAGS=${CFLAGS}\" \
		       \"LIB_INSTALL_DIR=${LIB_INSTALL}\" \
	               \"TK_LIBRARY=${TK_LIBRARY}\" \
		       \"BUILTIN_LIBS=${BUILTIN_LIBS}\"; \
	          if test \$$? -ne 0; then \
		      exit 1; \
	          fi; \
	      fi" \
	| sh

${BUILD_PREFIX}/obj/agent-tk/Makefile: \
	tk_stamp \
	${SOURCE_PREFIX}/agent-tk/Makefile.in \
	${SOURCE_PREFIX}/configure \
	Makefile \
	cache_stamp
	echo "cp configure ${BUILD_PREFIX}/obj; \
	      chmod 755 ${BUILD_PREFIX}/obj/configure; \
	      SOURCE_DIR=${SOURCE_PREFIX}; \
	      cd ${BUILD_PREFIX}/obj; \
	      CXX=${CC}; \
	      export CXX; \
	      if test -n \"${RANLIB}\"; then \
		  RANLIB=\"${RANLIB}\"; \
		  export RANLIB; \
	      fi; \
	      outputfile=agent-tk/Makefile; \
	      export outputfile; \
	      ./configure --enable-gcc ${CONFIG_FLAGS} --srcdir=\$${SOURCE_DIR}" \
	| sh

# -----------------------------------------------------------------------------------
# END OF AGENT TK 
# -----------------------------------------------------------------------------------

# -----------------------------------------------------------------------------------
# MIT OBJECT TCL 
# -----------------------------------------------------------------------------------

${BUILD_PREFIX}/obj/otcl/stamp:

otcl_stamp: stamp \
	${BUILD_PREFIX}/obj/otcl/stamp
	echo "for i in obj/otcl; \
		do \
		  if [ ! -d ${BUILD_PREFIX}/\$$i ] ; then \
		    mkdir ${BUILD_PREFIX}/\$$i; \
		    chmod 755 ${BUILD_PREFIX}/\$$i; \
		    touch ${BUILD_PREFIX}/\$$i/stamp; \
		  fi; \
		  if [ ! -f ${BUILD_PREFIX}/\$$i/stamp ]; then \
		    touch ${BUILD_PREFIX}/\$$i/stamp; \
		  fi; \
		done; \
		touch otcl_stamp" \
	| sh

otcl_stack: ${BUILD_PREFIX}/obj/otcl/Makefile force
	echo "cd ${BUILD_PREFIX}/obj/otcl; \
	      make lib" \
	| sh

${BUILD_PREFIX}/obj/otcl/Makefile: otcl_stamp otcl/Makefile.in configure Makefile
	echo "cp configure ${BUILD_PREFIX}/obj; \
	      chmod 755 ${BUILD_PREFIX}/obj/configure; \
	      SOURCE_DIR=${SOURCE_PREFIX}; \
	      cd ${BUILD_PREFIX}/obj; \
	      CC=${TCL_CC}; \
	      export CC; \
	      if test -n \"${RANLIB}\"; then \
		  RANLIB=\"${RANLIB}\"; \
		  export RANLIB; \
	      fi; \
	      outputfile=otcl/Makefile; \
	      export outputfile; \
	      ./configure --enable-gcc ${CONFIG_FLAGS} --srcdir=\$$SOURCE_DIR" \
	| sh

# -----------------------------------------------------------------------------------
# END OF MIT OBJECT TCL 
# -----------------------------------------------------------------------------------

# -----------------------------------------------------------------------------------
# EXPECT 
# -----------------------------------------------------------------------------------

${BUILD_PREFIX}/obj/expect/stamp:

expect_stamp: \
	stamp \
	${BUILD_PREFIX}/obj/expect/stamp
	echo "for i in obj/expect; \
		do \
		  if [ ! -d ${BUILD_PREFIX}/\$$i ] ; then \
		    mkdir ${BUILD_PREFIX}/\$$i; \
		    chmod 755 ${BUILD_PREFIX}/\$$i; \
		    touch ${BUILD_PREFIX}/\$$i/stamp; \
		  fi; \
		  if [ ! -f ${BUILD_PREFIX}/\$$i/stamp ]; then \
		    touch ${BUILD_PREFIX}/\$$i/stamp; \
		  fi; \
		done; \
		touch expect_stamp" \
	| sh

exp_stack: \
	${BUILD_PREFIX}/obj/expect/Makefile \
	force
	echo "cd build/obj/expect; \
	      make lib" \
	| sh

${BUILD_PREFIX}/obj/expect/Makefile: \
	expect_stamp \
	${SOURCE_PREFIX}/expect-5.21/Makefile.in \
	${SOURCE_PREFIX}/expect-5.21/configure \
	${BUILD_PREFIX}/obj/tcl/tclConfig.sh \
	${BUILD_PREFIX}/obj/tk/tkConfig.sh \
	Makefile
	echo "cp expect-5.21/configure ${BUILD_PREFIX}/obj/expect; \
	      chmod 755 ${BUILD_PREFIX}/obj/expect/configure; \
	      SOURCE_DIR=${SOURCE_PREFIX}/expect-5.21; \
	      cd ${BUILD_PREFIX}/obj/expect; \
	      CC=${TCL_CC}; \
	      export CC; \
	      if test -n \"${RANLIB}\"; then \
	  	  RANLIB=\"${RANLIB}\"; \
		  export RANLIB; \
	      fi; \
	      ./configure --enable-gcc \
		  ${CONFIG_FLAGS} \
		  --with-tclconfig=${BUILD_PREFIX}/obj/tcl \
		  --with-tkconfig=${BUILD_PREFIX}/obj/tk \
		  --with-tclinclude=${SOURCE_PREFIX}/tcl7.5/generic \
		  --with-tkinclude=${SOURCE_PREFIX}/tk4.1/generic \
		  --srcdir=\$$SOURCE_DIR" \
	| sh

# -----------------------------------------------------------------------------------
# END OF EXPECT 
# -----------------------------------------------------------------------------------

# -----------------------------------------------------------------------------------
# AGENT SCHEME
# -----------------------------------------------------------------------------------

${BUILD_PREFIX}/obj/generic-scheme/stamp:
${BUILD_PREFIX}/obj/agent-scheme/stamp:
${BUILD_PREFIX}/obj/libscheme-0.5/stamp:

scheme_stamp: \
	core_stamp \
	${BUILD_PREFIX}/obj/libscheme-0.5/stamp \
	${BUILD_PREFIX}/obj/generic-scheme/stamp \
	${BUILD_PREFIX}/obj/agent-scheme/stamp
	echo "for i in obj/generic-scheme \
		       obj/libscheme-0.5 \
		       obj/agent-scheme; \
		do \
		  if [ ! -d ${BUILD_PREFIX}/\$$i ] ; then \
		    mkdir ${BUILD_PREFIX}/\$$i; \
		    chmod 755 ${BUILD_PREFIX}/\$$i; \
		    touch ${BUILD_PREFIX}/\$$i/stamp; \
		  fi; \
		  if [ ! -f ${BUILD_PREFIX}/\$$i/stamp ]; then \
		    touch ${BUILD_PREFIX}/\$$i/stamp; \
		  fi; \
		done; \
		touch scheme_stamp" \
	| sh

scheme_stack: ${BUILD_PREFIX}/obj/libscheme-0.5/Makefile force
	echo "cd ${BUILD_PREFIX}/obj/libscheme-0.5; \
	      make lib \"CFLAGS=${CFLAGS}\"" \
	| sh

${BUILD_PREFIX}/obj/libscheme-0.5/Makefile: \
	scheme_stamp \
	${SOURCE_PREFIX}/libscheme-0.5/Makefile.in \
	${SOURCE_PREFIX}/configure \
	Makefile \
	cache_stamp
	echo "cp configure ${BUILD_PREFIX}/obj; \
	      chmod 755 ${BUILD_PREFIX}/obj/configure; \
	      SOURCE_DIR=${SOURCE_PREFIX}; \
	      cd ${BUILD_PREFIX}/obj; \
	      CC=${TCL_CC}; \
	      export CC; \
	      CXX=""; \
	      export CXX; \
	      outputfile=libscheme-0.5/Makefile; \
	      export outputfile; \
	      ./configure --enable-gcc ${CONFIG_SCHEME_FLAGS} --srcdir=\$${SOURCE_DIR} --cache-file=./config.c.cache; \
	      " \
	| sh

scheme_generic: \
	${BUILD_PREFIX}/obj/generic-scheme/Makefile \
	force
	echo "cd ${BUILD_PREFIX}/obj/generic-scheme; \
	      make all \"CFLAGS=${CFLAGS}\"" \
	| sh

${BUILD_PREFIX}/obj/generic-scheme/Makefile: \
	scheme_stamp \
	${SOURCE_PREFIX}/generic-scheme/Makefile.in \
        ${SOURCE_PREFIX}/configure \
        Makefile \
	cache_stamp
	echo "cp ${SOURCE_PREFIX}/configure ${BUILD_PREFIX}/obj; \
	      chmod 755 ${BUILD_PREFIX}/obj/configure; \
	      SOURCE_DIR=${SOURCE_PREFIX}; \
	      cd ${BUILD_PREFIX}/obj; \
	      CC=${CC}; \
	      export CC; \
	      outputfile=generic-scheme/Makefile; \
	      export outputfile; \
	      ./configure --enable-gcc ${CONFIG_FLAGS} --srcdir=\$${SOURCE_DIR}" \
	| sh

scheme_agent: \
	scheme_core \
	scheme_generic \
	scheme_stack \
	${BUILD_PREFIX}/obj/agent-scheme/Makefile 
	echo "cd ${BUILD_PREFIX}/obj/agent-scheme; \
	      make lib \
		   \"INTERP_NAME=${SCHEME_INTERP_NAME}\" \
		   \"LANGUAGE_NAME=${SCHEME_LANGUAGE_NAME}\" \
	           \"CFLAGS=${CFLAGS}\" \
		   \"LIB_INSTALL_DIR=${LIB_INSTALL}\" \
		   \"BUILTIN_LIBS=${BUILTIN_LIBS}\"; \
	      if test \$$? -ne 0; then \
		  exit 1; \
	      fi; \
	      if test ${GENERATE_INTERPS} = 1; then \
	          make ../../bin/${SCHEME_INTERP_NAME} \
		       \"INTERP_NAME=${SCHEME_INTERP_NAME}\" \
		       \"LANGUAGE_NAME=${SCHEME_LANGUAGE_NAME}\" \
	               \"CFLAGS=${CFLAGS}\" \
		       \"LIB_INSTALL_DIR=${LIB_INSTALL}\" \
		       \"BUILTIN_LIBS=${BUILTIN_LIBS}\"; \
		  if test \$$? -ne 0; then \
		      exit 1; \
		  fi; \
	      fi" \
	| sh

${BUILD_PREFIX}/obj/agent-scheme/Makefile: \
	scheme_stamp \
	${SOURCE_PREFIX}/agent-scheme/Makefile.in \
	${SOURCE_PREFIX}/configure \
	Makefile \
	cache_stamp
	echo "cp ${SOURCE_PREFIX}/configure ${BUILD_PREFIX}/obj; \
	      chmod 755 ${BUILD_PREFIX}/obj/configure; \
	      SOURCE_DIR=${SOURCE_PREFIX}; \
	      cd ${BUILD_PREFIX}/obj; \
	      CXX=${CC}; \
	      export CXX; \
	      if test -n \"${RANLIB}\"; then \
		  RANLIB=\"${RANLIB}\"; \
		  export RANLIB; \
	      fi; \
	      outputfile=agent-scheme/Makefile; \
	      export outputfile; \
	      ./configure --enable-gcc ${CONFIG_SCHEME_FLAGS} --srcdir=\$${SOURCE_DIR}" \
	| sh

# -----------------------------------------------------------------------------------
# END OF AGENT SCHEME 
# -----------------------------------------------------------------------------------

# -----------------------------------------------------------------------------------
# AGENT PYTHON
# -----------------------------------------------------------------------------------

${BUILD_PREFIX}/obj/generic-python/stamp:
${BUILD_PREFIX}/obj/agent-python/stamp:

python_stamp: \
	core_stamp \
	${BUILD_PREFIX}/obj/generic-python/stamp \
	${BUILD_PREFIX}/obj/agent-python/stamp
	echo "for i in obj/generic-python \
		       obj/agent-python; \
		do \
		  if [ ! -d ${BUILD_PREFIX}/\$$i ] ; then \
		    mkdir ${BUILD_PREFIX}/\$$i; \
		    chmod 755 ${BUILD_PREFIX}/\$$i; \
		    touch ${BUILD_PREFIX}/\$$i/stamp; \
		  fi; \
		  if [ ! -f ${BUILD_PREFIX}/\$$i/stamp ]; then \
		    touch ${BUILD_PREFIX}/\$$i/stamp; \
		  fi; \
		done; \
		touch python_stamp" \
	| sh

python_generic: \
	${BUILD_PREFIX}/obj/generic-python/Makefile \
	force
	echo "cd ${BUILD_PREFIX}/obj/generic-python; \
	      make all \"CFLAGS=${CFLAGS}\"" \
	| sh

${BUILD_PREFIX}/obj/generic-python/Makefile: \
	python_stamp \
	${SOURCE_PREFIX}/generic-python/Makefile.in \
        ${SOURCE_PREFIX}/configure \
        Makefile \
	cache_stamp
	echo "cp ${SOURCE_PREFIX}/configure ${BUILD_PREFIX}/obj; \
	      chmod 755 ${BUILD_PREFIX}/obj/configure; \
	      SOURCE_DIR=${SOURCE_PREFIX}; \
	      cd ${BUILD_PREFIX}/obj; \
	      CC=${CC}; \
	      export CC; \
	      outputfile=generic-python/Makefile; \
	      export outputfile; \
	      ./configure --enable-gcc ${CONFIG_FLAGS} --srcdir=\$${SOURCE_DIR}" \
	| sh

python_agent: \
	python_core \
	python_generic \
	${BUILD_PREFIX}/obj/agent-python/Makefile 
	echo "cd ${BUILD_PREFIX}/obj/agent-python; \
	      make all \
	           \"CFLAGS=${CFLAGS}\" \
		   \"LANGUAGE_NAME=${PYTHON_LANGUAGE_NAME}\" \
		   \"LIB_INSTALL_DIR=${LIB_INSTALL}\" \
		   \"BUILTIN_LIBS=${BUILTIN_LIBS}\"" \
	| sh

${BUILD_PREFIX}/obj/agent-python/Makefile: \
	python_stamp \
	${SOURCE_PREFIX}/agent-python/Makefile.in \
	${SOURCE_PREFIX}/configure \
	Makefile \
	cache_stamp
	echo "cp ${SOURCE_PREFIX}/configure ${BUILD_PREFIX}/obj; \
	      chmod 755 ${BUILD_PREFIX}/obj/configure; \
	      SOURCE_DIR=${SOURCE_PREFIX}; \
	      cd ${BUILD_PREFIX}/obj; \
	      CC=${CC}; \
	      export CC; \
	      if test -n \"${RANLIB}\"; then \
		  RANLIB=\"${RANLIB}\"; \
		  export RANLIB; \
	      fi; \
	      outputfile=agent-python/Makefile; \
	      export outputfile; \
	      ./configure --enable-gcc ${CONFIG_FLAGS} --srcdir=\$${SOURCE_DIR}" \
	| sh

# -----------------------------------------------------------------------------------
# END OF AGENT PYTHON
# -----------------------------------------------------------------------------------

# -----------------------------------------------------------------------------------
# AGENT C/C++
# -----------------------------------------------------------------------------------

${BUILD_PREFIX}/obj/generic-c-c++/stamp:

c_cxx_stamp: \
	core_stamp \
	${BUILD_PREFIX}/obj/generic-c-c++/stamp
	echo "for i in obj/generic-c-c++; \
		do \
		  if [ ! -d ${BUILD_PREFIX}/\$$i ] ; then \
		    mkdir ${BUILD_PREFIX}/\$$i; \
		    chmod 755 ${BUILD_PREFIX}/\$$i; \
		    touch ${BUILD_PREFIX}/\$$i/stamp; \
		  fi; \
		  if [ ! -f ${BUILD_PREFIX}/\$$i/stamp ]; then \
		    touch ${BUILD_PREFIX}/\$$i/stamp; \
		  fi; \
		done; \
		touch c_cxx_stamp" \
	| sh

c_cxx_generic: \
	${BUILD_PREFIX}/obj/generic-c-c++/Makefile \
	force
	echo "cd ${BUILD_PREFIX}/obj/generic-c-c++; \
	      make all \"CFLAGS=${CFLAGS}\"" \
	| sh

${BUILD_PREFIX}/obj/generic-c-c++/Makefile: \
	c_cxx_stamp \
	${SOURCE_PREFIX}/generic-c-c++/Makefile.in \
        ${SOURCE_PREFIX}/configure \
        Makefile \
	cache_stamp
	echo "cp ${SOURCE_PREFIX}/configure ${BUILD_PREFIX}/obj; \
	      chmod 755 ${BUILD_PREFIX}/obj/configure; \
	      SOURCE_DIR=${SOURCE_PREFIX}; \
	      cd ${BUILD_PREFIX}/obj; \
	      CC=${CC}; \
	      export CC; \
	      outputfile=generic-c-c++/Makefile; \
	      export outputfile; \
	      ./configure --enable-gcc ${CONFIG_FLAGS} --srcdir=\$${SOURCE_DIR}" \
	| sh

# -----------------------------------------------------------------------------------
# END OF AGENT C/C++
# -----------------------------------------------------------------------------------

# -----------------------------------------------------------------------------------
# AGENT JAVA 
# -----------------------------------------------------------------------------------

${THREAD_BUILD_PREFIX}/obj/generic-java/stamp:
${THREAD_BUILD_PREFIX}/obj/agent-java/stamp:
${THREAD_BUILD_PREFIX}/obj/agent-java/agentjava/stamp:
${THREAD_BUILD_PREFIX}/obj/agent-java/native/stamp:

java_stamp: \
	core_stamp \
	${THREAD_BUILD_PREFIX}/obj/generic-java/stamp \
	${THREAD_BUILD_PREFIX}/obj/agent-java/stamp \
	${THREAD_BUILD_PREFIX}/obj/agent-java/agentjava/stamp \
	${THREAD_BUILD_PREFIX}/obj/agent-java/native/stamp
	echo "for i in obj/generic-java \
			obj/agent-java \
			obj/agent-java/agentjava \
			obj/agent-java/native; \
		do \
		  if [ ! -d ${THREAD_BUILD_PREFIX}/\$$i ] ; then \
		    mkdir ${THREAD_BUILD_PREFIX}/\$$i; \
		    chmod 755 ${THREAD_BUILD_PREFIX}/\$$i; \
		    touch ${THREAD_BUILD_PREFIX}/\$$i/stamp; \
		  fi; \
		  if [ ! -f ${THREAD_BUILD_PREFIX}/\$$i/stamp ]; then \
		    touch ${THREAD_BUILD_PREFIX}/\$$i/stamp; \
		  fi; \
		done; \
		touch java_stamp" \
	| sh

java_generic: \
	${THREAD_BUILD_PREFIX}/obj/generic-java/Makefile \
	force
	echo "cd ${THREAD_BUILD_PREFIX}/obj/generic-java; \
	      make all \"CFLAGS=${CFLAGS}\" \
		       \"THREAD_FLAGS=${THREAD_FLAGS}\" \
		       \"JAVA_INCLUDE_DIR=${JAVA_INCLUDE_DIR}\";" \
	| sh

${THREAD_BUILD_PREFIX}/obj/generic-java/Makefile: \
	java_stamp \
	${SOURCE_PREFIX}/generic-java/Makefile.in \
        ${SOURCE_PREFIX}/configure \
        Makefile \
	thread_cache_stamp
	echo "cp ${SOURCE_PREFIX}/configure ${THREAD_BUILD_PREFIX}/obj; \
	      chmod 755 ${THREAD_BUILD_PREFIX}/obj/configure; \
	      SOURCE_DIR=${SOURCE_PREFIX}; \
	      cd ${THREAD_BUILD_PREFIX}/obj; \
	      CXX=${CC}; \
	      export CXX; \
	      outputfile=generic-java/Makefile; \
	      export outputfile; \
	      ./configure --enable-gcc ${CONFIG_FLAGS} --srcdir=\$${SOURCE_DIR}" \
	| sh

java_agent: \
	java_core \
	java_generic \
	${THREAD_BUILD_PREFIX}/obj/agent-java/Makefile 
	echo "cd ${THREAD_BUILD_PREFIX}/obj/agent-java; \
	      make all \
		   \"JAVA_BIN_DIR=${JAVA_BIN_DIR}\" \
		   \"STUB_CC=${TCL_CC}\" \
	           \"CFLAGS=${CFLAGS}\" \
		   \"THREAD_FLAGS=${THREAD_FLAGS}\" \
		   \"JAVA_CFLAGS=${JAVA_CFLAGS}\" \
		   \"MAKELIB_FLAGS=${MAKELIB_FLAGS}\" \
		   \"LANGUAGE_NAME=${JAVA_LANGUAGE_NAME}\" \
		   \"LIB_INSTALL_DIR=${LIB_INSTALL}\" \
		   \"JAVA_INCLUDE_DIR=${JAVA_INCLUDE_DIR}\" \
		   \"BUILTIN_LIBS=${BUILTIN_LIBS}\"" \
	| sh

${THREAD_BUILD_PREFIX}/obj/agent-java/Makefile: \
	java_stamp \
	${SOURCE_PREFIX}/agent-java/Makefile.in \
	${SOURCE_PREFIX}/configure \
	Makefile \
	thread_cache_stamp
	echo "cp ${SOURCE_PREFIX}/configure ${THREAD_BUILD_PREFIX}/obj; \
	      chmod 755 ${THREAD_BUILD_PREFIX}/obj/configure; \
	      SOURCE_DIR=${SOURCE_PREFIX}; \
	      cd ${THREAD_BUILD_PREFIX}/obj; \
	      CXX=${CC}; \
	      export CXX; \
	      if test -n \"${RANLIB}\"; then \
		  RANLIB=\"${RANLIB}\"; \
		  export RANLIB; \
	      fi; \
	      outputfile=agent-java/Makefile; \
	      export outputfile; \
	      ./configure --enable-gcc ${CONFIG_FLAGS} --srcdir=\$${SOURCE_DIR}" \
	| sh

# -----------------------------------------------------------------------------------
# END OF AGENT JAVA 
# -----------------------------------------------------------------------------------

# -----------------------------------------------------------------------------------
# SCRIPT CUSTOMIZATION 
# -----------------------------------------------------------------------------------

tcl_script_directories: \
	core_stamp \
	force
	echo "for i in scripts \
		       scripts/start \
		       scripts/managers \
		       scripts/keys \
		       scripts/examples \
		       scripts/tk \
		       scripts/tk/demos; \
		do \
		  if [ ! -d ${BUILD_PREFIX}/\$$i ] ; then \
		    mkdir ${BUILD_PREFIX}/\$$i; \
		    chmod 755 ${BUILD_PREFIX}/\$$i; \
		  fi; \
		done" \
	| sh

tcl_scripts: \
	tcl_script_directories \
	force
	echo "TCL_LIBRARY=${SOURCE_PREFIX}/scripts/agent; \
	      export TCL_LIBRARY; \
	      LD_LIBRARY_PATH=${BUILD_PREFIX}/lib:${LD_LIBRARY_PATH}; \
	      export LD_LIBRARY_PATH; \
              if test "x${CONFIG_FLAGS}" != "x"; then \
                  _RLD_LIST=""; \
                  if test -f ${BUILD_PREFIX}/lib/libagtcl.so; then \
                      _RLD_LIST=\"\$${_RLD_LIST}${BUILD_PREFIX}/lib/libagtcl.so:\"; \
                  fi; \
                  if test -f ${BUILD_PREFIX}/lib/libagtcl.a; then \
                      _RLD_LIST=\"\$${_RLD_LIST}${BUILD_PREFIX}/lib/libagtcl.a:\"; \
                  fi; \
                  if test -f ${BUILD_PREFIX}/lib/libagrand.so; then \
                      _RLD_LIST=\"\$${_RLD_LIST}${BUILD_PREFIX}/lib/libagrand.so:\"; \
                  fi; \
                  if test -f ${BUILD_PREFIX}/lib/libagrand.a; then \
                      _RLD_LIST=\"\$${_RLD_LIST}${BUILD_PREFIX}/lib/libagrand.a:\"; \
                  fi; \
                  if test -f ${BUILD_PREFIX}/lib/libsttcl.so; then \
                      _RLD_LIST=\"\$${_RLD_LIST}${BUILD_PREFIX}/lib/libsttcl.so:\"; \
                  fi; \
                  if test -f ${BUILD_PREFIX}/lib/libsttcl.a; then \
                      _RLD_LIST=\"\$${_RLD_LIST}${BUILD_PREFIX}/lib/libsttcl.a:\"; \
                  fi; \
                  _RLD_LIST=\"\$${_RLD_LIST}DEFAULT\"; \
                  export _RLD_LIST; \
              fi; \
	      cd ${BUILD_PREFIX}/obj/agent-tcl; \
	      ${BUILD_PREFIX}/bin/${TCL_INTERP_NAME} \
		${SOURCE_PREFIX}/customize.tcl \
		\"${BUILD_PREFIX}\" \
		\"${SOURCE_PREFIX}\" \
		\"${BIN_INSTALL}/${TCL_INTERP_NAME}\" \
		\"${BIN_INSTALL}/${TK_INTERP_NAME}\" \
		\"${PGP_INSTALL}/${PGP_NAME}\" \
		\"${PGP_KEY_DIRECTORY}\" \
		\"${TCL_LIBRARY}\" \
		\"${TK_LIBRARY}\" \
		\"${LIB_INSTALL}\" \
		\"${SERV_INSTALL}/${SERVER_NAME}\" \
		\"${SERV_INSTALL}\" \
		\"${PORT}\" \
		\"${DATA_DIRECTORY}/${SOCKET_NAME}\" \
		\"${LOG_DIRECTORY}\" \
		\"${USERNAME}\" \
		\"${GROUPNAME}\" \
		\"${SERVER_HOME}\" \
		\"${LOCAL_MACHINE}\" \
		\"${DATA_DIRECTORY}\" \
		\"${ADMIN_KEYNAME}\" \
		\"${JAVA_BIN_INSTALL}/java\" \
		\"${JAVA_LIB_INSTALL}/classes.zip\" \
		\"${JAVA_CLASS_INSTALL}\" \
		\"${TEMP_DIRECTORY}\" \
		\"${BIN_INSTALL}/${SCHEME_INTERP_NAME}\"; \
	      if test \$$? -ne 0; then \
		  echo \"**********************************************************\"; \
		  echo \"FATAL ERROR in customize.tcl\"; \
		  echo \"**********************************************************\"; \
		  exit 1; \
	      fi" \
	| sh

customize: tcl_scripts force


# -----------------------------------------------------------------------------------
# END OF SCRIPT CUSTOMIZATION
# -----------------------------------------------------------------------------------

# -----------------------------------------------------------------------------------
# INSTALLATION
# -----------------------------------------------------------------------------------

directories:
	echo "for i in ${PREFIX} ${BIN_PREFIX} ${INC_PREFIX} ${LIB_PREFIX} \
			${BIN_INSTALL} ${SERV_INSTALL} \
			${INC_INSTALL} ${INC_INSTALL}/random \
			${LIB_INSTALL} \
			${TCL_LIBRARY} ${EXAMP_LIBRARY} ${TK_LIBRARY} \
			${SERVER_HOME} ${SERVER_HOME}/.agpgp \
			${DATA_DIRECTORY} ${LOG_DIRECTORY} \
			${TEMP_DIRECTORY} \
			${TK_LIBRARY}/demos ${TK_LIBRARY}/demos/images \
			${JAVA_PREFIX} ${JAVA_BIN_PREFIX} \
			${JAVA_LIB_PREFIX} ${JAVA_INC_PREFIX} \
			${JAVA_CLASS_PREFIX} \
			${JAVA_BIN_INSTALL} ${JAVA_LIB_INSTALL} \
			${JAVA_INC_INSTALL} ${JAVA_CLASS_INSTALL} \
			${JAVA_CLASS_INSTALL}/agentjava \
			${JAVA_CLASS_INSTALL}/sun \
			${JAVA_CLASS_INSTALL}/java \
			${JAVA_BIN_INSTALL}/${ARCH} \
			${JAVA_LIB_INSTALL}/${ARCH}; \
		do \
		  if [ ! -d \$$i ] ; then \
		    mkdir \$$i; \
		    chmod 755 \$$i; \
		    else true; \
		  fi; \
		done; \
		chmod go-rwx ${TEMP_DIRECTORY};" \
	| sh

utilinstall: directories
	${INSTALL_PROG_U} ${BUILD_PREFIX}/scripts/start/machine.tcl ${BIN_INSTALL}/machine.tcl
	${INSTALL_PROG_U} ${BUILD_PREFIX}/scripts/keys/keys.tcl ${BIN_INSTALL}/keys.tcl

confinstall: directories
	${INSTALL_DATA_R} ${BUILD_PREFIX}/scripts/start/agent.languages ${DATA_DIRECTORY}/agent.languages
	${INSTALL_DATA_R} ${BUILD_PREFIX}/scripts/managers/manager.conf ${DATA_DIRECTORY}/manager.conf
	${INSTALL_DATA_R} ${BUILD_PREFIX}/scripts/start/agentd.conf ${DATA_DIRECTORY}/agentd.conf
	${INSTALL_PROG_R} ${BUILD_PREFIX}/scripts/start/start_agentd ${SERV_INSTALL}/start_agentd
	${INSTALL_PROG_R} ${BUILD_PREFIX}/scripts/start/start_man ${SERV_INSTALL}/start_man

includeinstall: directories
	echo "cd ${SOURCE_PREFIX}/platform/include; for i in *.h; \
	  do \
	  ${INSTALL_DATA_U} \$$i ${INC_INSTALL}/\$$i; \
	  done; \
	  cd ${SOURCE_PREFIX}/generic; for i in *.h; \
	  do \
	  ${INSTALL_DATA_U} \$$i ${INC_INSTALL}/\$$i; \
	  done; \
	  cd ${SOURCE_PREFIX}/generic-tcl; for i in *.h; \
	  do \
	  ${INSTALL_DATA_U} \$$i ${INC_INSTALL}/\$$i; \
	  done; \
	  cd ${SOURCE_PREFIX}/restrict-tcl; for i in *.h; \
	  do \
	  ${INSTALL_DATA_U} \$$i ${INC_INSTALL}/\$$i; \
	  done; \
	  cd ${SOURCE_PREFIX}/agent-tcl; for i in *.h; \
	  do \
	  ${INSTALL_DATA_U} \$$i ${INC_INSTALL}/\$$i; \
	  done; \
	  cd ${SOURCE_PREFIX}/agent-tk; for i in *.h; \
	  do \
	  ${INSTALL_DATA_U} \$$i ${INC_INSTALL}/\$$i; \
	  done; \
	  cd ${SOURCE_PREFIX}/random; for i in *.h; \
	  do \
	  ${INSTALL_DATA_U} \$$i ${INC_INSTALL}/random/\$$i; \
	  done" \
	| sh

install: \
	directories \
	utilinstall \
	confinstall \
	install-tcl \
	install-tk \
	install-server 

install-code: \
	directories \
	install-tcl \
	install-tk \
	install-server 

install-server-generic-binaries: directories
	${INSTALL_PROG_U} ${BUILD_PREFIX}/bin/genrand ${SERV_INSTALL}/genrand
	${INSTALL_PROG_U} ${BUILD_PREFIX}/bin/seerand ${SERV_INSTALL}/seerand
	${INSTALL_PROG_U} ${BUILD_PREFIX}/bin/stirrand ${SERV_INSTALL}/stirrand
	${INSTALL_PROG_R} ${BUILD_PREFIX}/scripts/start/kill.tcl ${SERV_INSTALL}/kill.tcl
	${INSTALL_PROG_R} ${BUILD_PREFIX}/scripts/managers/manager.tcl ${SERV_INSTALL}/manager.tcl

install-server-binaries: install-server-generic-binaries directories
	${INSTALL_PROG_R} ${BUILD_PREFIX}/bin/${SERVER_NAME} ${SERV_INSTALL}/${SERVER_NAME}

install-threaded-server-binaries: install-server-generic-binaries directories
	${INSTALL_PROG_R} ${THREAD_BUILD_PREFIX}/bin/${SERVER_THREADED_NAME} ${SERV_INSTALL}/${SERVER_THREADED_NAME}

install-server-libraries: directories
	echo "cd ${BUILD_PREFIX}/lib; \
	      for i in libagserv; \
	      do \
		link=\"\"; \
		file=\"\"; \
		for j in \$$i*.so*; \
		  do \
		    if test -f \$$j; then \
		      if ${TEST_COMMAND} \$$j; then \
			link=\$$j; \
		      else \
			file=\$$j; \
		      fi; \
		    fi; \
		  done; \
		if test "x\$$file" != "x"; then \
		  ${INSTALL_PROG_U} \$$file ${LIB_INSTALL}/\$$file; \
		  rm -f ${LIB_INSTALL}/\$$link; \
		  ln -s \$$file ${LIB_INSTALL}/\$$link; \
		fi; \
		link=\"\"; \
		file=\"\"; \
		for j in \$$i*.a; \
		  do \
		    if test -f \$$j; then \
		      if ${TEST_COMMAND} \$$j; then \
			link=\$$j; \
		      else \
			file=\$$j; \
		      fi; \
		    fi; \
		  done; \
		if test "x\$$file" != "x"; then \
		  ${INSTALL_PROG_U} \$$file ${LIB_INSTALL}/\$$file; \
		  rm -f ${LIB_INSTALL}/\$$link; \
		  ln -s \$$file ${LIB_INSTALL}/\$$link; \
		fi; \
	      done;" \
	| sh

install-threaded-server-libraries: directories
	echo "cd ${THREAD_BUILD_PREFIX}/lib; \
	      for i in libagtserv; \
	      do \
		link=\"\"; \
		file=\"\"; \
		for j in \$$i*.so*; \
		  do \
		    if test -f \$$j; then \
		      if ${TEST_COMMAND} \$$j; then \
			link=\$$j; \
		      else \
			file=\$$j; \
		      fi; \
		    fi; \
		  done; \
		if test "x\$$file" != "x"; then \
		  ${INSTALL_PROG_U} \$$file ${LIB_INSTALL}/\$$file; \
		  rm -f ${LIB_INSTALL}/\$$link; \
		  ln -s \$$file ${LIB_INSTALL}/\$$link; \
		fi; \
		link=\"\"; \
		file=\"\"; \
		for j in \$$i*.a; \
		  do \
		    if test -f \$$j; then \
		      if ${TEST_COMMAND} \$$j; then \
			link=\$$j; \
		      else \
			file=\$$j; \
		      fi; \
		    fi; \
		  done; \
		if test "x\$$file" != "x"; then \
		  ${INSTALL_PROG_U} \$$file ${LIB_INSTALL}/\$$file; \
		  rm -f ${LIB_INSTALL}/\$$link; \
		  ln -s \$$file ${LIB_INSTALL}/\$$link; \
		fi; \
	      done;" \
	| sh

install-server: \
	directories \
	install-server-binaries \
	install-server-libraries

install-threaded-server: \
	directories \
	install-threaded-server-binaries \
	install-threaded-server-libraries

install-agenttcl-binaries: directories
	${INSTALL_PROG_U} ${BUILD_PREFIX}/bin/${TCL_INTERP_NAME} ${BIN_INSTALL}/${TCL_INTERP_NAME}
	${INSTALL_DATA_U} ${SOURCE_PREFIX}/scripts/agent/tclIndex ${TCL_LIBRARY}/tclIndex
	echo "cd ${SOURCE_PREFIX}/scripts/agent; for i in *.tcl; \
	  do \
	  ${INSTALL_PROG_U} \$$i ${TCL_LIBRARY}/\$$i; \
	  done;" \
	| sh

install-agenttcl-examples: directories
	echo "cd ${BUILD_PREFIX}/scripts/examples; for i in *.tcl; \
	  do \
	  ${INSTALL_PROG_U} \$$i ${EXAMP_LIBRARY}/\$$i; \
	  done;" \
	| sh

install-agenttcl-libraries: directories
	echo "cd ${BUILD_PREFIX}/lib; \
	      for i in libagtcl libagrand libsttcl; \
	      do \
		link=\"\"; \
		file=\"\"; \
		for j in \$$i*.so*; \
		  do \
		    if test -f \$$j; then \
		      if ${TEST_COMMAND} \$$j; then \
			link=\$$j; \
		      else \
			file=\$$j; \
		      fi; \
		    fi; \
		  done; \
		if test "x\$$file" != "x"; then \
		  ${INSTALL_PROG_U} \$$file ${LIB_INSTALL}/\$$file; \
		  rm -f ${LIB_INSTALL}/\$$link; \
		  ln -s \$$file ${LIB_INSTALL}/\$$link; \
		fi; \
		link=\"\"; \
		file=\"\"; \
		for j in \$$i*.a; \
		  do \
		    if test -f \$$j; then \
		      if ${TEST_COMMAND} \$$j; then \
			link=\$$j; \
		      else \
			file=\$$j; \
		      fi; \
		    fi; \
		  done; \
		if test "x\$$file" != "x"; then \
		  ${INSTALL_PROG_U} \$$file ${LIB_INSTALL}/\$$file; \
		  rm -f ${LIB_INSTALL}/\$$link; \
		  ln -s \$$file ${LIB_INSTALL}/\$$link; \
		fi; \
	      done;" \
	| sh

install-tcl: \
	directories \
	install-agenttcl-binaries \
	install-agenttcl-examples \
	install-agenttcl-libraries

install-agenttk-binaries: directories
	${INSTALL_PROG_U} ${BUILD_PREFIX}/bin/${TK_INTERP_NAME} ${BIN_INSTALL}/${TK_INTERP_NAME}
	${INSTALL_DATA_U} ${SOURCE_PREFIX}/scripts/agent/tclIndex ${TCL_LIBRARY}/tclIndex
	echo "cd ${SOURCE_PREFIX}/scripts/agent; for i in *.tcl; \
	  do \
	  ${INSTALL_PROG_U} \$$i ${TCL_LIBRARY}/\$$i; \
	  done;" \
	| sh
	${INSTALL_DATA_U} ${SOURCE_PREFIX}/scripts/tk/tclIndex ${TK_LIBRARY}/tclIndex
	${INSTALL_DATA_U} ${SOURCE_PREFIX}/scripts/tk/prolog.ps ${TK_LIBRARY}/prolog.ps
	echo "cd ${SOURCE_PREFIX}/scripts/tk; for i in *.tcl; \
	  do \
	  ${INSTALL_PROG_U} \$$i ${TK_LIBRARY}/\$$i; \
	  done;" \
	| sh

install-agenttk-examples: directories
	echo "cd ${BUILD_PREFIX}/scripts/examples; for i in *.tk; \
	  do \
	  ${INSTALL_PROG_U} \$$i ${EXAMP_LIBRARY}/\$$i; \
	  done;" \
	| sh

install-agenttk-libraries: directories
	echo "cd ${BUILD_PREFIX}/lib; \
	      for i in libagtk libagrand libsttcl libsttk; \
	      do \
		link=\"\"; \
		file=\"\"; \
		for j in \$$i*.so*; \
		  do \
		    if test -f \$$j; then \
		      if ${TEST_COMMAND} \$$j; then \
			link=\$$j; \
		      else \
			file=\$$j; \
		      fi; \
		    fi; \
		  done; \
		if test "x\$$file" != "x"; then \
		  ${INSTALL_PROG_U} \$$file ${LIB_INSTALL}/\$$file; \
		  rm -f ${LIB_INSTALL}/\$$link; \
		  ln -s \$$file ${LIB_INSTALL}/\$$link; \
		fi; \
		link=\"\"; \
		file=\"\"; \
		for j in \$$i*.a; \
		  do \
		    if test -f \$$j; then \
		      if ${TEST_COMMAND} \$$j; then \
			link=\$$j; \
		      else \
			file=\$$j; \
		      fi; \
		    fi; \
		  done; \
		if test "x\$$file" != "x"; then \
		  ${INSTALL_PROG_U} \$$file ${LIB_INSTALL}/\$$file; \
		  rm -f ${LIB_INSTALL}/\$$link; \
		  ln -s \$$file ${LIB_INSTALL}/\$$link; \
		fi; \
	      done;" \
	| sh

install-tk: \
	directories \
	install-agenttk-binaries \
	install-agenttk-examples \
	install-agenttk-libraries

install-agentjava-libraries: directories
	echo "cd ${THREAD_BUILD_PREFIX}/lib; \
	      for i in libagjava libagtrand; \
	      do \
		link=\"\"; \
		file=\"\"; \
		for j in \$$i*.so*; \
		  do \
		    if test -f \$$j; then \
		      if ${TEST_COMMAND} \$$j; then \
			link=\$$j; \
		      else \
			file=\$$j; \
		      fi; \
		    fi; \
		  done; \
		if test "x\$$file" != "x"; then \
		  ${INSTALL_PROG_U} \$$file ${LIB_INSTALL}/\$$file; \
		  rm -f ${LIB_INSTALL}/\$$link; \
		  ln -s \$$file ${LIB_INSTALL}/\$$link; \
		fi; \
		link=\"\"; \
		file=\"\"; \
		for j in \$$i*.a; \
		  do \
		    if test -f \$$j; then \
		      if ${TEST_COMMAND} \$$j; then \
			link=\$$j; \
		      else \
			file=\$$j; \
		      fi; \
		    fi; \
		  done; \
		if test "x\$$file" != "x"; then \
		  ${INSTALL_PROG_U} \$$file ${LIB_INSTALL}/\$$file; \
		  rm -f ${LIB_INSTALL}/\$$link; \
		  ln -s \$$file ${LIB_INSTALL}/\$$link; \
		fi; \
	      done;" \
	| sh

install-java-libraries: directories
	echo "cd ${SOURCE_PREFIX}/jdk1.0.2/jdk/build/lib; \
	      ${INSTALL_DATA_U} appletviewer.properties ${JAVA_LIB_INSTALL}/appletviewer.properties; \
	      ${INSTALL_DATA_U} javac.properties ${JAVA_LIB_INSTALL}/javac.properties; \
	      cd ${SOURCE_PREFIX}/jdk1.0.2/jdk/build/lib/${ARCH}; \
	      for i in *.so*; \
		do \
		  ${INSTALL_PROG_U} \$$i ${JAVA_LIB_INSTALL}/${ARCH}/\$$file; \
		done;" \
	| sh

install-agentjava-classes: directories
	echo "cd ${THREAD_BUILD_PREFIX}/obj/agent-java/agentjava; \
	      for i in *.class; \
		do \
		    ${INSTALL_DATA_U} \$$i ${JAVA_CLASS_INSTALL}/agentjava/\$$i; \
	        done" \
	| sh

install-java-classes: directories
	echo "cd ${SOURCE_PREFIX}/jdk1.0.2/jdk/build/classes; \
	      cp -r sun/* ${JAVA_CLASS_INSTALL}/sun; \
	      cp -r java/* ${JAVA_CLASS_INSTALL}/java" \
	| sh

install-java-binaries: directories
	echo "cd ${SOURCE_PREFIX}/jdk1.0.2/jdk/build/bin/${ARCH}; \
	      for i in java javac javah javap jdb java_g javac_g javah_g javap_g; \
	        do \
		  ${INSTALL_PROG_U} \$$i ${JAVA_BIN_INSTALL}/${ARCH}/\$$i; \
		done; \
	      cd ${SOURCE_PREFIX}/jdk1.0.2/jdk/build/bin; \
	      ${INSTALL_PROG_U} .java_wrapper ${JAVA_BIN_INSTALL}/java_wrapper; \
	      ${INSTALL_PROG_U} javadoc ${JAVA_BIN_INSTALL}/javadoc; \
	      ${INSTALL_PROG_U} upgrade ${JAVA_BIN_INSTALL}/upgrade; \
	      ${INSTALL_PROG_U} appletviewer ${JAVA_BIN_INSTALL}/appletviewer; \
	      for i in java java_g javac javac_g javah javah_g javap javap_g; \
	        do \
		   rm -f ${JAVA_BIN_INSTALL}/\$$i; \
		   ln -s java_wrapper ${JAVA_BIN_INSTALL}/\$$i; \
	        done" \
	| sh

install-java: \
	directories \
	install-java-binaries \
	install-java-classes \
	install-agentjava-classes \
	install-java-libraries \
	install-agentjava-libraries

install-agentscheme-libraries: directories
	echo "cd ${BUILD_PREFIX}/lib; \
	      for i in libscheme libagscheme libagrand; \
	      do \
		link=\"\"; \
		file=\"\"; \
		for j in \$$i*.so*; \
		  do \
		    if test -f \$$j; then \
		      if ${TEST_COMMAND} \$$j; then \
			link=\$$j; \
		      else \
			file=\$$j; \
		      fi; \
		    fi; \
		  done; \
		if test "x\$$file" != "x"; then \
		  ${INSTALL_PROG_U} \$$file ${LIB_INSTALL}/\$$file; \
		  rm -f ${LIB_INSTALL}/\$$link; \
		  ln -s \$$file ${LIB_INSTALL}/\$$link; \
		fi; \
		link=\"\"; \
		file=\"\"; \
		for j in \$$i*.a; \
		  do \
		    if test -f \$$j; then \
		      if ${TEST_COMMAND} \$$j; then \
			link=\$$j; \
		      else \
			file=\$$j; \
		      fi; \
		    fi; \
		  done; \
		if test "x\$$file" != "x"; then \
		  ${INSTALL_PROG_U} \$$file ${LIB_INSTALL}/\$$file; \
		  rm -f ${LIB_INSTALL}/\$$link; \
		  ln -s \$$file ${LIB_INSTALL}/\$$link; \
		fi; \
	      done;" \
	| sh

install-agentscheme-binaries: directories
	${INSTALL_PROG_U} ${BUILD_PREFIX}/bin/${SCHEME_INTERP_NAME} ${BIN_INSTALL}/${SCHEME_INTERP_NAME}

install-scheme: \
	directories \
	install-agentscheme-libraries \
	install-agentscheme-binaries

# -----------------------------------------------------------------------------------
# END OF INSTALLATION
# -----------------------------------------------------------------------------------

# -----------------------------------------------------------------------------------
# RANDOM BITS 
# -----------------------------------------------------------------------------------

ranbits: force
	echo "echo \"\"; \
	      echo \"Making random bits ...\"; \
	      LD_LIBRARY_PATH=${BUILD_PREFIX}/lib; \
	      export LD_LIBRARY_PATH; \
              if test "x${CONFIG_FLAGS}" != "x"; then \
                  _RLD_LIST=""; \
                  if test -f ${BUILD_PREFIX}/lib/libagrand.so; then \
                      _RLD_LIST=\"\$${_RLD_LIST}${BUILD_PREFIX}/lib/libagrand.so:\"; \
                  fi; \
                  if test -f ${BUILD_PREFIX}/lib/libagrand.a; then \
                      _RLD_LIST=\"\$${_RLD_LIST}${BUILD_PREFIX}/lib/libagrand.a:\"; \
                  fi; \
                  _RLD_LIST=\"\$${_RLD_LIST}DEFAULT\"; \
                  export _RLD_LIST; \
              fi; \
	      ${BUILD_PREFIX}/bin/genrand ${DATA_DIRECTORY}/random.bin 3072; \
	      if test \$$? -ne 0; then \
		  exit 1; \
	      fi; \
	      ${INSTALL_DATA_R} ${DATA_DIRECTORY}/random.bin ${SERVER_HOME}/.agpgp/randseed.bin" \
	| sh


# -----------------------------------------------------------------------------------
# CLEANUP 
# -----------------------------------------------------------------------------------

clean:
	echo "rm -rf ${BUILD_PREFIX}/obj" | sh
 
superclean:
	echo "rm -rf ${BUILD_PREFIX}; \
	      rm -f stamp; \
	      rm -f core_stamp; \
	      rm -f tcl_stamp; \
	      rm -f tk_stamp; \
	      rm -f server_stamp" \
	| sh

# -----------------------------------------------------------------------------------
# END OF CLEANUP 
# -----------------------------------------------------------------------------------

depends: gen_depend


gentcl_depend: ${BUILD_PREFIX}/obj/generic/Makefile
	echo "cd ${BUILD_PREFIX}/obj/generic-tcl; \
	     make depend \"CFLAGS=${CFLAGS}\"" \
	| sh

tcl_depend: ${BUILD_PREFIX}/obj/tcl/Makefile
	echo "cd ${BUILD_PREFIX}/obj/tcl; \
	     make depend" \
	| sh

agtcl_depend: ${BUILD_PREFIX}/obj/agent-tcl/Makefile
	echo "cd ${BUILD_PREFIX}/obj/agent-tcl; \
	     make depend" \
	| sh

serv_depend: ${BUILD_PREFIX}/obj/server/Makefile
	echo "cd ${BUILD_PREFIX}/obj/server; \
	     make depend" \
	| sh

rest_depend: ${BUILD_PREFIX}/obj/restrict-tcl/Makefile
	echo "cd ${BUILD_PREFIX}/obj/restrict-tcl; \
	     make depend" \
	| sh

echo_test:
	@echo ${TEST_COMMAND}

depend: gen_depend gentcl_depend tcl_depend agtcl_depend serv_depend rest_depend tcpip_depend

force:
