#--------------------------------------------------------------------
# Configure these Macros
#--------------------------------------------------------------------

# On what URL should the Jumping Spider start
START_URL=http://www.eecs.wsu.edu/index.html

# Restrict the Jumping Spider to what URL directory (don't go out of here)
RESTRICT_TO_URL=http://www.eecs.wsu.edu/

# 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=/net/zeus/facstaff/cdyreson/perl/

#--------------------------------------------------------------------
# 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.
DATABASE_MODE=BSD

# Where is the installhtml command (if you want to recreate the docs).
INSTALL_HTML=/net/zeus/facstaff/cdyreson/bin/perl/installhtml 

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

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

# In what directory will the documents live.
DOCUMENT_DIRECTORY=docs
#DOCUMENT_HTMLROOT=/~cdyreson/pub/JumpingSpider/docs
DOCUMENT_HTMLROOT=http://www.eecs.wsu.edu/~cdyreson/pub/JumpingSpider/docs

# Name of created script
TEST_FILE=testing

# Name of the Jumping Spider library directory
INCLUDES=lib

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

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

newIndex: removeIndex addIndex

removeIndex: 
	rm -f $(DATABASE_NAME)/*

addIndex: createIndex createInitialGraph createReachable createTitles

createTitles : 
	perl -I$(INCLUDES) bin/createTitles $(OPTIONS) results/$(TEST_FILE)

createReachable: 
	perl -I$(INCLUDES) bin/createReachable $(OPTIONS) 

createInitialGraph: 
	perl -I$(INCLUDES) bin/createInitialGraph $(OPTIONS) results/$(TEST_FILE)

createIndex: 
	perl -I$(INCLUDES):$(HTTP_PM) bin/createIndex $(OPTIONS) \
          -fastCreation \
          -exclude excludedWords \
          results/$(TEST_FILE)

tar:
	rm -f JumpingSpider.tar.gz
	cd ..; tar -chf /tmp/JumpingSpider.tar JumpingSpider
	gzip /tmp/JumpingSpider.tar
	mv -f /tmp/JumpingSpider.tar.gz /net/zeus/facstaff/cdyreson/public_html/pub/JumpingSpider/JumpingSpider.tar.gz
	chmod a+r /net/zeus/facstaff/cdyreson/public_html/pub/JumpingSpider/JumpingSpider.tar.gz

query1: 
	perl -w -I$(INCLUDES) bin/query $(OPTIONS) EECS curtis home

runRobot: 
	rm -f results/$(TEST_FILE)
	rm -f spillfiles/$(TEST_FILE)
	perl -I$(INCLUDES):$(HTTP_PM) bin/Robot \
          -verbose \
          -robotVerbose \
          -maxPages 10000 \
          -spillfile spillfiles/$(TEST_FILE) \
          -starturl $(START_URL) \
          $(RESTRICT_TO_URL) >> results/$(TEST_FILE)

continueRobot: 
	perl -I$(INCLUDES):$(HTTP_PM) bin/Robot \
          -verbose \
          -robotVerbose \
          -maxPages 10000 \
          -spillfile spillfiles/$(TEST_FILE) \
          -starturl $(START_URL) \
          $(RESTRICT_TO_URL) >> results/$(TEST_FILE)

## MUST have installhtml command from the pod2html standard package
redoDocs: 
	perl -I$(HTTP_PM) $(INSTALL_HTML) \
           --podpath=. \
           --podroot=lib \
           --recurse \
           --verbose \
           --htmldir=$(DOCUMENT_DIRECTORY) \
           --htmlroot=$(DOCUMENT_HTMLROOT)
	chmod -R a+Xr $(DOCUMENT_DIRECTORY)/*

## MUST have installhtml command from the pod2html standard package
redoDocs2: 
	perl -I$(HTTP_PM) $(INSTALL_HTML) \
           --podpath=lib \
           --recurse \
           --verbose \
           --htmldir=$(DOCUMENT_DIRECTORY) \
           --htmlroot=$(DOCUMENT_HTMLROOT)
	chmod -R a+Xr $(DOCUMENT_DIRECTORY)/*
