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