# 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.
#
# See the file "license.terms" for information on usage and redistribution
# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
#
# RCS: @(#) $Id: Makefile.in,v 1.15 2001/05/29 15:51:16 andreas_kupries Exp $


#========================================================================
# Edit the following few lines when writing a new extension
#========================================================================

#========================================================================
# Change the name of the variable "exampleA_LIB_FILE" to match the one
# used in the configure script.  This is the parameterized name of the
# library that we are building.
#========================================================================

STUB_LIB_BINARY=$(xotclstub_LIB_FILE)
lib_BINARIES=$(xotcl_LIB_FILE) @STUB_LIB_BINARY@
BINARIES=$(lib_BINARIES) 

#========================================================================
# Enumerate the names of the source files included in this package.
# This will be used when a dist target is added to the Makefile.
#========================================================================

TOP_DIR=${srcdir}/..

WIN_DIR=$(TOP_DIR)/win
UNIX_DIR=$(TOP_DIR)/unix
PLATFORM_DIR=@PLATFORM_DIR@

src_doc_dir = $(TOP_DIR)/doc
src_lib_dir = $(TOP_DIR)/library
src_test_dir = $(TOP_DIR)/tests
src_app_dir = $(TOP_DIR)/apps
src_man_dir = $(TOP_DIR)/man
src_config_dir = $(TOP_DIR)/config
src_generic_dir = $(TOP_DIR)/generic

WIN_SOURCES=$(PLATFORM_DIR)/dllEntryPoint.c
UNIX_SOURCES=

GENERIC_SOURCES_NO_STUBS = \
	$(src_generic_dir)/xotcl.c \
	$(src_generic_dir)/xotclError.c \
	$(src_generic_dir)/xotclMetaData.c \
	$(src_generic_dir)/xotclObjectData.c \
	$(src_generic_dir)/xotclProfile.c \
	$(src_generic_dir)/xotclTrace.c \
	$(src_generic_dir)/xotclUtil.c \
	$(src_generic_dir)/xotclShadow.c \
	$(src_generic_dir)/xotclCompile.c \
	$(src_generic_dir)/aolstub.c
STUB_SOURCES = $(src_generic_dir)/xotclStubInit.c \
	$(src_generic_dir)/xotclStubLib.c
GENERIC_SOURCES = @STUB_SOURCES@

PLATFORM_SOURCES = @PLATFORM_SOURCES@
SOURCES = $(PLATFORM_SOURCES) $(GENERIC_SOURCES)

#========================================================================
# Enumerate the names of the object files included in this package.
# These objects are created and linked into the final library.  In
# most cases these object files will correspond to the source files
# above.
#
#========================================================================

WIN_OBJECTS = dllEntryPoint.$(OBJEXT)
UNIX_OBJECTS =

STUB_OBJECTS = so/xotclStubInit.$(OBJEXT)
CONDITIONAL_STUB_OBJECTS = @STUB_OBJECTS@
GENERIC_OBJECTS_NO_STUBS = \
	so/xotcl.$(OBJEXT) \
	so/xotclError.$(OBJEXT) \
	so/xotclMetaData.$(OBJEXT) \
	so/xotclObjectData.$(OBJEXT) \
	so/xotclProfile.$(OBJEXT) \
	so/xotclTrace.$(OBJEXT) \
	so/xotclUtil.$(OBJEXT) \
	so/xotclShadow.$(OBJEXT) \
	so/xotclCompile.$(OBJEXT) \
	so/aolstub.$(OBJEXT)
GENERIC_OBJECTS_NOT_SHARED = \
	o/xotcl.$(OBJEXT) \
	o/xotclError.$(OBJEXT) \
	o/xotclMetaData.$(OBJEXT) \
	o/xotclObjectData.$(OBJEXT) \
	o/xotclProfile.$(OBJEXT) \
	o/xotclTrace.$(OBJEXT) \
	o/xotclUtil.$(OBJEXT) \
	o/xotclShadow.$(OBJEXT) \
	o/xotclCompile.$(OBJEXT) \
	o/aolstub.$(OBJEXT)
GENERIC_OBJECTS = $(GENERIC_OBJECTS_NO_STUBS) @STUB_OBJECTS@

PLATFORM_OBJECTS = @PLATFORM_OBJECTS@
xotclstub_OBJECTS = so/xotclStubLib.$(OBJEXT)
xotcl_OBJECTS = $(PLATFORM_OBJECTS) $(GENERIC_OBJECTS) $(STORE_OBJECTS)
OBJECTS = $(xotcl_OBJECTS) $(xotclstub_OBJECTS)

XOTCL_DECLS = $(src_generic_dir)/xotcl.decls $(src_generic_dir)/xotclInt.decls
libdirs = comm lib COPYRIGHT pkgIndex.tcl serialize @libdirs_actiweb@
appdirs = comm COPYRIGHT scripts utils @apps_actiweb@

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] 

#========================================================================
# The substitution of "exampleA_LIB_FILE" into the variable name below
# let's us refer to the objects for the library without knowing the name
# of the library in advance.  It also lets us use the "$@" variable in
# the rule for building the library, so we can refer to both the list of 
# objects and the library itself in a platform-independent manner.
#========================================================================

xotcl_LIB_FILE = @xotcl_LIB_FILE@
@xotcl_LIB_FILE@_OBJECTS = $(xotcl_OBJECTS)

xotclstub_LIB_FILE = @xotclstub_LIB_FILE@
@xotclstub_LIB_FILE@_OBJECTS = $(xotclstub_OBJECTS)

#======================================================================
# This is a list of header files to be installed
#========================================================================

GENERIC_HDRS= \
	$(TOP_DIR)/generic/xotcl.h \
	$(TOP_DIR)/generic/xotclDecls.h \
	$(TOP_DIR)/generic/xotclInt.h \
	$(TOP_DIR)/generic/xotclAccessInt.h \
	$(TOP_DIR)/generic/xotclIntDecls.h

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

XOTCL_GENERIC_DIR_NATIVE = @XOTCL_GENERIC_DIR_NATIVE@
XOTCL_UNIX_DIR_NATIVE = @XOTCL_UNIX_DIR_NATIVE@
XOTCL_WIN_DIR_NATIVE = @XOTCL_WIN_DIR_NATIVE@

#export TCLLIBPATH=$(TOP_DIR)/unix $(TOP_DIR)/library
export TCLLIBPATH=..

#========================================================================
# Nothing of the variables below this line need to be changed.  Please
# check the TARGETS section below to make sure the make targets are
# correct.
#========================================================================

SHELL = @SHELL@

srcdir = @srcdir@
top_srcdir = @top_srcdir@
prefix = @prefix@
exec_prefix = @exec_prefix@

bindir = @bindir@
libdir = @libdir@
mandir = @mandir@
includedir = @includedir@
pkglibdir = $(libdir)/@PACKAGE@@VERSION@
top_builddir = .

subdirs = @subdirs@
DESTDIR =

INSTALL = $(TCLSH_PROG) `@CYGPATH@ $(src_config_dir)/installFile.tcl` -c
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_DATA = @INSTALL_DATA@
transform = @program_transform_name@

NORMAL_INSTALL = :
PRE_INSTALL = :
POST_INSTALL = :
NORMAL_UNINSTALL = :
PRE_UNINSTALL = :
POST_UNINSTALL = :

PACKAGE = @PACKAGE@
VERSION = @VERSION@
PATCHLEVEL = @PATCHLEVEL@
FULLVERSION= @FULLVERSION@
CC = @CC@
CFLAGS_DEBUG = @CFLAGS_DEBUG@
CFLAGS_DEFAULT = @CFLAGS_DEFAULT@
CFLAGS_OPTIMIZE = @CFLAGS_OPTIMIZE@
CFLAGS_WARNING =
CLEANFILES = @CLEANFILES@
EXEEXT = @EXEEXT@
LDFLAGS_DEBUG = @LDFLAGS_DEBUG@
LDFLAGS_DEFAULT = @LDFLAGS_DEFAULT@
LDFLAGS_OPTIMIZE = @LDFLAGS_OPTIMIZE@
MAKE_LIB = @MAKE_LIB@
MAKE_SHARED_LIB = @MAKE_SHARED_LIB@
MAKE_STATIC_LIB = @MAKE_STATIC_LIB@
OBJEXT = @OBJEXT@
RANLIB = @RANLIB@
RANLIB_STUB = @RANLIB_STUB@
SHLIB_CFLAGS = @SHLIB_CFLAGS@
SHLIB_LD = @SHLIB_LD@
SHLIB_LDFLAGS = @SHLIB_LDFLAGS@
SHLIB_LD_LIBS = @SHLIB_LD_LIBS@
SHLIB_SUFFIX=  @SHLIB_SUFFIX@
STLIB_LD = @STLIB_LD@
TCL_BIN_DIR = @TCL_BIN_DIR@
TCL_DEFS = @TCL_DEFS@
TCL_EXTRA_CFLAGS = @TCL_EXTRA_CFLAGS@
TCL_EXTRA_CFLAGS = #
TCL_LD_FLAGS = @TCL_LD_FLAGS@
TCL_LIBS = @TCL_LIBS@
TCL_INCLUDES = @TCL_INCLUDES@
TK_INCLUDES = @TK_INCLUDES@
TCL_SHLIB_LD_LIBS = @TCL_SHLIB_LD_LIBS@
TCL_SRC_DIR = @TCL_SRC_DIR@
TCL_DBGX = @TCL_DBGX@
TCL_STUB_LIB_FILE = @TCL_STUB_LIB_FILE@
TCL_STUB_LIB_SPEC = @TCL_STUB_LIB_SPEC@
TCL_TOOL_DIR_NATIVE = @TCL_TOOL_DIR_NATIVE@
TCL_TOP_DIR_NATIVE = @TCL_TOP_DIR_NATIVE@
TCL_UNIX_DIR_NATIVE = @TCL_UNIX_DIR_NATIVE@
TCL_WIN_DIR_NATIVE = @TCL_WIN_DIR_NATIVE@
INCLUDE_DIR_NATIVE = @INCLUDE_DIR_NATIVE@
TCL_BMAP_DIR_NATIVE = @TCL_BMAP_DIR_NATIVE@
TCL_PLATFORM_DIR_NATIVE = @TCL_PLATFORM_DIR_NATIVE@
TCL_GENERIC_DIR_NATIVE = @TCL_GENERIC_DIR_NATIVE@
TCLSH_PROG = @TCLSH_PROG@
XOTCL_INCLUDES = @XOTCL_INCLUDES@
TCL_LIB_SPEC = @TCL_LIB_SPEC@
TK_LIB_SPEC = @TK_LIB_SPEC@
XOTCLSH=@XOTCLSH@
XOWISH=@XOWISH@

AUTOCONF = autoconf

LDFLAGS = $(LDFLAGS_DEFAULT)
INCLUDES = @TCL_INCLUDES@ @XOTCL_INCLUDES@ 
EXTRA_CFLAGS = $(AC_FLAGS) $(PROTO_FLAGS) $(MEM_DEBUG_FLAGS) $(NO_DEPRECATED_FLAGS) $(TCL_EXTRA_CFLAGS)

AOL_DEFINES		= @AOL_DEFINES@
HAVE_TCL_COMPILE_H	= @HAVE_TCL_COMPILE_H@
DEFS = @DEFS@ $(EXTRA_CFLAGS) \
  $(AOL_DEFINES) $(HAVE_TCL_COMPILE_H) \
  -DTCL_SHLIB_EXT=\"${SHLIB_SUFFIX}\"

DEFS_WITH_STUBS = @TCL_STUB_LIB_DEFINE@ $(DEFS)
ACLOCAL_M4 = $(srcdir)/aclocal.m4
mkinstalldirs = $(SHELL) $(src_config_dir)/mkinstalldirs
CPPFLAGS = @CPPFLAGS@
LIBS = @LIBS@
AR = ar
CFLAGS=		@CFLAGS@ @CFLAGS_DEBUG@  \
			-DXOTCLVERSION=\"$(VERSION)\"  \
			-DXOTCLPATCHLEVEL=\"$(PATCHLEVEL)\"  \
			$(DMALLOC_DEFINES)
COMPILE = $(CC) $(DEFS_WITH_STUBS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
COMPILE_NO_STUBS = $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
CCLD = $(CC)
LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(LDFLAGS) -o $@

#========================================================================
# 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 \
	for dir in $(subdirs) ; do \
	   if (cd $$dir; $(MAKE) $@) ; then true ; else exit 1 ; fi ; \
	done; fi;

libraries: 
	@if test ! "x$(subdirs)" = "x" ; then \
	for dir in $(subdirs) ; do \
	   if (cd $$dir; $(MAKE) $@) ; then true ; else exit 1 ; fi ; \
	done; fi;
	@$(TCLSH_PROG) $(src_lib_dir)/lib/make.xotcl -dir $(src_lib_dir) -all

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

$(src_doc_dir)/langRef-xotcl.html: $(src_doc_dir)/langRef.xotcl $(DOC_SOURCE)
	@$(TCLSH_PROG) $(src_lib_dir)/lib/makeDoc.xotcl $(src_doc_dir) $(DOC_SOURCE)

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 \
	for dir in $(subdirs) ; 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)/usr/local/aolserver/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 $(GENERIC_HDRS) ; do \
	    echo "Installing $$i" ; \
	    $(INSTALL_DATA) $$i $(DESTDIR)$(includedir) ; \
	done;
	@for i in $(libdirs) ; do \
	    echo "Installing $$i" ; \
	    rm -rf $(DESTDIR)$(pkglibdir)/$$i ; \
	    $(INSTALL) $(src_lib_dir)/$$i $(DESTDIR)$(pkglibdir) ; \
	done;
	cat pkgIndex.unix >> $(DESTDIR)$(pkglibdir)/pkgIndex.tcl
	@for i in $(appdirs) ; do \
	    echo "Installing $$i" ; \
	    rm -rf $(DESTDIR)$(pkglibdir)/apps/$$i ; \
	    $(INSTALL) $(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
	@$(mkinstalldirs) $(DESTDIR)$(mandir)/man1
	@$(mkinstalldirs) $(DESTDIR)$(mandir)/man3
	@$(mkinstalldirs) $(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

test: binaries libraries test-core @test_actiweb@

#TESTFLAGS = -srcdir $(srcdir)
test-core: $(TCLSH_PROG)
	$(TCLSH_PROG) `@CYGPATH@ $(TOP_DIR)/tests/testx.xotcl` \
		-libdir `@CYGPATH@ $(PLATFORM_DIR)` $(TESTFLAGS)
	$(TCLSH_PROG) `@CYGPATH@ $(TOP_DIR)/tests/testo.xotcl` \
		-libdir `@CYGPATH@ $(PLATFORM_DIR)` $(TESTFLAGS)
	$(TCLSH_PROG) `@CYGPATH@ $(TOP_DIR)/tests/speedtest.xotcl` \
		-libdir `@CYGPATH@ $(PLATFORM_DIR)` $(TESTFLAGS)
	$(TCLSH_PROG) `@CYGPATH@ $(TOP_DIR)/tests/xocomm.test` \
		-libdir `@CYGPATH@ $(PLATFORM_DIR)` $(TESTFLAGS)
test-actiweb: $(TCLSH_PROG)
	$(TCLSH_PROG) `@CYGPATH@ $(TOP_DIR)/tests/actiweb.test` \
		-libdir `@CYGPATH@ $(PLATFORM_DIR)` $(TESTFLAGS)
	$(TCLSH_PROG) `@CYGPATH@ $(TOP_DIR)/tests/persistence.test` \
		-libdir `@CYGPATH@ $(PLATFORM_DIR)` $(TESTFLAGS)
	$(TCLSH_PROG) `@CYGPATH@ $(TOP_DIR)/tests/UNIVERSAL.test` \
		-libdir `@CYGPATH@ $(PLATFORM_DIR)` $(TESTFLAGS)
	$(TCLSH_PROG) `@CYGPATH@ $(TOP_DIR)/tests/xoRDF.test` \
		-libdir `@CYGPATH@ $(PLATFORM_DIR)` $(TESTFLAGS)
	@rm -rf receiver

depend:

#========================================================================
# Enumerate the names of the object files included in this package.
# These objects are created and linked into the final library.  In
# most cases these object files will correspond to the source files
# above.
#
# $(exampleA_LIB_FILE) should be listed as part of the BINARIES variable
# at the top of the Makefile.  That will ensure that this target is built
# when you run "make binaries".
#
# You shouldn't need to modify this target, except to change the package
# name from "exampleA" to your package's name.
#========================================================================

$(xotcl_LIB_FILE): $(xotcl_OBJECTS) @STUB_LIB_BINARY@
	@if test ! -d so; then mkdir so; fi
	-rm -f $(xotcl_LIB_FILE)
	@MAKE_LIB@
	$(RANLIB) $(xotcl_LIB_FILE)

$(xotclstub_LIB_FILE): $(xotclstub_OBJECTS)
	@if test ! -d so; then mkdir so; fi
	-rm -f $(xotclstub_LIB_FILE)
	@MAKE_STATIC_LIB@
	$(RANLIB_STUB) $(xotclstub_LIB_FILE)

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

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

#$(src_lib_dir)/pkgIndex.tcl:
#	cp $(src_lib_dir)/pkgIndex.unix $(src_lib_dir)/pkgIndex.tcl

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

xotclsh: o/tclAppInit.o $(GENERIC_OBJECTS_NOT_SHARED) $(CONDITIONAL_STUB_OBJECTS)
	$(CC) -rdynamic -o $@ o/tclAppInit.o \
		$(GENERIC_OBJECTS_NOT_SHARED) \
		$(CFLAGS)  $(TCL_LIB_SPEC) \
		$(DMALLOC_LIB) $(CONDITIONAL_STUB_OBJECTS)

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

install-shells:
	chmod +x xotclsh xowish 
	@if test -e xotclsh; then \
		$(INSTALL_PROGRAM) xotclsh $(DESTDIR)$(bindir); \
	fi
	@if test -e 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_PROG) mk_predefined.xotcl > predefined.h)

so/dllEntryPoint.$(OBJEXT): $(WIN_DIR)/dllEntryPoint.c
	$(COMPILE) -c `@CYGPATH@ $(WIN_DIR)/dllEntryPoint.c` -o $@

o/tkAppInit.$(OBJEXT): $(PLATFORM_DIR)/tkAppInit.c
	@if test ! -d o; then mkdir o; fi
	$(COMPILE_NO_STUBS) $(TK_INCLUDES) -c `@CYGPATH@ $<` -o $@

o/%.$(OBJEXT): $(PLATFORM_DIR)/%.c
	@if test ! -d o; then mkdir o; fi
	$(COMPILE_NO_STUBS) -c `@CYGPATH@ $<` -o $@

o/%.$(OBJEXT): $(src_generic_dir)/%.c $(GENERIC_HDRS)
	@if test ! -d o; then mkdir o; fi
	$(COMPILE_NO_STUBS) -c `@CYGPATH@ $<` -o $@

so/%.o: $(src_generic_dir)/%.c $(GENERIC_HDRS)
	@if test ! -d so; then mkdir so; fi
	$(COMPILE) -c `@CYGPATH@ $<` -o $@

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

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

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

genstubs:
	$(TCLSH_PROG) $(TCL_TOOL_DIR_NATIVE)/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 $(xotcl_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 so o pkgIndex.tcl ./receiver
	@if test ! "x$(subdirs)" = "x" ; then \
	for dir in $(subdirs) ; do \
	   if (cd $$dir; $(MAKE) $@) ; then true ; else exit 1 ; fi ; \
	done; fi

distclean: clean
	-rm -f Makefile $(CONFIG_CLEAN_FILES) config.*

#========================================================================
# 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.
# Additionally, the .dll files go into the bin directory, but the .lib
# files go into the lib directory.  On Unix platforms, all 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 tclsh8.2 shell)
#
# You should not have to modify this target.
#========================================================================

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

#========================================================================
# Install binary executables (e.g. .exe files)
#
# You should not have to modify this target.
#========================================================================

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

.SUFFIXES: .c .o .obj

uninstall-binaries:
	@$(NORMAL_UNINSTALL)
	list='$(BINARIES)'; for p in $$list; do \
	  rm -f $(DESTDIR)$(libdir)/$$p; \
	done

$(DESTDIR)$(includedir):
	$(mkinstalldirs) $@
$(DESTDIR)$(bindir):
	$(mkinstalldirs)  $@
$(DESTDIR)$(libdir):
	$(mkinstalldirs)  $@
$(DESTDIR)$(pkglibdir):
	$(mkinstalldirs)  $@
$(DESTDIR)$(pkglibdir)/apps: $(DESTDIR)$(pkglibdir)
	$(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: tar
	@if test ! -d $(RPMSOURCES); then mkdir -p $(RPMSOURCES); fi
	@if test ! -d $(RPMSPECS); then mkdir -p $(RPMSPECS); fi
	cp ../../xotcl-$(FULLVERSION).tar.gz $(RPMSOURCES)
	cp xotcl.spec $(RPMSPECS)/xotcl-$(FULLVERSION).spec
	rpmbuild -ba $(RPMSPECS)/xotcl-$(FULLVERSION).spec

bin-tar: 
	(cd ../..; tar zcvf xotcl-$(FULLVERSION)-bin-linux-i686-glibc.tar.gz \
                `find $(exec_prefix)/bin/xotclsh $(exec_prefix)/bin/xowish \
		  $(prefix)/include/xotcl*.h \
                  $(prefix)/lib/$(xotcl_LIB_FILE) \
                  $(prefix)/lib/$(xotclstub_LIB_FILE) \
                  $(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: clean
	(cd ../..; tar zcvf ./xotcl-$(FULLVERSION).tar.gz \
		`find ./xotcl-$(FULLVERSION) -type f -o -type l| fgrep -v CVS | fgrep -v SCCS | fgrep -v Attic | fgrep -v "autom4te"| fgrep -v config\.status | fgrep -v "~"|fgrep -v .db | fgrep -v .junk | fgrep -v "#" | grep -v "/o$$"`)

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