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

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

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

# = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = #
# 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: ../1811.abc ../../CaledonianMusicalRepository_1811.abc
../1811.abc: 1811.abc
	/bin/ln -f 1811.abc ../1811.abc
../../CaledonianMusicalRepository_1811.abc: 1811.abc
	/bin/ln -f 1811.abc ../../CaledonianMusicalRepository_1811.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

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


# Tullochgorum
Tullochgorum= Tullochgorum.abc
Tullochgorum: Tullochgorum.abc Tullochgorum.ps Tullochgorum.pdf
#Tullochgorum.abc: $(Tullochgorum) # hdr/Tullochgorum.hdr
#	abcjoin +s $(Tullochgorum) >Tullochgorum.abc
Tullochgorum.ps: Tullochgorum.abc fmt/1811.fmt
	abcm2ps -c -j 1 -F fmt/1811 Tullochgorum.abc -O tmp.ps
	PShdr <tmp.ps Tullochgorum 'Caledonian Musical Repository' Tullochgorum \
	|PSftr %D $U/ %D >Tullochgorum.ps
Tullochgorum.pdf: Tullochgorum.ps
	ps2pdf Tullochgorum.ps Tullochgorum.pdf
