# Generated automatically from Makefile.in by configure.
# ---------------------------------------------------------------------------
#           [incr Tcl] - Object-oriented programming in Tcl
# ---------------------------------------------------------------------------
# This file is a Makefile for [incr 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.
# ---------------------------------------------------------------------------
ROOTNAME = itcl
VERSION  = 1.5
PACKAGE  = $(ROOTNAME)-$(VERSION)

# ---------------------------------------------------------------------------
# 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.)
# ---------------------------------------------------------------------------
# INSTALLATION DIRECTORIES
# ---------------------------------------------------------------------------

# Top-level directory in which to install architecture-specific files:
prefix = /usr/local
exec_prefix = $(prefix)

# Directory in which to install the archive libitcl.a:
LIB_DIR = $(exec_prefix)/lib

# Directory in which to install the include file itcl.h:
INCLUDE_DIR = $(exec_prefix)/include/tcl

# Directory in which to install the programs (itcl_wish and itcl_sh):
BIN_DIR = $(exec_prefix)/bin

# ---------------------------------------------------------------------------
# COMPILATION SOURCES/LIBRARIES
# ---------------------------------------------------------------------------

# Tcl source directory (must contain tclInt.h)
# (the configure script should find it; if not, edit below)
TCL_INC = -I/usr/src/itcl-1.5/../tcl7.3

# Tk include directory
# (the configure script should find it; if not, edit below)
TK_INC = -I/usr/src/itcl-1.5/../tk3.6

# X11 include directory
# (the configure script should find it; if it is /usr/include,
# it will be commented out)
X11_INC =	 -I/usr/X386/include

# Tcl library
# (the configure script should find it; if not, edit below)
TCL_LIB = -L/usr/src/itcl-1.5/../tcl7.3 -ltcl

# Tk library
# (the configure script should find it; if not, edit below)
TK_LIB = -L/usr/src/itcl-1.5/../tk3.6 -ltk

# Linker switch(es) to use to link with the X11 library archive (the
# configure script will try to set this value automatically, but you
# can override it).
X11_LIB = -L/usr/X386/lib -lX11

# Libraries to use when linking:  must include at least Tk, Tcl, Xlib,
# and the math library (in that order).  The " -lm" part will be
# replaced (or has already been replaced) with relevant libraries as
# determined by the configure script.
LIBS = $(TK_LIB) $(TCL_LIB) $(X11_LIB)  -lm -lm -lieee

# Composite list of include files
INCS = -I$(SRC_DIR) $(TCL_INC) $(TK_INC) $(X11_INC)

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

# To turn off the security checks that disallow incoming sends when
# the X server appears to be insecure, reverse the comments on the
# following lines:
SECURITY_FLAGS =
#SECURITY_FLAGS = -DTK_NO_SECURITY

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

# 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.
# ---------------------------------------------------------------------------

AC_FLAGS =		
INSTALL =		/usr/bin/install -c
INSTALL_PROGRAM =	$(INSTALL) -s
INSTALL_DATA =		$(INSTALL) -m 644
RANLIB =		ranlib
SRC_DIR =		.
VPATH =			.

# ---------------------------------------------------------------------------
# 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) $(INCS) $(AC_FLAGS) $(PROTO_FLAGS) \
	$(SECURITY_FLAGS) $(MEM_DEBUG_FLAGS)

SRCS = itcl_class.c itcl_core.c \
	itcl_methods.c itcl_objects.c itcl_vars.c \
	itcl_util.c

OBJS = itcl_class.o itcl_core.o \
	itcl_methods.o itcl_objects.o itcl_vars.o \
	itcl_util.o

SOBJS = itcl_class.so itcl_core.so \
	itcl_methods.so itcl_objects.so itcl_vars.so \
	itcl_util.so

LDFLAGS = -N
DLLBIN = /usr/dll/bin
SHCC = ${CC} -B/usr/dll/jump/
SHOBJS = ${OBJS:.o=.so}
JUMP_VER = 3.1.0
JUMP_ARGS = -v ${JUMP_VER} -a 0x6a340000 -j 0x1000 -g 4096
export JUMP_DIR = $(shell pwd)/jump
export JUMP_LIB = libitcl

all: libitcl.a libitcl.sa itcl_wish itcl_sh

libitcl.a: $(OBJS)
	rm -f libitcl.a
	ar cr libitcl.a $(OBJS)
	$(RANLIB) libitcl.a

libitcl.sa: ${SHOBJS} libitcl.so.${JUMP_VER}
	${DLLBIN}/mkstubs -l libitcl ${JUMP_ARGS} -- libitcl

libitcl.so.${JUMP_VER}: ${SHOBJS}
	${DLLBIN}/mkimage -l libitcl ${JUMP_ARGS} -- ${SHOBJS} $(TCL_LIB) -lm -lc `${CC} -print-libgcc-file-name` -lc

itcl_wish: tkAppInit.o libitcl.a libitcl.sa
	$(CC) ${LDFLAGS} $(CC_SWITCHES) tkAppInit.o -L. -litcl $(LIBS) -o itcl_wish

itcl_sh: tclAppInit.o libitcl.a libitcl.sa
	$(CC) ${LDFLAGS} $(CC_SWITCHES) tclAppInit.o -L. -litcl $(TCL_LIB) -lm -o itcl_sh

test: itcl_sh
	@( echo cd $(SRC_DIR)/../tests\; source all\; exit ) | ./itcl_sh

pure: tclAppInit.o tkAppInit.o libitcl.a
	purify $(CC) $(CC_SWITCHES) tclAppInit.o libitcl.a $(TCL_LIB) -lm \
		-o itcl_sh.pure
	purify $(CC) $(CC_SWITCHES) tkAppInit.o libitcl.a $(LIBS) \
		-o itcl_wish.pure

install:  libitcl.a itcl_wish itcl_sh
	@for i in $(INCLUDE_DIR) $(LIB_DIR) $(BIN_DIR) ; do \
	    if [ ! -d $$i ] ; then \
			echo "Making directory $$i"; \
			mkdir $$i; \
			chmod 755 $$i; \
		else true; \
		fi; \
	done;
	@echo "Installing itcl.h"
	@$(INSTALL_DATA) itcl.h $(INCLUDE_DIR)
	@echo "Installing libitcl.a"
	@$(INSTALL_DATA) libitcl.a $(LIB_DIR)
	@echo "Installing libitcl.sa"
	@$(INSTALL_DATA) libitcl.sa $(LIB_DIR)
	@echo "Installing libitcl.so.$(JUMP_VER)"
	@$(INSTALL_PROGRAM) libitcl.so.$(JUMP_VER) $(LIB_DIR)
	@echo "Running ldconfig"
	@ldconfig
	@echo "Installing itcl_wish"
	@$(INSTALL_PROGRAM) itcl_wish $(BIN_DIR)
	@echo "Installing itcl_sh"
	@$(INSTALL_PROGRAM) itcl_sh $(BIN_DIR)

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

clean:
	rm -f *.o *.a *.so *.so.* *.sa core errs *~ \#* TAGS *.E a.out errors jump/_*
	rm -f itcl_wish itcl_sh *pure*

distclean: clean
	rm -f Makefile config.status

lint:
	$(LINT) $(INCS) $(SRCS)

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

%.so: %.c
	${SHCC} -c ${CC_SWITCHES} $< -o $@

$(OBJS): itcl_class.h itcl_core.h \
	itcl_methods.h itcl_objects.h itcl_vars.h \
	itcl_util.h
