#
# This file is a Makefile for MEMCHAN 2.2a4.  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.
#
# Distribution as of AUG-20-2002
#
# $Id: Makefile.in,v 1.20 2004/06/03 23:39:13 patthoyts Exp $

EXTENSION	=	Memchan
VERSION		=	2.2.0

#----------------------------------------------------------------
# Things you can change to personalize the Makefile for your own
# site (you can make these changes in either Makefile.in or
# Makefile, but changes to Makefile will get lost if you re-run
# the configuration script).
#----------------------------------------------------------------

# Directory containing the unix specific part of the extension
srcdir		=	@srcdir@
TOP_DIR		=	@srcdir@/..
GENERIC_DIR	=	$(TOP_DIR)/generic
ISAAC_DIR	=	$(TOP_DIR)/isaac
UNIX_DIR	=	@srcdir@


# Directories in which the tcl core can be found
TCL_INCLUDE_DIR		=	@TCL_INCLUDE_DIR@
TCL_LIB_DIR		=	@TCL_LIB_DIR@


# Default top-level directories in which to install architecture-
# specific files (exec_prefix) and machine-independent files such
# as scripts (prefix).  The values specified here may be overridden
# at configure-time with the --exec-prefix and --prefix options
# to the "configure" script.

prefix		=	@prefix@
exec_prefix	=	@exec_prefix@

# Directory containing scripts supporting the work of this makefile
tool		=	$(TOP_DIR)/tools
top_tool	=	./tools



# The following definition can be set to non-null for special systems
# like AFS with replication.  It allows the pathnames used for installation
# to be different than those used for actually reference files at
# run-time.  INSTALL_ROOT is prepended to $prefix and $exec_prefix
# when installing files.
INSTALL_ROOT =


# Directory in which libMEMCHAN.a is at runtime:
LIB_RUNTIME_DIR =	$(exec_prefix)/lib/$(EXTENSION)$(VERSION)


# Directory in which to install the archive libMEMCHAN.a:
LIB_INSTALL_DIR =	$(INSTALL_ROOT)$(LIB_RUNTIME_DIR)


# Directory in which to install the extended shell tclsh:
BIN_INSTALL_DIR =	$(INSTALL_ROOT)$(exec_prefix)/bin


# Directory in which to install the include file transform.h:
INCLUDE_INSTALL_DIR =	$(INSTALL_ROOT)$(prefix)/include


# Top-level directory in which to install manual entries:
MAN_INSTALL_DIR =	$(INSTALL_ROOT)$(prefix)/man


# To change the compiler switches, for example to change from -O
# to -g, change the following line:
CFLAGS		=	-O


# To disable ANSI-C procedure prototypes reverse the comment characters
# on the following lines:
PROTO_FLAGS =
#PROTO_FLAGS = -DNO_PROTOTYPE


# To enable memory debugging reverse the comment characters on the following
# lines.  Warning:  if you enable memory debugging, you must do it
# *everywhere*, including all the code that calls Tcl, and you must use
# ckalloc and ckfree everywhere instead of malloc and free.
MEM_DEBUG_FLAGS =
#MEM_DEBUG_FLAGS = -DTCL_MEM_DEBUG


# Some versions of make, like SGI's, use the following variable to
# determine which shell to use for executing commands:
SHELL =		/bin/sh


# Tcl used to let the configure script choose which program to use
# for installing, but there are just too many different versions of
# "install" around;  better to use the install-sh script that comes
# with the distribution, which is slower but guaranteed to work.

INSTALL = $(tool)/install-sh -c


# The symbols below provide support for dynamic loading and shared
# libraries.  The values of the symbols are normally set by the
# configure script.  You shouldn't normally need to modify any of
# these definitions by hand.

MEMCHAN_SHLIB_CFLAGS = @MEMCHAN_SHLIB_CFLAGS@


# The symbol below provides support for dynamic loading and shared
# libraries.  See configure.in for a description of what it means.
# The values of the symbolis normally set by the configure script.

SHLIB_LD = @SHLIB_LD@


# Libraries to use when linking:  must include at least the dynamic
# loading library and the math library (in that order).  This
# definition is determined by the configure script.
LIBS = @TCL_LIB_SPEC@ -lc

MEMCHAN_LIB_FILE = @MEMCHAN_LIB_FILE@
#MEMCHAN_LIB_FILE = libmemchan.a

#----------------------------------------------------------------
# The information below is modified by the configure script when
# Makefile is generated from Makefile.in.  You shouldn't normally
# modify any of this stuff by hand.
#----------------------------------------------------------------

INSTALL_PROGRAM =	$(INSTALL) -m 755
INSTALL_DATA =		$(INSTALL) -m 644
RANLIB =		@RANLIB@

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

CC		=	@CC@

CC_SWITCHES	=	$(CFLAGS) $(MEMCHAN_SHLIB_CFLAGS) $(CPPFLAGS) -DMEMCHAN_VERSION=\"$(VERSION)\"
# $(TCL_CC_SWITCHES)
CPPFLAGS	=	$(DEFINES) $(INCLUDES)

INCLUDES	=	-I. -I$(srcdir) -I$(GENERIC_DIR) -I$(TOP_DIR)	\
			-I$(TCL_INCLUDE_DIR)

DEFINES		=	$(PROTO_FLAGS) $(MEM_DEBUG_FLAGS) @DEFS@ @TCL_DEFS@

HEADER		=	

SOURCES		=	$(GENERIC_DIR)/memchan.c	\
			$(GENERIC_DIR)/init.c		\
			$(GENERIC_DIR)/fifo.c		\
			$(GENERIC_DIR)/fifo2.c		\
			$(GENERIC_DIR)/null.c		\
			$(GENERIC_DIR)/zero.c		\
			$(GENERIC_DIR)/random.c		\
			$(GENERIC_DIR)/buf.c		\
			$(GENERIC_DIR)/bufRange.c	\
			$(GENERIC_DIR)/bufFix.c		\
			$(GENERIC_DIR)/bufExt.c		\
			$(GENERIC_DIR)/bufQueue.c	\
			$(GENERIC_DIR)/counter.c	\
			$(GENERIC_DIR)/bufStubInit.c	\
			$(GENERIC_DIR)/bufStubLib.c     \
			$(ISAAC_DIR)/randport.c

OBJECTS		=	init.o counter.o	\
			memchan.o fifo.o	\
			fifo2.o null.o		\
			zero.o random.o		\
			buf.o bufQueue.o	\
			bufRange.o bufExt.o	\
			bufFix.o bufStubInit.o	\
			bufStubLib.o randport.o

#-------------------------------------------------------#

all:	library

clean:
	rm -f $(OBJECTS) $(MEMCHAN_LIB_FILE)
	rm -f TAGS *~ */*~ core*

distclean:	clean
	rm -f config.status config.cache config.log Makefile pkgIndex.tcl

install:	install-lib @install_other@

install-lib: $(MEMCHAN_LIB_FILE)
	$(tool)/mkinstalldirs $(LIB_INSTALL_DIR)
	@echo "Installing $(MEMCHAN_LIB_FILE)"
	@$(INSTALL_DATA) $(MEMCHAN_LIB_FILE) $(LIB_INSTALL_DIR)
	@$(RANLIB) $(LIB_INSTALL_DIR)/$(MEMCHAN_LIB_FILE)
	@$(INSTALL_DATA) $(UNIX_DIR)/pkgIndex.tcl $(LIB_INSTALL_DIR)/pkgIndex.tcl

# Important in 'test': Move win/pkgIndex.tcl out of the way, prevent its usage.

check:	test
test:
	mv $(TOP_DIR)/win/pkgIndex.tcl $(TOP_DIR)/win/pkgIndex.tclX
	LD_LIBRARY_PATH="$(srcdir):$(TCL_LIB_DIR)";	export LD_LIBRARY_PATH; \
	SHLIB_PATH="$LD_LIBRARY_PATH";			export SHLIB_PATH; \
	wish $(TOP_DIR)/testlib/tester -auto -delay 1
	mv $(TOP_DIR)/win/pkgIndex.tclX $(TOP_DIR)/win/pkgIndex.tcl

ctest:
	LD_LIBRARY_PATH="$(srcdir):$(TCL_LIB_DIR)"; \
	echo set auto_path [concat [pwd] $$auto_path] \; package require Memchan \; \
	cd $(TOP_DIR)/tests \; source all | tclsh

#	echo lappend auto_path [pwd] \; package require Memchan \; \



#-------------------------------------------------------#

lib:	library

library:	$(MEMCHAN_LIB_FILE)
	@echo ... done

#-------------------------------------------------------#

TAGS:
		etags *.[ch]

#-------------------------------------------------------#
# unix specific files

.c.o:
	$(CC) -c $(CC_SWITCHES) $< -o $@

#-------------------------------------------------------#
# generic files

memchan.o: $(GENERIC_DIR)/memchan.c
	$(CC) -c $(CC_SWITCHES) $(GENERIC_DIR)/memchan.c -o $@

fifo.o: $(GENERIC_DIR)/fifo.c
	$(CC) -c $(CC_SWITCHES) $(GENERIC_DIR)/fifo.c -o $@

fifo2.o: $(GENERIC_DIR)/fifo2.c
	$(CC) -c $(CC_SWITCHES) $(GENERIC_DIR)/fifo2.c -o $@

null.o: $(GENERIC_DIR)/null.c
	$(CC) -c $(CC_SWITCHES) $(GENERIC_DIR)/null.c -o $@

zero.o: $(GENERIC_DIR)/zero.c
	$(CC) -c $(CC_SWITCHES) $(GENERIC_DIR)/zero.c -o $@

random.o: $(GENERIC_DIR)/random.c
	$(CC) -c $(CC_SWITCHES) $(GENERIC_DIR)/random.c -o $@

buf.o: $(GENERIC_DIR)/buf.c
	$(CC) -c $(CC_SWITCHES) $(GENERIC_DIR)/buf.c -o $@

bufQueue.o: $(GENERIC_DIR)/bufQueue.c
	$(CC) -c $(CC_SWITCHES) $(GENERIC_DIR)/bufQueue.c -o $@

bufFix.o: $(GENERIC_DIR)/bufFix.c
	$(CC) -c $(CC_SWITCHES) $(GENERIC_DIR)/bufFix.c -o $@

bufExt.o: $(GENERIC_DIR)/bufExt.c
	$(CC) -c $(CC_SWITCHES) $(GENERIC_DIR)/bufExt.c -o $@

bufRange.o: $(GENERIC_DIR)/bufRange.c
	$(CC) -c $(CC_SWITCHES) $(GENERIC_DIR)/bufRange.c -o $@

init.o: $(GENERIC_DIR)/init.c
	$(CC) -c $(CC_SWITCHES) $(GENERIC_DIR)/init.c -o $@

counter.o: $(GENERIC_DIR)/counter.c
	$(CC) -c $(CC_SWITCHES) $(GENERIC_DIR)/counter.c -o $@

bufStubInit.o: $(GENERIC_DIR)/bufStubInit.c
	$(CC) -c $(CC_SWITCHES) $(GENERIC_DIR)/bufStubInit.c -o $@

bufStubLib.o: $(GENERIC_DIR)/bufStubLib.c
	$(CC) -c $(CC_SWITCHES) $(GENERIC_DIR)/bufStubLib.c -o $@

randport.o: $(ISAAC_DIR)/randport.c
	$(CC) -c $(CC_SWITCHES) -I$(ISAAC_DIR) $(ISAAC_DIR)/randport.c -o $@

#-------------------------------------------------------#

$(MEMCHAN_LIB_FILE):	$(OBJECTS)
	rm -f		$(MEMCHAN_LIB_FILE)
	@MAKE_LIB@
	$(RANLIB)	$(MEMCHAN_LIB_FILE)

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