# Makefile - Don Yang (uguu.org)
#
# 2014-03-15


width1 = 121
height1 = `perl -e 'print int($(width1) * 0.42)'`
width2 = 130
height2 = `perl -e 'print int($(width2) * 0.40)'`
width3 = 120
height3 = `perl -e 'print int($(width3) * 0.40)'`

all: neptune.txt neptune3.txt

neptune.txt: neptune.png Makefile
	perl anytotxt.pl $< $(width1) $(height1) | perl trim_space.pl > $@
	perl freq.pl $@

neptune2.txt: neptune2a.txt neptune2b.txt neptune2c.txt Makefile
	perl overlay.pl neptune2b.txt neptune2c.txt | perl overlay.pl - neptune2a.txt | perl trim_space.pl > $@

neptune2a.txt: neptune2.png Makefile
	perl anytotxt.pl $< $(width2) $(height2) | perl downsample.pl | sed -e 's/[^ ]/./g' > $@

neptune2b.txt: neptune2f.png Makefile
	perl anytotxt.pl $< $(width2) $(height2) | perl downsample.pl | sed -e 's/[^ ]/X/g' > $@

neptune2c.txt: neptune2d.png Makefile
	perl anytotxt.pl $< $(width2) $(height2) | perl downsample.pl | sed -e 's/[^ ]/X/g' > $@

neptune3.txt: neptune3.png Makefile
	perl anytotxt.pl $< $(width3) $(height3) | perl downsample.pl | perl trim_space.pl > $@
	perl freq.pl $@

clean:
	-rm -f neptune.txt neptune2.txt neptune2a.txt neptune2b.txt neptune2c.txt neptune3.txt

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