# ------------------------------------------------------------------------
# 	Makefile for demos 
# ------------------------------------------------------------------------

prefix =	@prefix@
exec_prefix =	@exec_prefix@
version =	@BLT_VERSION@
libdir =	@libdir@
scriptdir =	$(prefix)/lib/blt$(version)
destdir =	$(scriptdir)/demos
srcdir =	@srcdir@

SHELL =		/bin/sh
RM =		rm -rf
INSTALL =	@INSTALL@
INSTALL_DATA =	@INSTALL_DATA@
INSTALL_ROOT = 

instdirs =	$(prefix) \
		$(exec_prefix) \
		$(libdir) \
		$(scriptdir) \
		$(destdir) \
		$(destdir)/bitmaps \
		$(destdir)/bitmaps/hand \
		$(destdir)/bitmaps/fish \
		$(destdir)/images \
		$(destdir)/scripts

demos 	=	barchart1.tcl barchart2.tcl barchart3.tcl barchart4.tcl \
		barchart5.tcl \
		bgexec1.tcl bgexec2.tcl bgexec3.tcl bgexec4.tcl \
		bitmap.tcl \
		busy1.tcl busy2.tcl \
		dnd1.tcl dnd2.tcl dragdrop1.tcl dragdrop2.tcl \
		eps.tcl \
		graph1.tcl graph2.tcl graph3.tcl graph4.tcl graph5.tcl \
		graph6.tcl graph7.tcl \
		hierbox1.tcl hierbox2.tcl hierbox3.tcl hierbox4.tcl \
		hiertable1.tcl hiertable2.tcl \
		htext1.tcl htext.txt \
		spline.tcl stripchart1.tcl \
		tabset1.tcl tabset2.tcl tabset3.tcl tabset4.tcl \
		tabnotebook1.tcl tabnotebook2.tcl tabnotebook3.tcl \
		treeview1.tcl \
		winop1.tcl winop2.tcl

all:

install: mkdirs install-bitmaps install-images install-scripts 

install-scripts: 
	for i in $(srcdir)/scripts/*.tcl ; do \
            $(INSTALL) $$i $(INSTALL_ROOT)$(destdir)/scripts ; \
	done 
	for i in $(demos) ; do \
            $(INSTALL) $(srcdir)/$$i $(INSTALL_ROOT)$(destdir)/$$i ; \
	done 

install-bitmaps: 
	for i in $(srcdir)/bitmaps/*.xbm ; do \
	    $(INSTALL_DATA) $$i $(INSTALL_ROOT)$(destdir)/bitmaps ; \
	done 
	for i in $(srcdir)/bitmaps/hand/*.xbm ; do \
	    $(INSTALL_DATA) $$i $(INSTALL_ROOT)$(destdir)/bitmaps/hand ; \
	done 
	for i in $(srcdir)/bitmaps/fish/*.xbm ; do \
	    $(INSTALL_DATA) $$i $(INSTALL_ROOT)$(destdir)/bitmaps/fish ; \
	done 

install-images: 
	for i in $(srcdir)/images/*.gif $(srcdir)/images/*.ps ; do \
	    $(INSTALL_DATA) $$i $(INSTALL_ROOT)$(destdir)/images ; \
	done 

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

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

distclean: clean
	$(RM) *.ps Makefile
