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