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