#                             Main MagicStats Makefile
#
# This is the main makefile for the MagicStats system.  It simply causes the 
# subdirectories to be built in the order of DIRS.  Nothing too exciting here.
# most of the functionality of this makefile is provided by Makefile.common.
#
# This makefile provides the following targets:
#   1. make all - Build all of the files, putting an install image into the
#      ./Install directory
#   2. make install - Install the files from the ./Install directory onto the
#      local system... this is great for testing!  It puts files into the 
#      "inst" locations defined at the top of the Makefile.common...
#   3. make clean - Remove all temporary files from the tree.
#   4. make clobber - Do a make clean, then remove the ./Install directory.
#   5. make source - Compile all of the source code for the MagicStats engine.
#   6. make plugins - Compile all of the plugins...
#   7. make themes - Build all of the themes...
#   8. make docs - Build and index the documentation
# 

#------------------------------------------------------------------------------
# Set some variables up for Makefile.common...
#------------------------------------------------------------------------------

# This is the top of the MagicStats tree...
LEVEL = .

# Clue Makefile.common in as to which subdirectories need to be built first.
DIRS     = Source Plugins StatsGraph Themes Documentation

# Include common make functionality...
include Makefile.common

#------------------------------------------------------------------------------
# Define all of the common make file functions...
#------------------------------------------------------------------------------

# All - Build all three binaries plus the plugins...
all::
	@echo \*\*\* MagicStats build complete! \*\*\*

# global clean - Nothing terribly special, but remove all emacs ~ files...
clean::
	find . -name \*~ -exec rm {} \;

# install - Let the recursive install do most of the work, we just ensure that
# something exists in the Install directory...
#
install:: all

#------------------------------------------------------------------------------
# Define some helpful targets that are only valid at the top level...
#------------------------------------------------------------------------------

# clobber is the same as clean, except that it is only valid at the top 
# level, and that it deletes all of the installation files...
#
clobber: clean
	rm -rf Install

# Targets to build the source...
source Source binaries Binaries:
	cd Source; $(MAKE) all

# Targets to build the plugins...
#
plugins Plugins:
	cd Plugins; $(MAKE) all

# Targets to build themes...
#
themes Themes:
	cd Themes; $(MAKE) all

# Various targets for building documentation...
#
documentation Documentation docs Docs:
	cd Documentation; $(MAKE) all
