# Generated automatically from Makefile.in by configure.
#
# Makefile --
#
# Makefile for Extended Tcl package library.  Also generates help files
# for both standard and Extended Tcl.  This assumes that Tcl has compiled
# successfully, as it is run here.
#------------------------------------------------------------------------------
# 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:59:43 markd Rel $
#------------------------------------------------------------------------------
#
SHELL = /bin/sh

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

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}

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

include ${bldbasedir}/Config.mk

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

HELPSRC      = ${srcbasedir}/tclhelp
TCLMANPAGES  = ${srcbasedir}/tools/tclmanpages
GENINDEX     = ../runtcl ${srcbasedir}/tools/genindex.tcl
BLDMANHELP   = ../runtcl ${srcbasedir}/tools/bldmanhelp
INST_MASTER  = ${TCL_MASTERDIR}/`../tools/tclxversion`
INSTCOPY     = ../runtcl ../tools/instcopy

TMPMASTER    = ../tclmaster
TCLINIT      = ${TMPMASTER}/TclInit.tcl
BUILDIDX     = ${TMPMASTER}/buildidx.tcl
TCLTLIB      = ${TMPMASTER}/tcl.tlib
TCLTNDX      = ${TMPMASTER}/tcl.tndx
LOADOUSTER   = ${TMPMASTER}/loadouster.tcl
TMPHELP      = ${TMPMASTER}/help

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

TCL_SRCS = arrayprocs.tcl   compat.tcl       convlib.tcl      edprocs.tcl    \
           forfile.tcl      globrecur.tcl    help.tcl         profrep.tcl    \
           pushd.tcl        setfuncs.tcl     showproc.tcl     stringfile.tcl \
           tcllib.tcl       fmath.tcl        tclshell.tcl     buildhelp.tcl  \
           parray.tcl       ${TCL_UCB_SRC}/library/parray.tcl

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

all: made.tmp ${TCLINIT} ${BUILDIDX} ${TCLTLIB} ${TCLTNDX} ${LOADOUSTER} \
     ${TMPHELP}

# Can't use 'test -d X || mkdir X', it don't work on Ultrix
made.tmp:
	if [ ! -d ${TMPMASTER} ] ; then mkdir ${TMPMASTER} ; else exit 0; fi
	touch made.tmp

${TCLINIT}: ${srcdir}/TclInit.tcl made.tmp
	rm -f ${TCLINIT}
	cp ${srcdir}/TclInit.tcl ${TCLINIT}

${BUILDIDX}: buildidx.tcl made.tmp
	rm -f ${BUILDIDX}
	cp ${srcdir}/buildidx.tcl ${BUILDIDX}

${TCLTLIB}: ${TCL_SRCS} made.tmp
	-rm -f ${TCLTLIB} ${TCLTNDX}
	(cd ${srcdir}; cat ${TCL_SRCS}) | \
	    grep -v '^#[^@].*' | grep -v '#$$' > $@

${TCLTNDX}: ${TCLTLIB} ${TCLINIT} ${BUILDIDX} made.tmp
	${GENINDEX} ${TCLTLIB}

${LOADOUSTER}: loadouster.tcl made.tmp
	rm -f ${LOADOUSTER}
	cp ${srcdir}/loadouster.tcl ${LOADOUSTER}

#------------------------------------------------------------------------------
# Need a "help" directory in the tmp master so that the help command will
# work before installation.  Normally just symlink, unless we don't have them.
# (Must enforce master dir being there, as a dependency on make.tmp causes
# it to be always rebuilt).

${TMPMASTER}/help:
	if [ ! -d ${TMPMASTER} ] ; then mkdir ${TMPMASTER} ; else exit 0; fi
	if [ "YES" = "YES" ]; then \
	    rm -rf ${TMPHELP} ;\
	    ln -s ${HELPSRC} ${TMPHELP} ;\
	else \
	    rm -rf ${TMPHELP} ;\
	    mkdir ${TMPHELP} ;\
	    (cd ${HELPSRC}; tar -cf -) | (cd ${TMPHELP}; tar -xf -) ;\
	fi

#------------------------------------------------------------------------------
# Build help for Tcl & TclX.

buildtclhelp: ${TCLINITTCL} ${TCLTLIB}
	rm -rf ${HELPSRC} ${TMPHELP}
	mkdir ${HELPSRC}
	${BLDMANHELP} ${TCL_UCB_SRC}/doc ${TCLMANPAGES} ${HELPSRC} Tcl.brf
	../runtcl -c "buildhelp ${HELPSRC} TclX.brf ${srcbasedir}/man/TclX.n"

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

install:
	${INSTCOPY} ${srcdir}/TclInit.tcl ${TCLTLIB} ${TCLTNDX} \
	    ${srcdir}/buildidx.tcl ${srcdir}/loadouster.tcl \
	    ${INSTALL_ROOT}${INST_MASTER}
	${INSTCOPY} ${HELPSRC} ${INSTALL_ROOT}${INST_MASTER}/help

install-master: install

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

clean:
	rm -rf ${TMPMASTER} made.tmp

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

distclean: clean
	rm -f Makefile

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