#--------------------------------------------------------------------
# Configure these Macros for a new cube 
#--------------------------------------------------------------------

# Where is the input database
INPUTDB=specifications/MovieDB

# What is the example query
QUERY=specifications/query

# Where is Berkeley DB includes - You only need this if you have
# or want to use BERKLEY DB, otherwise make it empty
#BERKELEYDB=
BERKELEYDB=-I/user/curtis/perl/BerkeleyDB-0.04 -I/user/curtis/perl/BerkeleyDB-0.04/blib/arch -I/user/curtis/perl/BerkeleyDB-0.04/blib/lib

#--------------------------------------------------------------------
# Perhaps configure these Macros if you really want to
#--------------------------------------------------------------------

# DBM to use DBM files, set to GDBM or (best of all) BSD if you have
# these on your system, or BerkeleyDB if you have the new version of BSD
# and the BerkeleyDB.pm interface.  Set to SMALLDBM for small 
# DBM files, but this is dangerous since you may lose some information due
# to field size restrictions!
#DATABASE_MODE=BerkeleyDB
DATABASE_MODE=DBM

# Yapp source
YAPP=YAPP/yapp/Parse-Yapp-0.15

# The following are for documentation only!
# Where is the installhtml command (if you want to recreate the docs).
INSTALL_HTML=/user/curtis/bin/perl/installhtml 

# Where does the LWP, HTTP, and other modules live.  This should be
# a standard place on most normal machines (in ...perl/lib/src ...).
HTTP_PM=/user/curtis/pm/modules

# In what directory will the documents live.
REL_DOCUMENT_DIRECTORY=docs
ABS_DOCUMENT_DIRECTORY=/~curtis/AUCQL/docs
#ABS_DOCUMENT_DIRECTORY=$(REL_DOCUMENT_DIRECTORY)

#--------------------------------------------------------------------
# Probably do not have to configure these Macros
#--------------------------------------------------------------------

# In what directory will the index live.
DATABASE_NAME=dbs

# Name of the library directory
INCLUDES=lib $(BERKELEYDB)

# Name of the yp source directory
YP=yp

# Options for commands
OPTIONS=-verbose -databaseName $(DATABASE_NAME) -databaseMode $(DATABASE_MODE)

#--------------------------------------------------------------------
# END OF CONFIGURATION
#--------------------------------------------------------------------

select: 
	perl -I$(INCLUDES):$(YAPP) bin/evaluateQuery $(OPTIONS) < $(QUERY)

selectyp:
	perl -I$(YAPP) $(YAPP)/yapp.pl -v -m 'Parser::Select' -o lib/Parser/Select.pm $(YP)/Select.yp

loadDByp:
	perl -I$(YAPP) $(YAPP)/yapp.pl -m 'Parser::LoadDB' -o lib/Parser/LoadDB.pm $(YP)/LoadDB.yp

loadDB: cleanDB
	perl -w -I$(INCLUDES):$(YAPP) bin/loadDB $(OPTIONS) < $(INPUTDB)

cleanDB: 
	rm -f $(DATABASE_NAME)/*

## MUST have installhtml command from the pod2html standard package
redodocs: 
	cd lib; \
	perl -I$(HTTP_PM) $(INSTALL_HTML) \
	   --recurse \
	   --htmldir=../$(REL_DOCUMENT_DIRECTORY) \
	   --htmlroot=$(ABS_DOCUMENT_DIRECTORY)
	chmod -R a+r $(REL_DOCUMENT_DIRECTORY)/*
