# -*-makefile-*----------------------------------------------------------------
# $Id: pkg_tcl.in,v 1.13 1996/10/25 18:55:36 furnish Exp $
#
# Maurice LeBrun
# IFS, University of Texas at Austin
# 14-Jul-1994
#
# Make assignments for PLplot/Tcl support.
# Includes build rules for:
#
#	tclIndex	auto-load index
#
# -----------------------------------------------------------------------------

TCL_C		= tclAPI.c tclMain.c
TCL_OBJ		= tclAPI$O
TCL_OBJ_SA	= tclMain$O 
TCL_EXE		= pltcl$E tclIndex
TCL_INSTALL	= install_tcl

MAKEINDEX	= @MAKEINDEX@
TCL_INDEX_FILES = @TCL_INDEX_FILES@

MAT_C		= tclMatrix.c matrixInit.c
MAT_OBJS	= tclMatrix$O matrixInit$O
MAT_OBJS_SO	=
MAT_OBJS_SA	=
MATLIB_AR	= libMatrix.a
# Changed by Rafael Laboissiere
# on Tue Oct 13 13:42:54 CEST 1998
# Numbering the so file for correct library dependency in the Debian package
# MATLIB_SO	= libMatrix$(SO)
MATLIB_SO	= libMatrix$(SO).$(SOVERSION)
MAT_INSTALL	= install_mat
MAT_LINK	= -lMatrix

MAT_BUILD	= $(MATLIBS)

tclAPI.c: tclgen.h tclgen_s.h tclgen.c

tclgen.h tclgen_s.h tclgen.c : plapi.tpl
	./pltclgen

#tclIndex:
#	mktclidx *.tcl

tclIndex:
	(echo "auto_mkindex . $(TCL_INDEX_FILES)" | $(MAKEINDEX) )

install_tcl:
	-if test $(SHARED) = 1; then \
	   $(LDC) $(LDC_FLAGS) pltcl$O $(LIB_INSTALL) -o pltcl$E $(LDC_LIBS); \
	 fi
	-strip pltcl$E
	-cp pltcl$E $(BIN_DIR)
	-if test ! -d $(TCL_DIR); then mkdir -p $(TCL_DIR); fi
	-cp tclIndex $(TCL_DIR)
	-cd $(top_srcdir)/bindings/tcl; \
	 cp pltcl.h $(INCLUDE_DIR)
	-if test ! -d $(DEMOS_DIR)/tcl; then mkdir -p $(DEMOS_DIR)/tcl; fi
	-cd $(top_srcdir)/examples/tcl; cp * $(DEMOS_DIR)/tcl

install_mat:
	cp tclMatrix.h $(INCLUDE_DIR)
	cp libMatrix* $(LIB_DIR)/..
	if test -r libMatrix.a; then $(RANLIB) $(LIB_DIR)/../libMatrix.a; fi

