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

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

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

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

# Directory in which to install the program dpwish and dptcl:
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 dpwish
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 in which the library of Tcl scripts is installed.  This
# variable is only used for "make test"
# TCL_LIB =   ./../tcl7.3/library
TCL_LIB =   $(prefix)/lib/tcl

# 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
# TK_INCLUDES = -I./../tk3.6
TK_INCLUDES = -I$(prefix)/include

# The directory in which the library of Tk scripts is installed.  This
# variable is only used for "make test"
# TK_LIB =   ./../tk3.6/library
TK_LIB =   $(prefix)/lib/tk

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

# The directory containing the Tk library archive file (libtk.a)
# appropriate for this version of Tcl-DP:
# TK_BIN_DIR =	../tk3.6
TK_BIN_DIR =	$(exec_prefix)/lib

# 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 = -Aa -D_HPUX_SOURCE
HP_ANSI_FLAGS =

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

#----------------------------------------------------------------
# Most of the rest of these options you probably won't have to touch.
#----------------------------------------------------------------

# 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

# A "-I" switch that can be used when compiling to make all of the
# X11 include files accessible (the configure script will try to
# set this value, and will cause it to be an empty string if the
# include files are accessible via /usr/include).
X11_INCLUDES =  -I/usr/X11R6/include

# Linker switch(es) to use to link with the X11 library archive (the
# configure script will try to set this value automatically, but you
# can override it).
X11_LIB_SWITCHES =  -L/usr/X11R6/lib -lXpm -lXext -lXt -lX11

# 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 = -rdynamic -L$(exec_prefix)/lib libdpnetwork.a libCREG.a -ltclcdev -litix4.0 -ltk -ltcl -litcl2.0 -litk2.0 -lBLT -lsvipc -ltcldbg -ltclStruct -L$(CDEVROOT)/lib/Linux -lcdev -lSQL -lmsql $(X11_LIB_SWITCHES)  -lieee -lm -lm -lnsl -lresolv -ldl

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

# 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_SWITCHES =	${CFLAGS} -I${SRC_DIR} -I${INCLUDE_DIR} ${AC_FLAGS} ${PROTO_FLAGS} ${MEM_DEBUG_FLAGS} \
-DDP_LIB=\"${DP_LIB}\"  -fwritable-strings -D_POSIX_THREADS  ${X11_INCLUDES}

OBJS = dpnetInit.o dpnetwork.o dpaddress.o dprpc.o dpnslib.o minilzo.o ns.o

TKNX_OBJS = tkArgv.o tkCmds.o tkBind.o tkPreserve.o tkEvent.o

all: dpwish dptcl

libCREG.a: codaRegistry.o
	rm -f libCREG.a
	ar cr libCREG.a codaRegistry.o
	$(RANLIB) libCREG.a

libtknx.a: $(TKNX_OBJS)
	rm -f libtknx.a
	ar cr libtknx.a $(OBJS)
	$(RANLIB) libtknx.a

libdpnetwork.a: $(OBJS)
	rm -f libdpnetwork.a
	ar cr libdpnetwork.a $(OBJS)
	$(RANLIB) libdpnetwork.a

dpwish: tkAppInit.o tkMain.o libdpnetwork.a libCREG.a
	g++ $(CC_SWITCHES) tkMain.o tkAppInit.o $(LIBS) -o dpwish

dptcl: dpwish
	rm -f dptcl
	ln -s dpwish dptcl

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

VXWORKS_INSTALL =  install-none
UNIX_INSTALL    =  install-libraries install-binaries

install: $(UNIX_INSTALL)

install-none:
	@echo "nothing to do for architecture UNIX"

install-binaries: libdpnetwork.a libCREG.a dpwish
	@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 libdpnetwork.a"
	@rm -f $(LIB_DIR)/libdpnetwork.a
	@cp libdpnetwork.a $(LIB_DIR)/libdpnetwork.a
	@$(RANLIB) $(LIB_DIR)/libdpnetwork.a

	@echo "Installing libCREG.a"
	@rm -f $(LIB_DIR)/libCREG.a
	@cp libCREG.a $(LIB_DIR)/libCREG.a
	@$(RANLIB) $(LIB_DIR)/libCREG.a

	@echo "Installing dpwish"
	@$(INSTALL_PROGRAM) dpwish $(BIN_DIR)/dpwish
	@echo "Installing dptcl"
	@rm -f $(BIN_DIR)/dptcl
	@ln -s $(BIN_DIR)/dpwish $(BIN_DIR)/dptcl

install-libraries:
	@for i in $(prefix)/lib $(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 codaRegistry.h"
	@$(INSTALL_DATA) $(SRC_DIR)/codaRegistry.h $(INCLUDE_DIR)
	@for i in library/*.tcl library/tclIndex; \
	    do \
	    echo "Installing $$i"; \
	    $(INSTALL_DATA) $$i $(DP_LIB); \
	    done;
	@echo "Making tclIndex in $(DP_LIB)"
	@echo auto_mkindex $(DP_LIB) '*.tcl' > tmp
	@echo exit >> tmp
	@echo "script is ..."
	@cat  tmp
	@cat tmp| $(BIN_DIR)/tclsh
	@/bin/rm -f tmp

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 dpwish dptcl

distclean: clean
	rm -f Makefile config.status

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