# ------------------------------------------------------------------------
#       Makefile for BLT distribution
# ------------------------------------------------------------------------

# ------------------------------------------------------------------------
#       Source and target installation directories
# ------------------------------------------------------------------------

prefix =	@prefix@
exec_prefix  =	@exec_prefix@
srcdir =	@srcdir@
bindir =	@bindir@
includedir =	@includedir@
libdir =	@libdir@
version =	@BLT_VERSION@
scriptdir =	$(prefix)/lib/blt$(version)

instdirs =	$(prefix) \
		$(exec_prefix) \
		$(bindir) \
		$(libdir) \
		$(includedir) \
		$(scriptdir)

# ------------------------------------------------------------------------
#       Don't edit anything beyond this point
# ------------------------------------------------------------------------

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

subdirs =	src library man demos 

all:  
	(cd src; $(MAKE) all)
	(cd library; $(MAKE) all)
	(cd man; $(MAKE) all)
	(cd demos; $(MAKE) all)

install: mkdirs install-all 

install-all:
	(cd src; $(MAKE) install)
	(cd library; $(MAKE) install)
	(cd man; $(MAKE) install)
	(cd demos; $(MAKE) install)
	$(INSTALL_DATA) $(srcdir)/README $(INSTALL_ROOT)$(scriptdir)
	$(INSTALL_DATA) $(srcdir)/PROBLEMS $(INSTALL_ROOT)$(scriptdir)
	$(INSTALL_DATA) $(srcdir)/NEWS $(INSTALL_ROOT)$(scriptdir)

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

clean:
	(cd src; $(MAKE) clean)
	(cd library; $(MAKE) clean)
	(cd man; $(MAKE) clean)
	(cd demos; $(MAKE) clean)
	$(RM) *.bak *\~ "#"* .pure*

GENERATED_FILES = \
	config.status config.cache config.log Makefile 

distclean: clean
	(cd src; $(MAKE) distclean)
	(cd library; $(MAKE) distclean)
	(cd man; $(MAKE) distclean)
	(cd demos; $(MAKE) distclean)
	$(RM) $(GENERATED_FILES)
