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