# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - #
# This is the Makefile for John Chambers .../China/ ABC collection. In this
# directory, we build the PostScript files in the ps subdirectory.  These may
# be made directly from the source .abc files in other directories, or  those
# may  be  combined into .abc files that are created here.  Any .abc files in
# this directory are probably created, and may be deleted.
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - #
U=http://trillian.mit.edu/~jc/music/abc/China/
a2p=jcabc2ps
P= \
	BuBuGao GreenIslandSerenade Little_Swallow Ruguo SilentNight_PingAnYe \
	TwoFountainsReflectTheMoonlight YueliangDaibiaoWodeXin 

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

.SUFFIXES:
.SUFFIXES: .abc .ps
.abc.ps: $*.abc; $(a2p) $*.abc +F_75 >$*.ps

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

all:  $P

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

neat:         ; -/bin/rm -f *-
clean:    neat; -/bin/rm -f *.out new.* *.ps *.pdf
clobber: clean; -/bin/rm -f core *.abc

# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - #
# Prototypes for building pages from single-tune files:

# jj
jj= _1.abc _2.abc _3.abc
jj: jj.ps jj.pdf
jj.abc: $(jj)
	abcjoin +s $(jj) >jj.abc
jj.ps: jj.abc fmt/_70.fmt
	$(a2p) +Ffmt/_70 jj.abc \
	| PShdr jj "" jj \
	| PSftr %D $U/ %D >jj.ps
jj.pdf: jj.ps
	ps2pdf jj.ps jj.pdf

xx= __/xx_1.abc __/xx_1.abc
xx: xx.abc xx.ps xx.pdf
xx.abc: hdr/xxx.hdr $(xx)
	abcmedley xx $(xx) >xx.abc
xx.ps: xx.abc _75.fmt
	$(a2p) xx.abc +F_75 >xx.ps
xx.pdf: xx.ps
	ps2pdf xx.ps xx.pdf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u4Gao1v2.pdf: Bu4Bu4Gao1v2.ps
	ps2pdf Bu4Bu4Gao1v2.ps Bu4Bu4Gao1v2.pdf

# Green Island Serenade
GIS: \
	GIS_3T_D GIS_3T_D.utf8 GIS_4T_D.utf8 GIS_4T_D_W.utf8 GIS_5T_D_W.utf8 \
	GIS_5T_D_WCE.utf8 GIS_6T_D_W.utf8 GIS_6T_D_WCE.utf8

# Green Island Serenade
GreenIslandSerenade= GreenIslandSerenade_G.abc GreenIslandSerenade_D.abc GreenIslandSerenade_C.abc
GreenIslandSerenade: GreenIslandSerenade.ps GreenIslandSerenade.pdf
GreenIslandSerenade.abc: hdr/GreenIslandSerenade.hdr $(GreenIslandSerenade)
	abcmedley GreenIslandSerenade $(GreenIslandSerenade) >GreenIslandSerenade.abc
GreenIslandSerenade.ps: GreenIslandSerenade.abc _70.fmt
	$(a2p) GreenIslandSerenade.abc +F_70 >GreenIslandSerenade.ps
GreenIslandSerenade.pdf: GreenIslandSerenade.ps
	ps2pdf GreenIslandSerenade.ps GreenIslandSerenade.pdf

# Green Island Serenade, UTF-8 charset named
#GIS_6T_D_WCE.utf8= GIS_6T_D_WCE.utf8_G.abc GIS_6T_D_WCE.utf8_D_W.abc GIS_6T_D_WCE.utf8_C.abc
#GIS_6T_D_WCE.utf8: GIS_6T_D_WCE.utf8.ps GIS_6T_D_WCE.utf8.pdf
#GIS_6T_D_WCE.utf8.ps: GIS_6T_D_WCE.utf8.abc _70.fmt
#	$(a2p) GIS_6T_D_WCE.utf8.abc +F_70 >GIS_6T_D_WCE.utf8.ps
#GIS_6T_D_WCE.utf8.pdf: GIS_6T_D_WCE.utf8.ps
#	ps2pdf GIS_6T_D_WCE.utf8.ps GIS_6T_D_WCE.utf8.pdf

GIS_3T_D_WCE= GIS_3T_D_WCE_G.abc GIS_3T_D_WCE_D_W.abc GIS_3T_D_WCE_C.abc
GIS_3T_D_WCE: GIS_3T_D_WCE.ps GIS_3T_D_WCE.pdf
GIS_3T_D_WCE.ps: GIS_3T_D_WCE.abc _70.fmt
	$(a2p) GIS_3T_D_WCE.abc +F_70 >GIS_3T_D_WCE.ps
GIS_3T_D_WCE.pdf: GIS_3T_D_WCE.ps
	ps2pdf GIS_3T_D_WCE.ps GIS_3T_D_WCE.pdf

# Green Island Serenade, UTF-8 charset named
GIS_3T_D.utf8= GIS_3T_D.utf8_G.abc GIS_3T_D.utf8_D.abc GIS_3T_D.utf8_C.abc
GIS_3T_D.utf8: GIS_3T_D.utf8.ps GIS_3T_D.utf8.pdf
GIS_3T_D.utf8.ps: GIS_3T_D.utf8.abc _70.fmt
	$(a2p) GIS_3T_D.utf8.abc +F_70 >GIS_3T_D.utf8.ps
GIS_3T_D.utf8.pdf: GIS_3T_D.utf8.ps
	ps2pdf GIS_3T_D.utf8.ps GIS_3T_D.utf8.pdf

# Green Island Serenade, UTF-8 charset named
GIS_4T_D.utf8= GIS_4T_D.utf8_G.abc GIS_4T_D.utf8_D.abc GIS_4T_D.utf8_C.abc
GIS_4T_D.utf8: GIS_4T_D.utf8.ps GIS_4T_D.utf8.pdf
GIS_4T_D.utf8.ps: GIS_4T_D.utf8.abc _70.fmt
	$(a2p) GIS_4T_D.utf8.abc +F_70 >GIS_4T_D.utf8.ps
GIS_4T_D.utf8.pdf: GIS_4T_D.utf8.ps
	ps2pdf GIS_4T_D.utf8.ps GIS_4T_D.utf8.pdf

# Green Island Serenade, UTF-8 charset named
GIS_4T_D_W.utf8= GIS_4T_D_W.utf8_G.abc GIS_4T_D_W.utf8_D_W.abc GIS_4T_D_W.utf8_C.abc
GIS_4T_D_W.utf8: GIS_4T_D_W.utf8.ps GIS_4T_D_W.utf8.pdf
GIS_4T_D_W.utf8.ps: GIS_4T_D_W.utf8.abc _70.fmt
	$(a2p) GIS_4T_D_W.utf8.abc +F_70 >GIS_4T_D_W.utf8.ps
GIS_4T_D_W.utf8.pdf: GIS_4T_D_W.utf8.ps
	ps2pdf GIS_4T_D_W.utf8.ps GIS_4T_D_W.utf8.pdf

# Green Island Serenade, UTF-8 charset named
GIS_5T_D_W.utf8= GIS_5T_D_W.utf8_G.abc GIS_5T_D_W.utf8_D_W.abc GIS_5T_D_W.utf8_C.abc
GIS_5T_D_W.utf8: GIS_5T_D_W.utf8.ps GIS_5T_D_W.utf8.pdf
GIS_5T_D_W.utf8.ps: GIS_5T_D_W.utf8.abc _70.fmt
	$(a2p) GIS_5T_D_W.utf8.abc +F_70 >GIS_5T_D_W.utf8.ps
GIS_5T_D_W.utf8.pdf: GIS_5T_D_W.utf8.ps
	ps2pdf GIS_5T_D_W.utf8.ps GIS_5T_D_W.utf8.pdf

# Green Island Serenade, UTF-8 charset named
GIS_5T_D_WCE.utf8= GIS_5T_D_WCE.utf8_G.abc GIS_5T_D_WCE.utf8_D_W.abc GIS_5T_D_WCE.utf8_C.abc
GIS_5T_D_WCE.utf8: GIS_5T_D_WCE.utf8.ps GIS_5T_D_WCE.utf8.pdf
GIS_5T_D_WCE.utf8.ps: GIS_5T_D_WCE.utf8.abc _70.fmt
	$(a2p) GIS_5T_D_WCE.utf8.abc +F_70 >GIS_5T_D_WCE.utf8.ps
GIS_5T_D_WCE.utf8.pdf: GIS_5T_D_WCE.utf8.ps
	ps2pdf GIS_5T_D_WCE.utf8.ps GIS_5T_D_WCE.utf8.pdf

# Green Island Serenade, UTF-8 charset named
GIS_6T_D_W.utf8= GIS_6T_D_W.utf8_G.abc GIS_6T_D_W.utf8_D_W.abc GIS_6T_D_W.utf8_C.abc
GIS_6T_D_W.utf8: GIS_6T_D_W.utf8.ps GIS_6T_D_W.utf8.pdf
GIS_6T_D_W.utf8.ps: GIS_6T_D_W.utf8.abc _70.fmt
	$(a2p) GIS_6T_D_W.utf8.abc +F_70 >GIS_6T_D_W.utf8.ps
GIS_6T_D_W.utf8.pdf: GIS_6T_D_W.utf8.ps
	ps2pdf GIS_6T_D_W.utf8.ps GIS_6T_D_W.utf8.pdf

# Green Island Serenade, UTF-8 charset named
GIS_6T_D_WCE.utf8= GIS_6T_D_WCE.utf8_G.abc GIS_6T_D_WCE.utf8_D_WCE.abc GIS_6T_D_WCE.utf8_C.abc
GIS_6T_D_WCE.utf8: GIS_6T_D_WCE.utf8.ps GIS_6T_D_WCE.utf8.pdf
GIS_6T_D_WCE.utf8.ps: GIS_6T_D_WCE.utf8.abc _70.fmt
	$(a2p) GIS_6T_D_WCE.utf8.abc +F_70 >GIS_6T_D_WCE.utf8.ps
GIS_6T_D_WCE.utf8.pdf: GIS_6T_D_WCE.utf8.ps
	ps2pdf GIS_6T_D_WCE.utf8.ps GIS_6T_D_WCE.utf8.pdf

# Green Island Serenade, no charset named
GIS_3T_D: GIS_3T_D.ps GIS_3T_D.pdf
GIS_3T_D.ps: GIS_3T_D.abc _70.fmt
	$(a2p) GIS_3T_D.abc +F_70 >GIS_3T_D.ps
GIS_3T_D.pdf: GIS_3T_D.ps
	ps2pdf GIS_3T_D.ps GIS_3T_D.pdf

# Little Swallow 
Little_Swallow= song/Little_Swallow-C-20-5w.abc
Little_Swallow: Little_Swallow.ps Little_Swallow.pdf Little_Swallow.svg
Little_Swallow.abc: $(Little_Swallow)
	abcjoin +s $(Little_Swallow) >Little_Swallow.abc
Little_Swallow.ps: Little_Swallow.abc fmt/_70.fmt
	$(a2p) +Ffmt/_70 Little_Swallow.abc \
	| PShdr Little_Swallow "" Little_Swallow \
	| PSftr %D $U/ %D >Little_Swallow.ps
Little_Swallow.pdf: Little_Swallow.ps
	ps2pdf Little_Swallow.ps Little_Swallow.pdf
Little_Swallow.svg:
	abcm2ps -v Little_Swallow.abc -O Little_Swallow_.svg

# Ruguo (如果)
Ruguo= song/Ruguo_A_w.abc tune/Ruguo_A.abc \
	tune/Ruguo_D.abc tune/Ruguo_D_32.abc tune/Ruguo_G_32.abc Ruguo.ftr
Ruguo: Ruguo.abc Ruguo.ps Ruguo.pdf
Ruguo.abc: $(Ruguo)
	abcjoin +S $(Ruguo) >Ruguo.abc
Ruguo.ps: Ruguo.abc _80.fmt
	$(a2p) Ruguo.abc +F_80 \
	|PShdr Ruguo '' Ruguo \
	|PSftr %D $U %T >Ruguo.ps
Ruguo.pdf: Ruguo.ps
	ps2pdf Ruguo.ps Ruguo.pdf

# SilentNight_PingAnYe
SilentNight_PingAnYe= SilentNight_PingAnYe_C.abc
SilentNight_PingAnYe: SilentNight_PingAnYe.ps SilentNight_PingAnYe.pdf
SilentNight_PingAnYe.abc: $(SilentNight_PingAnYe)
	abcjoin +s $(SilentNight_PingAnYe) >SilentNight_PingAnYe.abc
SilentNight_PingAnYe.ps: SilentNight_PingAnYe.abc fmt/_70.fmt
	$(a2p) +Ffmt/_70 SilentNight_PingAnYe.abc \
	| PShdr SilentNight_PingAnYe "" SilentNight_PingAnYe \
	| PSftr %D $U/ %D >SilentNight_PingAnYe.ps
SilentNight_PingAnYe.pdf: SilentNight_PingAnYe.ps
	ps2pdf SilentNight_PingAnYe.ps SilentNight_PingAnYe.pdf

# Two Fountains Reflect the Moonlight
TwoFountainsReflectTheMoonlight: TwoFountainsReflectTheMoonlight.ps TwoFountainsReflectTheMoonlight.pdf
TwoFountainsReflectTheMoonlight.ps: TwoFountainsReflectTheMoonlight.abc
	$(a2p) TwoFountainsReflectTheMoonlight.abc +F_80 >TwoFountainsReflectTheMoonlight.ps
TwoFountainsReflectTheMoonlight.pdf: TwoFountainsReflectTheMoonlight.ps
	ps2pdf TwoFountainsReflectTheMoonlight.ps TwoFountainsReflectTheMoonlight.pdf


# XiaoBaiCai
XiaoBaiCai= song/小白菜_1-G-16-2.abc
XiaoBaiCai: XiaoBaiCai.abc XiaoBaiCai.ps XiaoBaiCai.pdf
XiaoBaiCai.abc: $(XiaoBaiCai) # hdr/XiaoBaiCai.hdr
	abcjoin +s $(XiaoBaiCai) >XiaoBaiCai.abc
XiaoBaiCai.ps: XiaoBaiCai.abc fmt/_80.fmt
	$(a2p) XiaoBaiCai.abc +Ffmt/_80 \
	|PShdr XiaoBaiCai '' XiaoBaiCai \
	|PSftr %D $U/ %D >XiaoBaiCai.ps
XiaoBaiCai.pdf: XiaoBaiCai.ps
	ps2pdf XiaoBaiCai.ps XiaoBaiCai.pdf

YueliangDaibiaoWodeXin= song/YueliangDaibiaoWodeXin_D.abc
YueliangDaibiaoWodeXin: YueliangDaibiaoWodeXin.ps YueliangDaibiaoWodeXin.pdf
YueliangDaibiaoWodeXin.abc: $(YueliangDaibiaoWodeXin)
	abcjoin +S2 $(YueliangDaibiaoWodeXin) >YueliangDaibiaoWodeXin.abc
YueliangDaibiaoWodeXin.ps: YueliangDaibiaoWodeXin.abc _80.fmt
	$(a2p) YueliangDaibiaoWodeXin.abc +F_80 >YueliangDaibiaoWodeXin.ps
YueliangDaibiaoWodeXin.pdf: YueliangDaibiaoWodeXin.ps
	ps2pdf YueliangDaibiaoWodeXin.ps YueliangDaibiaoWodeXin.pdf
