ange_width = 125
ange_height = `perl -e 'print int($(ange_width) * 0.5)'`
charlotte_width = 86
charlotte_height = `perl -e 'print int($(charlotte_width) * 0.5)'`
dorothy_width = 124
dorothy_height = `perl -e 'print int($(dorothy_width) * 0.45)'`
beatrice_width = 89
beatrice_height = `perl -e 'print int($(beatrice_width) * 0.5)'`
chise_width = 110
chise_height = `perl -e 'print int($(chise_width) * 0.5)'`

target = ange.txt charlotte.txt dorothy.txt beatrice.txt chise.txt

all: $(target)
	@echo "Full:"
	@for i in $^; do printf '%15s  ' $$i; perl freq.pl $$i; done
	@echo "Truncated:"
	@for i in $^; do printf '%15s  ' $$i; sed -e '1,7d' $$i | perl freq.pl; done

ange.txt: ange.png Makefile
	perl anytotxt.pl $< $(ange_width) $(ange_height) | perl trim_space.pl > $@
	perl freq.pl $@

charlotte.txt: charlotte.png Makefile
	perl anytotxt.pl $< $(charlotte_width) $(charlotte_height) | perl trim_space.pl > $@
	perl freq.pl $@

dorothy.txt: dorothy.png Makefile
	perl anytotxt.pl $< $(dorothy_width) $(dorothy_height) | perl trim_space.pl > $@
	perl freq.pl $@

beatrice.txt: beatrice.png Makefile
	perl anytotxt.pl $< $(beatrice_width) $(beatrice_height) | perl trim_space.pl > $@
	perl freq.pl $@

chise.txt: chise.png Makefile
	perl anytotxt.pl $< $(chise_width) $(chise_height) | perl trim_space.pl > $@
	perl freq.pl $@


clean:
	-rm -f $(target)

backup:
	-rm -f backup.tar.gz
	tar czf backup.tar.gz *.pl *.svg *.txt Makefile
