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