# Makefile - Don Yang (uguu.org)
#
# 11/03/12

width1 = 127
width2 = 162
height1 = `perl -e 'print int($(width1) * 0.45)'`
height2 = `perl -e 'print int($(width2) * 0.39)'`

all: rikka0.txt rikka1.txt rikka2.txt

rikka0.txt: rikka0c.txt rikka0d.txt
	perl merge.pl $^ > $@

rikka1.txt: rikka1a.txt rikka1b.txt
	perl merge.pl $^ > $@

rikka2.txt: rikka2a.txt rikka2b.txt
	perl merge.pl $^ > $@

rikka3.txt: rikka3a.txt rikka3b.txt
	perl merge.pl $^ > $@

rikka0a.txt: rikka0y.png Makefile
	perl anytotxt.pl $< $(width1) $(height1) > $@

rikka0b.txt: rikka0.png Makefile
	perl anytotxt.pl $< $(width1) $(height1) | sed -e 's/X/+/g' > $@

rikka0c.txt: rikka0a.txt rikka0b.txt
	perl merge.pl $^ > $@

rikka0d.txt: rikka0x.png Makefile
	perl anytotxt.pl $< $(width1) $(height1) | sed -e 's/X/./g' > $@

rikka1a.txt: rikka1.png Makefile
	perl anytotxt.pl $< $(width2) $(height2) > $@

rikka1b.txt: rikka1x.png Makefile
	perl anytotxt.pl $< $(width2) $(height2) | sed -e 's/X/./g' > $@

rikka2a.txt: rikka2.png Makefile
	perl anytotxt.pl $< $(width2) $(height2) > $@

rikka2b.txt: rikka2x.png Makefile
	perl anytotxt.pl $< $(width2) $(height2) | sed -e 's/X/./g' > $@

clean:
	-rm -f rikka0{,a,b,c,d}.txt rikka{1,2}{,a,b}.txt

backup:
	-rm -f backup.tar.xz
	tar cf backup.tar *.pl *.cdr Makefile
	xz -9 backup.tar
