# Generated automatically from Makefile.in by configure.

# This is a Makefile for tkined. 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.

prefix =	/usr/local
exec_prefix =	${prefix}

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

# Directory in which to install the library of tkined files.
# (note: you can set the TKINED_PATH environment variable 
# at run-time to override the compiled-in location):
TKINED_DIR =	$(prefix)/lib/tkined

# Directory in which to install the tkined bitmaps.
BITMAP_DIR =	$(TKINED_DIR)/bitmaps

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

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

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

# 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

# A "-I" switch that can be used when compiling to make all the
# Tcl include files accessible (the configure script will try to
# set this value).
TCL_INCLUDES =	-I/usr/include/tcl

# Linker switch(es) to use to link with the Tcl library archive (the
# configure script will try to set this value automatically, but you
# can override it).
TCL_LIB =  /usr/lib/libtcl7.4.a

# A "-I" switch that can be used when compiling to make all the
# Tk include files accessible (the configure script will try to
# set this value).
TK_INCLUDES =	-I/usr/include/tcl

# 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_LIBS = -L/usr/X11R6/lib -lX11

# Linker switch(es) to use to link with the Tk library archive (the
# configure script will try to set this value automatically, but you
# can override it).
TK_LIB = /usr/lib/libtk4.0.a

# Libraries to use when linking:  must include at least Tcl and the
# math library (in that order).  The first part will be replaced 
# with relevant libraries as determined by the configure script.
LIBS =   -ldl -lieee -lm

# 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 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.  However, you can reverse the comments
# on the pairs of lines to force "no dynamic loading or shared
# libraries".
#----------------------------------------------------------------

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

# Base command to use for combining object files into a shared
# library:
SHLIB_LD = ld -assert pure-text

# 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
#SHLIB_SUFFIX = .a

# Library file(s) to include in tclsh and other base applications
# in order to provide facilities needed by DLOBJ above.
DL_LIBS = -ldl
#DL_LIBS =

# Flags to pass to the compiler when linking object files into
# an executable wish or tktest binary.
LD_FLAGS = 
#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.
#----------------------------------------------------------------

INSTALL =		/usr/bin/install -c
INSTALL_PROGRAM =	${INSTALL}
INSTALL_DATA =		${INSTALL} -m 644
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 =		cc
LD =		cc
CC_SWITCHES = ${CFLAGS} -I. -I${SRC_DIR}  -DHAVE_STDLIB_H=1 -DHAVE_UNISTD_H=1 -DHAVE_MALLOC_H=1  -DTKINEDLIB=\"$(TKINED_DIR)\" \
${PROTO_FLAGS} ${MEM_DEBUG_FLAGS} $(TCL_INCLUDES) $(TK_INCLUDES) $(X11_INCLUDES)

TCLC=	Editor.c Diagram.c Command.c Tool.c Objects.c Dialog.c \
	Html.c Event.c Help.c Misc.c

TCLO=	Editor.o Diagram.o Command.o Tool.o Objects.o Dialog.o \
	Html.o Event.o Help.o Misc.o

SRCS=	tkined.c editor.c objects.c methods.c misc.c flash.c html.c \
	stripchart.c barchart.c 

OBJS=	tkined.o editor.o objects.o methods.o misc.o flash.o html.o \
	stripchart.o barchart.o 

.SUFFIXES: .tcl

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

# convert a tcl script to an initialized C string
#
# Transformations applied to each line of the file:
#       eliminate blank lines
#       eliminate lines that are only comments
#	eliminate tab characters
#       eliminate leading white space characters
#       Convert preexisting backslash into double backslash.
#       Precede preexisting double quote (") with backslash.
#       Add backslash, n, backslash to the end of each line.

.tcl.c:
	@echo "converting $*.tcl to $*.c"
	@echo "/* this file was machine generated from $*.tcl */" > $*.c
	@echo "/* on `date` by $$USER */" >> $*.c
	@echo "" >> $*.c
	@echo 'static char foo[] = {' >> $*.c
	@sed -e '/^$$/d'             \
	    -e '/^[ 	]*#/d'       \
	    -e 's/	/ /g'        \
	    -e 's/^ *//g'            \
	    -e "s/\\(.\\)/'\\1',/g"  \
	    -e 's/\\/\\\\/g'         \
	    -e 's/$$/0x0a,/'         \
	    $< >> $*".c"
	@echo '0x0 };' >> $*.c
	@echo "" >> $*.c
	@echo "/* This indirection is needed to fool damaged linker */" >> $*.c
	@echo "" >> $*.c
	@echo 'char *$*_tcl = foo;' >> $*.c

all: tkined

tkined: $(OBJS) $(TCLC) $(TCLO)
	$(LD) -o tkined $(OBJS) $(TCLO) $(TK_LIB) $(X11_LIBS) $(TCL_LIB) $(LIBS)

install: tkined
	@if [ ! -d $(BIN_DIR) ] ; then \
		mkdir -p $(BIN_DIR); \
	else true; \
	fi
	rm -f $(BIN_DIR)/tkined
	$(INSTALL_PROGRAM) tkined $(BIN_DIR)
	@if [ ! -d $(TKINED_DIR) ] ; then \
		mkdir -p $(TKINED_DIR); \
	else true; \
	fi
	@if [ ! -d $(TKINED_DIR)/site ] ; then \
		mkdir -p $(TKINED_DIR)/site; \
	else true; \
	fi
	$(INSTALL_DATA) $(SRC_DIR)/init.tcl $(TKINED_DIR)
	$(INSTALL_DATA) $(SRC_DIR)/tkined.defaults $(TKINED_DIR)
	@if [ ! -d $(BITMAP_DIR) ] ; then \
		mkdir -p $(BITMAP_DIR); \
	else true; \
	fi
	for f in $(SRC_DIR)/bitmaps/*.xbm ; do \
		$(INSTALL_DATA) $$f $(BITMAP_DIR) ; \
	done
	@if [ ! -d $(MAN1_DIR) ] ; then \
		mkdir -p $(MAN1_DIR); \
	else true; \
	fi
	$(INSTALL_DATA) $(SRC_DIR)/tkined.1 $(MAN1_DIR)

depend: 
	cp Makefile Makefile.bak
	sed -e '/^# DO NOT DELETE THIS LINE/,$$d' < Makefile.bak > Makefile
	echo '# DO NOT DELETE THIS LINE' >> Makefile
	echo ' ' >> Makefile
	$(CC) -MM $(CC_SWITCHES) $(SRCS) >> Makefile

clean:
	rm -f tkined core $(OBJS) lmake.???
	rm -f $(TCLC)
	rm -f $(TCLO) ncc1701.o

distclean: clean
	rm -f *~ *.bak *.orig TAGS
	rm -f Makefile config.*

tar: distclean
	rm -f tkined-?.*.tar.gz
	pwd=`pwd`; \
	pwd=`basename $$pwd`; \
	echo $$pwd; \
	cd ..; tar cvf /tmp/$$pwd.tar $$pwd/????*; \
	mv /tmp/$$pwd.tar $$pwd; \
	gzip -v -9 $$pwd/$$pwd.tar

BINDIST=/usr/local/bin/tkined /usr/local/man/man1/tkined.1 \
	/usr/local/bin/mibtree /usr/local/man/man1/mibtree.1 \
	/usr/local/bin/scotty /usr/local/man/man1/scotty.1 \
	/usr/local/bin/straps /usr/local/man/man8/straps.8 \
	/usr/local/bin/ntping /usr/local/man/man8/ntping.8 \
	/usr/local/include/scotty.h /usr/local/lib/libscotty.a \
	/usr/local/lib/tkined /usr/local/lib/scotty

bintar:
	rm -f tkined-?.*.tar.gz
	pwd=`pwd`; \
	pwd=`basename $$pwd`; \
	tar cvf $$pwd-bin.tar $(BINDIST); \
	gzip -v -9 $$pwd-bin.tar

# DO NOT DELETE THIS LINE
