# ---------------------------------------------------------------------------
#           [incr Tcl] - Object-oriented programming in Tcl
# ---------------------------------------------------------------------------
# This file is a Makefile for [incr Tcl].  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.
# ---------------------------------------------------------------------------
ROOTNAME = @ROOTNAME@
VERSION  = @VERSION@
PACKAGE  = $(ROOTNAME)-$(VERSION)

# ---------------------------------------------------------------------------
# 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.)
# ---------------------------------------------------------------------------
# INSTALLATION DIRECTORIES
# ---------------------------------------------------------------------------
# Top-level directory in which to install architecture-specific files:
prefix = /usr/local
exec_prefix = $(prefix)

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

# Directory in which to install the programs (itcl_wish and itcl_sh):
BIN_DIR = $(exec_prefix)/bin


SUBDIRS  = src

libitcl.a: 
	@set -x;
	(cd src; $(MAKE) -$(MAKEFLAGS) $@)

all:
	@set -x; for i in $(SUBDIRS); do \
		(cd $$i; $(MAKE) -$(MAKEFLAGS) $@); \
		done
	@echo "== MAKE COMPLETE =="

install:
	@for i in $(prefix) $(exec_prefix) ; do \
		if [ ! -d $$i ] ; then \
			echo "Making directory $$i"; \
			mkdir $$i; \
			chmod 755 $$i; \
		else true; \
		fi; \
		done;
	@set -x; for i in $(SUBDIRS); do \
		(cd $$i; $(MAKE) -$(MAKEFLAGS) $@); \
		done
	@echo "== INSTALL COMPLETE =="

clean:
	rm -f $(PACKAGE).tar $(PACKAGE).tar.Z $(PACKAGE).uu
	rm -rf itcl itcl-*
	@set -x; for i in $(SUBDIRS); do \
		(cd $$i; $(MAKE) -$(MAKEFLAGS) $@); \
		done

distclean:
	rm -f Makefile config.status
	rm -f $(PACKAGE).tar $(PACKAGE).tar.Z $(PACKAGE).uu
	@set -x; for i in $(SUBDIRS); do \
		(cd $$i; $(MAKE) -$(MAKEFLAGS) $@); \
		done

tar: Intro.ps
	rm -f $(PACKAGE).tar $(PACKAGE).tar.Z
	@echo "== Release tag?"; \
	 read tag; \
	 cvs export -r $$tag itcl
	@mv itcl $(PACKAGE)
	@chmod -R +r $(PACKAGE)
	@chmod +rx `find $(PACKAGE) -type d -print`
	@echo "creating tar file..."
	@tar cvf /tmp/$(PACKAGE).tar $(PACKAGE)
	@rm -rf $(PACKAGE)
	@mv /tmp/$(PACKAGE).tar .

uu: tar
	rm -f $(PACKAGE).uu
	compress $(PACKAGE).tar
	uuencode $(PACKAGE).tar.Z $(PACKAGE).tar.Z > $(PACKAGE).uu

Intro.ps: ../doc/Intro
	@echo '== Make PostScript for Intro =='
	exit 1

configure: configure.in
	autoconf

excludelist:
	@echo "Making exclude list for Version $(VERSION)..."
	@rm -f EXCLUDE.tmp
	@cat EXCLUDE.FROM.TAR \
		| sed -e"s/%version%/$(VERSION)/g" \
		> EXCLUDE.tmp

