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