#
# This file is a Makefile for [incr Widgets].  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.14 2002/09/25 23:12:59 hobbs Exp $

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

ITCL_VERSION = @ITCL_VERSION@
IWIDGETS_VERSION = @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@

srcdir = @srcdir@
bindir = @bindir@
libdir = @libdir@

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

# Path name to use when installing library scripts:
SCRIPT_INSTALL_DIR = $(INSTALL_ROOT)$(libdir)/iwidgets$(IWIDGETS_VERSION)

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

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

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

# Directory containing Tcl source code (for library used during test):
TCL_SRC_DIR = @TCL_SRC_DIR@

# Directory containing Tk source code (for library used during test):
TK_SRC_DIR = @TK_SRC_DIR@

# Itcl libraries can be found here:
ITCL_LIB_DIR = @ITCL_LIB_DIR@

# Directory containing Itcl source code (for library used during test):
ITCL_SRC_DIR = @ITCL_SRC_DIR@

# Itk libraries can be found here:
ITK_LIB_DIR = @ITK_LIB_DIR@

# Directory containing Itk source code (for library used during test):
ITK_SRC_DIR = @ITK_SRC_DIR@

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

INSTALL =		$(TCLSH_PROG) `$(CYGPATH) $(ITCL_SRC_DIR)/../config/installFile.tcl` -c
INSTALL_PROGRAM =	$(INSTALL)
INSTALL_DATA =		$(INSTALL) -m 644
INSTALL_SCRIPT =	$(INSTALL) -m 555
MKINSTALLDIRS =		$(ITCL_SRC_DIR)/../config/mkinstalldirs
RANLIB =		@RANLIB@
LN_S =			ln -s
TOP_DIR =		$(srcdir)
GENERIC_DIR =		$(TOP_DIR)/generic
UNIX_DIR =		$(TOP_DIR)/unix

CYGPATH =		@CYGPATH@
TCLSH_PROG =		@TCLSH_PROG@

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

info:
	@echo "Please specify either 'make test' or 'make install'."

all:
	@echo "Nothing to make for target 'all'.  Run 'make test' to \
	test the distribution"
	@echo "and 'make install' to install it."

install: install-libraries install-doc install-demos

test:
	LD_LIBRARY_PATH=$(ITCL_LIB_DIR):$(ITK_LIB_DIR):$(LD_LIBRARY_PATH); export LD_LIBRARY_PATH ; \
	TCL_LIBRARY=$(TCL_SRC_DIR)/library; export TCL_LIBRARY; \
	ITCL_LIBRARY=$(ITCL_LIB_DIR); export ITCL_LIBRARY; \
	TK_LIBRARY=$(TK_SRC_DIR)/library; export TK_LIBRARY; \
	ITK_LIBRARY=$(ITK_LIB_DIR); export ITK_LIBRARY; \
	IWIDGETS_LIBRARY=@IWIDGETS_SRC_DIR@; export IWIDGETS_LIBRARY; \
	$(TCLSH_PROG) `@CYGPATH@ $(srcdir)/tests/all.tcl` \
		-exedir `@CYGPATH@ $(TK_SRC_DIR)/unix` $(TESTFLAGS)

install-libraries:
	@$(MKINSTALLDIRS) $(SCRIPT_INSTALL_DIR) $(LIB_INSTALL_DIR)
	@rm -f $(LIB_INSTALL_DIR)/iwidgets
	$(LN_S) $(SCRIPT_INSTALL_DIR) $(LIB_INSTALL_DIR)/iwidgets
	@$(MKINSTALLDIRS) $(SCRIPT_INSTALL_DIR)/scripts
	@echo "Installing source files from $(GENERIC_DIR) into $(SCRIPT_INSTALL_DIR)"
	@for i in $(GENERIC_DIR)/*.itk $(GENERIC_DIR)/*.itcl $(GENERIC_DIR)/tclIndex $(GENERIC_DIR)/*.gif ; \
	    do \
	    $(INSTALL_DATA) $$i $(SCRIPT_INSTALL_DIR)/scripts; \
	    done;
	@echo "Installing iwidgets.tcl and pkgIndex.tcl into $(SCRIPT_INSTALL_DIR)"
	@for i in iwidgets.tcl pkgIndex.tcl ; \
	    do \
	    $(INSTALL_DATA) $$i $(SCRIPT_INSTALL_DIR); \
	    done;

install-demos:
	@$(MKINSTALLDIRS) $(SCRIPT_INSTALL_DIR)/demos/images $(SCRIPT_INSTALL_DIR)/demos/html
	@echo "Installing demos from $(srcdir)/demos into $(SCRIPT_INSTALL_DIR)/demos"
	@for i in $(srcdir)/demos/*; \
	    do \
	    if [ -f $$i ] ; then \
	        $(INSTALL_SCRIPT) $$i $(SCRIPT_INSTALL_DIR)/demos; \
	    fi; \
	    done;
	@echo "Installing images from $(srcdir)/demos/images into $(SCRIPT_INSTALL_DIR)/demos/images"
	for i in $(srcdir)/demos/images/*; \
	    do \
	    if [ -f $$i ] ; then \
	        $(INSTALL_DATA) $$i $(SCRIPT_INSTALL_DIR)/demos/images; \
	    fi; \
	    done;
	@echo "Installing html man pages from $(srcdir)/demos/html into $(SCRIPT_INSTALL_DIR)/demos/html"
	for i in $(srcdir)/demos/html/*; \
	    do \
	    if [ -f $$i ] ; then \
	        $(INSTALL_DATA) $$i $(SCRIPT_INSTALL_DIR)/demos/html; \
	    fi; \
	    done;

install-doc:
	@$(MKINSTALLDIRS) $(MAN_INSTALL_DIR)
	@echo "Installing man pages from $(TOP_DIR)/doc into $(MAN_INSTALL_DIR)"
	@cd $(TOP_DIR)/doc; for i in *.n; \
	    do \
	    rm -f $(MAN_INSTALL_DIR)/`basename $$i`; \
	    rm -f $(MAN_INSTALL_DIR)/`basename iwidgets_$$i`; \
	    sed -e '/man\.macros/r man.macros' -e '/man\.macros/d' \
	        $$i > $(MAN_INSTALL_DIR)/`basename iwidgets_$$i`; \
	    chmod 444 $(MAN_INSTALL_DIR)/`basename iwidgets_$$i`; \
	    done;
	$(INSTALL_DATA) $(srcdir)/license.terms $(SCRIPT_INSTALL_DIR)

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

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

distclean: clean
	rm -f Makefile config.status config.cache config.log

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

configure: configure.in
	autoconf

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