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

#----------------------------------------------------------------
#
#	Please read	README.shared.
#
#		changed by WonIl Lee (POSTECH HCI Lab. 1994)
#
#			to make shared library.
#

exec_prefix =	/home2/j-env
prefix =	/home2/j-env

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

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

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

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

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

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

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

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

# The directory containing the Tcl sources and headers appropriate
# for this version of Tk ("." will be replaced or has already
# been replaced by the configure script):
TCL_DIR =	./../tcl7.3jp

# The directory containing the Tcl library archive file appropriate
# for this version of Tk:
#TCL_BIN_DIR =	../tcl7.3jp
TCL_BIN_DIR =	/home2/j-env/lib

# 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 =	# no special path needed

# 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 =	-lX11

# Libraries to use when linking:  must include at least Tk, Tcl, Xlib,
# and the math library (in that order).  The " -lnsl" part will be
# replaced (or has already been replaced) with relevant libraries as
# determined by the configure script.
LIBS = -L. -ltk -L$(TCL_BIN_DIR) -ltcl $(X11_LIB_SWITCHES) -lnsl -lm

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

# To turn off the security checks that disallow incoming sends when
# the X server appears to be insecure, reverse the comments on the
# following lines:
#SECURITY_FLAGS =
SECURITY_FLAGS = -DTK_NO_SECURITY

# 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

# To disable kanji handling, reverse the comment characters on the following
# lines.  `KINPUT2' is the name of kanji input server.  Actually, `KINPUT2'
# is the only kanji input server you can choose right now. :-)
# Warning:  if you enable kanji handling for tk, you must enable kanji
# handling for tcl.
KANJI_FLAGS = -DKANJI -DKINPUT2
# KANJI_FLAGS =

# 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 =		 -DHAVE_UNISTD_H=1 -DNO_STDLIB_H=1
INSTALL =		//bin/install -c
INSTALL_PROGRAM =	$(INSTALL)
INSTALL_DATA =		$(INSTALL) -m 644
RANLIB =		ranlib
SRC_DIR =		.
VPATH =			.

#----------------------------------------------------------------
# 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${TCL_DIR} ${X11_INCLUDES} \
${AC_FLAGS} ${PROTO_FLAGS} ${SECURITY_FLAGS} ${MEM_DEBUG_FLAGS} ${KANJI_FLAGS} \
-DTK_LIBRARY=\"${TK_LIBRARY}\"

WIDGSOBJS = tkButton.so tkEntry.so tkFrame.so tkListbox.so \
	tkMenu.so tkMenubutton.so tkMessage.so tkScale.so \
	tkScrollbar.so

WIDGOBJS = tkButton.o tkEntry.o tkFrame.o tkListbox.o \
	tkMenu.o tkMenubutton.o tkMessage.o tkScale.o \
	tkScrollbar.o

CANVSOBJS = tkCanvas.so tkCanvArc.so tkCanvBmap.so tkCanvLine.so \
	tkCanvPoly.so tkCanvPs.so tkCanvText.so tkCanvWind.so \
	tkRectOval.so tkTrig.so

CANVOBJS = tkCanvas.o tkCanvArc.o tkCanvBmap.o tkCanvLine.o \
	tkCanvPoly.o tkCanvPs.o tkCanvText.o tkCanvWind.o \
	tkRectOval.o tkTrig.o

TEXTSOBJS = tkText.so tkTextBTree.so tkTextDisp.so tkTextIndex.so tkTextTag.so

TEXTOBJS = tkText.o tkTextBTree.o tkTextDisp.o tkTextIndex.o tkTextTag.o

KANJISOBJS = tkWStr.so tkKinput2.so tkCtext.so

KANJIOBJS = tkWStr.o tkKinput2.o tkCtext.o

SOBJS = tk3d.so tkArgv.so tkAtom.so tkBind.so tkBitmap.so tkCmds.so \
	tkColor.so tkConfig.so tkCursor.so tkError.so tkEvent.so \
	tkFocus.so tkFont.so tkGet.so tkGC.so tkGeometry.so tkGrab.so \
        tkMain.so tkOption.so tkPack.so tkPlace.so tkPreserve.so tkSelect.so \
        tkSend.so tkWindow.so tkWm.so $(WIDGSOBJS) \
	$(CANVSOBJS) $(TEXTSOBJS) $(KANJISOBJS)

OBJS = tk3d.o tkArgv.o tkAtom.o tkBind.o tkBitmap.o tkCmds.o \
	tkColor.o tkConfig.o tkCursor.o tkError.o tkEvent.o \
	tkFocus.o tkFont.o tkGet.o tkGC.o tkGeometry.o tkGrab.o \
        tkMain.o tkOption.o tkPack.o tkPlace.o tkPreserve.o tkSelect.o \
        tkSend.o tkWindow.o tkWm.o $(WIDGOBJS) \
	$(CANVOBJS) $(TEXTOBJS) $(KANJIOBJS)
DEMOPROGS = browse color dialog hello ixset rmt rolodex size square \
	tcolor timer widget

all: libtk.so.3.6 libtk.a wish

libtk.so.3.6: $(SOBJS)
	rm -f libtk.so.3.6
	ld -assert pure-text -o libtk.so.3.6 $(SOBJS)

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

wish: tkAppInit.o libtk.so.3.6 
	$(CC) $(CC_SWITCHES) tkAppInit.o $(LIBS) -o wish

tktest: tkTest.o libtk.a $(TCL_BIN_DIR)/libtcl.a
	${CC} ${CC_SWITCHES} tkTest.o $(LIBS) -o tktest

test: tktest
	@cwd=`pwd`; \
	cd $(TCL_DIR); TCL_LIBRARY=`pwd`/library; export TCL_LIBRARY; \
	cd $$cwd; cd $(SRC_DIR); TK_LIBRARY=`pwd`/library; export TK_LIBRARY; \
	cd $$cwd; ( echo cd $(SRC_DIR)/tests\; source all\; exit ) | ./tktest

install: install-binaries install-libraries install-demos install-man

install-binaries: libtk.a wish
	@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 libtk.a"
	@$(INSTALL_DATA) libtk.a $(LIB_DIR)
	@$(RANLIB) $(LIB_DIR)/libtk.a
	@if [ -n "libtk.so.3.6" ] ; then \
		echo "Installing libtk.so.3.6"; \
		$(INSTALL_DATA) libtk.so.3.6 $(LIB_DIR); \
	fi;
	@echo "Installing wish"
	@$(INSTALL_PROGRAM) wish $(BIN_DIR)

install-libraries:
	@for i in $(prefix)/lib $(INCLUDE_DIR) $(TK_LIBRARY) ; \
	    do \
	    if [ ! -d $$i ] ; then \
		echo "Making directory $$i"; \
		mkdir $$i; \
		chmod 755 $$i; \
		else true; \
		fi; \
	    done;
	@echo "Installing tk.h"
	@$(INSTALL_DATA) $(SRC_DIR)/tk.h $(INCLUDE_DIR)
	@cd $(SRC_DIR)/library; for i in *.tcl tclIndex prolog.ps; \
	    do \
	    echo "Installing library/$$i"; \
	    $(INSTALL_DATA) $$i $(TK_LIBRARY); \
	    done;

install-demos:
	@for i in $(prefix)/lib $(TK_LIBRARY) $(TK_LIBRARY)/demos \
		$(TK_LIBRARY)/demos/bitmaps ; \
	    do \
	    if [ ! -d $$i ] ; then \
		echo "Making directory $$i"; \
		mkdir $$i; \
		chmod 755 $$i; \
		else true; \
		fi; \
	    done;
	@cd $(SRC_DIR)/library/demos; for i in *; \
	    do \
	    if [ -f $$i ] ; then \
		echo "Installing library/demos/$$i"; \
		sed -e '1 s|/usr/local/bin/wish|$(BIN_DIR)/wish|' \
			$$i > $(TK_LIBRARY)/demos/$$i; \
	    fi; \
	    done;
	@for i in $(DEMOPROGS); \
	    do \
	    chmod 755 $(TK_LIBRARY)/demos/$$i; \
	    done;
	@cd $(SRC_DIR)/library/demos/bitmaps; for i in *; \
	    do \
	    echo "Installing library/demos/bitmaps/$$i"; \
	    $(INSTALL_DATA) $$i $(TK_LIBRARY)/demos/bitmaps; \
	    done;

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; for i in *.1; \
	    do \
	    echo "Installing doc/$$i"; \
	    rm -f $(MAN1_DIR)/$$i; \
	    sed -e '/man\.macros/r man.macros' -e '/man\.macros/d' \
		    $$i > $(MAN1_DIR)/$$i; \
	    chmod 444 $(MAN1_DIR)/$$i; \
	    done;
	@cd $(SRC_DIR)/doc; for i in *.3; \
	    do \
	    echo "Installing doc/$$i"; \
	    rm -f $(MAN3_DIR)/$$i; \
	    sed -e '/man\.macros/r man.macros' -e '/man\.macros/d' \
		    $$i > $(MAN3_DIR)/$$i; \
	    chmod 444 $(MAN3_DIR)/$$i; \
	    done;
	@cd $(SRC_DIR)/doc; for i in *.n; \
	    do \
	    echo "Installing doc/$$i"; \
	    rm -f $(MANN_DIR)/$$i; \
	    sed -e '/man\.macros/r man.macros' -e '/man\.macros/d' \
		    $$i > $(MANN_DIR)/$$i; \
	    chmod 444 $(MANN_DIR)/$$i; \
	    done;

Makefile: $(SRC_DIR)/Makefile.in
	$(SHELL) config.status

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

distclean: clean
	rm -f Makefile config.status

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

.SUFFIXES: .so $(SUFFIXES)
.c.so:
	$(CC) -c $(CC_SWITCHES) -fPIC $<
	mv $*.o $@

$(OBJS) tkTest.o: tk.h tkInt.h tkConfig.h
$(WIDGOBJS): default.h
$(CANVOBJS): default.h tkCanvas.h
$(TEXTOBJS): default.h tkText.h
tkWindow.o: patchlevel.h
