# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# This is the Makefile for the "Edinburgh Repository of Music", a  collection #
# of  English,  Scottish  &  Irish  tunes published in London by Thompson ca. #
# 1770. The single-tune files have names of the form VPPPN_Title.abc, where V #
# is  the  volume  number (1-2), PPP is the 3-digit page number, and N is the #
# tune number on the page.  Note that there are two versions, ERM-V1 for  ABC #
# software  with  no  support for voice overlays, and ERM-V2 for ABC software #
# that handles voice overlays.  For the tunes with 2 versions (V1/V2), we use #
# '-' rather than '_' in the file name for the V1 version, and '=' for the V2 #
# versioni, to make them easy to match in this Makefile.  Tunes on two  pages #
# are counted twice, with an empty VPPP1_.abc file to say that the first tune #
# on a page is started on the previous page.                                  #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
U=http://trillian.mit.edu/~jc/music/book/ERM

all: ERM install

ERM: ERM-V1 ERM-V2

# Format using jcabc2ps:
ERM-V1: ERM-V1.abc ERM-V1.ps ERM-V1.pdf
ERM-V1= [0-9][0-9][0-9][0-9][0-9][-_]*.abc
ERM-V1.abc: $(ERM-V1)
	abcjoin +CS2 $(ERM-V1) >ERM-V1.abc
ERM-V1.ps: ERM-V1.abc fmt/ERM-V1.fmt
	jcabc2ps +k4 +Ffmt/ERM-V1.fmt +n +x ERM-V1.abc \
	|PShdr %P 'Edinburgh Repository of Music' %P \
	|PSftr %D $U/ %D >ERM-V1.ps
ERM-V1.pdf: ERM-V1.ps
	ps2pdf ERM-V1.ps ERM-V1.pdf

# Format using abcm2ps:
ERM-V2: ERM-V2.abc ERM-V2.ps ERM-V2.pdf
ERM-V2= [0-9][0-9][0-9][0-9][0-9][=_]*.abc	# [0-9][0-9]_*-V2.abc
ERM-V2.abc: $(ERM-V2)
	abcjoin +CS2 $(ERM-V2) >ERM-V2.abc
ERM-V2.ps: ERM-V2.abc fmt/ERM-V2.fmt
	abcm2ps -x -F fmt/ERM-V2.fmt ERM-V2.abc -O tmp.ps
	PShdr <tmp.ps %P 'Edinburgh Repository of Music' %P \
	|PSftr %D $U/ %D >ERM-V2.ps
	rm tmp.ps
ERM-V2.pdf: ERM-V2.ps
	ps2pdf ERM-V2.ps ERM-V2.pdf

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

install: ../ERM-V1.abc ../ERM-V2.abc  
../ERM-V1.abc: ERM-V1.abc
	ln -f ERM-V1.abc ../ERM-V1.abc
../ERM-V2.abc: ERM-V2.abc
	ln -f ERM-V2.abc ../ERM-V2.abc
