# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - #
U=http://trillian.mit.edu/~jc/music/abc/Turkey/
a2p=jcabc2ps

.SUFFIXES:

# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - #
# Note that the "clobber" entry deletes the abc files in this directory. They #
# are  all medleys, derived from single-tune files in subdirectories, so this #
# shouldn't actually lose any music.  But this means that any abc files  here #
# must either be derived files or must be linked somewhere else.              #
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - #

all: SehnazLonga
#	tunes
#	books

# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - #
# MEDLEYS, using jc's abcmedley program.

medleys: 

# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - #
# Here are our cleanup entries. The "clobber" entry deletes all the lowercase
# abc  files, but not those whose names start with an uppercase letter.  This
# will leave all our dance medleys in place, while deleting the "books".

neat: ; rm -f *- core *.out Out.ps
clean: neat; rm -f *.log *.pdf *.ps new.* 
	find new/ -name '*.abc' -mtime +30 -exec ls -l {} ';' -exec rm {} ';'
clobber: clean; rm -f [a-z]??*.abc new/*.abc

# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - #
# Here's how we package it up for distribution:

D=`dt`
tarkit: ../Turkey-$D.tar.gz
../Turkey-$D.tar.gz: ../Turkey-$D.tar
	gzip ../Turkey-$D.tar
../Turkey-$D.tar: Makefile * */*.abc
	make clean
	tar cf ../Turkey-$D.tar .

# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - #
# Entries to create special files if they are clobbered:

fonts.fmt: ../fmt/fonts.fmt; ln -f ../fmt/fonts.fmt fonts.fmt
_65.fmt:   ../fmt/_65.fmt;   ln -f ../fmt/_65.fmt   _65.fmt
_70.fmt:   ../fmt/_70.fmt;   ln -f ../fmt/_70.fmt   _70.fmt
_75.fmt:   ../fmt/_75.fmt;   ln -f ../fmt/_75.fmt   _75.fmt
_80.fmt:   ../fmt/_80.fmt;   ln -f ../fmt/_80.fmt   _80.fmt

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

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

# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - #
# xxx doesn't look good with full page width. American "standard" 8.5x11
# paper has a "width" of 541 points. The following produces a close to
# centered version with an extra inch of margin.

xxx.ps: xxx.abc
	$(a2p) -m 100 -w 400 xxx.abc |PShdr "" "" "" |PSftr %D $U %D >xxx.ps

# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - #
# Here is a prototype for making medley pages in various ways:

# jj
jj= _.abc
jj: jj.abc jj.ps jj.pdf
jj.abc: $(jj) # hdr/jj.hdr
	abcjoin +s $(jj) >jj.abc
jj.ps: jj.abc fmt/_75.fmt
	$(a2p) +c jj.abc +Ffmt/_75 \
	|PShdr jj "" jj \
	|PSftr %D $U %D >jj.ps
jj.pdf: jj.ps
	ps2pdf jj.ps jj.ps

# mm0
mm: mm0

# mm0
mm0= x10.abc
mm0: mm0.abc mm0.ps mm0.pdf
mm0.abc: hdr/mm.hdr $(mm0)
	abcmedley mm $(mm0) >mm0.abc
mm0.ps: mm0.abc fmt/_75.fmt
	$(a2p) mm0.abc +Ffmt/_75 |PShdr mm "" mm |PSftr %D $U %D >mm0.ps
mm0.pdf: mm0.ps
	ps2pdf mm0.ps mm0.pdf

# xx
xx= x8.abc
xx: xx.abc xx.ps xx.pdf
xx.abc: hdr/xx.hdr $(xx)
	abcmedley xx $(xx) >xx.abc
xx.ps: xx.abc fmt/_75.fmt
	$(a2p) xx.abc +Ffmt/_75 |PShdr xx "" xx |PSftr %D $U %D >xx.ps
xx.pdf: xx.ps
	ps2pdf xx.ps xx.pdf

# yy
yy= x8.abc
yy: yy.abc yy.ps yy.pdf
yy.abc: hdr/yy.hdr $(yy)
	abcmedley yy $(yy) >yy.abc
yy.ps: yy.abc fmt/_75.fmt
	$(a2p) yy.abc +Ffmt/_75 |PShdr "" "" "" |PSftr %D $U %D >yy.ps
yy.pdf: yy.ps
	ps2pdf yy.ps yy.pdf

# Multiple versions:

# zz
zz: zz0
# zz 0
zz0= x8.abc
zz0: zz0.abc zz0.ps zz0.pdf
zz0.abc: hdr/zz.hdr $(zz0)
	abcmedley "zz" $(zz0) >zz0.abc
zz0.ps: zz0.abc fmt/_75.fmt
	$(a2p) zz0.abc +Ffmt/_75 |PShdr "" "" "" |PSftr %D $U %D >zz0.ps
zz0.pdf: zz0.ps
	ps2pdf zz0.ps zz0.pdf

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

SehnazLonga: SehnazLongaD SehnazLongaG

# Sehnaz Longa G
SehnazLongaG= tune/SehnazLonga_EE_G.abc
SehnazLongaG: SehnazLongaG.abc SehnazLongaG.ps SehnazLongaG.pdf
SehnazLongaG.abc: $(SehnazLongaG) # hdr/SehnazLongaG.hdr
	abcjoin +s $(SehnazLongaG) >SehnazLongaG.abc
SehnazLongaG.ps: SehnazLongaG.abc fmt/_75.fmt
	$(a2p) SehnazLongaG.abc +Ffmt/_75 \
	|PShdr SehnazLongaG "" SehnazLongaG \
	|PSftr %G $U %G >SehnazLongaG.ps
SehnazLongaG.pdf: SehnazLongaG.ps
	ps2pdf SehnazLongaG.ps SehnazLongaG.pdf

# Sehnaz Longa D
SehnazLongaD= tune/SehnazLonga_EE_D.abc
SehnazLongaD: SehnazLongaD.abc SehnazLongaD.ps SehnazLongaD.pdf
SehnazLongaD.abc: $(SehnazLongaD) # hdr/SehnazLongaD.hdr
	abcjoin +s $(SehnazLongaD) >SehnazLongaD.abc
SehnazLongaD.ps: SehnazLongaD.abc fmt/_75.fmt
	$(a2p) SehnazLongaD.abc +Ffmt/_75 \
	|PShdr SehnazLongaD "" SehnazLongaD \
	|PSftr %D $U %D >SehnazLongaD.ps
SehnazLongaD.pdf: SehnazLongaD.ps
	ps2pdf SehnazLongaD.ps SehnazLongaD.pdf

