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