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