# Generated automatically from Makefile.in by configure.
#
# Makefile --
#
# Top-level Unix makefile for Extended Tcl.
# 
#------------------------------------------------------------------------------
# Copyright 1992-1996 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.11 1996/03/14 06:11:37 markd Exp $
#------------------------------------------------------------------------------
#

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

include /usr/src/tclX7.5.0/unix/Common.mk
include /usr/src/tclX7.5.0/unix/Config.mk

#------------------------------------------------------------------------------
# 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: TCLX TKX_${TKX_BUILD}

TCLX: TOOLS runtcl
	cd ../tcl/unix; ${MAKE} all

TKX_YES: TOOLS runwishx
	cd ../tk/unix; ${MAKE} ${PASS_FLAGS} all

TKX_NO:

TOOLS:
	cd tools; ${MAKE} ${PASS_FLAGS} all

#------------------------------------------------------------------------------
# Generate scripts to point the TCLX_LIBRARY/TKX_LIBRARY environment variable
# at the local runtime directories so tcl & wishx can be run before installing.

runtcl: Makefile
	@echo '#!/bin/sh'                                           >runtcl
	@echo '# script for testing Tcl before installation'       >>runtcl
	@echo "TCL_LIBRARY=${TCL_SRC}/library"                     >>runtcl
	@echo "TCLX_LIBRARY=${TCLX_TMP_RUNTIME}"                   >>runtcl
	@echo "TCL_PROGRAM=${TCLX_UNIX_BLD_DIR}/tcl"               >>runtcl
	@echo "export TCL_LIBRARY TCLX_LIBRARY TCL_PROGRAM"        >>runtcl
	@echo "LD_LIBRARY_PATH=${bldbasedir}/tcl/unix:${TCL_SHLIB_DIR}:${LD_LIBRARY_PATH}" >>runtcl
	@echo "export LD_LIBRARY_PATH"                             >>runtcl
	@echo "if [ \$$# = 0 ]"                                    >>runtcl
	@echo "then"                                               >>runtcl
	@echo "    exec \$$TCL_PROGRAM"                            >>runtcl
	@echo "else"                                               >>runtcl
	@echo "    exec \$$TCL_PROGRAM \"\$$@\""                   >>runtcl
	@echo "fi"                                                 >>runtcl
	chmod a+rx runtcl

runwishx: Makefile
	@echo '#!/bin/sh'                                          >runwishx
	@echo '# script for testing wishx before installation'    >>runwishx
	@echo "TCL_LIBRARY=${TCL_SRC}/library"                    >>runwishx
	@echo "TCLX_LIBRARY=${TCLX_TMP_RUNTIME}"                  >>runwishx
	@echo "TK_LIBRARY=${TK_SRC}/library"                      >>runwishx
	@echo "TKX_LIBRARY=${TKX_TMP_RUNTIME}"                    >>runwishx
	@echo "TCL_PROGRAM=${TCLX_UNIX_BLD_DIR}/tcl"              >>runwishx
	@echo "WISHX=${TKX_UNIX_BLD_DIR}/wishx"                   >>runwishx
	@echo "export TCL_LIBRARY TCLX_LIBRARY"                   >>runwishx
	@echo "export TK_LIBRARY TKX_LIBRARY TCL_PROGRAM"         >>runwishx
	@echo "LD_LIBRARY_PATH=${bldbasedir}/tk/unix:${TK_SHLIB_DIR}:${bldbasedir}/tcl/unix:${TCL_SHLIB_DIR}:${LD_LIBRARY_PATH}" >>runwishx
	@echo "export LD_LIBRARY_PATH"                            >>runwishx
	@echo "if [ \$$# = 0 ]"                                   >>runwishx
	@echo "then"                                              >>runwishx
	@echo "    exec \$$WISHX"                                 >>runwishx
	@echo "else"                                              >>runwishx
	@echo "    exec \$$WISHX \"\$$@\""                        >>runwishx
	@echo "fi"                                                >>runwishx
	chmod a+rx runwishx

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

test: all
	cd ../tcl/unix; ${MAKE} test

ucbtests: all
	cd ../tcl/unix; ${MAKE} ucbtests

extdtests: all
	cd ../tcl/unix; ${MAKE} extdtests

tktest: all
	cd ../tk/unix;  ${MAKE} test

#------------------------------------------------------------------------------
# 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 TCLX_INSTALL TKX_INSTALL_${TKX_BUILD}

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

TKX_INSTALL_YES:
	cd ../tk/unix; ${MAKE} install

TKX_INSTALL_EXEC_YES:
	cd ../tk/unix; ${MAKE} install-exec

TKX_INSTALL_NO:
TKX_INSTALL_EXEC_NO:

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

clean:
	cd ../tk/unix;  ${MAKE} clean
	cd ../tcl/unix; ${MAKE} clean
	cd tools;       ${MAKE} clean
	-rm -f runtcl runwishx


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

distclean: clean
	cd ../tk/unix;  ${MAKE} distclean
	cd ../tcl/unix; ${MAKE} distclean
	cd tools;       ${MAKE} distclean
	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:
