all: 

#
# UNIDATA directory should have:
# UnicodeData.txt
# Unihan.txt
# BidiMirroring.txt
#
UNIROOT=/software/unicode/codetables/DOWNLOAD/
UNIDATA=$(UNIROOT)/UNIDATA
#MAPPINGS=$(UNIROOT)/MAPPINGS
MAPPINGS=../../

really: gcategory shape mirror precompose olditalic jis2000

charclass: $(UNIDATA)/UnicodeData.txt
	perl charclass.pl $< > ../mytool/mys/charclass.mys

bidiclass: $(UNIDATA)/UnicodeData.txt
	perl bidiclass.pl $< > ../mytool/mys/bidiclass.mys

precompose: $(UNIDATA)/UnicodeData.txt
	perl precompose.pl $< > ../mytool/mys/precompose.mys

mirror: $(UNIDATA)/BidiMirroring.txt
	perl mirroring.pl $< > ../mytool/uni/mirroring.txt 

olditalic: $(UNIDATA)/UnicodeData.txt
	perl olditalic.pl u $< > ../mytool/mys/OldItalic.mys

shape: $(UNIDATA)/UnicodeData.txt
	./shape.pl $< > ../mytool/mys/shape.mys 2> /dev/null

kmap: ../mytool/mys/shape.mys
	./arabickmap.pl $< > ../mytool/kmap/ArabicTranslit.kmap 

#
# This will create eastasia - that is obsolete
# JIS0201.TXT can not be calculated....
#
eastasia: $(UNIDATA)/Unihan.txt
	cp  $(MAPPINGS)/OBSOLETE/EASTASIA/JIS/JIS0201.TXT  MAPPINGS
	./eastasia.pl --dir MAPPINGS  $<

# CP949.TXT stripped will make KSC5601.TXT - this has nothing
# to do with KSC5601 but I will still keep it.
# 
korean:
	wget http://jshin.net/faq/KSX1001.TXT.gz
	wget http://jshin.net/faq/JOHAB.TXT.gz
	gunzip KSX1001.TXT.gz
	gunzip JOHAB.TXT.gz
	mv KSX1001.TXT MAPPINGS
	mv JOHAB.TXT MAPPINGS
	perl -ne 'next if (/^0x[0-9A-Za-z]{2}[ \t]/);print;' $(MAPPINGS)/VENDORS/MICSFT/WINDOWS/CP949.TXT > MAPPINGS/KSC5601.TXT

clean:
	rm MAPPINGS/*.TXT

veryclean:
	rm MAPPINGS/*.TXT
