width1 = 90
height1 = `perl -e 'print int($(width1) * 0.6)'`
width2 = 87
height2 = `perl -e 'print int($(width2) * 0.5)'`

target1 = serval.txt
target2 = tsuchinoko.txt

all: $(target1) $(target2)
	@perl freq.pl $(target1)
	@perl freq.pl $(target2)

$(target1): serval.png Makefile
	perl anytotxt.pl $< $(width1) $(height1) | perl trim_space.pl > $@

$(target2): tsuchinoko.png Makefile
	perl anytotxt.pl $< $(width2) $(height2) | perl trim_space.pl > $@

clean:
	-rm -f $(target1) $(target2)

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