
# list all "framework" files to be included in submission
FRAMEWORK_FILES = Makefile README challenge2002.sgml timestamp.pl


PERL=/usr/bin/perl


.PHONY: all clean realclean dist timestamp timestamp.html validate

all: answers.html


answers.html: challenge2002.sgml
	docbook2html challenge2002.sgml


clean:
	rm -f *.html
	rm -f timestamp.bak

realclean: clean
	rm -f stamper.msg
	rm -f files.tar


# "timestamp.pl" expects that the email from Stamper
# will be saved to the file 'stamper.msg'.  It inserts
# the message into "timestamp.html.
timestamp.html: answers.html
	$(PERL) timestamp.pl include


# "timestamp" target should have been executed already,
# and result inserted into timestamp.html
dist: timestamp.html
	rm -f submission.tar submission.tar.gz
	tar -cf submission.tar $(FRAMEWORK_FILES) *.html files.tar
	gzip --best submission.tar


timestamp: clean files.tar answers.html
	$(PERL) timestamp.pl stamp *.html files.tar $(FRAMEWORK_FILES)



# "localvalidate" target is used to unpack "submission.tar"
# and verify that all the md5 sums are correct
localvalidate:
	rm -rf validate
	mkdir validate
	@echo "Unpacking the submission..."
	cd validate; tar -xzf ../submission.tar.gz
	@echo "Validating..."
	cd validate; $(PERL) ../timestamp.pl validate

# "validate" is used to validate the current directory,
# which is useful for submission evaluators.
validate:
	$(PERL) timestamp.pl validate


# build the tar file of all the extra files.
files.tar: files/Makefile
	rm -f files.tar
	tar --exclude CVS --exclude sendraw --exclude sendcmd --exclude .cvsignore -cf files.tar files stylesheet-images

files/Makefile:

