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