Makefile.in   [plain text]


#
# Makefile for Expect
#

VERSION_FULL = \"@EXP_VERSION_FULL@\"
VERSION = @EXP_VERSION@
# Tcl's tclConfig requires VERSION have a short-style version string.

srcdir = @srcdir@
VPATH = @srcdir@
SUBDIRS = @subdirs@

######################################################################
# The following lines are things you may want to change
######################################################################

# Tcl include files.  (If you haven't installed Tcl yet, read the README file).
# This must point to the directory that contains ALL of Tcl's include
# files, not just the public ones.
# TCLHDIRDASHI provided so that "-I" can be omitted if TCLHDIR is empty.
TCLHDIR = @TCLHDIR@
TCLHDIRDASHI = @TCLHDIRDASHI@
# Tcl's Tcl library (definitions of parray, etc)
TCL_LIBRARY = @TCL_LIBRARY@

# Tcl library uninstalled.  Should be something like -ltcl or ../tcl/libtcl.a
TCLLIB = @TCL_BUILD_LIB_SPEC@
# Tcl library installed.  Should be something like -ltcl or ../tcl/libtcl.a
TCLLIB_INSTALLED = @TCL_LIB_SPEC@

# The following definitions are only nec. if you want to use Tk with Expect.
# Tk include files
TKHDIRDASHI = @TKHDIRDASHI@
# Tk library
TKLIB = @TK_BUILD_LIB_SPEC@
TKLIB_INSTALLED = @TK_LIB_SPEC@
# X11 include files and other flags to compiler
X11_CFLAGS = @TK_XINCLUDES@
# X library
X11_LD_FLAGS =
X11_PROGS = @X_PROGS@
# X11_PROGS_INSTALLED should really be a separate symbol generated by configure but we're
# hitting configure's limit on substitutions, so be crude and use one less symbol.
X11_PROGS_INSTALLED = @X_PROGS@_installed

# Flags to pass to both cc and ld
# You should be able to leave this just the way it is.  However, here are some
# note if you run into problems:
#
# Avoid -O (optimize) unless you are convinced your optimizer is flawless
# (hint: not a chance).  I have heard many reports of -O causing Expect to
# misbehave.
# I encourage you to use -g (debugging).  While it is unlikely you will
# encounter an internal error in Expect, should this happen, I may just need
# the -g information and then you will need to recompile Expect.  As an aside,
# Expect is not a space or time pig, so this won't affect the performance of
# your Expect scripts.
# Note: On Linux systems which only have dynamic X libraries, the -g prevents
# the linker from using them.  So do not use -g on such systems.
CFLAGS = @CFLAGS@
#XCFLAGS = @CFLAGS@ @EXP_CFLAGS@ @EXP_SHLIB_CFLAGS@ 
XCFLAGS = @CFLAGS@ @EXP_CFLAGS@

# Libraries built with optimization switches have this additional extension
TCL_DBGX =              @TCL_DBGX@
TK_DBGX =		@TK_DBGX@

# From now on, CFLAGS is never used.  Instead, use XCFLAGS.  This is done so
# that we can provide a public interface for CFLAGS thereby allowing users
# to add to it on the Make command-line and still get the rest of the flags
# computed by configure.  Do this at your own risk - it obvious goes against
# the idea of configure's interface, however this is established tradition
# at some sites (e.g., Cygnus)!

# Flags to pass only to linker (after .o files but before libraries)
LDFLAGS = @EXP_LDFLAGS@

# Which C compiler to use.  For simplicity, we inherit the same definition
# used when Tcl was compiled.  Changing this definition here can screw up
# deductions that the configure script made on the assumption that you were
# using a different compiler. 
CC = @CC@

# By default, "make install" will install the appropriate files in
# /usr/local/bin, /usr/local/lib, /usr/local/man, etc.  By changing this
# variable, you can specify an installation prefix other than /usr/local.
# You may find it preferable to call configure with the --prefix option
# to control this information.  This is especially handy if you are
# installing Expect several times (perhaps on a number of machines or
# in different places).  Then you don't have to hand-edit this file.
# See the INSTALL file for more information.  (Analogous information
# applies to the next variable as well.)
prefix = @prefix@

# You can specify a separate installation prefix for architecture-specific
# files such as binaries and libraries.
exec_prefix = @exec_prefix@

# The following definition can be set to non-null for special systems
# like AFS with replication.  It allows the pathnames used for installation
# to be different than those used for actually reference files at
# run-time.  INSTALL_ROOT is prepended to $prefix and $exec_prefix
# when installing files.
INSTALL_ROOT =

# The following Expect scripts are not necessary to have installed as
# commands, but are very useful.  Edit out what you don't want installed.
# The INSTALL file describes these and others in more detail.
# Some Make's screw up if you delete all of them because SCRIPTS is a
# target.  If this is a problem, just comment out the SCRIPTS target itself.
SCRIPTS = timed-run timed-read ftp-rfc autopasswd lpunlock weather \
	passmass rftp kibitz rlogin-cwd xpstat tkpasswd dislocate xkibitz \
	tknewsbiff unbuffer mkpasswd cryptdir decryptdir autoexpect \
	multixterm
# A couple of the scripts have man pages of their own.
# You can delete these too if you don't want'em.
SCRIPTS_MANPAGES = kibitz dislocate xkibitz tknewsbiff unbuffer mkpasswd \
	passmass cryptdir decryptdir autoexpect multixterm

# Short directory path where binaries can be found to support #! hack.
# This directory path can be the same as the directory in which the binary
# actually sits except when the path is so long that the #! mechanism breaks
# (usually at 32 characters).
# The solution is to create a directory with a very short name, which consists
# only of symbolic links back to the true binaries.  Subtracting two for "#!"
# and a couple more for arguments (typically " -f" or " --") gives you 27
# characters.  Pathnames over this length won't be able to use the #! magic.
# For more info on this, see the execve(2) man page.
SHORT_BINDIR = $(exec_prefix)/bin

# If you have ranlib but it should be avoided, change this from "ranlib"
# to something innocuous like "echo".  Known systems with this problem:
# older SCO boxes.
UNSHARED_RANLIB = @UNSHARED_RANLIB@

# Change EVENT_ABLE to "noevent" if your system is:
# old SCO	because poll doesn't exist and select is broken on ptys
# 3b2 SVR3	because select doesn't exist and poll is broken on ptys
#    If you do use "noevent":
# 1) you must also edit expect_cf.h and change
#    "#undef SIMPLE_EVENT" to "#define SIMPLE_EVENT",
# 2) you cannot use any event facilities such as "after" or anything in Tk.
# 3) you cannot expect or interact with two or more processes simultaneously
#
EVENT_ABLE = @EVENT_ABLE@

# Change EVENT_TYPE to poll if your system is:
# NCR SVR4 (1.03.01)			where select is broken on ttys
# StarServer (SVR3 and SVR4.0)		where select is broken on ttys
#
# You will need to change EVENT_TYPE to select if your system is:
# Pyramid OSx in the att universe	where poll is broken (see LIBS below)
#
EVENT_TYPE = @EVENT_TYPE@

# Define default parameters for ptys.  This is used when 1) running in the
# background, 2) user has not defined the variable STTY_INIT to initialize
# ptys, and 3) the pty-driver's defaults suck.
#
# If your system doesn't understand "sane", try "cooked".  Apollo systems
# need nothing at all and should delete this line.  Systems using 8-bit
# character sets may need to disable parity.
# Systems that define sane to use @ as line kill and # as erase should
# use something like "sane kill  erase ".
STTY = -DDFLT_STTY="\"@DEFAULT_STTY_ARGS@\""

######################################################################
# End of things you may want to change
#
# Do not change anything after this
######################################################################

bindir            = $(INSTALL_ROOT)@bindir@
bindir_arch_indep = $(INSTALL_ROOT)$(prefix)/bin
tcl_libdir        = $(INSTALL_ROOT)@libdir@
libdir            = $(INSTALL_ROOT)@libdir@/expect$(VERSION)
libdir_arch_indep = $(INSTALL_ROOT)$(prefix)/lib/expect$(VERSION)

mandir 	= $(INSTALL_ROOT)@mandir@
man1dir = $(mandir)/man1
man3dir = $(mandir)/man3
infodir = $(INSTALL_ROOT)@infodir@
includedir = $(INSTALL_ROOT)@includedir@

# Expect's utility script directories - arch-independent and arch-non-
# independent.  These correspond to the variables "exp_library" and
# "exp_exec_library".
SCRIPTDIR	= $(libdir_arch_indep)
EXECSCRIPTDIR	= $(libdir)

SHELL = @EXP_CONFIG_SHELL@

INSTALL = @INSTALL@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_DATA = @INSTALL_DATA@

AR = ar
ARFLAGS = cr

LOCAL_EXPECT=LD_LIBRARY_PATH=.:@TCL_EXEC_PREFIX@/lib:$(tcl_libdir):$$LD_LIBRARY_PATH ./expect

# These definitions are used by the "subdirs_do" target to pass
# the compile flags down recursively.
FLAGS_TO_PASS = \
	"CC=$(CC)" \
	"CFLAGS=$(XCFLAGS)" \
	"CFLAGS_INT=$(CFLAGS_INT)" \
	"HDEFS=$(HDEFS)" \
	"INSTALL=$(INSTALL)" \
	"INSTALL_DATA=$(INSTALL_DATA)" \
	"INSTALL_PROGRAM=$(INSTALL_PROGRAM)" \
	"LDFLAGS=$(LDFLAGS)" \
	"RUNTEST=$(RUNTEST)" \
	"RUNTESTFLAGS=$(RUNTESTFLAGS)" \
	"SHLIB_CFLAGS=$(@EXP_SHLIB_CFLAGS@)" \
	"prefix=$(prefix)" \
	"exec_prefix=$(exec_prefix)"

#
# Following defines are for DejaGnu
#

# These let the DejaGnu test suite run when DejaGnu isn't 
# installed yet, so run it from the srcdir and objdir.
EXPECT = ` \
  if [ -f $${rootme}/expect ] ; then \
    echo $${rootme}/expect ; \
  else echo expect ; fi`

RUNTESTFLAGS =
RUNTEST = ` \
  if [ -f ${srcdir}/../dejagnu/runtest ] ; then \
    echo ${srcdir}/../dejagnu/runtest ; \
  else echo runtest ;  fi`

PTY_TYPE = @PTY_TYPE@
PTY = pty_$(PTY_TYPE)
CFILES = exp_command.c expect.c $(PTY).c \
	exp_inter.c exp_regexp.c exp_tty.c \
	exp_log.c exp_main_sub.c exp_pty.c \
	exp_trap.c exp_strf.c \
	exp_console.c exp_glob.c exp_win.c exp_clib.c \
	exp_closetcl.c exp_memmove.c exp_tty_comm.c \
	exp_$(EVENT_TYPE).c exp_$(EVENT_ABLE).c \
	exp_chan.c Dbg.c
OFILES = exp_command.o expect.o $(PTY).o exp_inter.o exp_regexp.o exp_tty.o \
	exp_log.o exp_main_sub.o exp_pty.o exp_trap.o \
	exp_console.o exp_strf.o exp_glob.o exp_win.o exp_clib.o \
	exp_closetcl.o exp_memmove.o exp_tty_comm.o \
	exp_$(EVENT_TYPE).o exp_$(EVENT_ABLE).o \
	exp_chan.o Dbg.o
SHARED_OFILES = shared/exp_command.o shared/expect.o shared/$(PTY).o \
	shared/exp_inter.o shared/exp_regexp.o shared/exp_tty.o \
	shared/exp_log.o shared/exp_main_sub.o shared/exp_pty.o \
	shared/exp_trap.o \
	shared/exp_console.o shared/exp_strf.o shared/exp_glob.o \
	shared/exp_win.o shared/exp_clib.o \
	shared/exp_closetcl.o shared/exp_memmove.o shared/exp_tty_comm.o \
	shared/exp_$(EVENT_TYPE).o shared/exp_$(EVENT_ABLE).o \
	shared/exp_chan.o shared/Dbg.o

# Expect libraries (both .a and shared)
EXP_LIB_FILES = @EXP_LIB_FILES@
# default Expect library (shared if possible, otherwise static)
EXP_LIB_FILE = @EXP_LIB_FILE@
# Expect object library (.a)
EXP_UNSHARED_LIB_FILE = @EXP_UNSHARED_LIB_FILE@
# Expect object library (shared, if possible)
EXP_SHARED_LIB_FILE = @EXP_SHARED_LIB_FILE@

# expect must be setuid on crays in order to open ptys (and accordingly,
# you must run this Makefile as root).
# See the FAQ for more info on why this is necessary on Crays.
SETUID = @SETUID@
# SETUID = chmod u+s

# allow us to handle null list gracefully, "end_of_list" should not exist
SCRIPT_LIST = $(SCRIPTS) end_of_list
SCRIPT_MANPAGE_LIST = $(SCRIPTS_MANPAGES) end_of_list

# flags to pass only to the C compiler (not to ld)
# because STTY can include whitespace and quotes, pass STTY separately
CPPFLAGS = -I. -I$(srcdir) $(TCLHDIRDASHI) $(TKHDIRDASHI) $(X11_CFLAGS) \
		-DEXP_VERSION=$(VERSION_FULL) \
		-DSCRIPTDIR=\"$(SCRIPTDIR)\" \
		-DEXECSCRIPTDIR=\"$(EXECSCRIPTDIR)\" \
		-DTCL_DEBUGGER \
		-DUSE_NON_CONST \
		-DSTTY_BIN=\"@STTY_BIN@\"

# Flags to pass to cc (i.e. add to the end of the CLDFLAGS line below).
# Note that setting one will not set others automatically.  Set all that
# are relevant.
#
# NOTE THAT THESE FLAGS ARE NO LONGER SUPPORTED.  THE FUNCTIONALLY IS REPLACED
# BY THE AUTOMATIC CONFIGURATION CODE.  ONLY MESS WITH THE FOLLOWING DEFS IF
# YOU ARE POSITIVE THE AUTO CONFIG CODE IS FAILING.
# 
# -DSYSV3 if you are running SVR3 or later.
# -DSYSV4 if you are running SVR4.  This option does not preclude -DSYSV3.
# -DAUX2 if you are running Mac A/UX 2.
# -DMIPS_BSD if you are on a Mips machine using the BSD universe.
# -D_BSD_SIGNALS if you are on a Silicon Graphics AND want BSD semantics when
#	using the expect library.  Otherwise, you are better off just sticking
#	with rearming signals.

# Flags to pass to ld
# You may need to add additional ones to the end of the LIBS line below:
# -lc -lBSD     If you are using the BSD compatibility library on an HP/UX,
#		force libc.a to be loaded first.
# -lsocket	For SCO UNIX 3.2.2 (this should now be done automatically)
# -lX11		For Pyramid OSx, poll is broken, so use select from X lib
#  /usr/ucblib/libucb.a is needed for solaris 2.0 after -lm
EXP_AND_TCL_LIBS = $(LDFLAGS) @EXP_AND_TCL_LIBS@
EXP_AND_TK_LIBS = $(LDFLAGS) @EXP_AND_TK_LIBS@

CFLAGS_INT = $(MH_CFLAGS) $(CPPFLAGS) $(XCFLAGS)

LIB_INSTALL_DIR = $(tcl_libdir)
LIB_RUNTIME_DIR = $(tcl_libdir)
# I don't understand why Tcl splits these up, but it does.  LIB_RUNTIME_DIR
# can appear as part of the LD_SEARCH_FLAGS inherited by configure.

.c.o:
	$(CC) -c $(CFLAGS_INT) $(STTY) $(HDEFS) $<
	if [ "x$(EXP_UNSHARED_LIB_FILE)" != "x$(EXP_LIB_FILE)" ] ; then \
	   if [ ! -d shared ] ; then \
		mkdir shared ; \
	   else true; fi ; \
	   $(CC) -c $(CFLAGS_INT) @EXP_SHLIB_CFLAGS@ $(STTY) $(HDEFS) $< -o shared/$@ ; \
	fi

all: binaries libraries doc

binaries: expect $(EXP_LIB_FILES) ${X11_PROGS}
	@$(MAKE) subdir_do DO=$@  $(FLAGS_TO_PASS)

libraries:

doc: info dvi

info:
dvi:

# build expect binary that does not depend on Expect's shared libs
# IFF static Tcl/Tk libraries are available.
expect:	exp_main_exp.o $(EXP_UNSHARED_LIB_FILE)
	$(CC) $(XCFLAGS) @TCL_LD_FLAGS@ -o expect exp_main_exp.o $(EXP_UNSHARED_LIB_FILE) $(TCLLIB) $(EXP_AND_TCL_LIBS)
	$(SETUID) expect

# install Expect library
# This is done before the install target because the libraries have to be
# in place before the installed expect is built.  Actually, only the shared
# lib has to be handled this way, but do both here for consistency.
# Can't seem to embed shell comments in backslashed lines, so comments here:
# - To allow bare "load" commands, install shared libs in tcl_libdir rather
#   than Expect's lib-specific directory (libdir).
# - install hand-generated pkgIndex.tcl file.
#   Local copy is pkgIndex rather than pkgIndex.tcl because pkgIndex.tcl.in
#   is too long for some filesystems, sigh.
install_shared_lib: $(EXP_LIB_FILES)
	${srcdir}/mkinstalldirs $(libdir)
	if [ -s $(EXP_UNSHARED_LIB_FILE) ] ; then \
	  $(INSTALL_DATA) $(EXP_UNSHARED_LIB_FILE) $(libdir)/$(EXP_UNSHARED_LIB_FILE) ; \
	  $(UNSHARED_RANLIB) $(libdir)/$(EXP_UNSHARED_LIB_FILE) ; \
	  $(INSTALL_DATA) $(EXP_UNSHARED_LIB_FILE) $(tcl_libdir)/$(EXP_UNSHARED_LIB_FILE) ; \
	  $(UNSHARED_RANLIB) $(tcl_libdir)/$(EXP_UNSHARED_LIB_FILE) ; \
	else true; fi
	if [ -s $(EXP_SHARED_LIB_FILE) ] ; then \
	  $(INSTALL_PROGRAM) $(EXP_SHARED_LIB_FILE) $(tcl_libdir)/$(EXP_SHARED_LIB_FILE) ; \
	  $(INSTALL_PROGRAM) pkgIndex $(libdir)/pkgIndex.tcl ; \
	else true; fi

expect_installed:	exp_main_exp.o $(EXP_LIB_FILE) install_shared_lib
	$(CC) $(XCFLAGS) @EXP_SHLIB_CFLAGS@ @TCL_LD_FLAGS@ -o expect_installed exp_main_exp.o @EXP_LIB_SPEC@ $(TCLLIB_INSTALLED) $(EXP_AND_TCL_LIBS)
	$(SETUID) expect_installed

# Build Expect with TestCenter
expect.tc: exp_main_exp.o $(OFILES) 
	proof $(CC) $(XCFLAGS) @EXP_SHLIB_CFLAGS@ @TCL_LD_FLAGS@ -o expect.tc $(OFILES) exp_main_exp.o $(TCLLIB) $(EXP_AND_TCL_LIBS) 
	$(SETUID) expect.tc

# Build an executable with both Expect and Tk
# IFF static Tcl/Tk libraries are available.
# Yes, I know that the link line can have libraries repeated.  This is a
# consequence of Tcl's configure combining the Tcl and X dependent libs
# together.  I could fix it by testing all the libraries (again, in Expect's
# configure) separately for Expectk, but as far as I know, it doesn't hurt
# anything here, so I'm not worrying about it.
expectk: exp_main_tk.o $(EXP_UNSHARED_LIB_FILE)
	$(CC) $(XCFLAGS) @TCL_LD_FLAGS@ -o expectk exp_main_tk.o $(EXP_UNSHARED_LIB_FILE) $(TKLIB) $(TCLLIB) $(X11_LD_FLAGS) $(EXP_AND_TK_LIBS) 
	$(SETUID) expectk

expectk_installed: exp_main_tk.o $(EXP_LIB_FILE)
	$(CC) $(XCFLAGS) @EXP_SHLIB_CFLAGS@ @TCL_LD_FLAGS@ -o expectk_installed exp_main_tk.o @EXP_LIB_SPEC@ $(TKLIB_INSTALLED) $(TCLLIB_INSTALLED) $(X11_LD_FLAGS) $(EXP_AND_TK_LIBS) 
	$(SETUID) expectk_installed

# Build Expectk with TestCenter
expectk.tc: exp_main_tk.o $(OFILES) 
	proof $(CC) $(XCFLAGS) @TCL_LD_FLAGS@ -o expectk.tc $(OFILES) exp_main_tk.o $(TKLIB) $(TCLLIB) $(X11_LD_FLAGS) $(EXP_AND_TK_LIBS) 
	$(SETUID) expectk.tc

expect-unshared-lib-file :: $(EXP_UNSHARED_LIB_FILE)
$(EXP_UNSHARED_LIB_FILE): $(OFILES)
	-rm -f $(EXP_UNSHARED_LIB_FILE)
	$(AR) $(ARFLAGS) $(EXP_UNSHARED_LIB_FILE) $(OFILES)
	-$(UNSHARED_RANLIB) $(EXP_UNSHARED_LIB_FILE)

# the dependency should really be SHARED_OFILES rather than OFILES
# but there's no way to write a rule that says shared/XYZ.o should
# depend on XYZ.c in a different directory (except by writing the
# rule out for each file, sigh).
expect-shared-lib-file :: $(EXP_SHARED_LIB_FILE)
$(EXP_SHARED_LIB_FILE): $(OFILES)
	-rm -f $(EXP_SHARED_LIB_FILE)
	@TCL_SHLIB_LD@ -o $(EXP_SHARED_LIB_FILE) $(SHARED_OFILES) @EXP_LD_SEARCH_FLAGS@ @EXP_SHLIB_LD_LIBS@

.PHONY: install-info install info
install-info:

install: all install-binaries install-libraries install-doc

install-binaries: expect expect_installed ${X11_PROGS_INSTALLED} $(SCRIPTS)
	${srcdir}/mkinstalldirs $(man1dir) $(man3dir) $(bindir) $(tcl_libdir) $(includedir)
# install Expect
	$(INSTALL_PROGRAM) expect_installed $(bindir)/expect
# install Expectk (and man page) if present
	-if [ -s expectk_installed ] ; then \
	  $(INSTALL_PROGRAM) expectk_installed $(bindir)/expectk ; \
	else true; fi
# install Expect's public include files
#	$(INSTALL_DATA) expect_cf.h $(includedir)
	$(INSTALL_DATA) $(srcdir)/expect.h $(includedir)
	$(INSTALL_DATA) $(srcdir)/expect_tcl.h $(includedir)
	$(INSTALL_DATA) $(srcdir)/expect_comm.h $(includedir)
# force installation of Tcl's private regexp definition - we simply have to
# make it public in order for people to use Expect's C lib.
# hmm - no longer appropriate for Tcl 8.2+ - work on better solution?
#	$(INSTALL_DATA) $(TCLHDIR)/tclRegexp.h $(includedir)
# install Debugger's public include file (just in case it's not there)
	$(INSTALL_DATA) $(srcdir)/tcldbg.h $(includedir)
# some people don't install Tcl, sigh
	TCL_LIBRARY=$(TCL_LIBRARY) ; \
	export TCL_LIBRARY ; \
	   if $(LOCAL_EXPECT) $(srcdir)/fixcat ; then \
	      $(INSTALL_DATA) $(srcdir)/fixcat $(EXECSCRIPTDIR)/cat-buffers ; \
	   else true; fi

install-libraries:
# install standalone scripts and their man pages, if requested
	${srcdir}/mkinstalldirs $(bindir_arch_indep) $(man1dir) $(SCRIPTDIR) $(EXECSCRIPTDIR)
	-for i in $(SCRIPT_LIST) ; do \
	  if [ -f $$i ] ; then \
	    $(INSTALL_PROGRAM) $$i $(bindir_arch_indep)/$$i ; \
	    rm -f $$i ; \
	  else true; fi ; \
	done

install-doc:
	${srcdir}/mkinstalldirs $(man1dir) $(man3dir)
# install Expectk man page if present
	-if [ -s expectk_installed ] ; then \
	  $(INSTALL_DATA) $(srcdir)/expectk.man $(man1dir)/expectk.1 ; \
	else true; fi
# install Expect man page
	$(INSTALL_DATA) $(srcdir)/expect.man $(man1dir)/expect.1
# install man page for Expect and Expectk libraries
	$(INSTALL_DATA) $(srcdir)/libexpect.man $(man3dir)/libexpect.3
	-for i in $(SCRIPT_MANPAGE_LIST) ; do \
	  if [ -f $(srcdir)/example/$$i.man ] ; then \
	    $(INSTALL_DATA) $(srcdir)/example/$$i.man $(man1dir)/$$i.1 ; \
	  else true; fi ; \
	done

$(SCRIPT_LIST):
	TCL_LIBRARY=$(TCL_LIBRARY) ; \
	export TCL_LIBRARY ; \
	$(LOCAL_EXPECT) $(srcdir)/fixline1 $(SHORT_BINDIR) < $(srcdir)/example/$@ > $@

# Delete all the installed files that the `install' target creates
# (but not the noninstalled files such as `make all' creates)
uninstall:
	-rm -f  $(bindir)/expectk \
		$(man1dir)/expect.1 \
		$(man1dir)/expectk.1 \
		$(libdir)/$(EXP_SHARED_LIB_FILE) \
		$(tcl_libdir)/$(EXP_SHARED_LIB_FILE) \
		$(libdir)/$(EXP_UNSHARED_LIB_FILE) \
		$(tcl_libdir)/$(EXP_UNSHARED_LIB_FILE) \
		$(libdir)/pkgIndex.tcl \
		$(man3dir)/libexpect.3 \
		$(includedir)/expect_cf.h \
		$(includedir)/expect.h \
		$(includedir)/expect_tcl.h \
		$(includedir)/expect_comm.h \
		$(EXECSCRIPTDIR)/cat-buffers
# debugger is not removed, since other things could depend on it
# remove standalone scripts and man pages
	-for i in $(SCRIPT_LIST) ; do \
	  rm -f $(bindir_arch_indep)/$$i ; \
	done
	-for i in $(SCRIPT_MANPAGE_LIST) ; do \
	  rm -f $(man1dir)/$$i.1 ; \
	done

###################################
# Targets for Makefile and configure
###################################

#Makefile: $(srcdir)/Makefile.in $(host_makefile_frag) config.status
#	@echo "Rebuilding the Makefile..."
#	$(SHELL) ./config.status
#
# Let "make -f Makefile.in" produce a configure file
#configure: $(srcdir)/configure.in $(srcdir)/Makefile.in \
#		$(srcdir)/expect_cf.h.in $(srcdir)/aclocal.m4
#	@echo "Rebuilding configure..."
#	if [ x"${srcdir}" = x"@srcdir@" ] ; then \
#	  srcdir=. ; export srcdir ; \
#	else true ; fi ; \
#	(cd $${srcdir}; autoconf)
#
#config.status: $(srcdir)/configure
#	@echo "Rebuilding config.status..."
#	$(SHELL) ./config.status --recheck

check:
	@if [ -f testsuite/Makefile ]; then \
	   cd testsuite && $(MAKE) $(FLAGS_TO_PASS) check; \
	else true; fi

# Original Dbgconfig.in comes from the NIST Tcl debugger distribution.
# This rule is not an explicit dependency from any other rule in this
# Makefile.  It is not necessary, as the debugger distribution itself
# keeps it up to date.  However, if the debugger distribution is not
# around, this rule can be used.
Dbgconfigure: $(srcdir)/Dbgconfig.in $(srcdir)/Makefile.in \
		$(srcdir)/tcldbgcf.h.in $(srcdir)/aclocal.m4
	@echo "Rebuilding Dbgconfigure..."
	@if [ x"${srcdir}" = x"@srcdir@" ] ; then \
	  srcdir=. ; export srcdir ; \
	else true ; fi ; \
	(cd $${srcdir}; rm -fr Dbgconfigure ; \
	 autoconf Dbgconfig.in > Dbgconfigure ; \
	 chmod a+x Dbgconfigure)

################################################
# Various "clean" targets follow GNU conventions
################################################

# delete all files from current directory that are created by "make"
clean:
	-rm -rf *~ *.o shared core \
		expect expect_installed expectk expectk_installed \
		dumb exho devtty \
		$(EXP_UNSHARED_LIB_FILE) $(EXP_SHARED_LIB_FILE) \
		$(SCRIPT_LIST)
	@$(MAKE) subdir_do DO=$@ $(FLAGS_TO_PASS)

# like "clean", but also delete files created by "configure"
distclean: clean
	@$(MAKE) subdir_do DO=$@  $(FLAGS_TO_PASS)
	-rm -f Makefile config.status config.cache config.log expect_cf.h
	-rm -f tcldbgcf.h

# like "clean", but doesn't delete test utilities or massaged scripts
# because most people don't have to worry about them
mostlyclean:
	-rm -rf *~ *.o shared core \
		expect expect_installed expectk expectk_installed \
		$(EXP_UNSHARED_LIB_FILE) $(EXP_SHARED_LIB_FILE)
	@$(MAKE) subdir_do DO=$@ $(FLAGS_TO_PASS)

# delete everything from current directory that can be reconstructed
# except for configure
realclean:	distclean

##################################
# Targets for development at NIST
##################################

# the unsets allow calling this via Makefile.in

nist:
	unset CC ; \
	configure --verbose --prefix=/depot/tcl --exec-prefix=/depot/tcl/arch

epg:
	unset CC ; \
	echo configure --verbose --prefix=/home/libes --exec-prefix=/home/libes/arch

mink:
	unset CC ; \
	configure --verbose --prefix=/usr/tmp --exec-prefix=/usr/tmp/arch

cam:
	unset CC ; \
	configure --verbose --prefix=/tmp_mnt/home/fs1a/libes \
		      --exec-prefix=/tmp_mnt/home/fs1a/libes/arch

granta:
	unset CC ; \
	configure --verbose --prefix=/home/nist/libes/cray --exec-prefix=/home/nist/libes/cray/arch


hudson:
	unset CC ; \
	configure --verbose --prefix=/granta/home/nist/libes/ibm --exec-prefix=/granta /home/nist/libes/ibm/arch

# report globals that shouldn't be public but are
bad_globals:
	nm $(EXP_UNSHARED_LIB_FILE) | egrep -v " [a-zU] | _exp| _Exp| _Dbg"

LINTFLAGS = -h -q -x 

lint:
	lint $(LINTFLAGS) $(CPPFLAGS) $(STTY) $(CFILES) exp_main_exp.c $(TCLLINTLIB) | tee expect.lint

# after copying source directory, reestablish all links
symlink:
	rm -rf Dbg* tcldbg* e ek testsuite/aclocal.m4
	ln -s ../tcl-debug/configure	Dbgconfigure
	ln -s ../tcl-debug/configure.in	Dbgconfig.in
	ln -s ../tcl-debug/Makefile.in	DbgMkfl.in
	ln -s ../tcl-debug/pkgIndex.in	DbgpkgInd.in
	ln -s ../tcl-debug/tcldbgcf.h.in
	ln -s ../tcl-debug/tcldbg.h
	ln -s ../tcl-debug/Dbg.c
	ln -s ../aclocal.m4 testsuite

#########################################
# Targets for building with CodeCenter
#########################################

GCCROOT = /depot/gnu/arch/lib/gcc-lib/sparc-sun-sunos4.1/2.3.3
GCCLIB = $(GCCROOT)/libgcc.a
GCCINC = -I$(GCCROOT)/include
# following only on Sparcs
SABERDEFINE = -D__sparc__

# Following target builds expect under CodeCenter.
# Note that CodeCenter doesn't understand backslashes in STTY - there is a
# default value in the code itself that is used.  So if you don't use the default,
# you'll have to hand-edit the source.
# If using ObjectCenter, before loading, type: setopt primary_language C
exp:	$(CFILES) exp_main_exp.c
	#load $(CPPFLAGS) $(CFILES) exp_main_exp.c $(TCLLIB) $(GCCLIB) $(EXP_AND_TCL_LIBS)

# Following target builds expectk under CodeCenter.  Notes:
# Because of explicit #includes of <X11/...> in tk.h, you need to create
# a symlink from your X11 include directory to this directory
tk:     $(CFILES) exp_main_tk.c
	#load $(CPPFLAGS) $(STTY) $(CFILES) exp_main_tk.c $(TKLIB) $(TCLLIB) $(EXP_AND_TK_LIBS)

# Follow definitions are for building expect and expectk under ObjectCenter
oexp:   $(CFILES) exp_main_exp.c
	#load $(CPPFLAGS) $(STTY) -C $(CFILES) exp_main_exp.c $(TCLLIB) $(GCCLIB) $(EXP_AND_TCL_LIBS)

otk:    $(CFILES) exp_main_tk.c
	#load $(CPPFLAGS) $(STTY) -C $(CFILES) exp_main_tk.c $(TKLIB) $(TCLLIB) $(EXP_AND_TK_LIBS)

######################################
# Targets for pushing out releases
######################################

FTPDIR = /proj/itl/www/div826/subject/expect

# make a private tar file for myself
tar:	expect-$(VERSION).tar
	mv expect-$(VERSION).tar expect.tar

# make a release and install it on ftp server
# update web page to reflect new version
ftp:	expect-$(VERSION).tar.Z expect-$(VERSION).tar.gz install-html homepage.html
	cp expect-$(VERSION).tar.Z $(FTPDIR)/expect.tar.Z
	cp expect-$(VERSION).tar.gz $(FTPDIR)/expect.tar.gz
	cp expect-$(VERSION).tar.gz $(FTPDIR)/old/expect-@EXP_VERSION_FULL@.tar.gz
	md5 $(FTPDIR)/expect.tar.gz > expect.tar.gz.md5
	cp HISTORY $(FTPDIR)
	cp README $(FTPDIR)/README.distribution
	cp example/README $(FTPDIR)/example
	cp `pubfile example` $(FTPDIR)/example
	ls -l $(FTPDIR)/expect.tar*
#	delete .Z temp file, still need .gz though for md5 later
	rm expect-$(VERSION).tar*

# make an alpha release and install it on ftp server
alpha:	expect-$(VERSION).tar.Z expect-$(VERSION).tar.gz
	cp expect-$(VERSION).tar.Z $(FTPDIR)/alpha.tar.Z
	cp expect-$(VERSION).tar.gz $(FTPDIR)/alpha.tar.gz
	cp HISTORY $(FTPDIR)
	rm expect-$(VERSION).tar*
	ls -l $(FTPDIR)/alpha.tar*

# make a beta release and install it on ftp server
beta:	expect-$(VERSION).tar.Z expect-$(VERSION).tar.gz
	rm -rf $(FTPDIR)/alpha.tar*
	cp expect-$(VERSION).tar.Z $(FTPDIR)/beta.tar.Z
	cp expect-$(VERSION).tar.gz $(FTPDIR)/beta.tar.gz
	cp HISTORY $(FTPDIR)
	rm expect-$(VERSION).tar*
	ls -l $(FTPDIR)/beta.tar*

expect-$(VERSION).tar: configure
	rm -f ../expect-$(VERSION)
	ln -s `pwd` ../expect-$(VERSION)
	cd ..;tar cvfh $@ `pubfile expect-$(VERSION)`
	mv ../$@ .

expect-$(VERSION).tar.Z:	expect-$(VERSION).tar
	compress -fc expect-$(VERSION).tar > $@

expect-$(VERSION).tar.gz:	expect-$(VERSION).tar
	gzip -fc expect-$(VERSION).tar > $@

test:   expect
	rm -f .tmp
	echo "set objdir" `pwd` > .tmp
	if [ "$(srcdir)" = "." ] ; then \
	   echo "set srcdir" `pwd` >> .tmp ; \
	else echo "set srcdir" $(srcdir) >> .tmp ; fi
	echo "cd \$${srcdir}/tests" >> .tmp
	echo "source all.tcl" >> .tmp
	rootme=`pwd`; export rootme; \
	srcdir=${srcdir} ; export srcdir ; \
	if [ -f ./expect ] ; then  \
	   TCL_LIBRARY=$(TCL_LIBRARY) ; \
	   export TCL_LIBRARY ; fi ; \
	$(LOCAL_EXPECT) -f .tmp
	rm -f .tmp

###########################
# Targets for producing FAQ and homepage
###########################

#WEBDIR = /proj/elib/online/pub/expect
WEBDIR = /proj/itl/www/div826/subject/expect

# create the FAQ in html form
FAQ.html:	FAQ.src FAQ.tcl
	FAQ.src html > FAQ.html

# create the FAQ in text form
FAQ:	FAQ.src FAQ.tcl
	FAQ.src text > FAQ

# generate Expect home page
homepage.html:	homepage.src homepage.tcl expect.tar.gz.md5
	homepage.src > homepage.html

expect.tar.gz.md5:	expect-$(VERSION).tar.gz
	md5 expect-$(VERSION).tar.gz > expect.tar.gz.md5

#expect.tar.gz.md5:	$(FTPDIR)/expect.tar.gz
#	md5 $(FTPDIR)/expect.tar.gz > expect.tar.gz.md5

# install various html docs on our web server
install-html:	FAQ.html homepage.html
	cp homepage.html $(WEBDIR)/index.html
	cp FAQ.html $(WEBDIR)
#	cp FAQ.src $(WEBDIR)



#	cp FAQ.tcl $(WEBDIR)

# HTMLize man pages for examples and push them out to the web server
example-man-pages:
	-for i in $(SCRIPT_MANPAGE_LIST) ; do \
	  if [ -f $(srcdir)/example/$$i.man ] ; then \
	    rman -f HTML $(srcdir)/example/$$i.man > $(srcdir)/example/$$i.man.html ; \
	    cp $(srcdir)/example/$$i.man.html $(FTPDIR)/example ; \
	  else true; fi ; \
	done

# add recursive support to the build process.
subdir_do: force
	@for i in $(SUBDIRS); do \
	   echo "Making $(DO) in $${i}..." ; \
	   if [ -d ./$$i ] ; then \
	     if (rootme=`pwd`/ ; export rootme ; \
	       rootsrc=`cd $(srcdir); pwd`/ ; export rootsrc ; \
	       cd ./$$i; \
	       $(MAKE) $(FLAGS_TO_PASS) $(DO)) ; then true ; \
	     else exit 1 ; fi ; \
	   else true ; fi ; \
	done
force:

## dependencies will be put after this line... ##
Dbg.o: $(srcdir)/Dbg.c tcldbg.h 
exp_$(EVENT_ABLE).o: $(srcdir)/exp_$(EVENT_ABLE).c expect_cf.h expect.h \
	exp_command.h exp_event.h 
exp_$(EVENT_TYPE).o: $(srcdir)/exp_$(EVENT_TYPE).c expect_cf.h expect.h \
	exp_command.h exp_event.h 
exp_command.o: $(srcdir)/exp_command.c expect_cf.h exp_tty.h \
	exp_rename.h expect.h exp_command.h \
	exp_log.h exp_event.h exp_pty.h 
exp_console.o: $(srcdir)/exp_console.c expect_cf.h exp_rename.h exp_prog.h \
	exp_log.h
exp_glob.o: $(srcdir)/exp_glob.c expect_cf.h
exp_inter.o: $(srcdir)/exp_inter.c expect_cf.h \
	exp_tty_in.h exp_tty.h exp_rename.h expect.h exp_command.h \
	exp_log.h exp_regexp.h exp_tstamp.h
exp_log.o: $(srcdir)/exp_log.c expect_cf.h expect.h \
	exp_rename.h exp_log.h
exp_main_exp.o: $(srcdir)/exp_main_exp.c expect_cf.h \
	expect.h exp_rename.h exp_command.h exp_log.h
exp_main_sub.o: $(srcdir)/exp_main_sub.c expect_cf.h \
	exp_rename.h \
	expect.h exp_command.h exp_tty_in.h exp_tty.h exp_log.h \
	exp_event.h 
exp_main_tk.o: $(srcdir)/exp_main_tk.c expect_cf.h tcldbg.h
	$(CC) -c @TK_DEFS@ $(CFLAGS_INT) $(HDEFS) $<	
shared/exp_main_tk.o: $(srcdir)/exp_main_tk.c expect_cf.h tcldbg.h
	$(CC) -c @TK_DEFS@ $(CFLAGS_INT) $(HDEFS) $<	
exp_noevent.o: $(srcdir)/exp_noevent.c expect_cf.h exp_prog.h exp_command.h \
	exp_event.h
exp_poll.o: $(srcdir)/exp_poll.c expect_cf.h expect.h \
	exp_command.h exp_event.h 
	$(CC) -c $(CFLAGS_INT) @TCL_DEFS@ $(HDEFS) $<
shared/exp_poll.o: $(srcdir)/exp_poll.c expect_cf.h expect.h \
	exp_command.h exp_event.h 
	$(CC) -c $(CFLAGS_INT) @EXP_SHLIB_CFLAGS@ @TCL_DEFS@ $(HDEFS) $< -o shared/$@
exp_pty.o: $(srcdir)/exp_pty.c expect_cf.h exp_rename.h exp_pty.h 
exp_regexp.o: $(srcdir)/exp_regexp.c expect_cf.h \
	expect.h exp_regexp.h 
exp_select.o: $(srcdir)/exp_select.c expect_cf.h \
	expect.h exp_command.h exp_event.h 
exp_simple.o: $(srcdir)/exp_simple.c expect_cf.h \
	expect.h exp_command.h exp_event.h 
exp_strf.o: $(srcdir)/exp_strf.c expect_cf.h
exp_trap.o: $(srcdir)/exp_trap.c expect_cf.h expect.h \
	exp_command.h exp_log.h
exp_tty.o: $(srcdir)/exp_tty.c expect_cf.h \
	expect.h exp_rename.h exp_tty_in.h exp_tty.h exp_log.h \
	exp_command.h 
exp_win.o: $(srcdir)/exp_win.c exp_win.h expect_cf.h
expect.o: $(srcdir)/expect.c expect_cf.h \
	exp_rename.h expect.h exp_command.h \
	exp_log.h exp_event.h exp_tty.h exp_tstamp.h
lib_exp.o: $(srcdir)/lib_exp.c expect_cf.h exp_rename.h expect.h
pty_sgttyb.o: $(srcdir)/pty_sgttyb.c expect_cf.h exp_rename.h exp_tty_in.h \
	exp_tty.h exp_pty.h 
pty_termios.o: $(srcdir)/pty_termios.c expect_cf.h exp_win.h \
	exp_tty_in.h exp_tty.h exp_rename.h exp_pty.h 
pty_unicos.o: $(srcdir)/pty_unicos.c expect_cf.h exp_rename.h