# Makefile.in --
#
#	This file is a Makefile for Sample TEA Extension.  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.
#
# Copyright (c) 1999 Scriptics Corporation.
# Copyright (c) 2002-2003 ActiveState Corporation.
# Copyright (C) 1999-2014 Gustaf Neumann (a) (b)
# Copyright (C) 1999-2007 Uwe Zdun (a) (b)
#
# See the file "tcl-license.terms" for information on usage and redistribution
# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
#
# RCS: @(#) $Id: Makefile.in,v 1.25 2007/09/18 19:27:32 neumann Exp $

#========================================================================
# Add additional lines to handle any additional AC_SUBST cases that
# have been added in a customized configure script.
#========================================================================

#XOTCL_VERSION 	= @PACKAGE_VERSION@
XOTCL_VERSION 	= @XOTCL_VERSION@

src_lib_dir		= ${srcdir}/library
src_doc_dir		= ${srcdir}/doc
src_test_dir		= ${srcdir}/tests
src_app_dir		= ${srcdir}/apps
src_generic_dir		= ${srcdir}/generic
src_man_dir		= ${srcdir}/man
TCL_LIB_SPEC		= @TCL_LIB_SPEC@
TCL_STUB_LIB_SPEC	= @TCL_STUB_LIB_SPEC@
TK_LIB_SPEC		= @TK_LIB_SPEC@
TK_STUB_LIB_SPEC	= @TK_STUB_LIB_SPEC@

subdirs			= @subdirs@
aol_prefix		= @aol_prefix@

# Requires native paths
PLATFORM_DIR	= `@CYGPATH@ $(srcdir)/@TEA_PLATFORM@`
target_doc_dir		= ./doc

src_lib_dir_native	= `@CYGPATH@ ${src_lib_dir}`
src_doc_dir_native	= `@CYGPATH@ ${src_doc_dir}`
src_test_dir_native 	= `@CYGPATH@ ${src_test_dir}`
src_app_dir_native	= `@CYGPATH@ ${src_app_dir}`
src_generic_dir_native	= `@CYGPATH@ ${src_generic_dir}`

libdirs		= comm lib serialize @libdirs_actiweb@
libsrc		= COPYRIGHT pkgIndex.tcl 
appdirs		= comm scripts utils @apps_actiweb@
appsrc		= COPYRIGHT 

DOC_SOURCE = \
	$(src_doc_dir)/langRef.xotcl \
	$(src_lib_dir)/lib/*.xotcl \
	$(src_lib_dir)/store/*.xotcl \
	$(src_lib_dir)/serialize/Serializer.xotcl \
	$(src_test_dir)/*.xotcl \
	$(src_app_dir)/scripts/*.xotcl \
	$(src_app_dir)/comm/[flsw]*.xotcl \
	$(src_app_dir)/actiweb/univ/UNIVERSAL.xotcl \
	$(src_app_dir)/utils/xo-*[a-z0-9] 

#export TCLLIBPATH=. ${srcdir}
mkinstalldirs= mkdir -p
#========================================================================
# Nothing of the variables below this line should need to be changed.
# Please check the TARGETS section below to make sure the make targets
# are correct.
#========================================================================

#========================================================================
# The names of the source files is defined in the configure script.
# The object files are used for linking into the final library.
# This will be used when a dist target is added to the Makefile.
# It is not important to specify the directory, as long as it is the
# $(srcdir) or in the generic, win or unix subdirectory.
#========================================================================

PKG_SOURCES	= @PKG_SOURCES@
PKG_OBJECTS	= @PKG_OBJECTS@

PKG_STUB_SOURCES = @PKG_STUB_SOURCES@
PKG_STUB_OBJECTS = @PKG_STUB_OBJECTS@

#========================================================================
# PKG_TCL_SOURCES identifies Tcl runtime files that are associated with
# this package that need to be installed, if any.
#========================================================================

PKG_TCL_SOURCES = @PKG_TCL_SOURCES@

#========================================================================
# This is a list of public header files to be installed, if any.
#========================================================================

PKG_HEADERS	= @PKG_HEADERS@

#========================================================================
# "PKG_LIB_FILE" refers to the library (dynamic or static as per
# configuration options) composed of the named objects.
#========================================================================

PKG_LIB_FILE	= @PKG_LIB_FILE@
PKG_STUB_LIB_FILE = @PKG_STUB_LIB_FILE@

lib_BINARIES	= $(PKG_LIB_FILE) $(PKG_STUB_LIB_FILE)
BINARIES	= $(lib_BINARIES)

SHELL		= @SHELL@

srcdir		= @srcdir@
prefix		= @prefix@
exec_prefix	= @exec_prefix@
datarootdir     = @datarootdir@

bindir		= @bindir@
libdir		= @libdir@
datadir		= @datadir@
mandir		= @mandir@
includedir	= @includedir@

DESTDIR		=

top_builddir	= .

INSTALL		= @INSTALL@
INSTALL_PROGRAM	= @INSTALL_PROGRAM@
INSTALL_DATA	= @INSTALL_DATA@
INSTALL_SCRIPT	= @INSTALL_SCRIPT@

# INSTALL          = $(SHELL) $(srcdir)/config/install-sh -c ${INSTALL_OPTIONS}
# INSTALL_DATA_DIR = ${INSTALL} -d -m 755
# INSTALL_PROGRAM  = ${INSTALL} -m 755
# INSTALL_DATA    = ${INSTALL} -m 644
# INSTALL_SCRIPT  = ${INSTALL_PROGRAM}
# INSTALL_LIBRARY = ${INSTALL_DATA}

PACKAGE_NAME	= @PACKAGE_NAME@
PACKAGE_VERSION	= @PACKAGE_VERSION@
CC		= @CC@
CFLAGS_DEFAULT	= @CFLAGS_DEFAULT@
CFLAGS_WARNING	= @CFLAGS_WARNING@
CLEANFILES	= @CLEANFILES@
EXEEXT		= @EXEEXT@
LDFLAGS_DEFAULT	= @LDFLAGS_DEFAULT@
MAKE_LIB	= @MAKE_LIB@
MAKE_SHARED_LIB	= @MAKE_SHARED_LIB@
MAKE_STATIC_LIB	= @MAKE_STATIC_LIB@
MAKE_STUB_LIB	= @MAKE_STUB_LIB@
OBJEXT		= @OBJEXT@
RANLIB		= @RANLIB@
RANLIB_STUB	= @RANLIB_STUB@
SHLIB_CFLAGS	= @SHLIB_CFLAGS@
SHLIB_LD	= @SHLIB_LD@
SHLIB_LD_FLAGS	= @SHLIB_LD_FLAGS@
SHLIB_LD_LIBS	= @SHLIB_LD_LIBS@
STLIB_LD	= @STLIB_LD@
TCL_DEFS	= @TCL_DEFS@
TCL_BIN_DIR	= @TCL_BIN_DIR@
TCL_SRC_DIR	= @TCL_SRC_DIR@
# This is necessary for packages that use private Tcl headers
#TCL_TOP_DIR_NATIVE	= @TCL_TOP_DIR_NATIVE@
# Not used, but retained for reference of what libs Tcl required
TCL_LIBS	= @TCL_LIBS@

pkgdatadir	= @pkgdatadir@
pkglibdir	= @pkglibdir@
pkgincludedir	= @pkgincludedir@

# XOTCLSH = @XOTCLSH@

#========================================================================
# TCLLIBPATH seeds the auto_path in Tcl's init.tcl so we can test our
# package without installing.  The other environment variables allow us
# to test against an uninstalled Tcl.  Add special env vars that you
# require for testing here (like TCLX_LIBRARY).
#========================================================================

EXTRA_PATH	= $(top_builddir):$(TCL_BIN_DIR)
TCLSH_ENV	= TCL_LIBRARY=`@CYGPATH@ $(TCL_SRC_DIR)/library` \
		  @LD_LIBRARY_PATH_VAR@="$(EXTRA_PATH):$(@LD_LIBRARY_PATH_VAR@)" \
		  PATH="$(EXTRA_PATH):$(PATH)" \
		  TCLLIBPATH="$(top_builddir) ${srcdir}"
TCLSH_PROG	= @TCLSH_PROG@
TCLSH		= $(TCLSH_ENV) $(TCLSH_PROG)
SHARED_BUILD	= @SHARED_BUILD@

AM_CPPFLAGS	= @PKG_INCLUDES@ @TCL_INCLUDES@ @TK_INCLUDES@ @TK_XINCLUDES@ @XOTCL_BUILD_INCLUDE_SPEC@
EXTRA_CFLAGS	= @PKG_CFLAGS@

# TCL_DEFS is not strictly need here, but if you remove it, then you
# must make sure that configure.in checks for the necessary components
# that your library may use.  TCL_DEFS can actually be a problem if
# you do not compile with a similar machine setup as the Tcl core was
# compiled with.
#DEFS		= $(TCL_DEFS) @DEFS@ $(EXTRA_CFLAGS)
DEFS		= @DEFS@ $(EXTRA_CFLAGS) 

CONFIG_CLEAN_FILES = @CONFIG_CLEAN_FILES@

CPPFLAGS	= @CPPFLAGS@
LIBS		= @PKG_LIBS@ @LIBS@
AR		= @AR@
CFLAGS		= @CFLAGS@
COMPILE		= $(CC) $(DEFS) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)

#========================================================================
# Start of user-definable TARGETS section
#========================================================================

#========================================================================
# TEA TARGETS.  Please note that the "libraries:" target refers to platform
# independent files, and the "binaries:" target inclues executable programs and
# platform-dependent libraries.  Modify these targets so that they install
# the various pieces of your package.  The make and install rules
# for the BINARIES that you specified above have already been done.
#========================================================================

all: binaries libraries doc end

#========================================================================
# The binaries target builds executable programs, Windows .dll's, unix
# shared/static libraries, and any other platform-dependent files.
# The list of targets to build for "binaries:" is specified at the top
# of the Makefile, in the "BINARIES" variable.
#========================================================================

binaries: $(BINARIES) @XOTCLSH@ @XOWISH@ pkgIndex.tcl
	@if test ! "x$(subdirs)" = "x" ; then dirs="$(subdirs)" ; \
	for dir in $$dirs ; do \
	   if (cd $$dir; $(MAKE) $@) ; then true ; else exit 1 ; fi ; \
	done; fi;

libraries: 
	@if test ! "x$(subdirs)" = "x" ; then dirs="$(subdirs)" ; \
	for dir in $$dirs ; do \
	   if (cd $$dir; $(MAKE) $@) ; then true ; else exit 1 ; fi ; \
	done; fi;

libraries-pkgindex:
	@$(TCLSH) $(src_lib_dir_native)/lib/make.xotcl -dir $(src_lib_dir_native) -all

fulldoc: doc pdf
# use language reference as sample file to trigger generation of documentation files
doc: $(target_doc_dir)/langRef-xotcl.html

$(target_doc_dir)/langRef-xotcl.html: $(src_doc_dir)/langRef.xotcl $(DOC_SOURCE)
	@docs=""; \
	for i in $(DOC_SOURCE); do docs="$$docs `@CYGPATH@ $$i`"; done; \
	$(TCLSH) $(src_lib_dir_native)/lib/makeDoc.xotcl \
		$(target_doc_dir) $$docs

pdf:
	-(cd $(src_doc_dir); htmldoc --webpage --format pdf14 --title \
		-f tutorial.pdf tutorial.html )
	-(cd $(src_doc_dir); htmldoc --webpage --format pdf14  \
		-f langRef-xotcl.pdf langRef-xotcl.html )

install: install-binaries install-shells install-libraries install-doc
	@if test ! "x$(subdirs)" = "x" ; then dirs="$(subdirs)" ; \
	for dir in $$dirs ; do \
	   if (cd $$dir; $(MAKE) $@) ; then true ; else exit 1 ; fi ; \
	done; fi;

install-binaries: binaries install-lib-binaries install-bin-binaries install-pkgIndex

install-aol: install-binaries install-libraries
	$(INSTALL) $(src_generic_dir)/aol-xotcl.tcl \
		$(DESTDIR)/$(aol_prefix)/modules/tcl/xotcl.tcl


#========================================================================
# This rule installs platform-independent files, such as header files.
#========================================================================
install-libraries: libraries $(DESTDIR)$(includedir) $(DESTDIR)$(pkglibdir)
	@echo "Installing header files in $(DESTDIR)$(includedir)"
	@for i in $(PKG_HEADERS) ; do \
	    echo "    Installing $$i" ; \
	    $(INSTALL_DATA) $(srcdir)/$$i $(DESTDIR)$(includedir) ; \
	done;
	@echo "Installing Libraries to $(DESTDIR)$(pkglibdir)/"
	@for i in $(libdirs) ; do \
	    echo "    Installing $$i/" ; \
	    rm -rf $(DESTDIR)$(pkglibdir)/$$i ; \
	    mkdir -p $(DESTDIR)$(pkglibdir)/$$i; \
	    chmod 755 $(DESTDIR)$(pkglibdir)/$$i; \
	    for j in $(src_lib_dir)/$$i/*.*tcl ; do \
		$(INSTALL_DATA) $$j $(DESTDIR)$(pkglibdir)/$$i/; \
	    done; \
	done;
	@for i in $(libsrc) ; do \
	    echo "    Installing $$i" ; \
	    rm -rf $(DESTDIR)$(pkglibdir)/$$i ; \
	    $(INSTALL_DATA) $(src_lib_dir)/$$i $(DESTDIR)$(pkglibdir)/$$i ; \
	done;
	cat unix/pkgIndex.unix >> $(DESTDIR)$(pkglibdir)/pkgIndex.tcl
	$(INSTALL_DATA) xotclConfig.sh $(DESTDIR)$(libdir)/
	@echo "Installing Applications to $(DESTDIR)$(pkglibdir)/apps/"
	@for i in $(appdirs) ; do \
	    echo "    Installing $$i/" ; \
	    rm -rf $(DESTDIR)$(pkglibdir)/apps/$$i ; \
	    mkdir -p $(DESTDIR)$(pkglibdir)/apps/$$i; \
	    chmod 755 $(DESTDIR)$(pkglibdir)/apps/$$i; \
	    for j in $(src_app_dir)/$$i/* ; do \
		if test -d $$j; then \
		    mkdir -p $(DESTDIR)$(pkglibdir)/$$j; \
		    chmod 755 $(DESTDIR)$(pkglibdir)/$$j; \
		    for k in $$j/* ; do \
			$(INSTALL) $$k $(DESTDIR)$(pkglibdir)/$$j ; \
		done; \
		else \
		$(INSTALL) $$j $(DESTDIR)$(pkglibdir)/apps/$$i/; \
		fi; \
	    done; \
	done;
	@for i in $(appsrc) ; do \
	    echo "    Installing $$i" ; \
	    rm -rf $(DESTDIR)$(pkglibdir)/apps/$$i ; \
	    $(INSTALL_DATA) $(src_app_dir)/$$i $(DESTDIR)$(pkglibdir)/apps ; \
	done;
	@rm -rf $(DESTDIR)$(pkglibdir)/store/XOTclGdbm
	@rm -rf $(DESTDIR)$(pkglibdir)/store/XOTclSdbm
	@rm -rf $(DESTDIR)$(pkglibdir)/xml/TclExpat-1.1

#========================================================================
# Install documentation.  Unix manpages should go in the $(DESTDIR)$(mandir)
# directory.
#========================================================================

install-doc: doc $(DESTDIR)$(mandir)/man1 $(DESTDIR)$(mandir)/man3 $(DESTDIR)$(mandir)/mann
	@if test ! "x$(XOTCLSH)" = "x" ; then \
	(cd $(src_man_dir)/ ; \
	 for i in *.1; do \
	    echo "Installing $$i"; \
	    rm -f $(DESTDIR)$(mandir)/man1/$$i; \
	    sed -e '/man\.macros/r man.macros' -e '/man\.macros/d' \
		    $$i > $(DESTDIR)$(mandir)/man1/$$i; \
	    chmod 444 $(DESTDIR)$(mandir)/man1/$$i; \
	    done) ; \
	fi

shell: binaries libraries
	@$(TCLSH) $(SCRIPT)

gdb:
	$(TCLSH_ENV) gdb $(TCLSH_PROG) $(SCRIPT)

test: binaries libraries test-core test-http @test_actiweb@
test-nohttp: binaries libraries test-core

#TESTFLAGS = -srcdir $(srcdir)
test-core: $(TCLSH_PROG)
	$(TCLSH) $(src_test_dir_native)/testx.xotcl \
		-libdir $(PLATFORM_DIR) $(TESTFLAGS)
	$(TCLSH) $(src_test_dir_native)/testo.xotcl \
		-libdir $(PLATFORM_DIR) $(TESTFLAGS)
	$(TCLSH) $(src_test_dir_native)/speedtest.xotcl \
		-libdir $(PLATFORM_DIR) $(TESTFLAGS)
	$(TCLSH) $(src_test_dir_native)/forwardtest.xotcl \
		-libdir $(PLATFORM_DIR) $(TESTFLAGS)
	$(TCLSH) $(src_test_dir_native)/slottest.xotcl \
		-libdir $(PLATFORM_DIR) $(TESTFLAGS)
	$(TCLSH) $(src_test_dir_native)/mixinoftest.xotcl \
		-libdir $(PLATFORM_DIR) $(TESTFLAGS)
	$(TCLSH) $(src_test_dir_native)/varresolutiontest.xotcl \
		-libdir $(PLATFORM_DIR) $(TESTFLAGS)


test-http: $(TCLSH_PROG)
	$(TCLSH) $(src_test_dir_native)/xocomm.test \
		-libdir $(PLATFORM_DIR) $(TESTFLAGS)

test-actiweb: $(TCLSH_PROG)
	$(TCLSH) $(src_test_dir_native)/actiweb.test \
		-libdir $(PLATFORM_DIR) $(TESTFLAGS)
	$(TCLSH) $(src_test_dir_native)/persistence.test \
		-libdir $(PLATFORM_DIR) $(TESTFLAGS)
	$(TCLSH) $(src_test_dir_native)/UNIVERSAL.test \
		-libdir $(PLATFORM_DIR) $(TESTFLAGS)
	$(TCLSH) $(src_test_dir_native)/xoRDF.test \
		-libdir $(PLATFORM_DIR) $(TESTFLAGS)
	@rm -rf receiver

depend:


#========================================================================
# $(PKG_LIB_FILE) should be listed as part of the BINARIES variable
# mentioned above.  That will ensure that this target is built when you
# run "make binaries".
#
# The $(PKG_OBJECTS) objects are created and linked into the final
# library.  In most cases these object files will correspond to the
# source files above.
#========================================================================

$(PKG_LIB_FILE): $(PKG_OBJECTS)
	-rm -f $(PKG_LIB_FILE)
	${MAKE_LIB}
	$(RANLIB) $(PKG_LIB_FILE)

$(PKG_STUB_LIB_FILE): $(PKG_STUB_OBJECTS)
	-rm -f $(PKG_STUB_LIB_FILE)
	${MAKE_STUB_LIB}
	$(RANLIB_STUB) $(PKG_STUB_LIB_FILE)

#========================================================================
# We need to enumerate the list of .c to .o lines here.
#
# In the following lines, $(srcdir) refers to the toplevel directory
# containing your extension.  If your sources are in a subdirectory,
# you will have to modify the paths to reflect this:
#
# sample.$(OBJEXT): $(srcdir)/generic/sample.c
# 	$(COMPILE) -c `@CYGPATH@ $(srcdir)/generic/sample.c` -o $@
#
# Setting the VPATH variable to a list of paths will cause the makefile
# to look into these paths when resolving .c to .obj dependencies.
# As necessary, add $(srcdir):$(srcdir)/compat:....
#========================================================================

VPATH = $(srcdir):$(srcdir)/generic:$(srcdir)/unix:$(srcdir)/win

.c.@OBJEXT@:
	$(COMPILE) -c `@CYGPATH@ $<` -o $@

#========================================================================
# xotcl shells
#========================================================================

pkgIndex.tcl: $(PKG_LIB_FILE)
	@echo package ifneeded XOTcl $(PACKAGE_VERSION) [list load [file join \$$dir . $(PKG_LIB_FILE)] XOTcl] > pkgIndex.tcl

install-pkgIndex:
#	@echo package ifneeded XOTcl $(PACKAGE_VERSION) [list load [file join \$$dir .. "$(PKG_LIB_FILE)"] XOTcl] > "$(pkglibdir)/pkgIndex.tcl"

xotclsh: tclAppInit.o $(PKG_OBJECTS) $(CONDITIONAL_STUB_OBJECTS)
	$(CC)  -o $@ tclAppInit.o \
		$(PKG_OBJECTS) \
		$(CFLAGS) $(LDFLAGS_DEFAULT) $(TCL_LIB_SPEC) $(TCL_STUB_LIB_SPEC) \
		$(DMALLOC_LIB) $(CONDITIONAL_STUB_OBJECTS)

xowish: tkAppInit.o $(PKG_OBJECTS) $(CONDITIONAL_STUB_OBJECTS)
	$(CC)  -o $@ tkAppInit.o \
		$(PKG_OBJECTS) \
		$(CFLAGS) $(LDFLAGS_DEFAULT) $(TCL_LIB_SPEC) $(TCL_STUB_LIB_SPEC) $(TK_LIB_SPEC) $(TK_STUB_LIB_SPEC) \
		$(DMALLOC_LIB) $(CONDITIONAL_STUB_OBJECTS)

install-shells:
	@if test -f xotclsh; then \
		$(INSTALL_PROGRAM) xotclsh $(DESTDIR)$(bindir); \
	fi
	@if test -f xowish; then \
		$(INSTALL_PROGRAM) xowish $(DESTDIR)$(bindir); \
	fi

#========================================================================
# We need to enumerate the list of .c to .o lines here.
# Unfortunately, there does not seem to be any other way to do this
# in a Makefile-independent way.  We can't use VPATH because it picks up
# object files that may be located in the source directory.
#
# In the following lines, $(srcdir) refers to the toplevel directory
# containing your extension.  If your sources are in a subdirectory,
# you will have to modify the paths to reflect this:
#
# exampleA.$(OBJEXT): $(srcdir)/src/win/exampleA.c
# 	$(COMPILE) -c `@CYGPATH@ $(srcdir)/src/win/exampleA.c` -o $@
#========================================================================

$(src_generic_dir)/predefined.h: $(src_generic_dir)/mk_predefined.xotcl $(src_generic_dir)/predefined.xotcl
	(cd $(src_generic_dir); $(TCLSH) mk_predefined.xotcl > predefined.h)

xotclStubInit.$(OBJEXT): $(PKG_HEADERS)
xotclStubLib.$(OBJEXT): $(src_generic_dir)/xotclStubLib.c $(PKG_HEADERS)
xotcl.$(OBJEXT): $(src_generic_dir)/xotcl.c $(src_generic_dir)/predefined.h $(PKG_HEADERS)
xotclError.$(OBJEXT): $(src_generic_dir)/xotclError.c $(PKG_HEADERS)
xotclMetaData.$(OBJEXT): $(src_generic_dir)/xotclMetaData.c $(PKG_HEADERS)
xotclObjectData.$(OBJEXT): $(src_generic_dir)/xotclObjectData.c $(PKG_HEADERS)
xotclProfile.$(OBJEXT): $(src_generic_dir)/xotclProfile.c $(PKG_HEADERS)
xotclTrace.$(OBJEXT): $(src_generic_dir)/xotclTrace.c $(PKG_HEADERS)
xotclUtil.$(OBJEXT): $(src_generic_dir)/xotclUtil.c $(PKG_HEADERS)
xotclShadow.$(OBJEXT): $(src_generic_dir)/xotclShadow.c $(PKG_HEADERS)
aolstub.$(OBJEXT): $(src_generic_dir)/aolstub.c $(PKG_HEADERS)

#
# Target to regenerate header files and stub files from the *.decls tables.
#

genstubs:
	$(TCLSH) $(TCL_SRC_DIR)/tools/genStubs.tcl $(src_generic_dir) \
		$(src_generic_dir)/xotcl.decls $(src_generic_dir)/xotclInt.decls

#
# Target to check that all exported functions have an entry in the stubs
# tables.
#

checkstubs:
	-@for i in `nm -p $(PKG_LIB_FILE) | awk '$$2 ~ /T/ { print $$3 }' \
		| sort -n`; do \
		match=0; \
		for j in $(TCL_DECLS); do \
		    if [ `grep -c $$i $$j` -gt 0 ]; then \
			match=1; \
		    fi; \
		done; \
		if [ $$match -eq 0 ]; then echo $$i; fi \
	done

#========================================================================
# End of user-definable section
#========================================================================

#========================================================================
# Don't modify the file to clean here.  Instead, set the "CLEANFILES"
# variable in configure.in
#========================================================================

clean:  
	-rm -rf $(BINARIES) $(CLEANFILES) @XOTCLSH@ @XOWISH@ pkgIndex.tcl ./receiver \
		$(target_doc_dir)/*-xotcl.html
	find ${srcdir} -type f -name \*~ -exec rm \{} \;
	@if test ! "x$(subdirs)" = "x" ; then dirs="$(subdirs)" ; \
	for dir in $$dirs ; do \
	   if (cd $$dir; $(MAKE) $@) ; then true ; else exit 1 ; fi ; \
	done; fi

distclean: clean
	-rm -rf Makefile $(CONFIG_CLEAN_FILES)
	-rm -f config.cache config.log config.status
	@if test ! "x$(subdirs)" = "x" ; then dirs="$(subdirs)" ; \
	for dir in $$dirs ; do \
	   if (cd $$dir; $(MAKE) $@) ; then true ; else exit 1 ; fi ; \
	done; fi

#========================================================================
# Install binary object libraries.  On Windows this includes both .dll and
# .lib files.  Because the .lib files are not explicitly listed anywhere,
# we need to deduce their existence from the .dll file of the same name.
# Library files go into the lib directory.
# In addition, this will generate the pkgIndex.tcl
# file in the install location (assuming it can find a usable tclsh shell)
#
# You should not have to modify this target.
#========================================================================

install-lib-binaries:
	@mkdir -p $(DESTDIR)$(pkglibdir)
	@list='$(lib_BINARIES)'; for p in $$list; do \
	  if test -f $$p; then \
	    echo " $(INSTALL_PROGRAM) $$p $(DESTDIR)$(pkglibdir)/$$p"; \
	    $(INSTALL_PROGRAM) $$p $(DESTDIR)$(pkglibdir)/$$p; \
	    stub=`echo $$p|sed -e "s/.*\(stub\).*/\1/"`; \
	    if test "x$$stub" = "xstub"; then \
		echo " $(RANLIB_STUB) $(DESTDIR)$(pkglibdir)/$$p"; \
		$(RANLIB_STUB) $(DESTDIR)$(pkglibdir)/$$p; \
	    else \
		echo " $(RANLIB) $(DESTDIR)$(pkglibdir)/$$p"; \
		$(RANLIB) $(DESTDIR)$(pkglibdir)/$$p; \
		ln -s $(DESTDIR)$(pkglibdir)/$$p $(DESTDIR)$(libdir)/$$p; \
	    fi; \
	    ext=`echo $$p|sed -e "s/.*\.//"`; \
	    if test "x$$ext" = "xdll"; then \
		lib=`basename $$p|sed -e 's/.[^.]*$$//'`.lib; \
		if test -f $$lib; then \
		    echo " $(INSTALL_DATA) $$lib $(DESTDIR)$(pkglibdir)/$$lib"; \
	            $(INSTALL_DATA) $$lib $(DESTDIR)$(pkglibdir)/$$lib; \
		fi; \
	    fi; \
	  fi; \
	done
	@list='$(PKG_TCL_SOURCES)'; for p in $$list; do \
	  if test -f $(srcdir)/$$p; then \
	    destp=`basename $$p`; \
	    echo " Install $$destp $(DESTDIR)$(pkglibdir)/$$destp"; \
	    $(INSTALL_DATA) $(srcdir)/$$p $(DESTDIR)$(pkglibdir)/$$destp; \
	  fi; \
	done


#========================================================================
# Install binary executables (e.g. .exe files and dependent .dll files)
# This is for files that must go in the bin directory (located next to
# wish and tclsh), like dependent .dll files on Windows.
#
# You should not have to modify this target, except to define bin_BINARIES
# above if necessary.
#========================================================================

install-bin-binaries:
	@mkdir -p $(DESTDIR)$(bindir)
	@list='$(bin_BINARIES)'; for p in $$list; do \
	  if test -f $$p; then \
	    echo " $(INSTALL_PROGRAM) $$p $(DESTDIR)$(bindir)/$$p"; \
	    $(INSTALL_PROGRAM) $$p $(DESTDIR)$(bindir)/$$p; \
	  fi; \
	done

SUFFIXES= .c .$(OBJEXT)

#Makefile: $(srcdir)/Makefile.in  $(top_builddir)/config.status
#	cd $(top_builddir) \
#	  && CONFIG_FILES=$@ CONFIG_HEADERS= $(SHELL) ./config.status

uninstall-binaries:
	list='$(lib_BINARIES)'; for p in $$list; do \
	  rm -f $(DESTDIR)$(pkglibdir)/$$p; \
	done
	list='$(PKG_TCL_SOURCES)'; for p in $$list; do \
	  p=`basename $$p`; \
	  rm -f $(DESTDIR)$(pkglibdir)/$$p; \
	done
	list='$(bin_BINARIES)'; for p in $$list; do \
	  rm -f $(DESTDIR)$(bindir)/$$p; \
	done

$(DESTDIR)$(includedir):
	$(mkinstalldirs) $@
$(DESTDIR)$(bindir):
	$(mkinstalldirs)  $@
$(DESTDIR)$(libdir):
	$(mkinstalldirs)  $@
$(DESTDIR)$(pkglibdir):
	$(mkinstalldirs)  $@
$(DESTDIR)$(pkglibdir)/apps: $(DESTDIR)$(pkglibdir)
	$(mkinstalldirs)  $@
$(DESTDIR)$(mandir)/man1:
	$(mkinstalldirs)  $@
$(DESTDIR)$(mandir)/man3:
	$(mkinstalldirs)  $@
$(DESTDIR)$(mandir)/mann:
	$(mkinstalldirs)  $@

end:
	@echo "" 
	@echo "************************************************************"
	@echo " Make completed. In order to test XOTcl, invoke:"
	@echo "   make test"
	@echo ""
	@echo " In order install XOTcl, invoke:"
	@echo "   make install"
	@echo ""
	@echo " In order to install XOTcl for AOLserver 4.x, invoke:"
	@echo "   make install-aol"
	@echo "" 
	@echo " In order to invoke XOTcl interactively (before install), use:" 
	@echo "   export TCLLIBPATH=\"$(TCLLIBPATH)\"   or    " 
	@echo "   setenv TCLLIBPATH \"$(TCLLIBPATH)\""
	@echo " and"
	@if test "x$(XOTCLSH)" = "x" ; then \
	  echo "   @TCLSH_PROG@" ; \
	  echo "   package require XOTcl; namespace import -force xotcl::*" ; \
	  echo " or" ; \
	  echo "   put the 'package require' line into your ~/.tclshrc" ; \
	else \
	  echo "   ./xotclsh" ; \
	fi
	@echo "************************************************************"

RPMSOURCES=/usr/src/redhat/SOURCES
RPMSPECS=/usr/src/redhat/SPECS

rpm:
	@if test ! -d $(RPMSOURCES); then mkdir -p $(RPMSOURCES); fi
	@if test ! -d $(RPMSPECS); then mkdir -p $(RPMSPECS); fi
	cp unix/xotcl.spec $(RPMSPECS)/xotcl-$(PACKAGE_VERSION).spec
	make tar
	cp ../xotcl-$(PACKAGE_VERSION).tar.gz $(RPMSOURCES)
	rpmbuild -ba $(RPMSPECS)/xotcl-$(PACKAGE_VERSION).spec

bin-tar: 
	(cd ..; tar zcvf xotcl-$(PACKAGE_VERSION)-bin-linux-i686-glibc.tar.gz \
                `find $(exec_prefix)/bin/xotclsh $(exec_prefix)/bin/xowish \
                  $(prefix)/lib/xotcl$(PACKAGE_VERSION)* \
                  $(prefix)/lib/libxotcl$(PACKAGE_VERSION)* \
		  $(prefix)/include/xotcl*.h \
                  $(DESTDIR)$(pkglibdir) $(prefix)/man/man1/xo* \
                -type f -o -type l | fgrep -v CVS | fgrep -v SCCS | fgrep -v .junk| fgrep -v .db | fgrep -v "~" | fgrep -v "#" | fgrep -v /receiver/` \
	)

tar:  libraries-pkgindex
	sh ./tclconfig/mktar.sh


.PHONY: all binaries clean depend distclean doc install libraries \
	test test-core test-actiweb 

# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
.NOEXPORT:
