all: 

#
# UNIDATA directory should have:
# UnicodeData.txt
# # Unihan.txt - obseleted eastasia wont be made
# BidiMirroring.txt
#
VERSION=13.0.0
UNIROOT=/home/gsinai/Documents/Unicode/ftp.unicode.org/$(VERSION)

UNIDATA=$(UNIROOT)/ucd

# This has been removed. Dont make eastasia
MAPPINGS=$(UNIROOT)/MAPPINGS
#
# This is the target for unicode updates.
#
map: charclass bidiclass precompose mirror olditalic shape kmap

restricted: gcategory shape mirror precompose olditalic jis2000

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

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

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

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

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

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

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

Emoji: Emoji.txt
	./simplemys.pl $< > ../mytool/mys/Emoji.mys

#
# 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/KSX1001.*
	rm MAPPINGS/JOHAB.*

veryclean:
	rm MAPPINGS/KSX1001.*
	rm MAPPINGS/JOHAB.*
