# = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = #
# Makefile for the Caledonian Musical Repository 1806 collection(s). #
# = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = #
U=http://trillian.mit.edu/~jc/music/book/CaledonianMusicalRepository/1806

# = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = #
# The tune files have names of the form Dance_Title.abc, with  '_'  used  for #
# spaces,  and  initial  articles omitted.  The title may name the dance, the #
# tune, or both.  A number is added when there  are  duplicates  that  aren't #
# nearly identical.  The 0* files have "title page" info from the books.      #
# = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = #

all: \
1806.abc 1806.ps 1806.pdf
1806= [0-9][0-9][0-9][0-9]_*.abc [A-Z]*.abc
1806.abc: $(1806)
	abcjoin +S2 `ls $(1806) | sort -f` >1806.abc
1806.ps: 1806.abc fmt/1806.fmt
	abcm2ps -c -j 0 -F fmt/1806 1806.abc -O tmp.ps
	PShdr <tmp.ps %P '+Caledonian Musical Repository (1806)' %P |PSftr %D $U/ %P >1806.ps
	rm tmp.ps
1806.pdf: 1806.ps
	ps2pdf 1806.ps 1806.pdf

neat:         ; /bin/rm -f *-
clean:   neat ; /bin/rm -f *.ps *.pdf
clobber: clean; /bin/rm -f 1806.*

# = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = #
# We may change the name of the full collection to be more descriptive. Right #
# now, we just use our directory name, to keep our file next to our directory #
# in the parent directory.                                                    #
# = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = #

install: ../1806.abc ../../CaledonianMusicalRepository_1806.abc
../1806.abc: 1806.abc
	/bin/ln -f 1806.abc ../1806.abc
../../CaledonianMusicalRepository_1806.abc: 1806.abc
	/bin/ln -f 1806.abc ../../CaledonianMusicalRepository_1806.abc

# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - #
# The .htaccess file explains to the apache web server what's in  the  files.
# We  fill  in  descriptions of the abc files from the first T: line, so that
# the dance names appear in HTML listings of the  directory.

.htaccess: [A-Z]*.abc
	abcDesc [A-Z]*.abc

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

# 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/alltunes.fmt
	$(a2p) jj.abc +Ffmt/alltunes \
	|PShdr jj 'Caledonian Musical Repository' jj \
	|PSftr %D $U/ %D >jj.ps
jj.pdf: jj.ps
	ps2pdf jj.ps jj.pdf

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


# test: Twine Weel
test_TwineWeel= Twine_Weel_the_Plaiden.abc
test_TwineWeel: test_TwineWeel.abc test_TwineWeel.ps test_TwineWeel.pdf
test_TwineWeel.abc: $(test_TwineWeel) # hdr/test_TwineWeel.hdr
	abcjoin +s $(test_TwineWeel) >test_TwineWeel.abc
test_TwineWeel.ps: test_TwineWeel.abc fmt/1806.fmt
	abcm2ps -c -j 0 -F fmt/1806 test_TwineWeel.abc -O test_TwineWeel.ps 
test_TwineWeel.pdf: test_TwineWeel.ps
	ps2pdf test_TwineWeel.ps test_TwineWeel.pdf
