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