# Generated automatically from Makefile.in by configure.

# This file is a Makefile for tclStruct.  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.
#
# @(#) Makefile.in 1.3 95/09/15 12:21:06

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

# 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		= /usr/local/coda/2.5/common
exec_prefix	= /usr/local/coda/2.5/Linux

# 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 from which applications will reference the library of tclStruct
# scripts (note: this directory is not hard-coded into the binary)
STRUCT_LIBRARY	= $(prefix)/lib/tcl7.4

# Path name to use when installing library scripts:
SCRIPT_INSTALL_DIR	= $(INSTALL_ROOT)$(STRUCT_LIBRARY)

# Directory in which to install the archive libtclstruct.a:
LIB_INSTALL_DIR	= $(INSTALL_ROOT)$(exec_prefix)/lib

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

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

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

# Directory in which to install manual entry for tclsh:
MAN1_INSTALL_DIR	= $(MAN_INSTALL_DIR)/man1

# Directory in which to install manual entries for Tcl's C library
# procedures:
MAN3_INSTALL_DIR	= $(MAN_INSTALL_DIR)/man3

# Directory in which to install manual entries for the built-in
# Tcl commands:
MANN_INSTALL_DIR	= $(MAN_INSTALL_DIR)/mann

# Which version of Tcl to use and/or link against.
TCLSH		= $(exec_prefix)/bin/tclsh

# Additional libraries to use when linking.  The "LIBS" part will be
# replaced (or has already been replaced) with relevant libraries as
# determined by the configure script.
AC_LIBS		= 
MATH_LIBS	= -lieee -lm
SYSLIBS		= -L/usr/local/coda/source/tcl7.4 $(MATH_LIBS) $(AC_LIBS) $(DL_LIBS)

# To change the compiler switches, for example to change from -O
# to -g, change the following line:
CCOPTIONS	= -O
CDEBUGFLAGS	= -DDEBUG=0 -DSTRUCT_MAGIC

# 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

# For vxWorks, the following provides flags, includes
VXWORKS_DEFINES  = 
VXWORKS_INCLUDES = 

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


INSTALL		= /usr/bin/install -c
INSTALL_DATA	= ${INSTALL} -m 644
MAJOR_VERSION   = 1.2
#----------------------------------------------------------------
# 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.
#----------------------------------------------------------------

# Flags to pass to cc when compiling the components of a shared library:
SHLIB_CCFLAGS	= -fpic

# Base command to use for combining object files into a shared library:
SHLIB_LD	= gcc -shared

# Suffix to use for the name of the shared library.  An empty string
# means we don't know how to use shared libraries on this platform.
SHLIB_SUFFIX	= .so.$(MAJOR_VERSION)

# Suffix to use for _any_ library.  Defaults to ".a".
LIB_SUFFIX	= .a

# Library file(s) to include in tclsh and other base applications
# in order to provide facilities needed for dynamic linking.<
DL_LIBS		= -ldl

# Flags to pass to the compiler when linking object files into
# an executable tclsh or tcltest binary.
LD_FLAGS	= 

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

COMPAT_OBJS	= 
AC_CFLAGS	= 
DEFS		=  -DLINUX=1 -DHAVE_GETCWD=1 -DHAVE_OPENDIR=1 -DHAVE_STRERROR=1 -DHAVE_STRSTR=1 -DHAVE_STRTOL=1 -DHAVE_TMPNAM=1 -DHAVE_WAITPID=1 -DHAVE_STRDUP=1 -DHAVE_STRERROR=1 -DHAVE_STRDUP=1 -DHAVE_STRCASECMP=1 -DHAVE_UNISTD_H=1 -DHAVE_ERRNO_H=1 -DHAVE_FCNTL_H=1 -DNO_STREAM_H=1 -DNO_UN_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_TOLOWER=1 -DHAVE_NTOHL=1 -DSTDC_HEADERS=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_FLOAT_H=1 -DHAVE_MALLOC_H=1 -DHAVE_ERRNO_H=1 -DHAVE_UNISTD_H=1 -DHAVE_MEMORY_H=1 -DHAVE_LIMITS_H=1 -DHAVE_SYS_TIME_H=1 -DHAVE_SYS_WAIT_H=1 -DTIME_WITH_SYS_TIME=1 -DNO_UNION_WAIT=1 -DNEED_MATHERR=1 -DSVIPC_NO_UNION_SEMUN=1 -DTK_FILE_READ_PTR=1 
AC_DEFINES	=  -DLINUX=1 -DHAVE_GETCWD=1 -DHAVE_OPENDIR=1 -DHAVE_STRERROR=1 -DHAVE_STRSTR=1 -DHAVE_STRTOL=1 -DHAVE_TMPNAM=1 -DHAVE_WAITPID=1 -DHAVE_STRDUP=1 -DHAVE_STRERROR=1 -DHAVE_STRDUP=1 -DHAVE_STRCASECMP=1 -DHAVE_UNISTD_H=1 -DHAVE_ERRNO_H=1 -DHAVE_FCNTL_H=1 -DNO_STREAM_H=1 -DNO_UN_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_TOLOWER=1 -DHAVE_NTOHL=1 -DSTDC_HEADERS=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_FLOAT_H=1 -DHAVE_MALLOC_H=1 -DHAVE_ERRNO_H=1 -DHAVE_UNISTD_H=1 -DHAVE_MEMORY_H=1 -DHAVE_LIMITS_H=1 -DHAVE_SYS_TIME_H=1 -DHAVE_SYS_WAIT_H=1 -DTIME_WITH_SYS_TIME=1 -DNO_UNION_WAIT=1 -DNEED_MATHERR=1 -DSVIPC_NO_UNION_SEMUN=1 -DTK_FILE_READ_PTR=1 
AC_LDFLAGS	= 
AC_LIBS		= 
RM		= rm -f
CC		= gcc
#CC = /usr/local/gcc-bounds/xgcc -B/usr/local/gcc-bounds/ -fbounds-checking
LD		= ld
AR		= ar
RANLIB		= ranlib
SRC_DIR		= .


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

# Leave alone.  Will be overridden for shared libraries

STD_INCLUDES	= -I$(INCLUDE_DIR)

ALLINCLUDES	= $(STD_INCLUDES) $(INCLUDES) $(VXWORKS_INCLUDES)

ALLDEFINES	= $(ALLINCLUDES) $(CDEBUGFLAGS) $(VXWORKS_DEFINES) \
		  $(PROTO_DEFINES) $(DEFINES) \
		  $(AC_DEFINES) $(MATH_FLAGS) $(GENERIC_FLAGS) \
		  $(PROTO_FLAGS) $(MEM_DEBUG_FLAGS)

LINTFLAGS	= $(LINTOPTS) -DLINT $(ALLINCLUDES)
CFLAGS		= $(CCOPTIONS) $(AC_CFLAGS) $(SHLIB_CCFLAGS) $(ALLDEFINES) $(CRUNFLAGS)

SYSLIBS	= $(AC_LIBS) $(DL_LIBS) -ltcl$(TCLVERSION) -lm $(DL_LIBS)

LDFLAGS		= $(CFLAGS) -L$(exec_prefix)/lib

OBJSLIB	= \
	stAccess.o \
	stCopy.o \
	stDebug.o \
	stInfo.o \
	stInit.o \
	stLookup.o \
	stObject.o \
	stRead.o \
	stTrace.o \
	stTrNum.o \
	stTrStr.o \
	stTypeDef.o \
	stTypes.o

OBJECTS   = $(OBJSLIB) tclAppInit.o
# For vxWorks we need strdup.o
VXOBJECTS = 

LIB_TARGET  = libtclStruct$(LIB_SUFFIX)
ALL_TARGETS = tclstruct 

all: $(ALL_TARGETS)

# Building an archive library
libtclStruct.a: $(OBJSLIB) $(VXOBJECTS)
	$(RM) $@
	$(AR) cr $@ $(OBJSLIB) $(VXOBJECTS)
	$(RANLIB) $@

# Building a (dynamically) loadable/shared library

SHARED_LIB=libtclStruct$(SHLIB_SUFFIX)
libtclStruct$(SHLIB_SUFFIX): $(OBJSLIB)
	$(SHLIB_LD) -o libtclStruct$(SHLIB_SUFFIX) $(OBJSLIB)

# This executable is statically linked with the tclStruct package
# and is used for testing.  It is not (normally) installed.
tclstruct: $(OBJECTS)
	LD_RUN_PATH=$(LIB_INSTALL_DIR) $(CC) -o $@ $(LDFLAGS) $(OBJECTS) $(SYSLIBS)


# For vxWorks
tclStruct.o: $(OBJSLIB) $(VXOBJECTS)
	$(LD) -r $(OBJSLIB) $(VXOBJECTS) -o $@

strdup.o: $(SRC_DIR)/compat/strdup.c
	$(CC) -c $(CFLAGS) $(SRC_DIR)/compat/strdup.c


.c.o:
	$(CC) -c $(CFLAGS) $<

lint:
	lint $(LINTFLAGS) $(ALLINCLUDES) tclAppInit.c $(OBJSLIB:.o=.c) $(SYSLIBS)


# There are two ways to run the tests that are part of this package.
# The first (and default) method is to run the tests using the executable
# we create expressly for this purpose.  The second (and prefered) method
# is to dynamically load this extension into the Tcl interpreter.
test: tclstruct
	(cd tests; ../tclstruct all)
test-dl: $(LIB_TARGET)
	(cd tests; LD_LIBRARY_PATH=`pwd`:$(LIB_INSTALL_DIR) $(TCLSH) all)

install: install-binaries install-libraries 

install-binaries: $(LIB_TARGET)
	@for i in $(LIB_INSTALL_DIR) ; \
	    do \
	    if [ ! -d $$i ] ; then \
		echo "Making directory $$i"; \
		mkdir $$i; chmod 755 $$i ; \
	    fi; \
	    done;
	@echo "Installing $(LIB_TARGET)"
	@$(INSTALL_DATA) $(LIB_TARGET) $(LIB_INSTALL_DIR)
	@rm -f $(LIB_INSTALL_DIR)/libtclStruct.so
	@ln -s $(LIB_INSTALL_DIR)/$(LIB_TARGET) $(LIB_INSTALL_DIR)/libtclStruct.so
install-libraries:
	@for i in $(INCLUDE_INSTALL_DIR) $(SCRIPT_INSTALL_DIR) ; \
	    do \
	    if [ ! -d $$i ] ; then \
		echo "Making directory $$i"; \
		mkdir $$i; chmod 755 $$i ; \
	    fi; \
	    done;
	cp tclStruct.h $(INCLUDE_INSTALL_DIR)
	@echo "Installing tclStruct.h"
	@$(INSTALL_DATA) tclStruct.h $(INCLUDE_INSTALL_DIR)
	@for i in library/*.tcl ; \
	    do \
	    echo "Installing $$i"; \
	    $(INSTALL_DATA) $$i $(SCRIPT_INSTALL_DIR); \
	    done;
	echo "auto_mkindex $(SCRIPT_INSTALL_DIR) *.tcl;exit" | $(TCLSH)

install-vxworks: $(LIB_TARGET)
	@for i in $(LIB_INSTALL_DIR) ; \
	    do \
	    if [ ! -d $$i ] ; then \
		echo "Making directory $$i"; \
		mkdir $$i; chmod 755 $$i ; \
	    fi; \
	    done;
	@echo "Installing $(LIB_TARGET)"
	@cp ${LIB_TARGET} $(LIB_INSTALL_DIR)/


Makefile: Makefile.in
	echo

depend:
	makedepend $(ALLDEFINES) *.c

clean: 
	$(RM) $(OBJECTS) core $(ALL_TARGETS) libtclStruct.* $(VXOBJECTS)

distclean: clean
	$(RM) Makefile config.status config.cache

#
# Target to make sure that only symbols with "Tcl" prefixes are
# exported.
#

checkexports: $(LIB_TARGET)
	-nm -p $(LIB_TARGET) | awk '$$2 ~ /[TDB]/ { print $$3 }' | sort -n | grep -v '^[Ss]struct'

#
# Target to create a proper Tcl distribution from information in the
# master source directory.  DISTDIR must be defined to indicate where
# to put the distribution.
#

configure: configure.in
	autoconf
dist: configure
	./BuildPkg


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