# Generated automatically from Makefile.in by configure.
# This file is a Makefile for Tcl-DP.  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.

#----------------------------------------------------------------
# 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.  You should normally set these to the
# same values you used in the tcl installation.

exec_prefix =   /usr/local/coda/2.5/Linux
prefix =        /usr/local/coda/2.5/common

# Directory in which to install the library of Tcl-DP scripts and demos
# (note: you can set the DP_LIBRARY environment variable at run-time to
# override the compiled-in location):
DP_LIB =	$(prefix)/lib/dplite

# Directory in which to install the archive libdplite.a:
LIB_DIR =	$(exec_prefix)/lib

# Directory in which to install the program dpsh:
BIN_DIR =	$(exec_prefix)/bin

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

# Top-level directory for manual entries:
MAN_DIR =	$(prefix)/man

# Directory in which to install manual entry for dpsh
MAN1_DIR =	$(MAN_DIR)/man1

# Directory in which to install manual entries for Tcl-DP's C library
# procedures:
MAN3_DIR =	$(MAN_DIR)/man3

# Directory in which to install manual entries for the built-in
# Tcl commands implemented by Tcl-DP:
MANN_DIR =	$(MAN_DIR)/mann

# The directory containing the Tcl header files (i.e., tcl.h) appropriate
# for this version of Tcl-DP.  If they're in a standard place, leave this
# blank.
# TCL_INCLUDES = -I./../tcl7.3
TCL_INCLUDES = -I$(prefix)/include

# The directory containing the Tcl library script files (i.e., init.tcl)
# appropriate for this version of Tcl-DP.
# TCL_LIBRARY = ./../../tcl7.3
TCL_LIB =   $(prefix)/lib/tcl

# The directory containing the Tcl library archive file appropriate
# for this version of Tcl-DP:
# TCL_BIN_DIR =	../tcl7.3
TCL_BIN_DIR =	$(exec_prefix)/lib

# Libraries to use when linking:  must include at least Tcl-DP, Tk, Tcl,
# Xlib, and the math library (in that order).  The "" part will be
# replaced (or has already been replaced) with relevant libraries as
# determined by the configure script.
LIBS  = ./libdplite.a $(TCL_BIN_DIR)/libtcl7.4.a -L$(TCL_BIN_DIR) -lSQL -lmsql -lm -lnsl -lresolv -ldl
LIBRARIES = ${LIBS}

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

# Under HP/UX, reverse the comment characters on the following lines
# to enable the ansi HP compiler.  This may generate a few in dpnetwork.c,
# due to the inconsistent way the select() prototype is defined.
HP_ANSI_FLAGS = -fwritable-strings -D_POSIX_THREADS
#HP_ANSI_FLAGS =

# 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

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

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

CC =		gcc
#CC = /usr/local/gcc-bounds/xgcc -B/usr/local/gcc-bounds/ -fbounds-checking
AR =		ar
LD =		ld
LDFLAGS =	
COMPILE_DP =	${CC} ${CC_SWITCHES}
VXWORKS_STUFF=	 

CC_SWITCHES =	${CFLAGS} -I${SRC_DIR} ${TCL_INCLUDES} \
-I${INCLUDE_DIR} ${AC_FLAGS} ${PROTO_FLAGS} ${MEM_DEBUG_FLAGS} \
-DDP_LIBRARY=\"${DP_LIB}\" ${HP_ANSI_FLAGS} ${VXWORKS_STUFF} \
-DNO_X11

OBJS =	dpnetInit.o dpnetwork.o dpaddress.o dprpc.o dpnslib.o ns.o \
	tkArgv.o tkCmds.o tkBind.o tkPreserve.o tkEvent.o minilzo.o ns.o

all: dpsh libdpS.a

libdplite.a: $(OBJS)
	rm -f libdplite.a
	$(AR) cr libdplite.a $(OBJS)
	$(RANLIB) libdplite.a

libdpS.a: dplite.o
	rm -f libdpS.a
	$(AR) cr libdpS.a dplite.o
	$(RANLIB) libdpS.a

dpsh: tkAppInit.o tkMain.o strdup.o libdplite.a
	$(COMPILE_DP) tkMain.o tkAppInit.o $(LIBRARIES) -o dpsh

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

dptest: 
	cc -o dptest dptest.c -L. -ldpS -lsocket -lnsl

test: dpsh
	@cwd=`pwd`; \
	cd $(SRC_DIR); DP_LIBRARY=`pwd`/library; export DP_LIBRARY; \
	cd $$cwd; cd $(SRC_DIR)/tests; \
	( echo source all\; exit ) | $$cwd/dpsh

install: install-libraries install-binaries

install-binaries: libdplite.a libdpS.a dpsh
	@for i in $(LIB_DIR) $(BIN_DIR) ; \
	    do \
	    if [ ! -d $$i ] ; then \
		echo "Making directory $$i"; \
		mkdir $$i; \
		chmod 755 $$i; \
		else true; \
		fi; \
	    done;
	@echo "Installing libdplite.a"
	@$(INSTALL_DATA) libdplite.a $(LIB_DIR)/libdplite.a
	@$(RANLIB) $(LIB_DIR)/libdplite.a
	@$(INSTALL_DATA) libdpS.a $(LIB_DIR)/libdpS.a
	@$(RANLIB) $(LIB_DIR)/libdpS.a
	@echo "Installing dpsh"
	@$(INSTALL_PROGRAM) dpsh $(BIN_DIR)/dpsh

install-vxworks: libdplite.a dpsh
	@for i in $(LIB_DIR) $(BIN_DIR) ; \
	    do \
	    if [ ! -d $$i ] ; then \
		echo "Making directory $$i"; \
		mkdir $$i; \
		chmod 755 $$i; \
		else true; \
		fi; \
	    done;
	@echo "Installing libdplite.a"
	@$(INSTALL_DATA) libdplite.a $(LIB_DIR)/libdplite.a
	@$(RANLIB) $(LIB_DIR)/libdplite.a
	@echo "Installing dpsh"
	@$(INSTALL_PROGRAM) dpsh $(BIN_DIR)/dpsh

install-libraries:
	@for i in $(INCLUDE_DIR) $(DP_LIB) ; \
	    do \
	    if [ ! -d $$i ] ; then \
		echo "Making directory $$i"; \
		mkdir $$i; \
		chmod 755 $$i; \
		else true; \
		fi; \
	    done;
	@echo "Installing dp.h"
	@$(INSTALL_DATA) $(SRC_DIR)/dp.h $(INCLUDE_DIR)
	@echo "Installing dplite.h"
	@$(INSTALL_DATA) $(SRC_DIR)/dplite.h $(INCLUDE_DIR)
	@echo "Installing tk.h"
	@$(INSTALL_DATA) $(SRC_DIR)/tk.h $(INCLUDE_DIR)/tk_nox.h
	@if [ ! -d $(CODA)/common/include/compat ] ; then \
		echo "Making directory  $(CODA)/common/include/compat"; \
		mkdir $(CODA)/common/include/compat; \
		chmod 755 $(CODA)/common/include/compat; \
		else true; \
	fi;
	@echo "Installing netdb.h"
	@$(INSTALL_DATA) $(SRC_DIR)/netdb.h $(CODA)/common/include/compat

install-man:
	@for i in $(MAN_DIR) $(MAN1_DIR) $(MAN3_DIR) $(MANN_DIR) ; \
	    do \
	    if [ ! -d $$i ] ; then \
		echo "Making directory $$i"; \
		mkdir $$i; \
		chmod 755 $$i; \
		else true; \
		fi; \
	    done;
	@(cd $(SRC_DIR)/doc; tar cf - man1) | (cd $(MAN_DIR); tar xf -)
	@(cd $(SRC_DIR)/doc; tar cf - man3) | (cd $(MAN_DIR); tar xf -)
	@(cd $(SRC_DIR)/doc; tar cf - mann) | (cd $(MAN_DIR); tar xf -)

Makefile: $(SRC_DIR)/Makefile.in
	echo

clean:
	rm -f *.a *.o core errs *~ \#* TAGS *.E a.out errors dpsh

distclean: clean
	rm -f Makefile config.status

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