#
# 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.7 2006/11/07 20:28:24 irby Exp $

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

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

# 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)$(prefix)/lib/iwidgets$(VERSION)

# Directory in which to install the archive libtcl.a:
LIB_INSTALL_DIR = $(INSTALL_ROOT)$(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

# Directory in which to install html version of manual entries:
HTML_INSTALL_DIR = $(INSTALL_ROOT)$(prefix)/doc

# Tcl libraries can be found here:
TCL_LIB_DIR = @TCL_LIB_DIR@

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

# Tk libraries can be found here:
TK_LIB_DIR = @TK_LIB_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@

# [incr Tk] build directory containing the itkwish binary for 'make test'
ITK_BIN_DIR = ../../itk/unix

# 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 =		$(srcdir)/config/install-sh -c
#INSTALL =		$(TCLSH_PROG) `$(CYGPATH) $(srcdir)/../config/installFile.tcl` -c
INSTALL_PROGRAM =	$(INSTALL)
INSTALL_DATA =		$(INSTALL) -m 644
INSTALL_SCRIPT =	$(INSTALL) -m 555
MKINSTALLDIRS =		$(srcdir)/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 =		$(TCL_SRC_DIR)/unix/tclsh

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

all: binaries libraries doc

binaries:

libraries:

doc:

test:
	LD_LIBRARY_PATH=$(TCL_LIB_DIR):$(TK_LIB_DIR):$(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_SRC_DIR)/library; export ITCL_LIBRARY; \
	TK_LIBRARY=$(TK_SRC_DIR)/library; export TK_LIBRARY; \
	ITK_LIBRARY=$(ITK_SRC_DIR)/library; export ITK_LIBRARY; \
	$(TCLSH_PROG) `@CYGPATH@ $(srcdir)/tests/all.tcl` \
		-exedir `@CYGPATH@ $(bindir)` $(TESTFLAGS)

testold: $(ITK_BIN_DIR)/itkwish
	LD_LIBRARY_PATH=$(TCL_LIB_DIR):$(TK_LIB_DIR):$(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_SRC_DIR)/library; export ITCL_LIBRARY; \
	TK_LIBRARY=$(TK_SRC_DIR)/library; export TK_LIBRARY; \
	ITK_LIBRARY=$(ITK_SRC_DIR)/library; export ITK_LIBRARY; \
	( echo lappend auto_path $(TOP_DIR)/generic \; package provide Iwidgets $(VERSION) \; cd $(TOP_DIR)/tests\; source all\; exit ) | $(ITK_BIN_DIR)/itkwish

static:

standalone:

plusplus:

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

install-binaries:

install-libraries:
	@$(MKINSTALLDIRS) $(SCRIPT_INSTALL_DIR)/win $(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 files from $(GENERIC_DIR) into $(SCRIPT_INSTALL_DIR)"
	@for i in $(GENERIC_DIR)/*.itk $(GENERIC_DIR)/tclIndex $(GENERIC_DIR)/*.gif ; \
	    do \
	    $(INSTALL_DATA) $$i $(SCRIPT_INSTALL_DIR)/scripts; \
	    done;
	@for i in iwidgets.tcl pkgIndex.tcl ; \
	    do \
	    $(INSTALL_DATA) $$i $(SCRIPT_INSTALL_DIR); \
	    done;
	$(MAKE) install-demos

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 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_DATA) $(srcdir)/win/catalog.bat $(SCRIPT_INSTALL_DIR)/demos

install-doc:
	@$(MKINSTALLDIRS) $(MANN_INSTALL_DIR)
	@echo "Installing docs from $(TOP_DIR)/doc into $(MANN_INSTALL_DIR)"
	@cd $(TOP_DIR)/doc; for i in *.n; \
	    do \
	    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;
	$(INSTALL_DATA) $(srcdir)/license.terms $(SCRIPT_INSTALL_DIR)

install-html:
	@$(MKINSTALLDIRS) $(HTML_INSTALL_DIR)
	@echo "Generating html from $(TOP_DIR)/doc into $(HTML_INSTALL_DIR)"
	@cd $(TOP_DIR)/doc; for i in *.n; \
	    do \
	    rm -f $(HTML_INSTALL_DIR)/$$i.html; \
            $(TOP_DIR)/tk2html $(MANN_INSTALL_DIR)/$$i > $(HTML_INSTALL_DIR)/$$i.html; \
	    chmod 444 $(HTML_INSTALL_DIR)/$$i.html; \
	    done;

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 configure.lineno \
	iwidgets.tcl pkgIndex.tcl

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

configure: configure.in
	autoconf

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