# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - #
# This is the makefile for the MCD (Milford Contra Dance) collection.         #
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - #
a2p=jcabc2ps
RM=/bin/rm

all: sets 

sets: R-011 R-011

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

TOC: TOC.txt	# TOC.ps
TOC.ps: TOC.txt; mpage -1 -m40l35r50t -p -h"Milford Contra Dance Tunes" <TOC.txt >TOC.ps
TOC.txt: [A-Z]*.abc; abctoc [A-Z]*.abc >TOC.txt

# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - #
# The dance (repertoire) list is the plain-text file, dances.txt,  which  has
# one dance name per line, plus possibly other info. Here we use the htmlcols
# script to columnize it by converting it to a list of HTML tables, and  wrap
# it  in  a  header  and  footer to get a web page.  (Too bad the <embed> and
# <object> tags screw the job up so badly.  ;-)

#dancelist: dances.html # dances2.html 
#
#dances.html: danceTable.hdr danceTable.html danceTable.ftr
#	cat danceTable.hdr danceTable.html danceTable.ftr > dances.html
#danceTable.html: dances.txt
#	htmlcols +H44 +w44 dances.txt > danceTable.html

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

neat:
	$(RM) -f *- *.old
clean: neat
	$(RM) -f airs.p* hornpipes.p* slipjigs.p* jigs.p* mixed.p* marches.p* \
		polkas.p* songs.p* reels.p* shottishes.p* waltzes.p*
clobber: clean
	$(RM) -f *.abc

# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - #
airs: airs.abc airs.ps airs.pdf
airs.abc: air/*.abc
	abcjoin +R +S air/*.abc >airs.abc
airs.ps: airs.abc
	jcabc2ps +Ffmt/_65.fmt airs.abc %D >airs.ps
airs.pdf: airs.ps
	ps2pdf airs.ps airs.pdf

hornpipes: hornpipes.abc hornpipes.ps hornpipes.pdf
hornpipes.abc: hornpipe/*.abc
	abcjoin +R +S hornpipe/*.abc >hornpipes.abc
hornpipes.ps: hornpipes.abc
	$(a2p) hornpipes.abc +x +Ffmt/_65.fmt \
	|PSftr "Page %P" $U/ %D >hornpipes.ps
hornpipes.pdf: hornpipes.ps
	ps2pdf hornpipes.ps hornpipes.pdf

jigs: jigs.abc jigs.ps jigs.pdf
jigs.abc: jig/*.abc
	abcjoin +R +S jig/*.abc >jigs.abc
jigs.ps: jigs.abc
	$(a2p) jigs.abc +x +Ffmt/_65.fmt \
	|PSftr "Page %P" $U/ %D >jigs.ps
jigs.pdf: jigs.ps
	ps2pdf jigs.ps jigs.pdf

marches: marches.abc marches.ps marches.pdf
marches.abc: march/*.abc
	abcjoin +R +S march/*.abc >marches.abc
marches.ps: marches.abc
	$(a2p) marches.abc +x +Ffmt/_65.fmt \
	|PSftr "Page %P" $U/ %D >marches.ps
marches.pdf: marches.ps
	ps2pdf marches.ps marches.pdf

polkas: polkas.abc polkas.ps polkas.pdf
polkas.abc: polka/*.abc
	abcjoin +R +S polka/*.abc >polkas.abc
polkas.ps: polkas.abc
	$(a2p) polkas.abc +x +Ffmt/_65.fmt \
	|PSftr "Page %P" $U/ %D >polkas.ps
polkas.pdf: polkas.ps
	ps2pdf polkas.ps polkas.pdf

reels: reels.abc reels.ps reels.pdf
reels.abc: reel/*.abc
	abcjoin +R +S reel/*.abc >reels.abc
reels.ps: reels.abc
	$(a2p) reels.abc +x +Ffmt/_65.fmt \
	|PSftr "Page %P" $U/ %D >reels.ps
reels.pdf: reels.ps
	ps2pdf reels.ps reels.pdf

shottishes: shottishes.abc shottishes.ps shottishes.pdf
shottishes.abc: shottish/*.abc
	abcjoin +R +S shottish/*.abc >shottishes.abc
shottishes.ps: shottishes.abc
	$(a2p) shottishes.abc +x +Ffmt/_65.fmt \
	|PSftr "Page %P" $U/ %D >shottishes.ps
shottishes.pdf: shottishes.ps
	ps2pdf shottishes.ps shottishes.pdf

slipjigs: slipjigs.abc slipjigs.ps slipjigs.pdf
slipjigs.abc: slipjig/*.abc
	abcjoin +R +S slipjig/*.abc >slipjigs.abc
slipjigs.ps: slipjigs.abc
	$(a2p) slipjigs.abc +x +Ffmt/_65.fmt \
	|PSftr "Page %P" $U/ %D >slipjigs.ps
slipjigs.pdf: slipjigs.ps
	ps2pdf slipjigs.ps slipjigs.pdf

waltzes: waltzes.abc waltzes.ps waltzes.pdf
waltzes.abc: waltz/*.abc
	abcjoin +R +S waltz/*.abc >waltzes.abc
waltzes.ps: waltzes.abc
	$(a2p) waltzes.abc +x +Ffmt/_65.fmt \
	|PSftr "Page %P" $U/ %D >waltzes.ps
waltzes.pdf: waltzes.ps
	ps2pdf waltzes.ps waltzes.pdf

# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - #
# Here is a prototype for making medley pages:

# jj
jj= _.abc
jj: jj.abc jj.ps jj.pdf
jj.abc: hdr/jj.hdr $(jj) ftr/jj.ftr
	abcjoin +s $(jj) >jj.abc
jj.ps: jj.abc fmt/_70.fmt
	$(a2p) +Ffmt/_70.fmt jj.abc >jj.ps
jj.pdf: jj.ps
	ps2pdf jj.ps jj.pdf

# lnk - links from ../../Intl directory
lnk: type/lnk-info.abc
type/lnk-info.abc: ../../Intl/lnk.abc
	ln ../../Intl/lnk.abc type/lnk-info.abc

# bld - builds from local single-tune files
bld= \
	bld/bld-key1-shape.abc \
	bld/bld-key2-shape.abc \
	ftr/bld.ftr
bld: hdr/bld.hdr type/bld-keys-shape.abc ftr/bld.ftr
type/bld-keys-shape.abc: $(bld)
	abcmedley bld $(bld) >type/bld-keys-shape.abc

# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - #
# Medleys that we make locally to match the "book" pages:

R:	J-001 J-002 J-003 \
	R-001 R-011 R-002

# J-001
J-001= hdr/J-001.hdr \
	jig/Blackthorn_Stick-G-32-2.abc \
	jig/Steamboat_Quickstep-A-32-2.abc
J-001: set/J-001.abc
set/J-001.abc: $(J-001)
	abcjoin +C +R0 $(J-001) >set/J-001.abc

# J-002
J-002= hdr/J-002.hdr \
	jig/Pipe_on_the_Hob-D-32-5.abc \
	jig/Calliope_House-E-32-3.abc
J-002: set/J-002.abc
set/J-002.abc: $(J-002)
	abcjoin +C +R0 $(J-002) >set/J-002.abc

# J-003
J-003= hdr/J-003.hdr \
	jig/Rose_in_the_Heather-D-31-2.abc \
	jig/Swallowtail_Jig-Em-32-2.abc
J-003: set/J-003.abc
set/J-003.abc: $(J-003)
	abcjoin +C +R0 $(J-003) >set/J-003.abc

# R-001
R-001= hdr/R-001.hdr \
	reel/Over_the_Waterfall-D-32-2.abc \
	reel/Saint_Annes_Reel_1-D-32-2.abc \
	reel/Old_French_Reel-D-32-2.abc
R-001: set/R-001.abc
set/R-001.abc: $(R-001)
	abcjoin +s $(R-001) >set/R-001.abc

# R-002
R-002= hdr/R-002.hdr \
	reel/Saint_Annes_Reel_1-D-32-2.abc \
	reel/Montreal-GD-32-2.abc \
	reel/Joys_of_Quebec-A-32-3.abc
R-002: set/R-002.abc
set/R-002.abc: $(R-002)
	abcjoin +s $(R-002) >set/R-002.abc

# R-011
R-011= hdr/R-011.hdr \
	reel/Ross_Reel_No4_F-32-4.abc \
	reel/Batchelders_Reel-F-32-4.abc \
	reel/Mountain_Ranger-Bb-32-4.abc
R-011: set/R-011.abc
set/R-011.abc: $(R-011)
	abcjoin +s $(R-011) >set/R-011.abc

## R001 using abcmedley
#R001= reel/Tune_Name.abc
#R001: set/R001.abc
#set/R001.abc: hdr/R001.hdr $(R001)
#	abcmedley 'R-001' $(R001) >set/R001.abc

