# 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) 2001-2007 Uwe Zdun
# Copyright (c) 2001-2016 Gustaf Neumann
# Copyright (c) 2016 Stefan Sobernig
#
# See the file "tcl-license.terms" for information on usage and redistribution
# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
#

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

NX_VERSION 	= @PACKAGE_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@
subdirs			= @subdirs@
aol_prefix		= @aol_prefix@
stubdir                 = stubs${TCL_MAJOR_VERSION}.${TCL_MINOR_VERSION}

# 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		= lib nx serialize
libsrc		= COPYRIGHT pkgIndex.tcl 
appdirs		= 
appsrc		= COPYRIGHT 

CPPCHECK        = cppcheck

# XOTcl subpackage
xotcl_srcdir	= ${srcdir}/library/xotcl
xotcl_src_doc_dir = ${xotcl_srcdir}/doc
xotcl_src_app_dir = ${xotcl_srcdir}/apps
xotcl_src_lib_dir = ${xotcl_srcdir}/library
xotcl_src_test_dir = ${xotcl_srcdir}/tests
xotcl_target_doc_dir = ${xotcl_srcdir}/doc

xotcl_libdirs	= comm lib serialize @libdirs_actiweb@
xotcl_libsrc	= COPYRIGHT xotcl2.tcl pkgIndex.tcl
xotcl_appdirs	= comm scripts utils @apps_actiweb@ 
xotcl_appsrc	= COPYRIGHT 

# Documentation source for xotcl-style documentation system
XODOC_SOURCE = \
	$(src_lib_dir)/serialize/serializer.tcl \
	$(xotcl_src_doc_dir)/langRef.xotcl \
	$(xotcl_src_lib_dir)/lib/*.xotcl \
	$(xotcl_src_test_dir)/*.xotcl \
	$(xotcl_src_app_dir)/comm/[flsw]*.xotcl \
	$(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.
#========================================================================

DTRACE_OBJ = @DTRACE_OBJ@
DTRACE_HDR = $(src_generic_dir)/nsfDTrace.h
DTRACE_SRC = $(src_generic_dir)/nsfDTrace.d

#========================================================================
# 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@ ${DTRACE_OBJ}

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@

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

DESTDIR		=

PKG_DIR		= $(PACKAGE_NAME)$(PACKAGE_VERSION)
pkglibdir	= $(libdir)/$(PKG_DIR)

top_builddir	= .

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

# INSTALL_OPTIONS =
# 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@
# useful for debugging:
#CFLAGS_DEFAULT	= -pedantic -g -std=c99 -DTCL_NO_DEPRECATED -Wconversion -Wsign-conversion -Wfloat-conversion -Wsign-compare
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_LIBS	= @SHLIB_LD_LIBS@
STLIB_LD	= @STLIB_LD@
TCL_DEFS	= @TCL_DEFS@
TCL_BIN_DIR	= @TCL_BIN_DIR@
TCL_SRC_DIR	= @TCL_SRC_DIR@
#
DTRACE          = dtrace

ifeq ($(DTPLITE),)
  DTPLITE=dtplite
else
  # Do nothing, use the environment variable as is.
endif
#
# Not used, but retained for reference of what libs Tcl required
TCL_LIBS	= @TCL_LIBS@

xotcl_pkglibdir	= $(pkglibdir)/xotcl

installed_shells = $(DESTDIR)$(bindir)/nxsh $(DESTDIR)$(bindir)/nxwish $(DESTDIR)$(bindir)/xotclsh $(DESTDIR)$(bindir)/xowish

#========================================================================
# 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} $(TCLLIBPATH)"
TCLSH_PROG	= @TCLSH_PROG@
TCLSH		= $(TCLSH_ENV) $(TCLSH_PROG)
#TCLSH		= $(TCLSH_ENV) LD_PRELOAD="$(srcdir)/$(PKG_LIB_FILE)" valgrind --log-fd=9 --leak-check=full --track-origins=yes --show-possibly-lost=no $(TCLSH_PROG) 9>>valgrind.out
SHARED_BUILD	= @SHARED_BUILD@

INCLUDES	= @PKG_INCLUDES@ @TCL_INCLUDES@ @NSF_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) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)

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

EXAMPLE_SCRIPTS = \
	$(src_doc_dir)/example-scripts/bagel.html \
	$(src_doc_dir)/example-scripts/container.html \
	$(src_doc_dir)/example-scripts/per-object-mixins.html \
	$(src_doc_dir)/example-scripts/rosetta-abstract-type.html \
	$(src_doc_dir)/example-scripts/rosetta-classes.html \
	$(src_doc_dir)/example-scripts/rosetta-constraint-genericity.html \
	$(src_doc_dir)/example-scripts/rosetta-delegates.html \
	$(src_doc_dir)/example-scripts/rosetta-polymorphism.html \
	$(src_doc_dir)/example-scripts/rosetta-serialization.html \
	$(src_doc_dir)/example-scripts/rosetta-singleton.html \
	$(src_doc_dir)/example-scripts/rosetta-sudoku.html \
	$(src_doc_dir)/example-scripts/rosetta-unknown-method.html \
	$(src_doc_dir)/example-scripts/ruby-mixins.html \
	$(src_doc_dir)/example-scripts/tk-horse-race.html \
	$(src_doc_dir)/example-scripts/tk-locomotive.html \
	$(src_doc_dir)/example-scripts/tk-ludo.html \
	$(src_doc_dir)/example-scripts/tk-geo.html \
	$(src_doc_dir)/example-scripts/tk-mini.html \
	$(src_doc_dir)/example-scripts/tk-spread.html \
	$(src_doc_dir)/example-scripts/traits-composite.html \
	$(src_doc_dir)/example-scripts/traits-simple.html \
	$(src_doc_dir)/example-scripts/rosetta-tokenizer.html \
	$(src_doc_dir)/example-scripts/rosetta-tree.html \
	$(src_doc_dir)/example-scripts/rosetta-multiple-distinct.html \
	$(src_doc_dir)/example-scripts/rosetta-add-variable.html \
	$(src_doc_dir)/example-scripts/rosetta-clone.html \
	$(src_doc_dir)/example-scripts/rosetta-multiple-inheritance.html \
	$(src_doc_dir)/example-scripts/rosetta-single-inheritance.html

%.html : %.tcl
	$(TCLSH) $(src_app_dir_native)/utils/source-doc-beautifier.tcl $<
	PATH=$(src_app_dir_native)/utils:$(PATH) asciidoc -f $(src_app_dir_native)/utils/asciidoc.conf $*.txt

#========================================================================
# 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 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) 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: libraries-pkgindex
	@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;

cppcheck:
	$(CPPCHECK) --enable=all generic/*.c $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) \
		-DNDEBUG=1 -I/usr/include -D__x86_64__

etags:
	etags --language=none \
		--regex='/[ \t]*\(proc\)[ \t]+\([^ \t]+\)/\2/' \
		--regex='/[ \t]*[:]?\(public \|protected \|private \|\)[ \t]*\(method\|object method\)[ \t]+\([^ \t]+\)/\3/' \
		--regex='/[ \t]*[a-zA-Z:0-9]+[^ \t]\(public \|protected \|private \|\)[ \t]*\(method\)[ \t]+\([^ \t]+\)/\3/' \
		--regex='/[ \t]*[a-zA-Z:0-9]+[^ \t]+\(proc\|instproc\)[ \t]+\([^ \t]+\)/\3/' \
		`find . -name \*.tcl -or -name \*.test`

libraries-pkgindex: pkgIndex.tcl
	$(TCLSH) $(src_lib_dir_native)/lib/mkIndex.tcl -dir $(src_lib_dir_native)


full-doc: doc pdfdoc example-doc

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

# for now, just the two doc files
doc:
	(cd $(src_doc_dir); asciidoc next-migration.txt)
	(cd $(src_doc_dir)/next-tutorial; asciidoc next-tutorial.txt)

pdfdoc:
	(cd $(src_doc_dir); prince --javascript --style=nx-small.css next-migration.html -o next-migration.pdf)
	(cd $(src_doc_dir)/next-tutorial; prince --javascript --style=../nx.css next-tutorial.html -o next-tutorial.pdf)

example-doc: $(EXAMPLE_SCRIPTS)

$(xotcl_target_doc_dir)/langRef-xotcl.html: pkgIndex.tcl $(xotcl_src_doc_dir)/langRef.xotcl $(XODOC_SOURCE)
	@docs=""; \
	for i in $(XODOC_SOURCE); do docs="$$docs `@CYGPATH@ $$i`"; done; \
	$(TCLSH) $(xotcl_src_lib_dir)/lib/makeDoc.xotcl \
		$(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 )

NX_MAN3 = \
	$(src_doc_dir)/Object.man \
	$(src_doc_dir)/Class.man \
	$(src_doc_dir)/configure.man \
	$(src_doc_dir)/current.man \
	$(src_doc_dir)/next.man

NX_MAN1 = \
	$(src_doc_dir)/nxsh.man \
	$(src_doc_dir)/xotclsh.man \
	$(src_doc_dir)/nxwish.man \
	$(src_doc_dir)/xowish.man

man: man-html man-nroff man-pdf

man-html: $(NX_MAN3:%.man=%.html)
$(src_doc_dir)/%.html: $(src_doc_dir)/%.man
	@for m in $(?F) ; do \
	    echo "    Generating html manpage from $$m" ; \
            (cd $(src_doc_dir); $(DTPLITE) -style man.css -o . html $$m) ; \
	done;

man-nroff : man1 man3
man1 : $(NX_MAN1:%.man=%.1)
$(src_doc_dir)/%.1 : $(src_doc_dir)/%.man
	@for m in $(?F) ; do \
	    echo "    Generating nroff manpage (Section 1) from $$m" ; \
            (cd $(src_doc_dir); $(DTPLITE)  -ext 1 -o . nroff $$m) ; \
	done;

man3: $(NX_MAN3:%.man=%.3)
$(src_doc_dir)/%.3 : $(src_doc_dir)/%.man
	@for m in $(?F) ; do \
	    echo "    Generating nroff manpage (Section 3) from $$m" ; \
            (cd $(src_doc_dir); $(DTPLITE)  -ext 3 -o . nroff $$m) ; \
	done;

man-pdf: $(NX_MAN3:%.man=%.pdf)
$(src_doc_dir)/%.pdf : $(src_doc_dir)/%.html
	@for m in $(?F) ; do \
	    echo "    Generating pdf manpage for $$m" ; \
            (cd $(src_doc_dir); prince -s man-princexml.css $$m) ; \
	done;

install: install-binaries install-shells install-libraries install-doc install-xotcl-shells install-xotcl-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;

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

install-aol: install-binaries install-libraries install-xotcl-libraries
	@if test -d $(DESTDIR)/$(aol_prefix)/modules/tcl/; then \
		$(INSTALL) $(src_generic_dir)/aol-xotcl.tcl \
			$(DESTDIR)/$(aol_prefix)/modules/tcl/xotcl.tcl ; \
	else \
		$(INSTALL) $(src_generic_dir)/aol-xotcl.tcl \
			$(DESTDIR)/$(aol_prefix)/tcl/xotcl.tcl ; \
	fi;

#========================================================================
# 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;
	@mkdir -p $(DESTDIR)$(libdir)/tcl8/site-tcl
	@for i in $(srcdir)/tcl8/site-tcl/*.tm ; do \
	    if test -f $$i; then \
	       echo "    Installing module $$i in $(DESTDIR)$(libdir)/tcl8/site-tcl" ; \
	       $(INSTALL_DATA) $$i $(DESTDIR)$(libdir)/tcl8/site-tcl/; \
	    fi; \
	done;
	@echo "    Installing pkgIndex.tcl for nsf in $(DESTDIR)$(pkglibdir)/pkgIndex.tcl"
	@echo "" >> $(DESTDIR)$(pkglibdir)/pkgIndex.tcl
	@cat $(srcdir)/unix/pkgIndex.unix >> $(DESTDIR)$(pkglibdir)/pkgIndex.tcl
	@$(INSTALL_DATA) $(srcdir)/nsfConfig.sh $(DESTDIR)$(libdir)/

install-xotcl-libraries: install-libraries $(DESTDIR)$(pkglibdir)
	@echo "Installing XOTcl Libraries to $(DESTDIR)$(xotcl_pkglibdir)/"
	@rm -rf $(DESTDIR)$(xotcl_pkglibdir)
	@mkdir -p $(DESTDIR)$(xotcl_pkglibdir)
	@chmod 755 $(DESTDIR)$(xotcl_pkglibdir)
	@for i in $(xotcl_libdirs) ; do \
	    echo "    Installing library $$i/" ; \
	    rm -rf $(DESTDIR)$(xotcl_pkglibdir)/$$i ; \
	    mkdir -p $(DESTDIR)$(xotcl_pkglibdir)/$$i; \
	    chmod 755 $(DESTDIR)$(xotcl_pkglibdir)/$$i; \
	    for j in $(xotcl_src_lib_dir)/$$i/*.*tcl ; do \
		$(INSTALL_DATA) $$j $(DESTDIR)$(xotcl_pkglibdir)/$$i/; \
	    done; \
	done;
	@for i in $(xotcl_libsrc) ; do \
	    echo "    Installing $$i" ; \
	    rm -rf $(DESTDIR)$(xotcl_pkglibdir)/$$i ; \
	    $(INSTALL_DATA) $(xotcl_src_lib_dir)/$$i $(DESTDIR)$(xotcl_pkglibdir)/$$i ; \
	done;

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

install-xotcl-apps: install-xotcl-libraries
	@echo "Installing Applications to $(DESTDIR)$(xotcl_pkglibdir)/apps/"
	@for i in $(xotcl_appdirs) ; do \
	    echo "    Installing apps $$i/" ; \
	    rm -rf $(DESTDIR)$(xotcl_pkglibdir)/apps/$$i ; \
	    mkdir -p $(DESTDIR)$(xotcl_pkglibdir)/apps/$$i; \
	    chmod 755 $(DESTDIR)$(xotcl_pkglibdir)/apps/$$i; \
	    for j in $(src_app_dir)/$$i/* ; do \
		if test -d $$j; then \
		    mkdir -p $(DESTDIR)$(xotcl_pkglibdir)/$$j; \
		    chmod 755 $(DESTDIR)$(xotcl_pkglibdir)/$$j; \
		    for k in $$j/* ; do \
			$(INSTALL) $$k $(DESTDIR)$(xotcl_pkglibdir)/$$j ; \
		    done; \
		else \
		$(INSTALL) $$j $(DESTDIR)$(xotcl_pkglibdir)/apps/$$i/; \
		fi; \
	    done; \
	done;
	@for i in $(xotcl_appsrc) ; do \
	    echo "    Installing $$i" ; \
	    rm -rf $(DESTDIR)$(xotcl_pkglibdir)/apps/$$i ; \
	    $(INSTALL_DATA) $(src_app_dir)/$$i $(DESTDIR)$(xotcl_pkglibdir)/apps ; \
	done;
	@rm -rf $(DESTDIR)$(xotcl_pkglibdir)/store/XOTclGdbm
	@rm -rf $(DESTDIR)$(xotcl_pkglibdir)/store/XOTclSdbm
	@rm -rf $(DESTDIR)$(xotcl_pkglibdir)/xml/TclExpat-1.1

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

# install-doc: $(DESTDIR)$(mandir)/man1 $(DESTDIR)$(mandir)/man3 $(DESTDIR)$(mandir)/mann
#	@(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)

install-doc: $(DESTDIR)$(mandir)/man1 $(DESTDIR)$(mandir)/man3
	@echo "Installing documentation in $(DESTDIR)$(mandir)"
	@list='$(srcdir)/doc/*.1'; for i in $$list; do \
	    echo "Installing $$i"; \
	    $(INSTALL_DATA) $$i $(DESTDIR)$(mandir)/man1 ; \
	done
	@list='$(srcdir)/doc/*.3'; for i in $$list; do \
	    echo "Installing $$i"; \
	    $(INSTALL_DATA) $$i $(DESTDIR)$(mandir)/man3 ; \
	done

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

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

lldbtest:
	$(MAKE) "TCLSH_PROG=lldb -b -o run -- $(TCLSH_PROG)" test

test: binaries libraries test-core test-xotcl test-http @test_actiweb@
	@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
	$(TCLSH) $(src_test_dir_native)/summary.tcl -title NX+XOTcl -libdir $(PLATFORM_DIR) $(TESTFLAGS)

test-nohttp: binaries libraries test-core test-xotcl

TESTLOG   = ./__test.log
TESTFLAGS = -testlog $(TESTLOG)

test-summary:
	$(TCLSH) $(src_test_dir_native)/summary.tcl -libdir $(PLATFORM_DIR) $(TESTFLAGS)

test-core:
	rm -f $(TESTLOG)
	$(TCLSH) $(src_test_dir_native)/object-system.test -libdir $(PLATFORM_DIR) $(TESTFLAGS)
	$(TCLSH) $(src_test_dir_native)/destroy.test -libdir $(PLATFORM_DIR) $(TESTFLAGS)
	$(TCLSH) $(src_test_dir_native)/methods.test -libdir $(PLATFORM_DIR) $(TESTFLAGS)
	$(TCLSH) $(src_test_dir_native)/method-parameter.test -libdir $(PLATFORM_DIR) $(TESTFLAGS)
	$(TCLSH) $(src_test_dir_native)/nsf-cmd.test -libdir $(PLATFORM_DIR) $(TESTFLAGS)
	$(TCLSH) $(src_test_dir_native)/accessor.test -libdir $(PLATFORM_DIR) $(TESTFLAGS)
	$(TCLSH) $(src_test_dir_native)/cget.test -libdir $(PLATFORM_DIR) $(TESTFLAGS)
	$(TCLSH) $(src_test_dir_native)/properties.test -libdir $(PLATFORM_DIR) $(TESTFLAGS)
	$(TCLSH) $(src_test_dir_native)/var-access.test -libdir $(PLATFORM_DIR) $(TESTFLAGS)
	$(TCLSH) $(src_test_dir_native)/varresolution.test -libdir $(PLATFORM_DIR) $(TESTFLAGS)
	$(TCLSH) $(src_test_dir_native)/info-method.test -libdir $(PLATFORM_DIR) $(TESTFLAGS)
	$(TCLSH) $(src_test_dir_native)/submethods.test -libdir $(PLATFORM_DIR) $(TESTFLAGS)
	$(TCLSH) $(src_test_dir_native)/info-variable.test -libdir $(PLATFORM_DIR) $(TESTFLAGS)
	$(TCLSH) $(src_test_dir_native)/disposition.test -libdir $(PLATFORM_DIR) $(TESTFLAGS)
	$(TCLSH) $(src_test_dir_native)/volatile.test -libdir $(PLATFORM_DIR) $(TESTFLAGS)
	$(TCLSH) $(src_test_dir_native)/parameters.test -libdir $(PLATFORM_DIR) $(TESTFLAGS)
	$(TCLSH) $(src_test_dir_native)/returns.test -libdir $(PLATFORM_DIR) $(TESTFLAGS)
	$(TCLSH) $(src_test_dir_native)/method-require.test -libdir $(PLATFORM_DIR) $(TESTFLAGS)
	$(TCLSH) $(src_test_dir_native)/interceptor-slot.test -libdir $(PLATFORM_DIR) $(TESTFLAGS)
	$(TCLSH) $(src_test_dir_native)/alias.test -libdir $(PLATFORM_DIR) $(TESTFLAGS)
	$(TCLSH) $(src_test_dir_native)/protected.test -libdir $(PLATFORM_DIR) $(TESTFLAGS)
	$(TCLSH) $(src_test_dir_native)/forward.test -libdir $(PLATFORM_DIR) $(TESTFLAGS)
	$(TCLSH) $(src_test_dir_native)/mixinof.test -libdir $(PLATFORM_DIR) $(TESTFLAGS)
	$(TCLSH) $(src_test_dir_native)/tcl86.test -libdir $(PLATFORM_DIR) $(TESTFLAGS)
	$(TCLSH) $(src_test_dir_native)/contains.test -libdir $(PLATFORM_DIR) $(TESTFLAGS)
	$(TCLSH) $(src_test_dir_native)/tcloo.test -libdir $(PLATFORM_DIR) $(TESTFLAGS)
	$(TCLSH) $(src_test_dir_native)/interp.test -libdir $(PLATFORM_DIR) $(TESTFLAGS)
	$(TCLSH) $(src_test_dir_native)/serialize.test -libdir $(PLATFORM_DIR) $(TESTFLAGS)
	$(TCLSH) $(src_test_dir_native)/plain-object-method.test -libdir $(PLATFORM_DIR) $(TESTFLAGS)	
	$(TCLSH) $(src_test_dir_native)/class-method.test -libdir $(PLATFORM_DIR) $(TESTFLAGS)	
	$(TCLSH) $(src_test_dir_native)/linearization.test -libdir $(PLATFORM_DIR) $(TESTFLAGS)
	$(TCLSH) $(src_test_dir_native)/traits.test -libdir $(PLATFORM_DIR) $(TESTFLAGS)
	$(TCLSH) $(src_test_dir_native)/shells.test -libdir $(PLATFORM_DIR) $(TESTFLAGS)
	$(TCLSH) $(src_doc_dir_native)/example-scripts/bagel.tcl -libdir $(PLATFORM_DIR) $(TESTFLAGS)
	$(TCLSH) $(src_doc_dir_native)/example-scripts/container.tcl -libdir $(PLATFORM_DIR) $(TESTFLAGS)
	$(TCLSH) $(src_doc_dir_native)/example-scripts/rosetta-abstract-type.tcl -libdir $(PLATFORM_DIR) $(TESTFLAGS)
	$(TCLSH) $(src_doc_dir_native)/example-scripts/rosetta-classes.tcl -libdir $(PLATFORM_DIR) $(TESTFLAGS)
	$(TCLSH) $(src_doc_dir_native)/example-scripts/rosetta-constraint-genericity.tcl -libdir $(PLATFORM_DIR) $(TESTFLAGS)
	$(TCLSH) $(src_doc_dir_native)/example-scripts/rosetta-delegates.tcl -libdir $(PLATFORM_DIR) $(TESTFLAGS)
	$(TCLSH) $(src_doc_dir_native)/example-scripts/rosetta-polymorphism.tcl -libdir $(PLATFORM_DIR) $(TESTFLAGS)
	$(TCLSH) $(src_doc_dir_native)/example-scripts/rosetta-serialization.tcl -libdir $(PLATFORM_DIR) $(TESTFLAGS)
	$(TCLSH) $(src_doc_dir_native)/example-scripts/rosetta-singleton.tcl -libdir $(PLATFORM_DIR) $(TESTFLAGS)
	$(TCLSH) $(src_doc_dir_native)/example-scripts/rosetta-unknown-method.tcl -libdir $(PLATFORM_DIR) $(TESTFLAGS)
	$(TCLSH) $(src_doc_dir_native)/example-scripts/ruby-mixins.tcl -libdir $(PLATFORM_DIR) $(TESTFLAGS)
	$(TCLSH) $(src_doc_dir_native)/example-scripts/traits-composite.tcl -libdir $(PLATFORM_DIR) $(TESTFLAGS)
	$(TCLSH) $(src_doc_dir_native)/example-scripts/traits-simple.tcl -libdir $(PLATFORM_DIR) $(TESTFLAGS)
	$(TCLSH) $(src_doc_dir_native)/example-scripts/rosetta-tokenizer.tcl -libdir $(PLATFORM_DIR) $(TESTFLAGS)
	$(TCLSH) $(src_doc_dir_native)/example-scripts/rosetta-tree.tcl -libdir $(PLATFORM_DIR) $(TESTFLAGS)
	$(TCLSH) $(src_doc_dir_native)/example-scripts/rosetta-multiple-distinct.tcl -libdir $(PLATFORM_DIR) $(TESTFLAGS)
	$(TCLSH) $(src_doc_dir_native)/example-scripts/rosetta-add-variable.tcl -libdir $(PLATFORM_DIR) $(TESTFLAGS)
	$(TCLSH) $(src_doc_dir_native)/example-scripts/rosetta-clone.tcl -libdir $(PLATFORM_DIR) $(TESTFLAGS)
	$(TCLSH) $(src_doc_dir_native)/example-scripts/rosetta-multiple-inheritance.tcl -libdir $(PLATFORM_DIR) $(TESTFLAGS)
	$(TCLSH) $(src_doc_dir_native)/example-scripts/rosetta-single-inheritance.tcl -libdir $(PLATFORM_DIR) $(TESTFLAGS)

test-xotcl:
	$(TCLSH) $(xotcl_src_test_dir)/testo.xotcl -libdir $(PLATFORM_DIR) $(TESTFLAGS)
	$(TCLSH) $(xotcl_src_test_dir)/speedtest.xotcl -libdir $(PLATFORM_DIR) $(TESTFLAGS)
	$(TCLSH) $(xotcl_src_test_dir)/testx.xotcl -libdir $(PLATFORM_DIR) $(TESTFLAGS)
	$(TCLSH) $(xotcl_src_test_dir)/slottest.xotcl -libdir $(PLATFORM_DIR) $(TESTFLAGS)

test-http:
	$(TCLSH) $(xotcl_src_test_dir)/xocomm.test -libdir $(PLATFORM_DIR) $(TESTFLAGS)

test-actiweb:
	$(TCLSH) $(xotcl_src_test_dir)/actiweb.test -libdir $(PLATFORM_DIR) $(TESTFLAGS)
	$(TCLSH) $(xotcl_src_test_dir)/persistence.test -libdir $(PLATFORM_DIR) $(TESTFLAGS)
	$(TCLSH) $(xotcl_src_test_dir)/UNIVERSAL.test -libdir $(PLATFORM_DIR) $(TESTFLAGS)
	$(TCLSH) $(xotcl_src_test_dir)/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 $@

#========================================================================
# next shells
#========================================================================

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

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

#nxsh: tclAppInit.o $(PKG_OBJECTS) $(CONDITIONAL_STUB_OBJECTS)
#	$(CC) -rdynamic -o $@ tclAppInit.o \
#		$(CFLAGS)  $(TCL_LIB_SPEC) \
#		$(DMALLOC_LIB) $(CONDITIONAL_STUB_OBJECTS)

#xowish: tkAppInit.o $(PKG_OBJECTS) $(CONDITIONAL_STUB_OBJECTS)
#	$(CC) -rdynamic -o $@ tkAppInit.o \
#		$(PKG_OBJECTS) \
#		$(CFLAGS)  $(TCL_LIB_SPEC) $(TK_LIB_SPEC) \
#		$(DMALLOC_LIB) $(CONDITIONAL_STUB_OBJECTS)

install-shells:
	@if test -f nxsh; then \
		$(INSTALL_PROGRAM) nxsh $(DESTDIR)$(bindir); \
	fi
	@if test -f nxwish; then \
		$(INSTALL_PROGRAM) nxwish $(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.tcl $(src_generic_dir)/nsf.tcl
	(cd $(src_generic_dir); $(TCLSH) mk_predefined.tcl nsf.tcl > predefined.h)

$(src_generic_dir)/nsfAPI.h: $(src_generic_dir)/gentclAPI.tcl $(src_generic_dir)/nsfAPI.decls
	$(TCLSH) $(src_generic_dir)/gentclAPI.tcl $(src_generic_dir)/nsfAPI.decls > $(src_generic_dir)/nsfAPI.h

aolstub.$(OBJEXT): $(src_generic_dir)/aolstub.c $(PKG_HEADERS)
nsf.$(OBJEXT): $(src_generic_dir)/nsf.c $(src_generic_dir)/predefined.h $(src_generic_dir)/nsfAccessInt.h $(src_generic_dir)/nsfAPI.h $(PKG_HEADERS) $(src_generic_dir)/nsfStack.c $(src_generic_dir)/asm/nsfAssemble.c $(src_generic_dir)/asm/nsfAsmExecuteCallThreading.c $(src_generic_dir)/asm/nsfAsmExecuteLabelThreading.c $(src_generic_dir)/asm/nsfAsmAssemble.c $(DTRACE_HDR) 
nsfDebug.$(OBJEXT): $(src_generic_dir)/nsfDebug.c $(PKG_HEADERS)
nsfError.$(OBJEXT): $(src_generic_dir)/nsfError.c $(PKG_HEADERS)
nsfMetaData.$(OBJEXT): $(src_generic_dir)/nsfMetaData.c $(PKG_HEADERS)
nsfObj.$(OBJEXT): $(src_generic_dir)/nsfObj.c $(PKG_HEADERS)
nsfObjectData.$(OBJEXT): $(src_generic_dir)/nsfObjectData.c $(PKG_HEADERS)
nsfPointer.$(OBJEXT): $(src_generic_dir)/nsfPointer.c $(PKG_HEADERS)
nsfEnumerationType.$(OBJEXT): $(src_generic_dir)/nsfEnumerationType.c $(PKG_HEADERS)
nsfProfile.$(OBJEXT): $(src_generic_dir)/nsfProfile.c $(PKG_HEADERS)
nsfShadow.$(OBJEXT): $(src_generic_dir)/nsfShadow.c $(PKG_HEADERS)
$(stubdir)/nsfStubInit.$(OBJEXT): $(PKG_HEADERS)
nsfStubLib.$(OBJEXT): $(src_generic_dir)/nsfStubLib.c $(PKG_HEADERS)
nsfUtil.$(OBJEXT): $(src_generic_dir)/nsfUtil.c $(PKG_HEADERS)

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

TCL_SRC_DIR_85=/usr/local/src/tcl8.5.19
TCL_SRC_DIR_86=/usr/local/src/core-8-6-6-rc
TCL_SRC_DIR_87=/usr/local/src/tcl-trunk

genstubs:
	mkdir -p $(src_generic_dir)/stubs8.5
	tclsh8.5 $(TCL_SRC_DIR_85)/tools/genStubs.tcl $(src_generic_dir)/stubs8.5 \
		$(src_generic_dir)/nsf.decls $(src_generic_dir)/nsfInt.decls
	mkdir -p $(src_generic_dir)/stubs8.6
	tclsh8.6 $(TCL_SRC_DIR_86)/tools/genStubs.tcl $(src_generic_dir)/stubs8.6 \
		$(src_generic_dir)/nsf.decls $(src_generic_dir)/nsfInt.decls
	mkdir -p $(src_generic_dir)/stubs8.7
	tclsh8.7 $(TCL_SRC_DIR_87)/tools/genStubs.tcl $(src_generic_dir)/stubs8.7 \
		$(src_generic_dir)/nsf.decls $(src_generic_dir)/nsfInt.decls

getstubs:
	$(TCLSH) $(src_app_dir_native)/utils/getstubs.tcl $(src_generic_dir)

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

# DTrace support

$(PKG_OBJECTS): $(DTRACE_HDR)

$(DTRACE_HDR): $(DTRACE_SRC)
	$(DTRACE) -h $(DTRACE_SWITCHES) -o $@ -s $(DTRACE_SRC)

$(DTRACE_OBJ): $(DTRACE_SRC) $(TCL_OBJS)
	$(DTRACE) -G $(DTRACE_SWITCHES) -o $@ -s $(DTRACE_SRC) $(TCL_OBJS)


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

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

cleandoc:  
	-rm -rf $(xotcl_target_doc_dir)/*-xotcl.html

clean: cleandoc
	-rm -rf $(BINARIES) $(CLEANFILES) generic/stub*/*.o ./receiver $(TESTLOG)
	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 $(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.
#
# A manual generation of the pkgIndex files via tclsh should look like
#     pkg_mkIndex -direct -verbose library/lib *tcl
#
# 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 the next-scripting framework,"
	@echo " invoke:"
	@echo "   make test"
	@echo ""
	@echo " To install, use:"
	@echo "   make install"
	@echo ""
	@echo " To install for AOLserver 4.x, use:"
	@echo "   make install-aol"
	@echo "" 
	@echo " In order to invoke NX interactively (before install), use:" 
	@echo "   export TCLLIBPATH=\"$(TCLLIBPATH)\" TCL8_5_TM_PATH=\"$(TCLLIBPATH)\"/tcl8/site-tcl" 
	@echo " and"
	@echo "   @TCLSH_PROG@"
	@echo "   package require nx"
	@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 \
                  $(prefix)/bin/nx*sh \
                  $(prefix)/bin/xotcl*sh \
                  $(prefix)/lib/nsf* \
                  $(prefix)/lib/libnsf* \
		  $(prefix)/include/nsf*.h \
                  $(DESTDIR)$(pkglibdir) $(prefix)/man/man1/nsf* \
                -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
	echo @NSF_COMMIT@ > COMMIT
	sh $(srcdir)/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: