# Makefile for ncurses miscellany directory
#
# This makes/installs the terminfo database
#
# The variable 'srcdir' refers to the source-distribution, and can be set with
# the configure script by "--srcdir=DIR".
#
# The rules are organized to produce the libraries for the configured models,
# and the programs with the configured default model.

# turn off _all_ suffix rules; we'll generate our own
.SUFFIXES:

SHELL		= /bin/sh
THIS		= Makefile

NC_MFLAGS 	= @nc_cv_makeflags@
@SET_MAKE@

srcdir		= @srcdir@
VPATH		= @srcdir@
prefix		= @prefix@
exec_prefix	= @exec_prefix@
bindir		= $(exec_prefix)/bin

# We'd put terminfo in /usr/share/terminfo, but that's not the convention...
ticdir		= @datadir@

################################################################################
all:

install: install.data

# Kluge alert: we compile terminfo.src in two pieces because a lot of machines
# with < 16MB RAM choke on tic's core-hog habits.  It would be much nicer to
# use csplit -k -f tsplit $(srcdir)/terminfo.src '/SPLIT HERE/' '{99}' to split
# the file (permitting any number of cut marks), but BSD systems don't have it.
install.data: $(ticdir)
	sed <$(srcdir)/dotic.in -e's,@TERMINFO@,$(ticdir),' -e 's,@SRCDIR@,$(srcdir),' -e 's,@BINDIR@,$(bindir),' >dotic.sh
	sh dotic.sh

# On machines with lots of memory, this is simpler and faster
install.bigmem: $(ticdir)
	-rm -f do.tic
	echo "TERMINFO=$(ticdir)">do.tic
	echo "export TERMINFO">>do.tic
	echo "rm -fr $(ticdir)/[0-9A-Za-z]">>do.tic
	echo "$(bindir)/tic -v $(srcdir)/terminfo.src">>do.tic
	(sh do.tic)
	rm do.tic

$(ticdir) :
	$(srcdir)/../mkinstalldirs $@

tags:

TAGS:

clean ::
	-rm -f tags TAGS do.tic tsplit* *~

distclean: clean
	-rm -f Makefile

mostlyclean: clean

realclean: distclean

###############################################################################
# The remainder of this file is automatically generated during configuration
###############################################################################
