#
# Makefile --
#
# Top-level Unix makefile for Extended Tcl.
# 
#------------------------------------------------------------------------------
# Copyright 1992-1999 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 8.10 1999/08/20 23:30:13 wart Exp $
#------------------------------------------------------------------------------
#

#------------------------------------------------------------------------------
# Common and user-editable defines.
#
srcdir = @srcdir@

@MAKEINCLUDE@ @MAKEQUOTE@@bldbasedir@/unix/Common.mk@MAKEQUOTE@

#------------------------------------------------------------------------------
# Flags that were passed on the command line that are to be passed on to
# second level makes.

PASS_FLAGS = "CC=${CC}" "CFLAGS=${CFLAGS}" "LDFLAGS=${LDFLAGS}"

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

all: binaries libraries doc

binaries: TCLX TKX_${TKX_BUILD}

libraries:
	(cd ../tcl/unix && ${MAKE} ${PASS_FLAGS} libraries)

doc:
	(cd ../tcl/unix && ${MAKE} ${PASS_FLAGS} doc)

TCLX: TOOLS
	(cd ../tcl/unix && ${MAKE} ${PASS_FLAGS} all)

TKX_YES: TOOLS
	(cd ../tk/unix && ${MAKE} ${PASS_FLAGS} all)

TKX_NO:

TOOLS:
	(cd tools && ${MAKE} ${PASS_FLAGS} all)

#------------------------------------------------------------------------------
# Static executables.

static: all
	(cd ../tcl/unix && ${MAKE} static)
	(cd ../tk/unix  && ${MAKE} static)

#------------------------------------------------------------------------------
# Standalone executables.

standalone: all
	(cd ../tcl/unix && ${MAKE} standalone)
	(cd ../tk/unix  && ${MAKE} standalone)

#------------------------------------------------------------------------------
# Run the tests.

test: all
	(cd ../tcl/unix && ${MAKE} test)

ucbtests: all
	(cd ../tcl/unix && ${MAKE} ucbtests)

testx: all
	(cd ../tcl/unix && ${MAKE} testx)

tktest: all
	(cd ../tk/unix && ${MAKE} test)

test.static: static
	(cd ../tcl/unix && ${MAKE} test.static)

ucbtests.static: static
	(cd ../tcl/unix && ${MAKE} ucbtests.static)

testx.static: static
	(cd ../tcl/unix && ${MAKE} testx.static)

tktest.static: static
	(cd ../tk/unix && ${MAKE} test.static)

test.standalone: standalone
	(cd ../tcl/unix && ${MAKE} test.standalone)

ucbtests.standalone: standalone
	(cd ../tcl/unix && ${MAKE} ucbtests.standalone)

testx.standalone: standalone
	(cd ../tcl/unix && ${MAKE} testx.standalone)

tktest.standalone: standalone
	(cd ../tk/unix && ${MAKE} test.standalone)

#------------------------------------------------------------------------------
# Rebuild help files.  The are shipped with TclX, but can be rebuilt if Tcl or
# Tk versions have changed.
#
buildhelp:
	(cd ../tcl/unix && ${MAKE} buildhelp)
	(cd ../tk/unix  && ${MAKE} buildhelp)

#------------------------------------------------------------------------------
# Install Extended Tcl.
#
install: all install-binaries install-libraries install-doc

install-binaries: TCLX_INSTALL_BIN TKX_INSTALL_BIN_${TKX_BUILD}

install-libraries: TCLX_INSTALL TKX_INSTALL_${TKX_BUILD}

install-doc: TCLX_INSTALL_MAN

install-exec: all TCLX_INSTALL_EXEC  TKX_INSTALL_EXEC_${TKX_BUILD}

TCLX_INSTALL:
	(cd ../tcl/unix && ${MAKE} install)

TCLX_INSTALL_EXEC:
	(cd ../tcl/unix && ${MAKE} install-exec)

TCLX_INSTALL_BIN:
	(cd ../tcl/unix && ${MAKE} install-binaries)

TKX_INSTALL_YES:
	(cd ../tk/unix && ${MAKE} install)

TKX_INSTALL_EXEC_YES:
	(cd ../tk/unix && ${MAKE} install-exec)

TKX_INSTALL_BIN_YES:
	(cd ../tk/unix && ${MAKE} install-binaries)

TKX_INSTALL_NO:
TKX_INSTALL_EXEC_NO:
TKX_INSTALL_BIN_NO:

TCLX_INSTALL_MAN:
	${CPMANPAGES} -rmcat @${MAN_DIR_SEPARATOR}@ \
	    ${TCLX_MAN_CMD_SECTION} ${TCLX_MAN_FUNC_SECTION} @@ \
	    ${srcbasedir}/doc ${INSTALL_ROOT}${TCLX_INST_MAN}

#------------------------------------------------------------------------------
# Clean up all files that were built by make.

clean:
	(cd ../tk/unix  && ${MAKE} clean)
	(cd ../tcl/unix && ${MAKE} clean)
	(cd tools       && ${MAKE} clean)

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

distclean: clean
	(cd ../tk/unix  && ${MAKE} distclean)
	(cd ../tcl/unix && ${MAKE} distclean)
	(cd tools       && ${MAKE} distclean)
	-rm -f runtcl runtcl.static runtcl.standalone
	-rm -f runwishx runwishx.static runwishx.standalone
	-rm -f Makefile config.status config.cache config.log Common.mk

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


