#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#
# This is the Makefile for the Kohlers Violin  Repository,  a  collection  of
# Scottish Dance Music published by Ernest Köhler & Son, Edinburgh, in 1885.
# These tunes were published in  three  volumes,  and  the  music  pages  are
# numbered consequitively across the volumes.  The file names are of the form
# PPPN_Title.abc, where PPP is the page number, N is the tune number  on  the
# page, and Title is from the T: line.
#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#
U=http://trillian.mit.edu/~jc/music/book/Kohlers

# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - #
# The "all" entry builds three files containing all the tunes in each of  the
# three volumes, plus one that contains the entire collection.  These are all
# linked into the parent directory.

all: Kohlers1 Kohlers2 Kohlers3 Kohlers install \
	Deux_Duos Duet_for_Two_Violins Exercises ArthursSeatWaltzes

# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - #
install:  ../Kohlers.abc
../Kohlers.abc: Kohlers.abc; ln -f Kohlers.abc ../Kohlers.abc

# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - #
neat: ; /bin/rm -f *-
clean: neat; /bin/rm -f test.* tmp.* *.ps *.pdf *.svg
clobber: clean; /bin/rm -rf proto.* img

# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - #
# Kohlers Collection Book 1:

Kohlers1: Kohlers1.abc Kohlers1.ps Kohlers1.pdf
Kohlers1= 1[0-9]*.abc 99999*.abc
Kohlers1.abc: $(Kohlers1)
	abcjoin +S $(Kohlers1) >Kohlers1.abc
	/bin/ln -f Kohlers1.abc ../Kohlers1.abc
Kohlers1.ps: Kohlers1.abc fmt/Kohlers1.fmt
	abcm2ps -j 0 -x -F fmt/Kohlers1.fmt Kohlers1.abc -O tmp.ps
	PShdr <tmp.ps %P 'Kohlers Collection Book 1' %P |\
	PSftr %D $U/ %D >Kohlers1.ps
	rm tmp.ps
Kohlers1.pdf: Kohlers1.ps
	ps2pdf Kohlers1.ps Kohlers1.pdf
Kohlers1.svg: Kohlers1.abc fmt/Kohlers1.fmt
	abcm2ps -j 0 -X -N 3 -F fmt/Kohlers1.fmt -O Kohlers1.svg Kohlers1.abc

# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - #
# Kohlers Collection Book 2:

Kohlers2: Kohlers2.abc Kohlers2.ps Kohlers2.pdf
Kohlers2= 2[0-9]*.abc 99999*.abc
Kohlers2.abc: $(Kohlers2)
	abcjoin +S $(Kohlers2) >Kohlers2.abc
	/bin/ln -f Kohlers2.abc ../Kohlers2.abc
Kohlers2.ps: Kohlers2.abc fmt/Kohlers2.fmt
	abcm2ps -j 0 -x -F fmt/Kohlers2.fmt Kohlers2.abc -O tmp.ps
	PShdr <tmp.ps %P 'Kohlers Collection Book 2' %P |\
	PSftr %D $U/ %D >Kohlers2.ps
	rm tmp.ps
Kohlers2.pdf: Kohlers2.ps
	ps2pdf Kohlers2.ps Kohlers2.pdf
Kohlers2.svg: Kohlers2.abc fmt/Kohlers2.fmt
	abcm2ps -j 0 -X -N 3 -F fmt/Kohlers2.fmt -O Kohlers2.svg Kohlers2.abc

# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - #
# Kohlers Collection Book 1:

Kohlers3: Kohlers3.abc Kohlers3.ps Kohlers3.pdf
Kohlers3= 3[0-9]*.abc 99999*.abc
Kohlers3.abc: $(Kohlers3)
	abcjoin +S $(Kohlers3) >Kohlers3.abc
	/bin/ln -f Kohlers3.abc ../Kohlers3.abc
Kohlers3.ps: Kohlers3.abc fmt/Kohlers3.fmt
	abcm2ps -i -j 0 -x -F fmt/Kohlers3.fmt Kohlers3.abc -O tmp.ps
	PShdr <tmp.ps %P 'Kohlers Collection Book 3' %P |\
	PSftr %D $U/ %D >Kohlers3.ps
	rm tmp.ps
Kohlers3.pdf: Kohlers3.ps
	ps2pdf Kohlers3.ps Kohlers3.pdf
Kohlers3.svg: Kohlers3.abc fmt/Kohlers3.fmt
	abcm2ps -j 0 -X -N 3 -F fmt/Kohlers3.fmt -O Kohlers3.svg Kohlers3.abc

# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - #
# Complete Kohlers Collection:

Kohlers: Kohlers.abc Kohlers.ps Kohlers.pdf
Kohlers= 0*abc page.abc $(Kohlers1) page.abc $(Kohlers2) page.abc $(Kohlers3) page.abc [4-9]*.abc 
Kohlers.abc: $(Kohlers)
	abcjoin +S $(Kohlers) >Kohlers.abc
	ln -f Kohlers.abc ../Kohlers.abc
Kohlers.ps: Kohlers.abc fmt/Kohlers.fmt
	abcm2ps -x -F fmt/Kohlers.fmt Kohlers.abc -O tmp.ps
	PShdr <tmp.ps %P 'Kohlers Collection' %P |\
	PSftr %D $U/ %D >Kohlers.ps
	rm tmp.ps
Kohlers.pdf: Kohlers.ps
	ps2pdf Kohlers.ps Kohlers.pdf
Kohlers.svg: Kohlers.abc fmt/Kohlers.fmt
	abcm2ps -j 0 -X -N 3 -F fmt/Kohlers.fmt -O Kohlers.svg Kohlers.abc

# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - #
# ArthursSeatWaltzes

ArthursSeatWaltzes: ArthursSeatWaltzes.abc ArthursSeatWaltzes.ps ArthursSeatWaltzes.pdf
ArthursSeatWaltzes= \
	32851_ARTHURS_SEAT_WALTZ_1.abc \
	32852_ARTHURS_SEAT_WALTZ_2.abc \
	32853_ARTHURS_SEAT_WALTZ_3.abc
ArthursSeatWaltzes.abc: $(ArthursSeatWaltzes)
	abcjoin +S $(ArthursSeatWaltzes) >ArthursSeatWaltzes.abc
ArthursSeatWaltzes.ps: ArthursSeatWaltzes.abc fmt/_75.fmt
	abcm2ps -j 0 -x -F fmt/_75.fmt ArthursSeatWaltzes.abc -O tmp.ps
	PShdr <tmp.ps %P 'ArthursSeatWaltzes Collection' %P |\
	PSftr %D $U/ %D >ArthursSeatWaltzes.ps
	rm tmp.ps
ArthursSeatWaltzes.pdf: ArthursSeatWaltzes.ps
	ps2pdf ArthursSeatWaltzes.ps ArthursSeatWaltzes.pdf
ArthursSeatWaltzes.svg: ArthursSeatWaltzes.abc fmt/ArthursSeatWaltzes.fmt
	abcm2ps -j 0 -X -N 3 -F fmt/ArthursSeatWaltzes.fmt -O ArthursSeatWaltzes.svg ArthursSeatWaltzes.abc

# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - #
#  Special page for pages 238/239, which have two duets on facing pages:

Deux_Duos: Deux_Duos.abc Deux_Duos.ps Deux_Duos.pdf
Deux_Duos= 3238*.abc page.abc 3239*.abc 
Deux_Duos.abc: $(Deux_Duos)
	abcjoin $(Deux_Duos) >Deux_Duos.abc
Deux_Duos.ps: Deux_Duos.abc fmt/_75.fmt
	abcm2ps -j 0 -F fmt/_75.fmt Deux_Duos.abc -O tmp.ps
	PShdr <tmp.ps %P "Kohler's Collection" %P |\
	PSftr %D $U/ %D >Deux_Duos.ps
	rm tmp.ps
Deux_Duos.pdf: Deux_Duos.ps
	ps2pdf Deux_Duos.ps Deux_Duos.pdf
Deux_Duos.svg: Deux_Duos.abc fmt/Deux_Duos.fmt
	abcm2ps -j 0 -X -N 3 -F fmt/Deux_Duos.fmt -O Deux_Duos.svg Deux_Duos.abc

# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - #
#  Special page for pages 278/279, which have two duets on facing pages:

Duet_for_Two_Violins: Duet_for_Two_Violins.abc Duet_for_Two_Violins.ps Duet_for_Two_Violins.pdf
Duet_for_Two_Violins= 3278*.abc page.abc 3279*.abc 
Duet_for_Two_Violins.abc: $(Duet_for_Two_Violins)
	abcjoin $(Duet_for_Two_Violins) >Duet_for_Two_Violins.abc
Duet_for_Two_Violins.ps: Duet_for_Two_Violins.abc fmt/_85.fmt
	abcm2ps -j 0 -F fmt/_85.fmt Duet_for_Two_Violins.abc -O tmp.ps
	PShdr <tmp.ps %P '' %P |\
	PSftr %D $U/ %D >Duet_for_Two_Violins.ps
	rm tmp.ps
Duet_for_Two_Violins.pdf: Duet_for_Two_Violins.ps
	ps2pdf Duet_for_Two_Violins.ps Duet_for_Two_Violins.pdf
Duet_for_Two_Violins.svg: Duet_for_Two_Violins.abc fmt/Duet_for_Two_Violins.fmt
	abcm2ps -j 0 -X -N 3 -F fmt/Duet_for_Two_Violins.fmt -O Duet_for_Two_Violins.svg Duet_for_Two_Violins.abc

# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - #
#	Exercise_Loder_1 Exercise_Loder_2

Exercises: Exercise_Loder_1 Exercise_Loder_2
Exercise_Loder_1: Exercise_Loder_1.abc Exercise_Loder_1.ps Exercise_Loder_1.pdf
Exercise_Loder_1= 32861_EXERCISE_LODER_1.abc 32871_EXERCISE_LODER_1.abc
Exercise_Loder_1.abc: $(Exercise_Loder_1)
	abcjoin +S $(Exercise_Loder_1) >Exercise_Loder_1.abc
Exercise_Loder_1.ps: Exercise_Loder_1.abc fmt/_85.fmt
	abcm2ps -j 0 -x -F fmt/_85.fmt Exercise_Loder_1.abc -O tmp.ps
	PShdr <tmp.ps %P 'Exercise_Loder_1 Collection' %P |\
	PSftr %D $U/ %D >Exercise_Loder_1.ps
	rm tmp.ps
Exercise_Loder_1.pdf: Exercise_Loder_1.ps
	ps2pdf Exercise_Loder_1.ps Exercise_Loder_1.pdf
Exercise_Loder_1.svg: Exercise_Loder_1.abc fmt/Exercise_Loder_1.fmt
	abcm2ps -j 0 -X -N 3 -F fmt/Exercise_Loder_1.fmt -O Exercise_Loder_1.svg Exercise_Loder_1.abc

Exercise_Loder_2: Exercise_Loder_2.abc Exercise_Loder_2.ps Exercise_Loder_2.pdf
Exercise_Loder_2= 32872_EXERCISE_LODER_2.abc 32872_EXERCISE_LODER_2.abc
Exercise_Loder_2.abc: $(Exercise_Loder_2)
	abcjoin +S $(Exercise_Loder_2) >Exercise_Loder_2.abc
Exercise_Loder_2.ps: Exercise_Loder_2.abc fmt/_85.fmt
	abcm2ps -j 0 -x -F fmt/_85.fmt Exercise_Loder_2.abc -O tmp.ps
	PShdr <tmp.ps %P 'Exercise_Loder_2 Collection' %P |\
	PSftr %D $U/ %D >Exercise_Loder_2.ps
	rm tmp.ps
Exercise_Loder_2.pdf: Exercise_Loder_2.ps
	ps2pdf Exercise_Loder_2.ps Exercise_Loder_2.pdf
Exercise_Loder_2.svg: Exercise_Loder_2.abc fmt/Exercise_Loder_2.fmt
	abcm2ps -j 0 -X -N 3 -F fmt/Exercise_Loder_2.fmt -O Exercise_Loder_2.svg Exercise_Loder_2.abc

# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - #
#	Test file

test: test.abc test.ps test.pdf
test= 21662_THE_FASHION_WHICH_THE_LASSES_HAVE_orig.abc
test.abc: $(test)
	abcjoin +S $(test) >test.abc
test.ps: test.abc fmt/_65.fmt
	abcm2ps -F fmt/_70.fmt test.abc -O test.ps
#	rm tmp.ps
test.pdf: test.ps
	ps2pdf test.ps test.pdf
test.svg: test.abc fmt/test.fmt
	abcm2ps -j 0 -X -N 3 -F fmt/test.fmt -O test.svg test.abc
