#
# This file is a Makefile for Tcl.  If it has the name "Makefile.in"
# then it is a template for a Makefile;  to generate the actual Makefile,
# run "./configure", which is a configuration script generated by the
# "autoconf" program (constructs like "@foo@" will get replaced in the
# actual Makefile.
# @(#) Makefile.in 1.10 94/12/26 17:06:27

#----------------------------------------------------------------
# Things you can change to personalize the Makefile for your own
# site (you can make these changes in either Makefile.in or
# Makefile, but changes to Makefile will get lost if you re-run
# the configuration script).
#----------------------------------------------------------------

# To change the compiler switches, for example to change from -O
# to -g, change the following line:
CFLAGS = -O ${OPTIONFLAGS} 

# To disable ANSI-C procedure prototypes reverse the comment characters
# on the following lines:
PROTO_FLAGS =
#PROTO_FLAGS = -DNO_PROTOTYPE

# Mathematical functions like sin and atan2 are enabled for expressions
# by default.  To disable them, reverse the comment characters on the
# following pairs of lines:
MATH_FLAGS =
#MATH_FLAGS = -DTCL_NO_MATH
MATH_LIBS = @MATH_LIBS@
#MATH_LIBS =

# To compile for non-UNIX systems (so that only the non-UNIX-specific
# commands are available), reverse the comment characters on the
# following pairs of lines.  In addition, you'll have to provide your
# own replacement for the "panic" procedure (see panic.c for what
# the current one does).
GENERIC_FLAGS =
#GENERIC_FLAGS = -DTCL_GENERIC_ONLY
UNIX_OBJS = panic.o tclEnv.o tclGlob.o tclMain.o tclMtherr.o \
	tclStackUnixCmd.o tclUnixAZ.o tclUnixStr.o tclUnixUtil.o
#UNIX_OBJS =

# To enable memory debugging reverse the comment characters on the following
# lines.  Warning:  if you enable memory debugging, you must do it
# *everywhere*, including all the code that calls Tcl, and you must use
# ckalloc and ckfree everywhere instead of malloc and free.
MEM_DEBUG_FLAGS =
#MEM_DEBUG_FLAGS = -DTCL_MEM_DEBUG

# Some versions of make, like SGI's, use the following variable to
# determine which shell to use for executing commands:
SHELL =		/bin/sh

#----------------------------------------------------------------
# The information below is modified by the configure script when
# Makefile is generated from Makefile.in.  You shouldn't normally
# modify any of this stuff by hand.
#----------------------------------------------------------------

COMPAT_OBJS =		@LIBOBJS@
AC_FLAGS =		@DEFS@
RANLIB =		@RANLIB@
SRC_DIR =		@srcdir@
VPATH =			@srcdir@

#----------------------------------------------------------------
# The information below should be usable as is.  The configure
# script won't modify it and you shouldn't need to modify it
# either.
#----------------------------------------------------------------


CC =		@CC@
CC_SWITCHES =	${CFLAGS} -I. -I${SRC_DIR} ${AC_FLAGS} ${MATH_FLAGS} \
${GENERIC_FLAGS} ${PROTO_FLAGS} ${MEM_DEBUG_FLAGS} \
-DTCL_LIBRARY=\"${TCL_LIBRARY}\" 

GENERIC_OBJS =	regexp.o tclAsync.o tclBasic.o tclCkalloc.o \
	tclCmdAH.o tclCmdIL.o tclCmdMZ.o tclExpr.o tclGet.o \
	tclHash.o tclHistory.o tclInit.o tclLink.o tclParse.o tclProc.o \
	tclGlueCmd.o tclStack.o tclStackRun.o tclStackCmd.o \
	tclStackProcCmd.o tclState.o tclStateSave.o tclStateLoad.o \
	tclUtil.o tclVar.o

OBJS = ${GENERIC_OBJS} ${UNIX_OBJS} ${COMPAT_OBJS}

SRCS= regexp.c tclAsync.c tclBasic.c tclCkalloc.c \
	tclCmdAH.c tclCmdIL.c tclCmdMZ.c tclExpr.c tclGet.c \
	tclHash.c tclHistory.c tclInit.c tclLink.c tclParse.c tclProc.c \
	tclUtil.c tclVar.c panic.c tclEnv.c tclGlob.c \
	tclMtherr.c tclStack.c tclStackRun.c tclStackCmd.c \
	tclStackProcCmd.c tclStackUnixCmd.c tclState.c tclStateSave.c \
	tclStateLoad.c tclUnixAZ.c tclUnixStr.c tclUnixUtil.c

all: libtcl.a tclsh tcltest

libtcl.a: ${OBJS}
	rm -f libtcl.a
	ar cr libtcl.a ${OBJS}
	$(RANLIB) libtcl.a

tclsh: tclAppInit.o libtcl.a
	${CC} ${CC_SWITCHES} tclAppInit.o libtcl.a ${MATH_LIBS} -o tclsh

tcltest: tclTest.o libtcl.a
	${CC} ${CC_SWITCHES} tclTest.o libtcl.a ${MATH_LIBS} -o tcltest

test: tcltest
	@cwd=`pwd`; \
	cd $(SRC_DIR); TCL_LIBRARY=`pwd`/library; export TCL_LIBRARY; \
	cd $$cwd; ( echo cd $(SRC_DIR)/tests\; source all ) | ./tcltest

configInfo: Makefile
	@rm -f configInfo
	@echo "# Definitions and libraries needed to build Tcl applications" >> configInfo
	@echo "# (generated by the configure script):" >> configInfo
	@echo "TCL_CC_SWITCHES = ${AC_FLAGS} ${MEM_DEBUG_FLAGS}" >> configInfo
	@echo "TCL_LIBS = ${MATH_LIBS} @LIBS@" >> configInfo

Makefile: $(SRC_DIR)/Makefile.in
	$(SHELL) config.status

clean:
	rm -f *.o core errs *~ \#* TAGS *.E a.out errors config.info

distclean: clean
	rm -f Makefile config.status libtcl.a tclsh tcltest config.cache

superclean: distclean

depend:
	makedepend -- $(CC_SWITCHES) -- $(SRCS)

fixstrtod.o: $(SRC_DIR)/compat/fixstrtod.c
	$(CC) -c $(CC_SWITCHES) $(SRC_DIR)/compat/fixstrtod.c

getcwd.o: $(SRC_DIR)/compat/getcwd.c
	$(CC) -c $(CC_SWITCHES) $(SRC_DIR)/compat/getcwd.c

opendir.o: $(SRC_DIR)/compat/opendir.c
	$(CC) -c $(CC_SWITCHES) $(SRC_DIR)/compat/opendir.c

strerror.o: $(SRC_DIR)/compat/strerror.c
	$(CC) -c $(CC_SWITCHES) $(SRC_DIR)/compat/strerror.c

strncasecmp.o: $(SRC_DIR)/compat/strncasecmp.c
	$(CC) -c $(CC_SWITCHES) $(SRC_DIR)/compat/strncasecmp.c

strstr.o: $(SRC_DIR)/compat/strstr.c
	$(CC) -c $(CC_SWITCHES) $(SRC_DIR)/compat/strstr.c

strtod.o: $(SRC_DIR)/compat/strtod.c
	$(CC) -c $(CC_SWITCHES) $(SRC_DIR)/compat/strtod.c

strtol.o: $(SRC_DIR)/compat/strtol.c
	$(CC) -c $(CC_SWITCHES) $(SRC_DIR)/compat/strtol.c

strtoul.o: $(SRC_DIR)/compat/strtoul.c
	$(CC) -c $(CC_SWITCHES) $(SRC_DIR)/compat/strtoul.c

tmpnam.o: $(SRC_DIR)/compat/tmpnam.c
	$(CC) -c $(CC_SWITCHES) $(SRC_DIR)/compat/tmpnam.c

waitpid.o: $(SRC_DIR)/compat/waitpid.c
	$(CC) -c $(CC_SWITCHES) $(SRC_DIR)/compat/waitpid.c

.c.o:
	$(CC) -c $(CC_SWITCHES) $<

#
# Target to check for proper usage of UCHAR macro.
#

checkuchar:
	-egrep isalnum\|isalpha\|iscntrl\|isdigit\|islower\|isprint\|ispunct\|isspace\|isupper\|isxdigit $(SRCS) | grep -v UCHAR

#
# Target to make sure that only symbols with "Tcl" prefixes are
# exported.
#

checkexports: libtcl.a
	-nm -p libtcl.a | awk '$$2 ~ /[TDB]/ { print $$3 }' | sort -n | grep -v '^[Tt]cl'

# DO NOT DELETE THIS LINE -- make depend depends on it.
