]> git.donarmstrong.com Git - lilypond.git/blob - mf/GNUmakefile
* scm/output-tex.scm (named-glyph): new function. This fixes TeX output.
[lilypond.git] / mf / GNUmakefile
1 depth = ..
2
3 STEPMAKE_TEMPLATES=metafont install install-out
4
5 include $(depth)/make/stepmake.make 
6
7 AF_FILES = $(wildcard *.af) 
8
9 EXTRA_DIST_FILES += README feta.tex
10
11 # We don't use $(MF_FILES), because there's more .mf cruft here
12 FETA_MF_FILES = $(wildcard feta[0-9]*.mf)\
13         $(wildcard feta-braces-[a-z].mf)\
14         $(wildcard feta-alphabet*[0-9].mf)\
15         $(wildcard parmesan[0-9]*.mf)
16
17 STAFF_SIZES = 11 13 14 16 18 20 23 26
18 BRACES = a b c d e f g h i
19
20 CHEESES = $(addsuffix .otf, $(addprefix $(outdir)/bigcheese, $(STAFF_SIZES)))\
21  $(outdir)/aybabtu.otf
22 PE_SCRIPTS = $(addsuffix .pe, $(addprefix $(outdir)/bigcheese, $(STAFF_SIZES))) \
23   $(addsuffix .dep, $(addprefix $(outdir)/bigcheese, $(STAFF_SIZES))) 
24 OTF_TABLES = $(addsuffix .otf-table, $(addprefix $(outdir)/feta, $(STAFF_SIZES))) \
25  $(BRACES:%=$(outdir)/feta-braces-%.otf-table)
26 FETA_FONTS = $(FETA_MF_FILES:.mf=)
27
28
29
30 LOG_FILES = $(FETA_MF_FILES:%.mf=$(outdir)/%.log)
31 LISP_FILES = $(FETA_MF_FILES:%.mf=$(outdir)/%.lisp)
32 TEXTABLES = $(FETA_MF_FILES:%.mf=$(outdir)/%.tex)
33 AFM_FILES = $(FETA_MF_FILES:%.mf=$(outdir)/%.afm) \
34         $(AF_FILES:%.af=$(outdir)/%.afm)
35 ENC_FILES = $(TEXTABLES:.tex=.enc) $(outdir)/cmr.enc
36 TFM_FILES = $(FETA_MF_FILES:%.mf=$(outdir)/%.tfm) $(addprefix $(outdir)/,$(addsuffix .tfm,$(SAUTER_FONTS)))
37 FETA_LIST_FILES = $(FETA_MF_FILES:%.mf=$(outdir)/%list.ly)
38
39
40 ENCODING_FILE=$(findstring $(<:.mf=.enc), $(FETA_MF_FILES:.mf=.enc))
41 MFTRACE_FLAGS=$(if $(ENCODING_FILE),--encoding $(ENCODING_FILE),)
42
43 # only for fonts which
44 #
45 # 1. are mentioned in font.scm
46 #
47 # 2. are not included with teTeX
48 #
49
50 foe:
51         echo $(MFINPUTS)
52         echo $(TEXMF)
53         kpsewhich exbase.mf
54
55 $(outdir)/%.otf: $(outdir)/%.pe
56         (cd $(outdir) && fontforge -script $(notdir $<)) 
57
58 $(outdir)/%.otf-table: $(outdir)/%.lisp
59         cat $< $(subst parmesan,feta,$<) > $@
60
61 $(outdir)/aybabtu.otf: $(outdir)/aybabtu.subfonts
62
63 $(outdir)/aybabtu.subfonts: 
64          echo $(subst .mf,,$(wildcard feta-braces-[a-z].mf)) > $@
65
66 $(PE_SCRIPTS):
67         $(PYTHON) $(buildscript-dir)/gen-bigcheese-scripts.py --dir=$(outdir)
68
69 include $(outdir)/bigcheese20.dep
70
71
72 foo:
73         echo $(CHEESES)
74 ## use separate package sauter-fonts-mftraced.
75 SAUTER_FONTS = 
76
77 #cmbxti8 ecbm14 ecrm12
78 MORE_SAUTER_FONTS = cmbx14 cmbx17 \
79          cmbxti12 cmbxti14 \
80          cmbxti6 cmbxti7 cmbxti8 \
81          cmcsc12 cmcsc7 cmcsc8 \
82          cmss5 cmss6 cmss7 \
83          cmti5 cmti6 \
84          cmtt17 cmtt5 cmtt6 cmtt7
85
86 ALL_FONTS = $(FETA_FONTS) $(SAUTER_FONTS)
87 PFA_FILES = $(ALL_FONTS:%=$(outdir)/%.pfa)
88 PFB_FILES = $(PFA_FILES:%.pfa=%.pfb)
89
90 # Make tfm files first, log files last, 
91 # so that normally log files aren't made twice
92 ALL_GEN_FILES= $(TFM_FILES) $(TEXTABLES) $(AFM_FILES) $(TFM_FILES) $(LOG_FILES) $(ENC_FILES) $(LISP_FILES) $(FETA_LIST_FILES)  $(OTF_TABLES) $(PFA_FILES) $(outdir)/lilypond.map $(outdir)/fonts.scale $(outdir)/Fontmap.lily $(CHEESES)
93
94 #PRE_INSTALL=$(MAKE) "$(ALL_GEN_FILES)"
95 INSTALLATION_DIR=$(local_lilypond_datadir)/fonts/source
96 INSTALLATION_FILES=$(MF_FILES) $(AF_FILES)
97
98 INSTALLATION_OUT_SUFFIXES=1 2 3 4 5 6 7
99
100 INSTALLATION_OUT_DIR1=$(local_lilypond_datadir)/tex
101 INSTALLATION_OUT_FILES1=$(TEXTABLES)
102
103 INSTALLATION_OUT_DIR2=$(local_lilypond_datadir)/fonts/afm
104 INSTALLATION_OUT_FILES2=$(AFM_FILES)
105
106 INSTALLATION_OUT_DIR3=$(local_lilypond_datadir)/fonts/tfm
107 INSTALLATION_OUT_FILES3=$(TFM_FILES)
108
109 INSTALLATION_OUT_DIR4=$(local_lilypond_datadir)/ly
110 INSTALLATION_OUT_FILES4=$(FETA_LIST_FILES)
111
112 INSTALLATION_OUT_DIR5=$(local_lilypond_datadir)/fonts/type1
113 INSTALLATION_OUT_FILES5=$(PFA_FILES) $(outdir)/fonts.scale $(outdir)/Fontmap $(outdir)/Fontmap.lily
114
115 INSTALLATION_OUT_DIR6=$(local_lilypond_datadir)/dvips/
116 INSTALLATION_OUT_FILES6=$(outdir)/lilypond.map
117
118 INSTALLATION_OUT_DIR7=$(local_lilypond_datadir)/ps/
119 INSTALLATION_OUT_FILES7=$(ENC_FILES)
120
121 export MFINPUTS:=.:$(MFINPUTS)
122
123 default: pfa_warning $(ALL_GEN_FILES) $(outdir)/bigcheese20.otf
124
125
126 pfa_warning:
127 ifneq ($(notdir $(MFTRACE)),mftrace)
128         @echo ""
129         @echo "ERROR: mftrace not found"
130         @echo ""
131         @echo "For obtaining PFA fonts, either install mftrace "
132         @echo "(see http://www.xs4all.nl/~hanwen/mftrace/ ),"
133         @echo "or try one of the following commands in this directory: "
134         @echo ""
135         @echo " make get-pfa "
136         @echo " make get-rpm-pfa "
137         @echo " make get-deb-pfa "
138         @echo ""
139         @echo "These commands will try to download the files from the internet."
140         @false
141 endif
142
143
144 debian-mirror=http://ftp.us.debian.org
145 debian-package =lilypond_$(TOPLEVEL_VERSION)-1_i386.deb
146 $(outdir)/$(debian-package):
147         wget --passive-ftp -P $(outdir) $(debian-mirror)/debian/pool/main/l/lilypond/$(debian-package)
148
149 get-deb-pfa: $(outdir)/$(debian-package)
150         rm -rf $(outdir)/./usr
151         ar p $< data.tar.gz | \
152                 tar -C $(outdir) -zvxf - '*.pfa'
153         cp `find $(outdir)/usr/ -name '*.pfa'` $(outdir)/
154
155
156 redhat-package=lilypond-$(TOPLEVEL_VERSION)-1.i386.rpm
157 $(outdir)/$(redhat-package):
158         wget  --passive-ftp -P $(outdir) http://lilypond.org/download/binaries/Fedora-3/$(redhat-package)
159
160 get-rpm-pfa: $(outdir)/$(redhat-package)
161         cd $(outdir) ; rm -rf usr/ # (root alert!) 
162         cd $(outdir) ; rpm2cpio $(redhat-package) | cpio -uid '*.pfa'
163         cp `find $(outdir)/usr/ -name '*.pfa'` $(outdir)/
164
165 # change this dependency 
166 get-pfa: get-rpm-pfa
167
168
169 ##
170 ## todo: this also depends on .tfm, FIXME.
171 $(outdir)/%.lisp $(outdir)/%.otf-gtable $(outdir)/%.afm  $(outdir)/%.enc  $(outdir)/%.tex $(outdir)/%list.ly $(outdir)/%.dep: $(outdir)/%.log $(outdir)/%.tfm
172         $(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)  --afm $(outdir)/$(<F:.log=.afm)  --enc $(outdir)/$(<F:.log=.enc) --tex $(outdir)/$(<F:.log=.tex) --ly $(outdir)/$(<F:.log=list.ly) $<
173
174 fontdir: $(addprefix $(outdir)/, lilypond.map lilypond.sfd private-fonts fonts.scale fonts.dir Fontmap.lily)
175
176 ## Urg
177 mapentry=$(1) $(shell fgrep FontName $(outdir)/$(1).afm | sed -e 's/FontName *//') <$(1).pfaX
178
179 map = $(foreach a,$(2),$(call $(1),$(a)))
180 $(outdir)/lilypond.xmap: $(AFM_FILES)
181         echo '$(call map,mapentry,$(ALL_FONTS))' | \
182                 tr 'X' '\n' | sed -e 's/^ *//'> $@
183
184 # using shell for loop seems most robust
185 $(outdir)/lilypond.map: $(AFM_FILES)
186         for i in $(FETA_FONTS); do echo $$i $$(fgrep FontName $(outdir)/$$i.afm | sed -e 's/FontName *//') '<'$$i.pfa; done > $@
187         for i in $(SAUTER_FONTS); do echo "$$i $$i <$$i.pfa"; done >> $@
188
189 $(outdir)/Fontmap:
190         echo '%!' > $@
191         echo '% Override default GS Fontmap' >> $@
192         echo '% To let gs load fonts from builddir, do:' >> $@
193         echo '% export GS_LIB=$$(pwd)/mf/out:' >> $@
194         echo '% See Fontmap.GS for the syntax of real Fontmap files.' >> $@
195         echo '(Fontmap.GS) .runlibfile' >> $@
196         echo '(Fontmap.lily) .runlibfile' >> $@
197
198 $(outdir)/Fontmap.lily: $(AFM_FILES) $(outdir)/Fontmap
199         echo '%!' > $@
200         for i in $(FETA_FONTS); do echo "/$$(fgrep FontName $(outdir)/$$i.afm | sed -e 's/FontName *//') ($$i.pfa);"; done >> $@
201         for i in $(SAUTER_FONTS); do echo "$$i ($$i.pfa);"; done >> $@
202
203
204 $(outdir)/fonts.scale: $(PFA_FILES)
205 #       cd $(outdir) && echo $(FETA_MF_FILES:.mf=.pfa) $(FETA_MF_FILES:.mf=.pfb) | $(PYTHON) $(topdir)/buildscripts/make-font-dir.py  > $(@F)
206         cd $(outdir) && echo *.pfa *.pfb | $(PYTHON) $(topdir)/buildscripts/make-font-dir.py  > $(@F)
207
208 $(outdir)/fonts.dir: $(outdir)/fonts.scale
209         cd $(outdir) && mkfontdir
210
211 # Sketch map file
212 $(outdir)/lilypond.sfd:
213 #       cd $(outdir) && echo sketch $(FETA_MF_FILES:.mf=.pfa) | $(PYTHON) $(topdir)/buildscripts/make-font-dir.py  > $(@F)
214         cd $(outdir) && echo sketch *.pfa | $(PYTHON) $(topdir)/buildscripts/make-font-dir.py  > $(@F)
215
216 # Sodipodi map file
217 SODIPODI_FONTS = parmesan20 feta-braces0 feta-nummer10 feta20
218 $(outdir)/private-fonts:
219         cd $(outdir) && echo sodipodi $(SODIPODI_FONTS:%=%.pfa) | $(PYTHON) $(topdir)/buildscripts/make-font-dir.py  > $(@F)
220
221 local-clean:
222         rm -f mfplain.mem mfplain.log 
223         rm -f *.tfm *.log
224
225 afm: $(AFM_FILES)
226 pfa: afm $(PFA_FILES) fontdir
227 pfb: afm $(PFB_FILES) fontdir
228
229
230 # stupid trick to have separate rules for each PFA font ;
231 # otherwise building PFAs is all-or-nothing.
232 $(SAUTER_FONTS:%=$(outdir)/%.bla):
233         $(foreach i, $@, touch $i && ) true
234
235 $(outdir)/%.pfa: $(outdir)/%.bla
236         $(MFTRACE) -I $(outdir)/ --pfa --simplify --keep-trying $(notdir $(basename $@))  && mv $(notdir $@) $(outdir)/
237
238 $(outdir)/%.enc.in: %.enc
239         cp $< $@