# $Id: Makefile,v 35000.39 2007/01/13 23:12:39 kkeys Exp $
########################################################################
#
#  TinyFugue - programmable mud client
#  Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2002, 2003, 2004, 2005, 2006-2007 Ken Keys
#
#  TinyFugue (aka "tf") is protected under the terms of the GNU
#  General Public Licence.  See the file "COPYING" for details.
#
#  DO NOT EDIT THIS FILE.  To change the default configuration,
#  see "unix/README".
#
########################################################################

# unix Makefile.
# This is invoked from top level make, so the working directory is the root.

SHELL = /bin/sh

default: __always__
	@case `pwd` in; \
	*/tf*/unix) cd ..;; \
	esac; \
	make

# If the next rule were first, a few strange versions of make would try
# to make "install", "all", "files", AND "tf", instead of just "install".
install all files tf: default

configure: configure.in
	autoconf

reconfigure:  unconfigure install

unconfigure:
	rm -f src/Makefile src/config.h

clean:
	cd ./src; rm -f *.o Makefile core* *.core config.h typescript*
	cd ./unix; rm -f vars.mak

distclean:  clean
	rm -f Build.log
#	cd ./tf-lib; rm -f tf-help.idx
	cd ./src; rm -f tf makehelp tags
	cd ./src; rm -f tf.pixie* tf.Addrs* tf.Counts*

spotless cleanest veryclean:  distclean
	cd ./src; rm -f tf.1.catman

uninstall:
	cd ./src; $(MAKE) uninstall

./src/tf.1.catman:  ./src/tf.1.nroffman
	TERM=vt100; nroff -man ./src/tf.1.nroffman > ./src/tf.1.catman

srcdist: ./src/tf.1.catman

help ./tf-lib/tf-help ./tf-lib/tf-help.idx: __always__
	if test -d ./help; then cd ./help; $(MAKE); fi

bogus-makefile:
	cp bogus.mak Makefile

disttest: __always__
	@{ test ! -d CVS && test "`basename \`pwd\``" = "tf-$(TFVER)"; } || \
	    { echo '"make dist" should be run from a CVS exported directory.'; \
	    false; }

disthelp: distclean
	ln -s help tf-$(TFVER)-help
	tar -zcf tf-$(TFVER)-help.tar.gz tf-$(TFVER)-help/. \
	    --exclude 'html2tf.c' \
	    --exclude 'html2tf' \
	    --exclude 'tf-help' \
	    --exclude 'Makefile'
	rm tf-$(TFVER)-help
	mv tf-$(TFVER)-help.tar.gz ..

dist: disttest srcdist distclean disthelp help bogus-makefile configure
	chmod -R ugo+r .
	cd ..; tar -zcf tf-$(TFVER).tar.gz -X tf-$(TFVER)/EXCLUDE tf-$(TFVER)
	cd ..; zip -qlr tf-$(TFVER).zip tf-$(TFVER) \
	    -x `sed -e 's;^;tf-$(TFVER)/;' tf-$(TFVER)/EXCLUDE`

gzdist: ./tf-lib/tf-help ../tf-$(TFVER).tar
	cd ..; gzip tf-$(TFVER).tar

__always__:

# hack to get around a bug in BSDi (and FreeBSD?) make.
make:

