# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - #
# This is the makefile for the Scandinavian Jam tune  collection.   Most  of  the #
# set/medley/standpiece  multi-tune  sets  are  built in this directory, with the #
# single-tune files and other constituents are in the directories with lower-case #
# names.                                                                          #
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - #
a2p=jcabc2ps
RM=/bin/rm
U=http://john-chambers.us/~jc/music/session/SAFD

all: Laat_till_Kim

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

neat:
	$(RM) -f *- *.old *.out
clean: neat
	$(RM) -f *.ps *.pdf */*.ps */*.pdf
clobber: clean
	$(RM) -f *.abc

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

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 \
	|PSftr "Page %P" $U/ %D >jigs.ps
jigs.pdf: jigs.ps
	ps2pdf jigs.ps jigs.pdf

lesnota: lesnota.abc lesnota.ps lesnota.pdf
lesnota.abc: lesnoto/*.abc
	abcjoin +R +S lesnoto/*.abc >lesnota.abc
lesnota.ps: lesnota.abc
	$(a2p) lesnota.abc +x +Ffmt/_65 \
	|PSftr "Page %P" $U/ %D >lesnota.ps
lesnota.pdf: lesnota.ps
	ps2pdf lesnota.ps lesnota.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 \
	|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 \
	|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 \
	|PSftr "Page %P" $U/ %D >reels.ps
reels.pdf: reels.ps
	ps2pdf reels.ps reels.pdf

songs: songs.abc songs.ps songs.pdf
songs.abc: song/*.abc
	abcjoin +R +S song/*.abc >songs.abc
songs.ps: songs.abc
	$(a2p) songs.abc +x +Ffmt/_65 \
	|PSftr "Page %P" $U/ %D >songs.ps
songs.pdf: songs.ps
	ps2pdf songs.ps songs.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 \
	|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) jj.abc +Ffmt/_70 \
	|PShdr jj '' jj \
	|PSftr %D $U/ %D >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:

# _name medley
_name_medley= hdr/_name_medley.hdr \
	ftr/_name_medley.ftr
_name_medley: _name_medley.abc _name_medley.pdf
_name_medley.abc: $(_name_medley)
	abcjoin +C +R0 $(_name_medley) >_name_medley.abc
_name_medley.ps: _name_medley.abc fmt/_70.fmt
	$(a2p) +k 2  _name_medley.abc +Ffmt/_70.fmt \
	|PShdr '__' '__' '__' ______ \
	|PSftr %D $U/ %D >_name_medley.ps
_name_medley.pdf: _name_medley.ps
	ps2pdf _name_medley.ps _name_medley.pdf

# Set - Name
Set_Name= hdr/Set_Name.hdr \
	ftr/Set_Name.ftr
Set_Name: Set_Name.abc Set_Name.pdf
Set_Name.abc: $(Set_Name)
	abcjoin +CR $(Set_Name) >Set_Name.abc
Set_Name.ps: Set_Name.abc fmt/_70.fmt
	$(a2p) +k 2  Set_Name.abc +Ffmt/_70.fmt \
	|PSftr %D $U/ %D >Set_Name.ps
Set_Name.pdf: Set_Name.ps
	ps2pdf Set_Name.ps Set_Name.pdf
hdr/Set_Name.hdr: ;echo "%%center Set - Name" >hdr/Set_Name.hdr
ftr/Set_Name.ftr: ;ln ftr/_.ftr ftr/Set_Name.ftr

# Laat till Kim av Torbjorn Nasbom (Em,Am,Dm,Gm)
Laat_till_Kim: Laat_till_Kim-Em,Am,Dm,Gm-32-16
Laat_till_Kim-Em,Am,Dm,Gm-32-16= hdr/Laat_till_Kim-Em,Am,Dm,Gm-32-16.hdr \
	waltz/Laat_till_Kim_av_Torbjorn_Nasbom-Em-32-4.abc \
	waltz/Laat_till_Kim_av_Torbjorn_Nasbom-Am-32-4.abc \
	waltz/Laat_till_Kim_av_Torbjorn_Nasbom-Dm-32-4.abc \
	waltz/Laat_till_Kim_av_Torbjorn_Nasbom-Gm-32-4.abc \
	ftr/Laat_till_Kim-Em,Am,Dm,Gm-32-16.ftr
Laat_till_Kim-Em,Am,Dm,Gm-32-16: Laat_till_Kim-Em,Am,Dm,Gm-32-16.abc Laat_till_Kim-Em,Am,Dm,Gm-32-16.pdf
Laat_till_Kim-Em,Am,Dm,Gm-32-16.abc: $(Laat_till_Kim-Em,Am,Dm,Gm-32-16)
	abcjoin +CR $(Laat_till_Kim-Em,Am,Dm,Gm-32-16) >Laat_till_Kim-Em,Am,Dm,Gm-32-16.abc
Laat_till_Kim-Em,Am,Dm,Gm-32-16.ps: Laat_till_Kim-Em,Am,Dm,Gm-32-16.abc fmt/_75.fmt
	$(a2p) +k 2  Laat_till_Kim-Em,Am,Dm,Gm-32-16.abc +Ffmt/_75.fmt \
	|PSftr %D $U/ %D >Laat_till_Kim-Em,Am,Dm,Gm-32-16.ps
Laat_till_Kim-Em,Am,Dm,Gm-32-16.pdf: Laat_till_Kim-Em,Am,Dm,Gm-32-16.ps
	ps2pdf Laat_till_Kim-Em,Am,Dm,Gm-32-16.ps Laat_till_Kim-Em,Am,Dm,Gm-32-16.pdf
hdr/Laat_till_Kim-Em,Am,Dm,Gm-32-16.hdr: ;echo "%%center L\\aat till Kim-Em,Am,Dm,Gm-32-16" >hdr/Laat_till_Kim-Em,Am,Dm,Gm-32-16.hdr
ftr/Laat_till_Kim-Em,Am,Dm,Gm-32-16.ftr: ; touch ftr/Laat_till_Kim-Em,Am,Dm,Gm-32-16.ftr
