U=http://trillian.mit.edu/~jc/music/book/24CountryDances/1794/Preston

all: alltunes install

alltunes: alltunes1 alltunes2
alltunes= [0-9][0-9][0-9]_*.abc
alltunes.abc: $(alltunes)
	abcjoin +CS2 $(alltunes) >alltunes.abc

# Format using jcabc2ps:
alltunes1: alltunes.abc alltunes1.ps alltunes1.pdf
alltunes1.ps: alltunes.abc fmt/all1794TP1.fmt
	jcabc2ps +k4 +Ffmt/all1794TP1.fmt +n +x alltunes.abc \
	|PShdr %P '24 Country Dances for the Year 1794 - Preston' %P \
	|PSftr %D $U/ %D >alltunes1.ps
alltunes1.pdf: alltunes1.ps
	ps2pdf alltunes1.ps alltunes1.pdf

# Format using abcm2ps:
alltunes2: alltunes.abc alltunes2.ps alltunes2.pdf
alltunes2.ps: alltunes.abc fmt/all1794TP2.fmt
	abcm2ps -x -j 4 -F fmt/all1794TP2.fmt alltunes.abc -O tmp.ps
	PShdr <tmp.ps %P '24 Country Dances for the Year 1794 - Preston' %P \
	|PSftr %D $U/ %D >alltunes2.ps
	rm tmp.ps
alltunes2.pdf: alltunes2.ps
	ps2pdf alltunes2.ps alltunes2.pdf

neat:         ; /bin/rm -f *- *.bak *.out
clean:    neat; /bin/rm -f *.ps *.pdf
clobber: clean; /bin/rm -f alltunes.abc

install: ../Preston.abc ../../1794_Preston.abc ../../../24CountryDances_1794_Preston.abc
../Preston.abc: alltunes.abc
	ln -f alltunes.abc ../Preston.abc
../../1794_Preston.abc: alltunes.abc
	ln -f alltunes.abc ../../1794_Preston.abc
../../../24CountryDances_1794_Preston.abc: alltunes.abc
	ln -f alltunes.abc ../../../24CountryDances_1794_Preston.abc
