#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#
# This is the makefile in the "abc" directory.  Pages of music are  sometimes #
# linked  here from other directories.  Sometimes we cd to another directory, #
# make things there, and link the results here.  Also, we  have  a  bunch  of #
# entries  for  making  "collections"  of  tunes in particular rhythms and/or #
# keys. And various other oddities happen here on occasion.                   #
#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#

#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#
A=$(HOME)/abc
a2p=jcabc2ps	# Our personal ABC formatter.
U=http://trillian.mit.edu/~jc/music/abc/

all:

#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#

neat:  ; rm -f *-
clean:   neat  
	rm -f [a-z]*.abc new.* *.ps *.pdf
	find new -mtime +100 -name '*.abc' -exec rm {} ';'
clobber: clean 
	rm -f *.abc # The .../abc/ directory shouldn't contain .abc files ;-)


# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - #
# Gather all the ABC tune files in the .../XXX/new/ directory:

new: new_abc
new_abc= hdr/new_abc.hdr new/*.abc
new_abc: new_abc.abc new_abc.ps new_abc.pdf
new_abc.abc: $(new_abc)
	abcjoin +C +R0 +S new_abc $(new_abc) > new_abc.abc
new_abc.ps: new_abc.abc fmt/new_abc.fmt
	$(a2p) new_abc.abc +x +Ffmt/new_abc.fmt |\
	PShdr '%P new' 'New abc Tunes' 'new %P' |\
	PSftr 'Page %P' $(U)new/ %D >new_abc.ps
new_abc.pdf: new_abc.ps
	ps2pdf new_abc.ps new_abc.pdf

# # new tunes
# new: */*.abc new.abc new.ps new.pdf
# #	find */ -mtime -15 -name '*.abc' | xargs tonew
# 	make new.abc new.ps new.pdf
# new.abc: hdr/new.hdr new/*.abc
# 	abcjoin +R0 +S hdr/new.hdr new/*.abc > new.abc
# new.ps:  new.abc fmt/new.fmt
# 	$(a2p) new.abc +k2 +n +x +Ffmt/new \
# 	|PShdr %P "NEW TUNES" %P \
# 	|PSftr %D $U/new/ %D >new.ps
# new.pdf: new.ps;    ps2pdf new.ps new.pdf


#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#

# tune types:
types: airs hornpipes jigs marches minuets polkas reels shottishes strathspeys waltzes # xmas
 

# airs
airs: air
air: air0 air1 air2 # air3 
  
# air 0
air0: air0.abc air0.ps air0.pdf
air0.abc: air0/*.abc
	abcjoin +R +S `ls air0/*.abc` > air0.abc
air0.ps: air0.abc fmt/_55.fmt
	$(a2p) air0.abc +x +Ffmt/_55 \
	|PShdr air0 '' air0 \
	|PSftr "Page %P" $U/air0/ %D >air0.ps
air0.pdf: air0.ps
	ps2pdf air0.ps air0.pdf

# air 1
air1: air1.abc air1.ps air1.pdf
air1.abc: air1/*.abc
	abcjoin +R +S `ls air1/*.abc` > air1.abc
air1.ps: air1.abc fmt/_55.fmt
	$(a2p) air1.abc +x +Ffmt/_55 \
	|PShdr air1 '' air1 \
	|PSftr "Page %P" $U/air1/ %D >air1.ps
air1.pdf: air1.ps
	ps2pdf air1.ps air1.pdf

# air 2
air2: air2.abc air2.ps air2.pdf
air2.abc: air2/*.abc
	abcjoin +R +S `ls air2/*.abc` > air2.abc
air2.ps: air2.abc fmt/_55.fmt
	$(a2p) air2.abc +x +Ffmt/_55 \
	|PShdr air2 '' air2 \
	|PSftr "Page %P" $U/air2/ %D >air2.ps
air2.pdf: air2.ps
	ps2pdf air2.ps air2.pdf

# hornpips
hornpipes: hornpipe
hornpipe: hornpipe0 hornpipe1 hornpipe2 # hornpipe3 

# hornpipe 0
hornpipe0: hornpipe0.abc hornpipe0.ps hornpipe0.pdf
hornpipe0.abc: hornpipe0/*.abc
	abcjoin +R +S `ls hornpipe0/*.abc` > hornpipe0.abc
hornpipe0.ps: hornpipe0.abc fmt/_55.fmt
	$(a2p) hornpipe0.abc +x +Ffmt/_55 \
	|PShdr hornpipe0 '' hornpipe0 \
	|PSftr "Page %P" $U/hornpipe0/ %D >hornpipe0.ps
hornpipe0.pdf: hornpipe0.ps
	ps2pdf hornpipe0.ps hornpipe0.pdf

# hornpipe 1
hornpipe1: hornpipe1.abc hornpipe1.ps hornpipe1.pdf
hornpipe1.abc: hornpipe1/*.abc
	abcjoin +R +S `ls hornpipe1/*.abc` > hornpipe1.abc
hornpipe1.ps: hornpipe1.abc fmt/_55.fmt
	$(a2p) hornpipe1.abc +x +Ffmt/_55 \
	|PShdr hornpipe1 '' hornpipe1 \
	|PSftr "Page %P" $U/hornpipe1/ %D >hornpipe1.ps
hornpipe1.pdf: hornpipe1.ps
	ps2pdf hornpipe1.ps hornpipe1.pdf

# hornpipe 2
hornpipe2: hornpipe2.abc hornpipe2.ps hornpipe2.pdf
hornpipe2.abc: hornpipe2/*.abc
	abcjoin +R +S `ls hornpipe2/*.abc` > hornpipe2.abc
hornpipe2.ps: hornpipe2.abc fmt/_55.fmt
	$(a2p) hornpipe2.abc +x +Ffmt/_55 \
	|PShdr hornpipe2 '' hornpipe2 \
	|PSftr "Page %P" $U/hornpipe2/ %D >hornpipe2.ps
hornpipe2.pdf: hornpipe2.ps
	ps2pdf hornpipe2.ps hornpipe2.pdf

# jig
jigs: jig
jig: jig0 jig1 jig2 # jig3 jigs4

# jig 0
jig0: jig0.abc jig0.ps jig0.pdf
jig0.abc: jig0/*.abc
	abcjoin +R +S `ls jig0/*.abc` > jig0.abc
jig0.ps: jig0.abc fmt/_55.fmt
	$(a2p) jig0.abc +x +Ffmt/_55 \
	|PShdr jig0 '' jig0 \
	|PSftr "Page %P" $U/jig0/ %D >jig0.ps
jig0.pdf: jig0.ps
	ps2pdf jig0.ps jig0.pdf

# jig 1
jig1: jig1.abc jig1.ps jig1.pdf
jig1.abc: jig1/*.abc
	abcjoin +R +S `ls jig1/*.abc` > jig1.abc
jig1.ps: jig1.abc fmt/_55.fmt
	$(a2p) jig1.abc +x +Ffmt/_55 \
	|PShdr jig1 '' jig1 \
	|PSftr "Page %P" $U/jig1/ %D >jig1.ps
jig1.pdf: jig1.ps
	ps2pdf jig1.ps jig1.pdf

# jig 2
jig2: jig2.abc jig2.ps jig2.pdf
jig2.abc: jig2/*.abc
	abcjoin +R +S `ls jig2/*.abc` > jig2.abc
jig2.ps: jig2.abc fmt/_55.fmt
	$(a2p) jig2.abc +x +Ffmt/_55 \
	|PShdr jig2 '' jig2 \
	|PSftr "Page %P" $U/jig2/ %D >jig2.ps
jig2.pdf: jig2.ps
	ps2pdf jig2.ps jig2.pdf

# march:
marches: march
march: march0 march1 march2

# march 0
march0: march0.abc march0.ps march0.pdf
march0.abc: march0/*.abc
	abcjoin +R +S `ls march0/*.abc` > march0.abc
march0.ps: march0.abc fmt/_55.fmt
	$(a2p) march0.abc +x +Ffmt/_55 \
	|PShdr march0 '' march0 \
	|PSftr "Page %P" $U/march0/ %D >march0.ps
march0.pdf: march0.ps
	ps2pdf march0.ps march0.pdf

# march 1
march1: march1.abc march1.ps march1.pdf
march1.abc: march1/*.abc
	abcjoin +R +S `ls march1/*.abc` > march1.abc
march1.ps: march1.abc fmt/_55.fmt
	$(a2p) march1.abc +x +Ffmt/_55 \
	|PShdr march1 '' march1 \
	|PSftr "Page %P" $U/march1/ %D >march1.ps
march1.pdf: march1.ps
	ps2pdf march1.ps march1.pdf

# march 2
march2: march2.abc march2.ps march2.pdf
march2.abc: march2/*.abc
	abcjoin +R +S `ls march2/*.abc` > march2.abc
march2.ps: march2.abc fmt/_55.fmt
	$(a2p) march2.abc +x +Ffmt/_55 \
	|PShdr march2 '' march2 \
	|PSftr "Page %P" $U/march2/ %D >march2.ps
march2.pdf: march2.ps
	ps2pdf march2.ps march2.pdf

# minuets
minuets: minuet
minuet: minuet.pdf minuet0 minuet1 # minuet2 minuet3 
minuet: minuet.abc minuet.ps minuet.pdf
minuet.abc: minuet/*.abc
	abcjoin +R +S `ls minuet/*.abc` > minuet.abc
minuet.ps: minuet.abc fmt/_55.fmt
	$(a2p) minuet.abc +x +Ffmt/_55 \
	|PShdr minuet '' minuet \
	|PSftr "Page %P" $U/minuet/ %D >minuet.ps
minuet.pdf: minuet.ps
	ps2pdf minuet.ps minuet.pdf

# minuet 0
minuet0: minuet0.abc minuet0.ps minuet0.pdf
minuet0.abc: minuet0/*.abc
	abcjoin +R +S `ls minuet0/*.abc` > minuet0.abc
minuet0.ps: minuet0.abc fmt/_55.fmt
	$(a2p) minuet0.abc +x +Ffmt/_55 \
	|PShdr minuet0 '' minuet0 \
	|PSftr "Page %P" $U/minuet0/ %D >minuet0.ps
minuet0.pdf: minuet0.ps
	ps2pdf minuet0.ps minuet0.pdf

# minuet 1
minuet1: minuet1.abc minuet1.ps minuet1.pdf
minuet1.abc: minuet1/*.abc
	abcjoin +R +S `ls minuet1/*.abc` > minuet1.abc
minuet1.ps: minuet1.abc fmt/_55.fmt
	$(a2p) minuet1.abc +x +Ffmt/_55 \
	|PShdr minuet1 '' minuet1 \
	|PSftr "Page %P" $U/minuet1/ %D >minuet1.ps
minuet1.pdf: minuet1.ps
	ps2pdf minuet1.ps minuet1.pdf

# minuet 2
minuet2: minuet2.abc minuet2.ps minuet2.pdf
minuet2.abc: minuet2/*.abc
	abcjoin +R +S `ls minuet2/*.abc` > minuet2.abc
minuet2.ps: minuet2.abc fmt/_55.fmt
	$(a2p) minuet2.abc +x +Ffmt/_55 \
	|PShdr minuet2 '' minuet2 \
	|PSftr "Page %P" $U/minuet2/ %D >minuet2.ps
minuet2.pdf: minuet2.ps
	ps2pdf minuet2.ps minuet2.pdf

# polkas
polkas: polka
polka: polka0 polka1 polka2 # polka3 

# polka 0
polka0: polka0.abc polka0.ps polka0.pdf
polka0.abc: polka0/*.abc
	abcjoin +R +S `ls polka0/*.abc` > polka0.abc
polka0.ps: polka0.abc fmt/_55.fmt
	$(a2p) polka0.abc +x +Ffmt/_55 \
	|PShdr polka0 '' polka0 \
	|PSftr "Page %P" $U/polka0/ %D >polka0.ps
polka0.pdf: polka0.ps
	ps2pdf polka0.ps polka0.pdf

# polka 1
polka1: polka1.abc polka1.ps polka1.pdf
polka1.abc: polka1/*.abc
	abcjoin +R +S `ls polka1/*.abc` > polka1.abc
polka1.ps: polka1.abc fmt/_55.fmt
	$(a2p) polka1.abc +x +Ffmt/_55 \
	|PShdr polka1 '' polka1 \
	|PSftr "Page %P" $U/polka1/ %D >polka1.ps
polka1.pdf: polka1.ps
	ps2pdf polka1.ps polka1.pdf

# polka 2
polka2: polka2.abc polka2.ps polka2.pdf
polka2.abc: polka2/*.abc
	abcjoin +R +S `ls polka2/*.abc` > polka2.abc
polka2.ps: polka2.abc fmt/_55.fmt
	$(a2p) polka2.abc +x +Ffmt/_55 \
	|PShdr polka2 '' polka2 \
	|PSftr "Page %P" $U/polka2/ %D >polka2.ps
polka2.pdf: polka2.ps
	ps2pdf polka2.ps polka2.pdf

# reel
reels: reel
reel: reel0 reel1 reel2 reel3 

# reel 0
reel0: reel0.abc reel0.ps reel0.pdf
reel0.abc: reel0/*.abc
	abcjoin +R +S `ls reel0/*.abc` > reel0.abc
reel0.ps: reel0.abc fmt/_55.fmt
	$(a2p) reel0.abc +x +Ffmt/_55 \
	|PShdr reel0 '' reel0 \
	|PSftr "Page %P" $U/reel0/ %D >reel0.ps
reel0.pdf: reel0.ps
	ps2pdf reel0.ps reel0.pdf

# reel 1
reel1: reel1.abc reel1.ps reel1.pdf
reel1.abc: reel1/*.abc
	abcjoin +R +S `ls reel1/*.abc` > reel1.abc
reel1.ps: reel1.abc fmt/_55.fmt
	$(a2p) reel1.abc +x +Ffmt/_55 \
	|PShdr reel1 '' reel1 \
	|PSftr "Page %P" $U/reel1/ %D >reel1.ps
reel1.pdf: reel1.ps
	ps2pdf reel1.ps reel1.pdf

# reel 2
reel2: reel2.abc reel2.ps reel2.pdf
reel2.abc: reel2/*.abc
	abcjoin +R +S `ls reel2/*.abc` > reel2.abc
reel2.ps: reel2.abc fmt/_55.fmt
	$(a2p) reel2.abc +x +Ffmt/_55 \
	|PShdr reel2 '' reel2 \
	|PSftr "Page %P" $U/reel2/ %D >reel2.ps
reel2.pdf: reel2.ps
	ps2pdf reel2.ps reel2.pdf

# reel 3
reel3: reel3.abc reel3.ps reel3.pdf
reel3.abc: reel3/*.abc
	abcjoin +R +S `ls reel3/*.abc` > reel3.abc
reel3.ps: reel3.abc fmt/_55.fmt
	$(a2p) reel3.abc +x +Ffmt/_55 \
	|PShdr reel3 '' reel3 \
	|PSftr "Page %P" $U/reel3/ %D >reel3.ps
reel3.pdf: reel3.ps
	ps2pdf reel3.ps reel3.pdf

# shottishes
shottishes: shottish
shottish: shottish.pdf shottish0 shottish1 shottish2 # shottish3 

# shottish
shottish: shottish.abc shottish.ps shottish.pdf
shottish.abc: shottish/*.abc
	abcjoin +R +S `ls shottish/*.abc` > shottish.abc
shottish.ps: shottish.abc fmt/_55.fmt
	$(a2p) shottish.abc +c +x +Ffmt/_55 \
	|PShdr shottish '' shottish \
	|PSftr "Page %P" $U/shottish/ %D >shottish.ps
shottish.pdf: shottish.ps
	ps2pdf shottish.ps shottish.pdf

# shottish 0
shottish0: shottish0.abc shottish0.ps shottish0.pdf
shottish0.abc: shottish0/*.abc
	abcjoin +R +S `ls shottish0/*.abc` > shottish0.abc
shottish0.ps: shottish0.abc fmt/_55.fmt
	$(a2p) shottish0.abc +x +Ffmt/_55 \
	|PShdr shottish0 '' shottish0 \
	|PSftr "Page %P" $U/shottish0/ %D >shottish0.ps
shottish0.pdf: shottish0.ps
	ps2pdf shottish0.ps shottish0.pdf

# shottish 1
shottish1: shottish1.abc shottish1.ps shottish1.pdf
shottish1.abc: shottish1/*.abc
	abcjoin +R +S `ls shottish1/*.abc` > shottish1.abc
shottish1.ps: shottish1.abc fmt/_55.fmt
	$(a2p) shottish1.abc +x +Ffmt/_55 \
	|PShdr shottish1 '' shottish1 \
	|PSftr "Page %P" $U/shottish1/ %D >shottish1.ps
shottish1.pdf: shottish1.ps
	ps2pdf shottish1.ps shottish1.pdf

# shottish 2
shottish2: shottish2.abc shottish2.ps shottish2.pdf
shottish2.abc: shottish2/*.abc
	abcjoin +R +S `ls shottish2/*.abc` > shottish2.abc
shottish2.ps: shottish2.abc fmt/_55.fmt
	$(a2p) shottish2.abc +x +Ffmt/_55 \
	|PShdr shottish2 '' shottish2 \
	|PSftr "Page %P" $U/shottish2/ %D >shottish2.ps
shottish2.pdf: shottish2.ps
	ps2pdf shottish2.ps shottish2.pdf

# strathspeys
strathspeys: strathspey0 strathspey1 # strathspey2 strathspey3 

# strathspeys 0
strathspey0: strathspey0.abc strathspey0.ps strathspey0.pdf
strathspey0.abc: strathspey0/*.abc
	abcjoin +R +S `ls strathspey0/*.abc` > strathspey0.abc
strathspey0.ps: strathspey0.abc fmt/_55.fmt
	$(a2p) strathspey0.abc +x +Ffmt/_55 \
	|PShdr strathspey0 '' strathspey0 \
	|PSftr "Page %P" $U/strathspey0/ %D >strathspey0.ps
strathspey0.pdf: strathspey0.ps
	ps2pdf strathspey0.ps strathspey0.pdf


# strathspeys 1
strathspey1: strathspey1.abc strathspey1.ps strathspey1.pdf
strathspey1.abc: strathspey1/*.abc
	abcjoin +R +S `ls strathspey1/*.abc` > strathspey1.abc
strathspey1.ps: strathspey1.abc fmt/_55.fmt
	$(a2p) strathspey1.abc +x +Ffmt/_55 \
	|PShdr strathspey1 '' strathspey1 \
	|PSftr "Page %P" $U/strathspey1/ %D >strathspey1.ps
strathspey1.pdf: strathspey1.ps
	ps2pdf strathspey1.ps strathspey1.pdf


# strathspeys 2
strathspey2: strathspey2.abc strathspey2.ps strathspey2.pdf
strathspey2.abc: strathspey2/*.abc
	abcjoin +R +S `ls strathspey2/*.abc` > strathspey2.abc
strathspey2.ps: strathspey2.abc fmt/_55.fmt
	$(a2p) strathspey2.abc +x +Ffmt/_55 \
	|PShdr strathspey2 '' strathspey2 \
	|PSftr "Page %P" $U/strathspey2/ %D >strathspey2.ps
strathspey2.pdf: strathspey2.ps
	ps2pdf strathspey2.ps strathspey2.pdf

# waltzes:
waltzes: waltz
waltz: waltz0 waltz1 waltz2 waltz3

# waltz 0
waltz0: waltz0.abc waltz0.ps waltz0.pdf
waltz0.abc: waltz0/*.abc
	abcjoin +R +S `ls waltz0/*.abc` > waltz0.abc
waltz0.ps: waltz0.abc fmt/_55.fmt
	$(a2p) waltz0.abc +x +Ffmt/_55 \
	|PShdr waltz0 '' waltz0 \
	|PSftr "Page %P" $U/waltz0/ %D >waltz0.ps
waltz0.pdf: waltz0.ps
	ps2pdf waltz0.ps waltz0.pdf

# waltz 1
waltz1: waltz1.abc waltz1.ps waltz1.pdf
waltz1.abc: waltz1/*.abc
	abcjoin +R +S `ls waltz1/*.abc` > waltz1.abc
waltz1.ps: waltz1.abc fmt/_55.fmt
	$(a2p) waltz1.abc +x +Ffmt/_55 \
	|PShdr waltz1 '' waltz1 \
	|PSftr "Page %P" $U/waltz1/ %D >waltz1.ps
waltz1.pdf: waltz1.ps
	ps2pdf waltz1.ps waltz1.pdf

# waltz 2
waltz2: waltz2.abc waltz2.ps waltz2.pdf
waltz2.abc: waltz2/*.abc
	abcjoin +R +S `ls waltz2/*.abc` > waltz2.abc
waltz2.ps: waltz2.abc fmt/_55.fmt
	$(a2p) waltz2.abc +x +Ffmt/_55 \
	|PShdr waltz2 '' waltz2 \
	|PSftr "Page %P" $U/waltz2/ %D >waltz2.ps
waltz2.pdf: waltz2.ps
	ps2pdf waltz2.ps waltz2.pdf

# waltz 3
waltz3: waltz3.abc waltz3.ps waltz3.pdf
waltz3.abc: waltz3/*.abc
	abcjoin +R +S `ls waltz3/*.abc` > waltz3.abc
waltz3.ps: waltz3.abc fmt/_55.fmt
	$(a2p) waltz3.abc +x +Ffmt/_55 \
	|PShdr waltz3 '' waltz3 \
	|PSftr "Page %P" $U/waltz3/ %D >waltz3.ps
waltz3.pdf: waltz3.ps
	ps2pdf waltz3.ps waltz3.pdf

## xmas
#xmas: xmas.abc xmas.ps xmas.pdf
#xmas.abc: xmas/*.abc
#	abcjoin +R +S `ls xmas/*.abc` > xmas.abc
#xmas.ps: xmas.abc fmt/_55.fmt
#	$(a2p) xmas.abc +x +Ffmt/_55 \
#	|PShdr xmas '' xmas \
#	|PSftr "Page %P" $U/xmas/ %D >xmas.ps
#xmas.pdf: xmas.ps
#	ps2pdf xmas.ps xmas.pdf
#
