# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - #
a2p=jcabc2ps

b= barn
f= folk
G= ganglat
H= hambo
P= pols
S= shottish
t= tango
v= waltz
p= polka
s= snoa
x= xmas

U=http://trillian.mit.edu/~jc/music/abc/Sweden

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

.SUFFIXES:
.SUFFIXES: .ABC .abc .ps
#abc.ps:  $*.abc fmt/_70.fmt fmt/_70.fmt; $(a2p) +Ffmt/_70 -n $*.abc > $*.ps
#abc.eps: $*.abc fmt/_70.fmt fmt/_70.fmt; $(a2p) -E +Ffmt/_70 -n $*.abc > $*.eps

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

all: dancebook special pages singles workshops

dancebook: Carousel \
	Busserull FeiarMedVals Hambo Hamburska Hopsa1 Hopsa2 \
	Masurka Misc Polka Pols \
	Sekstur Shottish Snoa Sonderhoning Springleik1 \
	Stabberinglander Tango Vals 

pages: 

special: _1.abc _2.abc _3.abc fmt/fonts.fmt

xmas: \
	SantaLucia XmasNorsk1 \
	XmasDansk1 XmasDansk2 XmasSvensk1 \

# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - #
# 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.   This  actually
# propagates to subdirectories, so we only to do it here.

.htaccess: *.abc
	abcDesc *.abc

# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - #
# Printouts for special events:

program: 

# 2014____ 2014-__-__ __:__ pm
# Dance leader:
# Musicians:
#
2014____=
2014____: program/2014____/2014_____program $(2014____)
	mkprog 2014____ $(2014____)
P2014____: 2014____
	mkprog -p 2014____ $(2014____)
2014____/2014_____program:
	-mkdir 2014____
program/2014____/2014_____program: program/2014____ 2014_____program
	ln -f 2014_____program program/2014____/2014_____program
program/2014____:
	mkdir -p program/2014____

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

# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - #
# Experimentall entry to make "incipit" pages:

# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - #
# The rest of this makefile deals with making pages of music. They are mostly
# medleys for a specific sort of dance.

# Convert file name to .. entry:
# :s'^ *\(.*\) *$'\1: ../\1; ln -f ../\1 \1'

# Some vi commands to invoke PShdr:
# :s' -O \([A-Za-z][a-z]*\)\(.*\.ps\)'	PShdr "\1" "" "\1" >\1\2'
# :s' -O \([A-Za-z0-9][A-Za-z0-9_]*\)\.ps'	PShdr "\1" "" "\1" >\1.ps'
