#
# 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.
#
# RCS: $Id: Makefile.in,v 1.1.1.1 1999/03/31 20:39:48 damon Exp $

# Current [incr Tcl] version;  used in various names.

MAJOR_VERSION = @ITCL_MAJOR_VERSION@
MINOR_VERSION = @ITCL_MINOR_VERSION@
RELEASE_LEVEL = @ITCL_RELEASE_LEVEL@
VERSION = @ITCL_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).
#----------------------------------------------------------------

# Default top-level directories in which to install architecture-
# specific files (exec_prefix) and machine-independent files such
# as scripts (prefix).  The values specified here may be overridden
# at configure-time with the --exec-prefix and --prefix options
# to the "configure" script.

prefix =	@prefix@
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 =

# Directory from which applications will reference the library of
# [incr Tcl] scripts (note: you can set the ITCL_LIBRARY environment
# variable at run-time to override this value):
ITCL_LIBRARY = $(prefix)/lib/itcl$(VERSION)

# Path name to use when installing library scripts:
SCRIPT_INSTALL_DIR =	$(INSTALL_ROOT)$(ITCL_LIBRARY)

# Directory in which to install the archive libtcl.a:
LIB_INSTALL_DIR =	$(INSTALL_ROOT)$(exec_prefix)/lib

# Path to use at runtime to refer to LIB_INSTALL_DIR:
LIB_RUNTIME_DIR =	$(exec_prefix)/lib

# Directory in which to install the program tclsh:
BIN_INSTALL_DIR =	$(INSTALL_ROOT)$(exec_prefix)/bin

# Directory in which to install the include file itcl.h:
INCLUDE_INSTALL_DIR =	$(INSTALL_ROOT)$(prefix)/include

# Top-level directory in which to install manual entries:
MAN_INSTALL_DIR =	$(INSTALL_ROOT)$(prefix)/man

# Directory in which to install manual entry for itclsh:
MAN1_INSTALL_DIR =	$(MAN_INSTALL_DIR)/man1

# Directory in which to install manual entries for [incr Tcl]'s
# C library procedures:
MAN3_INSTALL_DIR =	$(MAN_INSTALL_DIR)/man3

# Directory in which to install manual entries for the built-in
# [incr Tcl] commands:
MANN_INSTALL_DIR =	$(MAN_INSTALL_DIR)/mann

# Tcl source directory is included in this distribution. Use this to
# get the correct path:
TCL_SRC_DIR = @TCL_SRC_DIR@

# The directory containing the Tcl library archive file appropriate
# for this version of Tk:
TCL_LIB_DIR =	@TCL_LIB_DIR@

# Library flags for Tcl library
TCL_LIB_FLAG =	@TCL_LIB_FLAG@

# Tcl libraries built with optimization switches have this additional extension
DBGX =		@TCL_DBGX@

# Additional libraries to use when linking.  The "LIBS" part will be
# replaced (or has already been replaced) with relevant libraries as
# determined by the configure script.
LIBS = @TCL_LIB_SPEC@ @TCL_LIBS@ @DL_LIBS@ -lc

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

# 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

# Tcl used to let the configure script choose which program to use
# for installing, but there are just too many different versions of
# "install" around;  better to use the install-sh script that comes
# with the distribution, which is slower but guaranteed to work.

INSTALL = $(TOP_DIR)/../config/install-sh -c
INSTALL_PROGRAM =       ${INSTALL}
INSTALL_DATA =          ${INSTALL} -m 644
MKINSTALLDIRS =         $(TOP_DIR)/../config/mkinstalldirs

# The symbols below provide support for dynamic loading and shared
# libraries.  The values of the symbols are normally set by the
# configure script.  You shouldn't normally need to modify any of
# these definitions by hand.

SHLIB_CFLAGS = @SHLIB_CFLAGS@

LD_SEARCH_FLAGS = @LD_SEARCH_FLAGS@

ITCL_LIB_FILE = @ITCL_LIB_FILE@
#ITCL_LIB_FILE = libitcl.a

# The symbol below provides support for dynamic loading and shared
# libraries.  See configure.in for a description of what it means.
# The values of the symbolis normally set by the configure script.

SHLIB_LD = @SHLIB_LD@

#----------------------------------------------------------------
# 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 =		@TCL_DEFS@
RANLIB =		@RANLIB@
TOP_DIR =		@ITCL_SRC_DIR@
GENERIC_DIR = 		$(TOP_DIR)/generic
UNIX_DIR = 		$(TOP_DIR)/unix

#----------------------------------------------------------------
# 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) $(SHLIB_CFLAGS) -I$(UNIX_DIR) -I$(GENERIC_DIR) \
-I$(TCL_SRC_DIR)/generic $(AC_FLAGS) $(PROTO_FLAGS) $(MEM_DEBUG_FLAGS) \
-DITCL_LIBRARY=\"$(ITCL_LIBRARY)\"

SRCS = 	$(GENERIC_DIR)/itcl_bicmds.c \
	$(GENERIC_DIR)/itcl_class.c \
	$(GENERIC_DIR)/itcl_cmds.c \
	$(GENERIC_DIR)/itcl_ensemble.c \
	$(GENERIC_DIR)/itcl_linkage.c \
	$(GENERIC_DIR)/itcl_methods.c \
	$(GENERIC_DIR)/itcl_migrate.c \
	$(GENERIC_DIR)/itcl_objects.c \
	$(GENERIC_DIR)/itcl_obsolete.c \
	$(GENERIC_DIR)/itcl_parse.c \
	$(GENERIC_DIR)/itcl_util.c \
	$(GENERIC_DIR)/tclAppInit.c

OBJS = itcl_bicmds.o itcl_class.o itcl_cmds.o itcl_ensemble.o \
	itcl_linkage.o itcl_methods.o itcl_migrate.o itcl_objects.o \
	itcl_obsolete.o itcl_parse.o itcl_util.o

all: $(ITCL_LIB_FILE) itclsh

@ITCL_LIB_FILE@:  $(OBJS)
	rm -f $(ITCL_LIB_FILE)
	@MAKE_LIB@
	$(RANLIB) $(ITCL_LIB_FILE)

itclsh: tclAppInit.o $(ITCL_LIB_FILE)
	$(CC) @LD_FLAGS@ tclAppInit.o @ITCL_BUILD_LIB_SPEC@ \
		$(LIBS) $(LD_SEARCH_FLAGS) -o itclsh

test: itclsh
	LD_LIBRARY_PATH="$(TCL_LIB_DIR):`pwd`:$(LD_LIBRARY_PATH)"; \
	export LD_LIBRARY_PATH; \
	TCL_LIBRARY="$(TCL_SRC_DIR)/library"; export TCL_LIBRARY; \
	ITCL_LIBRARY=$(TOP_DIR)/library; export ITCL_LIBRARY; \
	TCLLIBPATH=$(TOP_DIR)/unix; export TCLLIBPATH; \
	( echo cd $(TOP_DIR)/tests\; source all ) | ./itclsh

install: install-binaries install-libraries install-man

install-binaries: $(ITCL_LIB_FILE) itclsh
	@$(MKINSTALLDIRS) $(LIB_INSTALL_DIR) $(BIN_INSTALL_DIR)
	@echo "Installing $(ITCL_LIB_FILE)"
	@$(INSTALL_DATA) $(ITCL_LIB_FILE) $(LIB_INSTALL_DIR)/$(ITCL_LIB_FILE)
	@(cd $(LIB_INSTALL_DIR); $(RANLIB) $(ITCL_LIB_FILE))
	chmod 555 $(LIB_INSTALL_DIR)/$(ITCL_LIB_FILE)
	@echo "Installing itclsh"
	$(INSTALL_PROGRAM) itclsh $(BIN_INSTALL_DIR)/itclsh$(VERSION)
	@echo "Installing itclConfig.sh"
	@$(INSTALL_DATA) itclConfig.sh $(LIB_INSTALL_DIR)/itclConfig.sh

install-libraries:
	@$(MKINSTALLDIRS) $(INCLUDE_INSTALL_DIR) $(SCRIPT_INSTALL_DIR)
	@echo "Installing itcl.h"
	@$(INSTALL_DATA) $(GENERIC_DIR)/itcl.h $(INCLUDE_INSTALL_DIR)
	@for i in $(TOP_DIR)/library/*.* $(UNIX_DIR)/tclAppInit.c; \
	    do \
	    echo "Installing $$i"; \
	    $(INSTALL_DATA) $$i $(SCRIPT_INSTALL_DIR); \
	    done;
	@echo "Installing pkgIndex.tcl"
	@$(INSTALL_DATA) pkgIndex.tcl $(SCRIPT_INSTALL_DIR)

install-man:
	@$(MKINSTALLDIRS) $(MAN1_INSTALL_DIR) $(MANN_INSTALL_DIR)
	@cd $(TOP_DIR)/doc; for i in *.1; \
	    do \
	    echo "Installing doc/$$i"; \
	    rm -f $(MAN1_INSTALL_DIR)/$$i; \
	    sed -e '/man\.macros/r man.macros' -e '/man\.macros/d' \
		    $$i > $(MAN1_INSTALL_DIR)/$$i; \
	    chmod 444 $(MAN1_INSTALL_DIR)/$$i; \
	    done;
	@cd $(TOP_DIR)/doc; for i in *.n; \
	    do \
	    echo "Installing doc/$$i"; \
	    rm -f $(MANN_INSTALL_DIR)/$$i; \
	    sed -e '/man\.macros/r man.macros' -e '/man\.macros/d' \
		    $$i > $(MANN_INSTALL_DIR)/$$i; \
	    chmod 444 $(MANN_INSTALL_DIR)/$$i; \
	    done;

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

clean:
	rm -f *.a *.o core errs *~ \#* TAGS *.E a.out errors \
	rm -f itclsh* libitcl* *pure* *% ../tests/core

distclean: clean
	rm -f Makefile config.status config.cache config.log
	rm -f itclConfig.sh pkgIndex.tcl

pure: tclAppInit.o $(ITCL_LIB_FILE)
	purify $(CC) @LD_FLAGS@ tclAppInit.o @ITCL_BUILD_LIB_SPEC@ \
		$(LIBS) $(LD_SEARCH_FLAGS) -o itclsh.pure

profile: tclAppInit.o $(ITCL_LIB_FILE)
	quantify $(CC) @LD_FLAGS@ tclAppInit.o @ITCL_BUILD_LIB_SPEC@ \
		$(LIBS) $(LD_SEARCH_FLAGS) -o itclsh.pure

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

configure: configure.in
	autoconf

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

tclAppInit.o: $(UNIX_DIR)/tclAppInit.c
	$(CC) -c $(CC_SWITCHES) $(UNIX_DIR)/tclAppInit.c

itcl_bicmds.o: $(GENERIC_DIR)/itcl_bicmds.c
	$(CC) -c $(CC_SWITCHES) $(GENERIC_DIR)/itcl_bicmds.c

itcl_class.o: $(GENERIC_DIR)/itcl_class.c
	$(CC) -c $(CC_SWITCHES) $(GENERIC_DIR)/itcl_class.c

itcl_cmds.o: $(GENERIC_DIR)/itcl_cmds.c Makefile
	$(CC) -c $(CC_SWITCHES) $(GENERIC_DIR)/itcl_cmds.c

itcl_ensemble.o: $(GENERIC_DIR)/itcl_ensemble.c Makefile
	$(CC) -c $(CC_SWITCHES) $(GENERIC_DIR)/itcl_ensemble.c

itcl_linkage.o: $(GENERIC_DIR)/itcl_linkage.c
	$(CC) -c $(CC_SWITCHES) $(GENERIC_DIR)/itcl_linkage.c

itcl_methods.o: $(GENERIC_DIR)/itcl_methods.c
	$(CC) -c $(CC_SWITCHES) $(GENERIC_DIR)/itcl_methods.c

itcl_migrate.o: $(GENERIC_DIR)/itcl_migrate.c
	$(CC) -c $(CC_SWITCHES) $(GENERIC_DIR)/itcl_migrate.c

itcl_objects.o: $(GENERIC_DIR)/itcl_objects.c
	$(CC) -c $(CC_SWITCHES) $(GENERIC_DIR)/itcl_objects.c

itcl_obsolete.o: $(GENERIC_DIR)/itcl_obsolete.c
	$(CC) -c $(CC_SWITCHES) $(GENERIC_DIR)/itcl_obsolete.c

itcl_parse.o: $(GENERIC_DIR)/itcl_parse.c
	$(CC) -c $(CC_SWITCHES) $(GENERIC_DIR)/itcl_parse.c

itcl_util.o: $(GENERIC_DIR)/itcl_util.c
	$(CC) -c $(CC_SWITCHES) $(GENERIC_DIR)/itcl_util.c

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