# Generated automatically from Makefile.in by configure.
#
# tests/Makefile.in  --
#
# Makefile for Extended Tcl tests.
# 
#------------------------------------------------------------------------------
# Copyright 1992-1995 Karl Lehenbauer and Mark Diekhans.
#
# Permission to use, copy, modify, and distribute this software and its
# documentation for any purpose and without fee is hereby granted, provided
# that the above copyright notice appear in all copies.  Karl Lehenbauer and
# Mark Diekhans make no representations about the suitability of this
# software for any purpose.  It is provided "as is" without express or
# implied warranty.
#------------------------------------------------------------------------------
# $Id: Makefile.in,v 5.0 1995/07/25 05:42:04 markd Rel $
#------------------------------------------------------------------------------
#
SHELL = /bin/sh

#------------------------------------------------------------------------------
# Autoconfig defines that can be overridden in Config.mk

CC          = gcc
CFLAGS      = -g
srcdir      = .
srcbasedir  = /opt/dsap/tcl7.4tk4.0/itcl2.0/tclX7.4a-p2
bldbasedir  = /opt/dsap/tcl7.4tk4.0/itcl2.0/tclX7.4a-p2
prefix      = /opt/dsap/tcl7.4tk4.0
exec_prefix = ${prefix}
ARCH        = 
LIBS        =  -lsocks -lnsl -ldl -lm

#------------------------------------------------------------------------------
# Include user-editable defines.

include ${bldbasedir}/Config.mk

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

LIBTCL       = ${TCL_UCB_LIB}/libtcl.a
LIBTCLX      = ../src/libtclx.a

LDLIBS = -L../src -ltclx -L${TCL_UCB_LIB} -ltcl ${LIBS} ${XLDLIBS}

CC_FLAGS = ${CPPFLAGS} ${XCFLAGS} ${CFLAGS} -I${srcbasedir}/src \
           -I${bldbasedir}/src -I${TCL_UCB_SRC}

LD_FLAGS = ${XLDFLAGS} ${XCFLAGS} ${CFLAGS}

.c.o:
	${CC} ${CC_FLAGS} -c $<

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

OBJS= tclXtest.o

#------------------------------------------------------------------------------
# Compile the test proram.  It is generated from the Tcl test program with 
# a sed script.
#

all: tclXtest runtest

tclXtest: tclXtest.o ${LIBTCLX} ${LIBTCL}
	${CC} ${LD_FLAGS} tclXtest.o ${LDLIBS} -o tclXtest || \
	    (rm -f tclXtest; exit 1)

tclXtest.o: tclXtest.c

tclXtest.c: ${TCL_UCB_SRC}/tclTest.c
	rm -f tclXtest.c	
	echo '#include "../src/tclXconf.h"' >tclXtest.c
	sed -e 's/Tcl_Init(/TclX_Init(/' \
	    -e 's/Tcl_Main(/TclX_Main(/' \
	    -e '/tcl_RcFileName =/d' ${TCL_UCB_SRC}/tclTest.c >>tclXtest.c

#------------------------------------------------------------------------------
# Generate scripts to point the TCLX_LIBRARY environment variable at
# the local master directories so tclXtest can be run.

runtest:
	@echo '#!/bin/sh'                                           >runtest
	@echo "TCLX_LIBRARY=${bldbasedir}/tclmaster"               >>runtest
	@echo "TCL_PROGRAM=${bldbasedir}/tests/tclXtest"           >>runtest
	@echo "export TCLX_LIBRARY TCL_PROGRAM"                    >>runtest
	@echo "if [ \$$# = 0 ]"                                    >>runtest
	@echo "then"                                               >>runtest
	@echo "    exec \$$TCL_PROGRAM"                            >>runtest
	@echo "else"                                               >>runtest
	@echo "    exec \$$TCL_PROGRAM \"\$$@\""                   >>runtest
	@echo "fi"                                                 >>runtest
	chmod a+rx runtest

#------------------------------------------------------------------------------
# Run the UCB and Extended Tcl tests.

test: ucbtests extdtests

ucbtests: all
	./runtest -c "cd ${TCL_UCB_SRC}/tests;source ${srcbasedir}/tests/all"

extdtests: all
	./runtest all

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

clean:
	-rm -f ${OBJS} tclXtest.c tclXtest runtest

#------------------------------------------------------------------------------
# Restore to the distributed state.

distclean: clean
	rm -f Makefile

# Disable Sun's parallel make, it doesn't get the dependencies right.
.NO_PARALLEL:
