# -*- make -*-
# FILE: "/disk01/home/joze/src/tclreadline/Makefile.in"
# LAST MODIFICATION: "Thu Dec 16 23:12:50 1999 (joze)"
# (C) 1998, 1999 by Johannes Zellner, <johannes@zellner.org>
# $Id$
# ---
#
# tclreadline -- gnu readline for tcl
# Copyright (C) 1999  Johannes Zellner
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
#
# johannes@zellner.org
# http://www.zellner.org/tclreadline/
#
# ================================================================== 


MAJOR_VERSION = @TCLREADLINE_MAJOR_VERSION@
MINOR_VERSION = @TCLREADLINE_MINOR_VERSION@
VERSION       = @TCLREADLINE_VERSION@
# NOTE, that PATCHLEVEL is the complete version string
#
PATCHLEVEL    = $(VERSION).@TCLREADLINE_PATCHLEVEL@

#host         = @host@
#host_cpu     = @host_cpu@
#host_vendor  = @host_vendor@
#host_os      = @host_os@

srcdir        = @srcdir@
VPATH         = @srcdir@

#----------------------------------------------------------------
# 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      = @prefix@
exec_prefix = @exec_prefix@

bindir      = @bindir@

# 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 Tcl
# scripts (note: you can set the TCLREADLINE_LIBRARY environment variable at
# run-time to override the compiled-in location):
TCLREADLINE_LIBRARY = @TCLREADLINE_LIBRARY@

# Path name to use when installing library scripts:
LIBRARY_INSTALL_DIR = $(INSTALL_ROOT)$(TCLREADLINE_LIBRARY)

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

# Path to use at runtime to refer to LIB_INSTALL_DIR:
LIB_RUNTIME_DIR = $(exec_prefix)/lib

# Top-level directory for manual entries:
# MAN_INSTALL_DIR = $(INSTALL_ROOT)$(prefix)/man
MAN_INSTALL_DIR = $(INSTALL_ROOT)@mandir@

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


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

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


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

# Tk used to let the configure script choose which program to use
# for installing, but there are just too many different versions of
# "install" around;  better to use the install-sh script that comes
# with the distribution, which is slower but guaranteed to work.

INSTALL         = $(TOP_DIR)/aux/install-sh -c
# INSTALL         = @INSTALL@
INSTALL_PROGRAM = ${INSTALL}
INSTALL_DATA    = ${INSTALL} -m 644
MKINSTALLDIRS   = $(TOP_DIR)/aux/mkinstalldirs

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

SHLIB_CFLAGS = @SHLIB_CFLAGS@


# The symbol below provides support for dynamic loading and shared
# libraries.  See configure.in for a description of what it means.
# The values of the symbolis normally set by the configure script.

SHLIB_LD = @SHLIB_LD@

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

RANLIB               = @RANLIB@
TOP_DIR              = $(srcdir)
TCL_INCLUDE_DIR      = @TCL_INCLUDE_DIR@
TCL_LIB_SPEC         = @TCL_LIB_SPEC@
TK_LIB_SPEC          = @TK_LIB_SPEC@
READLINE_INCLUDE_DIR = @READLINE_INCLUDE_DIR@
TCLREADLINE_LIB_FILE = @TCLREADLINE_LIB_FILE@

READLINE_LIB         = -L@READLINE_LIB_DIR@ -lreadline
TERMLIB              = @TERMLIB@
TERMLIB_DIR          = @TERMLIB_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@
DEFS = @DEFS@

CC_SWITCHES = $(CFLAGS) $(SHLIB_CFLAGS) -I$(TOP_DIR) \
        -I$(TCL_INCLUDE_DIR) -I$(READLINE_INCLUDE_DIR)

OBJS = tclreadline.o

CSRCS = $(TOP_DIR)/tclreadline.c
TCLFILES = tclreadlineInit.tcl tclreadlineSetup.tcl tclreadlineCompleter.tcl

SOURCES = \
    GPL \
    Makefile.in \
    README \
    configure.in \
    pkgIndex.tcl.in \
    sample.tclshrc \
    sources \
    config.h.in \
    tclreadline.c \
    tclreadline.h.in \
    tclreadline.n.in \
    tclreadlineConfig.sh.in \
    tclreadlineInit.tcl.in \
    tclreadlineSetup.tcl.in \
    tclreadlineCompleter.tcl \
    tclshrl.c \
    wishrl.c

MISC = TODO

AUXILIARY = \
    aux/config.guess \
    aux/config.sub \
    aux/install-sh \
    aux/mkinstalldirs \
    aux/vimtags

MAN = tclreadline.n
HTML = tclreadline.n.html

CIFLAGS = -f -t-"gnu readline for tcl" -m"before initial relase"

all: $(TCLREADLINE_LIB_FILE)


.PHONY: clean distclean ctags tcltags vimtags tags ci co

.SUFFIXES: .c .o .so .sl .tcl



@TCLREADLINE_LIB_FILE@: ${OBJS}
	rm -f $(TCLREADLINE_LIB_FILE)
	@MAKE_LIB@ $(TERMLIB_DIR) $(READLINE_LIB) $(TERMLIB)
	$(RANLIB) $(TCLREADLINE_LIB_FILE)

shells: tclshrl wishrl

tclshrl: $(OBJS) tclshrl.o
	$(CC) -o tclshrl tclshrl.o $(OBJS) $(TERMLIB_DIR) $(READLINE_LIB) $(TERMLIB) $(TCL_LIB_SPEC)

wishrl: $(OBJS) wishrl.o
	$(CC) -o wishrl wishrl.o $(OBJS) $(TERMLIB_DIR) $(READLINE_LIB) $(TERMLIB) $(TK_LIB_SPEC) $(TCL_LIB_SPEC)

install: install-binaries install-libraries install-man

install-shells: install-tclshrl install-wishrl

install-tclshrl:
	$(MKINSTALLDIRS) $(bindir)
	$(INSTALL_PROGRAM) tclshrl $(bindir)/tclshrl

install-wishrl:
	$(MKINSTALLDIRS) $(bindir)
	$(INSTALL_PROGRAM) wishrl $(bindir)/wishrl

install-man: $(MANN_INSTALL_DIR)/$(MAN)

install-binaries: $(TCLREADLINE_LIB_FILE)
	@$(MKINSTALLDIRS) $(LIBRARY_INSTALL_DIR)
	@echo "Installing $(TCLREADLINE_LIB_FILE)"
	@$(INSTALL_DATA) $(TCLREADLINE_LIB_FILE) \
            $(LIBRARY_INSTALL_DIR)/$(TCLREADLINE_LIB_FILE)
	@(cd $(LIBRARY_INSTALL_DIR); $(RANLIB) $(TCLREADLINE_LIB_FILE))
	chmod 555 $(LIBRARY_INSTALL_DIR)/$(TCLREADLINE_LIB_FILE)


install-libraries: tclreadlineInit.tcl tclreadlineSetup.tcl \
                   tclreadlineCompleter.tcl pkgIndex.tcl tclreadlineConfig.sh
	@$(MKINSTALLDIRS) $(LIBRARY_INSTALL_DIR)
	for f in \
            tclreadlineInit.tcl \
            tclreadlineSetup.tcl \
            tclreadlineCompleter.tcl \
            pkgIndex.tcl \
            tclreadlineConfig.sh\
        ; do \
            $(INSTALL_DATA) $$f $(LIBRARY_INSTALL_DIR) \
        ; done

FORCE:

$(MANN_INSTALL_DIR)/$(MAN): FORCE
	- $(INSTALL_DATA) $(srcdir)/$(MAN) $@ &&  chmod 644 $@

tclreadline.n.html: tclreadline.n
	rman -f html $^ > $@

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

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

distclean: clean
	rm -f \
	Makefile *.so.* *.sl pkgIndex.tcl tclreadlineInit.tcl \
	tclreadlineSetup.tcl config.h tclreadline.h tclreadline.n \
	tclreadlineConfig.sh config.status config.log config.cache

depend:
	makedepend -- $(CC_SWITCHES) -- $(CSRCS)

configure: configure.in
	autoconf

tclreadline.o:	$(TOP_DIR)/tclreadline.c Makefile
	$(CC) -c $(CC_SWITCHES) $(DEFS) $(TOP_DIR)/tclreadline.c

tclshrl.o:	$(TOP_DIR)/tclshrl.c Makefile
	$(CC) -c $(CC_SWITCHES) $(DEFS) $(TOP_DIR)/tclshrl.c

wishrl.o:	$(TOP_DIR)/wishrl.c Makefile
	$(CC) -c $(CC_SWITCHES) $(DEFS) $(TOP_DIR)/wishrl.c

ctags:
	ctags -R

tcltags: ctags tclreadlineInit.tcl.in tclreadlineSetup.tcl.in \
            tclreadlineCompleter.tcl
	tcltags -a tclreadlineInit.tcl.in tclreadlineSetup.tcl.in \
            tclreadlineCompleter.tcl

vimtags: tcltags
	vimtags

tags: vimtags


ci: $(SOURCES)
	ci -u $(CIFLAGS) $^

co: $(SOURCES)
	co -l $^

dist: distribution
distribution: $(SOURCES) configure $(AUXILIARY) tclreadline.n.html
	- mkdir -p dist/tclreadline-$(PATCHLEVEL)/aux
	- cp $(SOURCES) configure tclreadline.n.html dist/tclreadline-$(PATCHLEVEL)
	- cp $(AUXILIARY) dist/tclreadline-$(PATCHLEVEL)/aux
	(cd dist; tar zcvf tclreadline-$(PATCHLEVEL).tar.gz tclreadline-$(PATCHLEVEL); rm -rf tclreadline-$(PATCHLEVEL))
	- cp README dist/tclreadline-$(PATCHLEVEL).README
	- echo AddDescription '"<font size=+2 color=red><b>most recent version</b></font>"' tclreadline-$(PATCHLEVEL).tar.gz > dist/.htaccess


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