
# ------------------------------------------------------------------------
# 	Makefile for library files and directories of BLT library
# ------------------------------------------------------------------------

include ../win/makedefs

version =	$(BLT_MAJOR_VERSION).$(BLT_MINOR_VERSION)
pkgdir =	$(libdir)/tcl$(v1)/blt$(version)
srcdir =	.

cursors = 	treeview.cur

miscFiles     = bltCanvEps.pro \
		bltGraph.pro \
		dnd.tcl \
		dragdrop.tcl \
		graph.tcl \
		hierbox.tcl \
		tabnotebook.tcl \
		tabset.tcl \
		treeview.tcl \
		init.tcl \
		tclIndex \
		$(cursors)

ddFiles =	dd-color.tcl \
		dd-file.tcl \
		dd-number.tcl \
		dd-text.tcl \
		tclIndex

instdirs =	$(prefix) $(exec_prefix) $(libdir) \
		$(scriptdir) $(scriptdir)/dd_protocols $(libdir)/tcl$(v1) \
		$(pkgdir)

all: build-pkgindex

install: install-dirs install-ddfiles install-files install-pkgindex

install-dirs:
	@for i in $(instdirs) ; do \
	    if test -d "$$i" ; then : ; else mkdir "$$i" ; fi ; \
        done

install-ddfiles: install-dirs
	for i in $(ddFiles) ; do \
	    $(INSTALL_DATA) $(srcdir)/dd_protocols/$$i $(scriptdir)/dd_protocols ; \
	done 

install-files: install-dirs
	for i in $(miscFiles) ; do \
	    $(INSTALL_DATA) $(srcdir)/$$i $(scriptdir) ; \
	done 

pkgIndex.tcl: build-pkgindex

build-pkgindex:
	rm -f pkgIndex.tcl
	sed -e 's/%VERSION%/$(version)/' $(srcdir)/pkgIndex.tcl.in | \
	sed -e 's/%LIB_PREFIX%//' | \
	sed -e 's;%LIB_DIR%;$(libdir);' > pkgIndex.tcl

install-pkgindex: pkgIndex.tcl
	$(INSTALL_DATA) pkgIndex.tcl $(scriptdir)
	$(INSTALL_DATA) pkgIndex.tcl $(pkgdir)

clean:
	$(RM) pkgIndex.tcl
	$(RM) $(srcdir)/*.bak $(srcdir)/*\~ $(srcdir)/"#"* 

distclean: clean
	$(RM) Makefile
