include ../../Makefile.conf

#-------------------------------------------------------------------------------

.SUFFIXES: .o .cpp .h .mys .my
SRC_MAPS=$(basename $(notdir $(wildcard *.mys)))
OUT_MAPS=$(addsuffix .my,$(SRC_MAPS))

#
# Contains private, unofficial JIS0213-1.TXT JIS0213-2.TXT
# needed for jis-0213-1.mys, jis-0213-2.mys, shift-jis-3.mys
#
JIS0213_1=../../../JISX0213-1.TXT
JIS0213_2=../../../JISX0213-2.TXT

TARGET = $(OUT_MAPS) 



%.o:%.cpp
	$(CXX)  -c $(ALL_CFLAGS) -o $@ $<


all: $(TARGET)

%.my:%.mys
	@echo "Making $@ ..."
	$(MYTOOL) -convert my -write $@ -mys $<

Emoji.my:Emoji.mys
	@echo "Making $@ ..."
	$(MYTOOL) -convert my -write $@ -mys $< -rmys $<

OldHungarian.my:OldHungarian.mys
	@echo "Making $@ ..."
	$(MYTOOL) -convert my -write $@ -mys $< -rmys $<

OldItalic.my:OldItalic.mys
	@echo "Making $@ ..."
	$(MYTOOL) -convert my -write $@ -mys $< -rmys $<

Hosszu.my:Hosszu.mys
	@echo "Making $@ ..."
	$(MYTOOL) -convert my -write $@ -mys $< -rmys $<

IS_AS.my:IS_AS.mys
	@echo "Making $@ ..."
	$(MYTOOL) -convert my -write $@ -mys $< -rmys $<

IS_BN.my:IS_BN.mys
	@echo "Making $@ ..."
	$(MYTOOL) -convert my -write $@ -mys $< -rmys $<

IS_DV.my:IS_DV.mys
	@echo "Making $@ ..."
	$(MYTOOL) -convert my -write $@ -mys $< -rmys $<

IS_GJ.my:IS_GJ.mys
	@echo "Making $@ ..."
	$(MYTOOL) -convert my -write $@ -mys $< -rmys $<

IS_KN.my:IS_KN.mys
	@echo "Making $@ ..."
	$(MYTOOL) -convert my -write $@ -mys $< -rmys $<

IS_ML.my:IS_ML.mys
	@echo "Making $@ ..."
	$(MYTOOL) -convert my -write $@ -mys $< -rmys $<

IS_OR.my:IS_OR.mys
	@echo "Making $@ ..."
	$(MYTOOL) -convert my -write $@ -mys $< -rmys $<

IS_PJ.my:IS_PJ.mys
	@echo "Making $@ ..."
	$(MYTOOL) -convert my -write $@ -mys $< -rmys $<

IS_RM.my:IS_RM.mys
	@echo "Making $@ ..."
	$(MYTOOL) -convert my -write $@ -mys $< -rmys $<

IS_TL.my:IS_TL.mys
	@echo "Making $@ ..."
	$(MYTOOL) -convert my -write $@ -mys $< -rmys $<

IS_TM.my:IS_TM.mys
	@echo "Making $@ ..."
	$(MYTOOL) -convert my -write $@ -mys $< -rmys $<

tscii.my:tscii.mys
	@echo "Making $@ ..."
	$(MYTOOL) -convert my -write $@ -mys $< -rmys $<

nastaliq.my:nastaliq.mys
	@echo "Making $@ ..."
	$(MYTOOL) -convert my -write $@ -mys $< -rmys $<

# Make all jis-0213-1.mys, jis-0213-2.mys, shift-jis-3.mys
# This is usually already made.
jisx0213: 
	perl ../../bin/parsejisx0213.pl 2 jis-0213-1.mys  $(JIS0213_1) > jis-0213-1.mys
	perl ../../bin/parsejisx0213.pl 2 jis-0213-2.mys  $(JIS0213_2) > jis-0213-2.mys
	perl ../../bin/parsejisx0213.pl 1 shift-jis-3.mys $(JIS0213_1) $(JIS0213_2) > shift-jis-3.mys

jis-0213-1.my:jis-0213-1.mys
	@echo "Making $@ ..."
	$(MYTOOL) -convert my -write $@ -mys $< -rmys $<

jis-0213-2.my:jis-0213-2.mys
	@echo "Making $@ ..."
	$(MYTOOL) -convert my -write $@ -mys $< -rmys $<

shift-jis-3.my:shift-jis-3.mys
	@echo "Making $@ ..."
	$(MYTOOL) -convert my -write $@ -mys $< -rmys $<

gb-18030.my:gb-18030.mys
	@echo "Making $@ ..."
	$(MYTOOL) -convert my -write $@ -mys $< -rmys $<

charclass.my:charclass.mys
	@echo "Making $@ ..."
	$(MYTOOL) -convert my -write $@ -mys $< -rmys $<

bidiclass.my:bidiclass.mys
	@echo "Making $@ ..."
	$(MYTOOL) -convert my -write $@ -mys $< -rmys $<

clean:
	rm -f *.my *.o *.bak core message.txt

depend:

install: $(TARGET)
	@if test ! -d $(DESTDIR)/$(prefix) ; then mkdir -p $(DESTDIR)/$(prefix); fi
	@if test ! -d $(DESTDIR)/$(datadir) ; then mkdir -p $(DESTDIR)/$(datadir); fi
	@if test ! -d $(DESTDIR)/$(datadir)/yudit ; then mkdir -p $(DESTDIR)/$(datadir)/yudit;fi 
	@if test ! -d $(DESTDIR)/$(datadir)/yudit/data ;then mkdir -p $(DESTDIR)/$(datadir)/yudit/data;fi 
	@echo installing my files...
	@$(INSTALL_DATA) *.my  $(DESTDIR)/$(datadir)/yudit/data
	

ifeq (.depend, $(wildcard .depend))
include .depend
endif

