#=============begin configuration=============
# Configuration is ONLY FOR MAKING THE EXAMPLE!!!  You do not need to change
# the Makefile to install SAMaker

# This is the directory where the databases and pages built by SAMaker 
# will live (must be a hard link!!!)
EXAMPLEDIR = examples
PAGESDIR = pages

# where does SAMaker live (here we assume it is not in our command path)?
SAMAKER = ~cdyreson/bin/perl/SAMaker

# where does LessonMaker live (here we assume it is not in our command path)?
LESSONMAKER = ~cdyreson/bin/perl/SAMaker

# name of the created entry page to example 
TUTEPAGE = $(PAGESDIR)/example.html

# name of the created example statistcal package entry page
STATSPAGE = $(PAGESDIR)/example-stats.html

# what chmod to use so the WWW can read the pages/databases
CHMOD = chmod -f

# what chgrp to use so the WWW can read the pages/databases
#CHGRP = chgrp -fR cgiperl
#=============end configuration=============

install:
	perl -w SAMakerinstall

example:	
		-mkdir $(EXAMPLEDIR)/example.dbs
		#$(CHMOD) 770 $(EXAMPLEDIR)/example.dbs
		$(SAMAKER) \
			-database $(EXAMPLEDIR)/example.dbs \
			-entry $(TUTEPAGE) \
			-stats $(STATSPAGE) \
			< example.tex
		$(CHMOD) 644 $(TUTEPAGE) $(STATSPAGE)
		#$(CHGRP) $(EXAMPLEDIR)/example.dbs
		#$(CHMOD) 660 $(EXAMPLEDIR)/example.dbs/*

lesson:		
		-mkdir $(EXAMPLEDIR)/lesson.dbs
		$(LESSONMAKER) \
           		-embed \
           		-database $(EXAMPLEDIR)/lesson.dbs \
           	-lesson lesson.html < lesson.tex
		#$(CHGRP) $(EXAMPLEDIR)/lesson.dbs
		#$(CHMOD) $(EXAMPLEDIR)/lesson.dbs

germanexample:	
		-mkdir $(EXAMPLEDIR)/germanexample.dbs
		#$(CHMOD) 770 $(EXAMPLEDIR)/germanexample.dbs
		$(SAMAKER) \
			-database $(EXAMPLEDIR)/germanexample.dbs \
			-entry $(PAGESDIR)/germanexample.html \
			-stats $(PAGESDIR)/germanexample-stats.html \
			< germanexample.tex
		#$(CHMOD) 644 $(PAGESDIR)/$(TUTEPAGE) $(PAGESDIR)/$(STATSPAGE)
		#$(CHGRP) $(EXAMPLEDIR)/germanexample.dbs
		#$(CHMOD) 660 $(EXAMPLEDIR)/germanexample.dbs/*

cleanexample:
	rm -rf $(TUTEPAGE) $(STATSPAGE) $(EXAMPLEDIR)/example.dbs 
