XMLBZ2 = enwiktionary-20100310-pages-articles.xml.bz2


.PHONY:	split index

all:	inform

inform:
	@echo Put ${XMLBZ2} in the wiki-splits directory and \'make split index\'

split:
	@mkdir -p wiki-splits
	@find wiki-splits -type f -iname rec\*  -exec rm -f '{}' ';'
	@cd wiki-splits && bzip2recover ${XMLBZ2} 
	@echo Perfect, spliting done

index:
	@rm -rf db/
	@cd wiki-splits && rm -rf db && for i in rec*.bz2 ; do echo \#$$i ; bzcat $$i | grep '<title' | perl -ne 'm/<title>([^<]+)<\/title>/ && print $$1."\n";' ; done | ../quickstartindex
	@mv wiki-splits/db ./
	@echo Index built - we are done
