]> git.donarmstrong.com Git - lilypond.git/blob - mf/GNUmakefile
*** empty log message ***
[lilypond.git] / mf / GNUmakefile
1 depth = ..
2
3 STEPMAKE_TEMPLATES=metafont install install-out
4 LOCALSTEPMAKE_TEMPLATES=lilypond
5
6 include $(depth)/make/stepmake.make 
7
8 AF_FILES = $(wildcard *.af) 
9
10 EXTRA_DIST_FILES += README feta.tex
11
12 # We don't use $(MF_FILES), because there's more .mf cruft here
13 FETA_MF_FILES = $(wildcard feta[0-9]*.mf)\
14         $(wildcard feta-braces-[a-z].mf)\
15         $(wildcard feta-alphabet*[0-9].mf)\
16         $(wildcard parmesan[0-9]*.mf)
17
18 STAFF_SIZES = 11 13 14 16 18 20 23 26
19 BRACES = a b c d e f g h i
20
21 OTF_FILES = $(STAFF_SIZES:%=$(outdir)/emmentaler-%.otf)\
22  $(outdir)/aybabtu.otf
23 PFA_OTF_FILES = $(STAFF_SIZES:%=$(outdir)/PFAemmentaler-%.pfa)\
24  $(outdir)/PFAaybabtu.pfa
25 PE_SCRIPTS = $(STAFF_SIZES:%=$(outdir)/emmentaler-%.pe)\
26  $(STAFF_SIZES:%=$(outdir)/emmentaler-%.dep)
27 OTF_TABLES = $(STAFF_SIZES:%=$(outdir)/feta%.otf-table)\
28  $(BRACES:%=$(outdir)/feta-braces-%.otf-table)
29 FETA_FONTS = $(FETA_MF_FILES:.mf=)
30 SVG_FILES = $(OTF_FILES:%.otf=%.svg) $(ALL_FONTS:%=$(outdir)/%.svg)
31 CFF_FILES = $(OTF_FILES:%.otf=%.cff)
32 CFF_PS_FILES = $(OTF_FILES:%.otf=%.cff.ps)
33
34
35 $(outdir)/aybabtu.otf-table: $(BRACES:%=$(outdir)/feta-braces-%.otf-table)
36         cat $^ > $@
37
38 $(outdir)/aybabtu.otf-gtable: $(BRACES:%=$(outdir)/feta-braces-%.otf-gtable)
39         echo '(design_size . 20)' > $@
40
41 LOG_FILES = $(FETA_MF_FILES:%.mf=$(outdir)/%.log)
42 LISP_FILES = $(FETA_MF_FILES:%.mf=$(outdir)/%.lisp)
43 TEXTABLES = $(FETA_MF_FILES:%.mf=$(outdir)/%.tex)
44 ENC_FILES = $(TEXTABLES:.tex=.enc) $(outdir)/cmr.enc
45 TFM_FILES = $(FETA_MF_FILES:%.mf=$(outdir)/%.tfm)\
46  $(SAUTER_FONTS:%=$(outdir)/%.tfm)
47 FETA_LIST_FILES = $(FETA_MF_FILES:%.mf=$(outdir)/%list.ly)
48
49
50 ENCODING_FILE=$(findstring $(<:.mf=.enc), $(FETA_MF_FILES:.mf=.enc))
51 MFTRACE_FLAGS=$(if $(ENCODING_FILE),--encoding $(ENCODING_FILE),) --no-afm
52
53 # only for fonts which
54 #
55 # 1. are mentioned in font.scm
56 #
57 # 2. are not included with teTeX
58 #
59
60 $(outdir)/%.cff.ps $(outdir)/PFA%.pfa $(outdir)/%.cff $(outdir)/%.otf $(outdir)/%.svg: $(outdir)/%.pe
61         (cd $(outdir) && $(FONTFORGE) -script $(notdir $<))
62         $(PYTHON) $(buildscript-dir)/ps-embed-cff.py $(basename $<).cff `cat $(basename $<).fontname` $(basename $<).cff.ps
63         -rm $(outdir)/*.scale.pfa
64
65
66 $(outdir)/%.otf-table: $(outdir)/%.lisp $(if $(findstring brace,$<),,$(subst feta,parmesan,$<)) 
67         cat $< \
68                 $(if $(findstring brace,$<),,$(subst feta,parmesan,$<)) \
69                 $(if $(findstring brace,$<),,$(subst feta,feta-alphabet,$<)) > $@
70
71 $(outdir)/aybabtu.otf $(outdir)/PFAaybabtu.pfa: $(outdir)/aybabtu.subfonts $(outdir)/aybabtu.fontname $(outdir)/aybabtu.otf-table $(outdir)/aybabtu.otf-gtable $(outdir)/aybabtu.pe
72
73 $(outdir)/aybabtu.fontname:
74         echo -n 'aybabtu' > $@ 
75 $(outdir)/aybabtu.subfonts: 
76         echo $(subst .mf,,$(wildcard feta-braces-[a-z].mf)) > $@
77
78 $(PE_SCRIPTS): $(buildscript-dir)/gen-emmentaler-scripts.py
79         $(PYTHON) $< --dir=$(outdir)
80
81
82 ALL_FONTS = $(FETA_FONTS) $(SAUTER_FONTS)
83 PFA_FILES = $(ALL_FONTS:%=$(outdir)/%.pfa) $(PFA_OTF_FILES)
84
85 # Make tfm files first, log files last, 
86 # so that normally log files aren't made twice
87 ALL_GEN_FILES= $(TFM_FILES) $(TEXTABLES) $(TFM_FILES) $(LOG_FILES) $(ENC_FILES) $(LISP_FILES) $(FETA_LIST_FILES)  $(OTF_TABLES) $(PFA_FILES) $(outdir)/lilypond.map $(OTF_FILES) $(SVG_FILES) $(CFF_PS_FILES) $(CFF_FILES)
88
89 #PRE_INSTALL=$(MAKE) "$(ALL_GEN_FILES)"
90 INSTALLATION_DIR=$(local_lilypond_datadir)/fonts/source
91 INSTALLATION_FILES=$(MF_FILES) $(AF_FILES)
92
93 INSTALLATION_OUT_SUFFIXES=1 2 3 4 5 6 7 8 9
94
95 INSTALLATION_OUT_DIR1=$(local_lilypond_datadir)/tex
96 INSTALLATION_OUT_FILES1=$(TEXTABLES)
97
98 # must not be installed with .cff, pango/fontconfig does not like .cff fonts 
99 INSTALLATION_OUT_DIR2=$(local_lilypond_datadir)/fonts/otf
100 INSTALLATION_OUT_FILES2=$(OTF_FILES)
101
102 INSTALLATION_OUT_DIR3=$(local_lilypond_datadir)/fonts/tfm
103 INSTALLATION_OUT_FILES3=$(TFM_FILES)
104
105 INSTALLATION_OUT_DIR4=$(local_lilypond_datadir)/ps
106 INSTALLATION_OUT_FILES4=$(CFF_PS_FILES)
107
108 INSTALLATION_OUT_DIR5=$(local_lilypond_datadir)/fonts/type1
109 INSTALLATION_OUT_FILES5=$(PFA_FILES)
110
111 INSTALLATION_OUT_DIR6=$(local_lilypond_datadir)/fonts/map
112 INSTALLATION_OUT_FILES6=$(outdir)/lilypond.map
113
114 INSTALLATION_OUT_DIR7=$(local_lilypond_datadir)/fonts/cff/
115 INSTALLATION_OUT_FILES7=$(CFF_FILES)
116
117 INSTALLATION_OUT_DIR7=$(local_lilypond_datadir)/ps/
118 INSTALLATION_OUT_FILES7=$(ENC_FILES)
119
120 INSTALLATION_OUT_DIR9=$(local_lilypond_datadir)/fonts/svg
121 INSTALLATION_OUT_FILES9=$(SVG_FILES)
122
123
124 export MFINPUTS:=.:$(MFINPUTS)
125
126 .PHONY: tree-regen
127 # FIXME: temporary hack: must regenerate after building fonts
128 tree-regen:
129         rm -rf $(builddir)/share
130         make -C $(builddir) link-tree
131
132 default: pfa_warning $(ALL_GEN_FILES) $(outdir)/emmentaler-20.otf tree-regen
133
134 pfa_warning:
135 ifneq ($(shell $(MFTRACE) --version | sed 's/ .*//'),mftrace)
136         @echo ""
137         @echo "ERROR: mftrace not found"
138         @echo ""
139         @echo "For obtaining PFA fonts, either install mftrace "
140         @echo "(see http://www.xs4all.nl/~hanwen/mftrace/ ),"
141         @echo "or try one of the following commands in this directory: "
142         @echo ""
143         @echo " make get-pfa "
144         @echo " make get-rpm-pfa "
145         @echo " make get-deb-pfa "
146         @echo ""
147         @echo "These commands will try to download the files from internet."
148         @false
149 endif
150
151
152 debian-mirror=http://ftp.us.debian.org
153 debian-package =lilypond_$(TOPLEVEL_VERSION)-1_i386.deb
154 $(outdir)/$(debian-package):
155         wget --passive-ftp -P $(outdir) $(debian-mirror)/debian/pool/main/l/lilypond/$(debian-package)
156
157 get-deb-pfa: $(outdir)/$(debian-package)
158         rm -rf $(outdir)/./usr
159         ar p $< data.tar.gz | \
160                 tar -C $(outdir) -zvxf - '*.pfa'
161         cp `find $(outdir)/usr/ -name '*.pfa'` $(outdir)/
162
163
164 redhat-package=lilypond-$(TOPLEVEL_VERSION)-1.i386.rpm
165 $(outdir)/$(redhat-package):
166         wget  --passive-ftp -P $(outdir) http://lilypond.org/download/binaries/Fedora-3/$(redhat-package)
167
168 get-rpm-pfa: $(outdir)/$(redhat-package)
169         cd $(outdir) ; rm -rf usr/ # (root alert!) 
170         cd $(outdir) ; rpm2cpio $(redhat-package) | cpio -uid '*.pfa'
171         cp `find $(outdir)/usr/ -name '*.pfa'` $(outdir)/
172
173 # change this dependency 
174 get-pfa: get-rpm-pfa
175
176
177 ##
178 ## todo: this also depends on .tfm, FIXME.
179 $(outdir)/%.lisp $(outdir)/%.otf-gtable $(outdir)/%.enc  $(outdir)/%.tex $(outdir)/%list.ly $(outdir)/%.dep: $(outdir)/%.log $(outdir)/%.tfm
180         $(PYTHON) $(buildscript-dir)/mf-to-table.py --global-lisp=$(outdir)/$(<F:.log=.otf-gtable) --lisp=$(outdir)/$(<F:.log=.lisp) --outdir=$(outdir) --dep $(outdir)/$(<F:.log=.dep) --enc $(outdir)/$(<F:.log=.enc) --tex $(outdir)/$(<F:.log=.tex) --ly $(outdir)/$(<F:.log=list.ly) $<
181
182 fontdir: $(addprefix $(outdir)/, lilypond.map lilypond.sfd private-fonts fonts.scale fonts.dir Fontmap.lily)
183
184
185 $(outdir)/lilypond.map: GNUmakefile
186         for i in $(FETA_FONTS); do echo $$i $$i '<'$$i.pfa; done > $@
187         for i in $(STAFF_SIZES); do\
188                 echo "Emmentaler-$$i Emmentaler-$$i <emmentaler-$$i.cff.ps";\
189                 echo "PFAEmmentaler-$$i PFAEmmentaler-$$i <PFAemmentaler-$$i.pfa";\
190         done >> $@
191         echo "Aybabtu-Regular Aybabtu-Regular <aybabtu.cff.ps" >> $@
192         echo "PFAAybabtu-Regular PFAAybabtu-Regular <aybabtu.cff.ps" >> $@
193 #
194 # FIXME: needed for make web on Debian/unstable -- not in any other .map file   
195         echo "FreeSans FreeSans <FreeSans.ttf" >> $@
196         echo "Kochi-Gothic Kochi-Gothic <kochi-gothic.ttf" >> $@
197         
198 $(outdir)/Fontmap.lily: GNUmakefile
199         for i in $(FETA_FONTS); do echo "/$$i ($$i.pfa);" ; done > $@
200         for i in $(STAFF_SIZES); do \
201                 echo "/Emmentaler-$$i (emmentaler-$$i.cff.ps);" ; \
202                 echo "/PFAEmmentaler-$$i (PFAemmentaler-$$i.pfa);" \
203                 done >> $@
204         echo "/Aybabtu (aybabtu.cff.ps);" >> $@
205         echo "/PFAAybabtu (PFAaybabtu.pfa);" >> $@
206
207 local-clean:
208         rm -f mfplain.mem mfplain.log 
209         rm -f *.tfm *.log
210
211 $(outdir)/%.enc.in: %.enc
212         cp $< $@
213
214 # teTeX-2.0.x compatibility.
215 local-install:
216         -$(INSTALL) -d $(DESTDIR)$(local_lilypond_datadir)/dvips
217         (cd $(DESTDIR)$(local_lilypond_datadir)/dvips && ln -sf ../fonts/map .)
218
219 local-uninstall:
220         -rm -f $(DESTDIR)$(local_lilypond_datadir)/dvips/map
221         -rmdir $(DESTDIR)$(local_lilypond_datadir)/dvips