Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(1180)

Side by Side Diff: mf/GNUmakefile

Issue 553700043: scripts/build/scan-mf-deps: script to generate MF dependencies (Closed)
Patch Set: touch multiple files Created 4 years ago
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | mf/invoke-mf2pt1.sh » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # mf/GNUmakefile 1 # mf/GNUmakefile
2 2
3 depth = .. 3 depth = ..
4 4
5 STEPMAKE_TEMPLATES = install install-out 5 STEPMAKE_TEMPLATES = install install-out
6 LOCALSTEPMAKE_TEMPLATES = lilypond 6 LOCALSTEPMAKE_TEMPLATES = lilypond
7 7
8 # These are the main .mf files. We don't use $(MF_FILES) here, 8 # These are the main .mf files. We don't use $(MF_FILES) here,
9 # because there are more .mf files, input'ed into the main files. 9 # because there are more .mf files, input'ed into the main files.
10 FETA_MF_FILES = $(call src-wildcard,feta[0-9]*.mf) \ 10 FETA_MF_FILES = $(call src-wildcard,feta[0-9]*.mf) \
11 $(call src-wildcard,feta-braces-[a-z].mf) \ 11 $(call src-wildcard,feta-braces-[a-z].mf) \
12 $(call src-wildcard,feta-alphabet*[0-9].mf) \ 12 $(call src-wildcard,feta-alphabet*[0-9].mf) \
13 $(call src-wildcard,feta-noteheads*[0-9].mf) \ 13 $(call src-wildcard,feta-noteheads*[0-9].mf) \
14 $(call src-wildcard,feta-flags*[0-9].mf) \ 14 $(call src-wildcard,feta-flags*[0-9].mf) \
15 $(call src-wildcard,parmesan[0-9]*.mf) \ 15 $(call src-wildcard,parmesan[0-9]*.mf) \
16 $(call src-wildcard,parmesan-noteheads*[0-9].mf) 16 $(call src-wildcard,parmesan-noteheads*[0-9].mf)
17 FETA_FONTS = $(FETA_MF_FILES:.mf=) 17 FETA_FONTS = $(FETA_MF_FILES:.mf=)
18 ALL_FONTS = $(FETA_FONTS) 18 ALL_FONTS = $(FETA_FONTS)
19 PFB_FILES = $(ALL_FONTS:%=$(outdir)/%.pfb) 19 PFB_FILES = $(ALL_FONTS:%=$(outdir)/%.pfb)
20 20
21 include $(depth)/make/stepmake.make 21 include $(depth)/make/stepmake.make
22 22
23 .PHONY: tfm dvi pfb
24
25 pfb: $(PFB_FILES)
26
27 MF2PT1_OPTIONS=--rounding=0.0001 \
28 --family=$(notdir $(<:%.mf=%)) \
29 --fullname=$(notdir $(<:%.mf=%)) \
30 --name=$(notdir $(<:%.mf=%))
31
32 # Don't remove $(outdir)/.log's. Logs are a target! 23 # Don't remove $(outdir)/.log's. Logs are a target!
33
34 # we want to see botched results as well. 24 # we want to see botched results as well.
25 # TODO: use the dependency scanning from invoke-mf2pt1.sh here too.
35 $(outdir)/%.dvi: %.mf 26 $(outdir)/%.dvi: %.mf
36 $(call ly_progress,Making,$@,< mf) 27 $(call ly_progress,Making,$@,< mf)
37 » -$(DO_MF_DEP) \ 28 » MFINPUTS=$(src-dir) \
38 » MFINPUTS=$(src-dir) \
39 max_print_line=1000 \ 29 max_print_line=1000 \
40 $(METAFONT) "\scrollmode; input $<;" $(METAFONT_QUIET) 30 $(METAFONT) "\scrollmode; input $<;" $(METAFONT_QUIET)
41 gftodvi $(basename $<) 31 gftodvi $(basename $<)
42 mv $(basename $<).dvi $(outdir) 32 mv $(basename $<).dvi $(outdir)
43 rm $(basename $<).*gf 33 rm $(basename $<).*gf
44 34
45 $(outdir)/%.tfm $(outdir)/%.log: %.mf 35 $(outdir)/%.pfb: %.mf $(outdir)/mf2pt1.mem invoke-mf2pt1.sh
46 $(call ly_progress,Making,$@,< mf) 36 $(call ly_progress,Making,$@,< mf)
47 » $(DO_MF_DEP) \ 37 » $(src-dir)/invoke-mf2pt1.sh $(buildscript-dir)/mf2pt1 $< $@ $(METAFONT_Q UIET)
48 » MFINPUTS=$(src-dir) \
49 » max_print_line=1000 \
50 » $(METAFONT) "\mode:=$(MFMODE); nonstopmode; input $<;" $(METAFONT_QUIE T)
51 # Let's keep this log output, it saves another mf run.
52 » mv $(basename $(@F)).log $(basename $(@F)).tfm $(outdir)
53 » rm -f $(basename $(@F)).*gf $(basename $(@F)).*pk
54 38
55 # ugh . mf2pt1 is extremely broken, it pollutes CWD iso. creating a 39 $(outdir)/%.tfm $(outdir)/%.log: $(outdir)/%.pfb
hahnjo 2020/03/18 13:27:51 This doesn't work for me: After a 'make clean' / d
56 # temp dir.
57 #
58 # the soft link for mf2pt1.mp is for recent mpost versions
59 # which no longer dump a .mem file
60 $(outdir)/%.pfb: %.mf $(outdir)/mf2pt1.mem $(outdir)/%.log
61 » $(call ly_progress,Making,$@,< mf)
62 » $(DO_MF_DEP) TMP_DIR=`mktemp -d $(outdir)/pfbtemp.$*.XXXXXXXXX` \
63 » && ( cd $$TMP_DIR \
64 » » && ln -s ../mf2pt1.mem . \
65 » » && ln -s ../../mf2pt1.mp . \
66 » » && MFINPUTS=$(abs-src-dir):..:: \
67 » » FONTFORGE=$(FONTFORGE) \
68 » » max_print_line=1000 \
69 » » $(buildscript-dir)/mf2pt1 $(MF2PT1_OPTIONS) $< $(METAFONT_QUI ET)) \
70 » && mv $$TMP_DIR/*pfb $(outdir); \
71 » rm -rf $$TMP_DIR
72 40
73 # since recent mpost versions no longer create a mem file, we create a dummy 41 # since recent mpost versions no longer create a mem file, we create a dummy
74 # file to satisfy the dependency (which gets overwritten in case an older 42 # file to satisfy the dependency (which gets overwritten in case an older
75 # mpost creates a real mem file) 43 # mpost creates a real mem file)
76 $(outdir)/mf2pt1.mem: mf2pt1.mp 44 $(outdir)/mf2pt1.mem: mf2pt1.mp
77 $(call ly_progress,Making,$@,< mp) 45 $(call ly_progress,Making,$@,< mp)
78 cd $(outdir) \ 46 cd $(outdir) \
79 && touch mf2pt1.mem \ 47 && touch mf2pt1.mem \
80 && mpost -progname=mpost -ini $(top-src-dir)/mf/mf2pt1.mp \\dump $(ME TAFONT_QUIET) 48 && mpost -progname=mpost -ini $(top-src-dir)/mf/mf2pt1.mp \\dump $(ME TAFONT_QUIET)
81 49
82 ifndef VERBOSE 50 ifndef VERBOSE
83 METAFONT_QUIET = >/dev/null 51 METAFONT_QUIET = >/dev/null
84 else 52 else
85 METAFONT_QUIET = 53 METAFONT_QUIET =
86 endif 54 endif
87 55
88 # Find the metafont file $(1) within the source dirs and return its path. 56 $(outdir)/emmentaler-brace.subfonts:
89 # If not found, return $(outdir)/$(1) assuming that it is a generated file. 57 » $(call ly_progress,Making,$@,)
90 find-mf = \ 58 » echo $(subst .mf,,$(call src-wildcard,feta-braces-[a-z].mf)) > $@
91 $(firstword \
92 » $(wildcard $(src-dir)/$(1)) \
93 » $(wildcard $(top-src-dir)/mf/$(1)) \
94 » $(outdir)/$(1) \
95 )
96 59
97 # Recursively scan the metafont .mf file $(1) for "input X;" 60 $(outdir)/emmentaler-%.genpe: $(buildscript-dir)/gen-emmentaler-scripts
98 # and return all dependencies. 61 » $(call ly_progress,Making,$@,)
99 scan-mf = \ 62 » $< --dir=$(outdir) --design-size=$(patsubst emmentaler-%.genpe,%,$(notdi r $@))
100 $(foreach f, $(shell test -f $(1) && sed -ne "/^[[:space:]]*input[[:space:]]/s/^ [[:space:]]*input\([^.;]*\)\(.mf;\|;\)/\1.mf/p" $(1)), \
101 » $(call find-mf,$(f)) \
102 » $(call scan-mf,$(call find-mf,$(f))) \
103 )
104
105 # Find dependencies for the target $@, based on the metafont source file $<,
106 # and write the dependencies to a .dep file. We cannot strip the extension of $@ ,
107 # because we have multiple rules generating .dep files.
108 DO_MF_DEP = ( echo ./$@: $(call scan-mf,$<) > $@.dep ) &&
109 63
110 64
111 EXTRA_DIST_FILES += README mf2pt1.mp 65 EXTRA_DIST_FILES += README mf2pt1.mp invoke-mf2pt.sh r
112 66
113 STAFF_SIZES = 11 13 14 16 18 20 23 26 67 STAFF_SIZES = 11 13 14 16 18 20 23 26
114 BRACES = a b c d e f g h i 68 BRACES = a b c d e f g h i
115 69
116 OTF_FILES = $(STAFF_SIZES:%=$(outdir)/emmentaler-%.otf) \ 70 OTF_FILES = $(STAFF_SIZES:%=$(outdir)/emmentaler-%.otf) \
117 » $(outdir)/emmentaler-brace.otf 71 $(outdir)/emmentaler-brace.otf
118 OTF_TABLES = $(STAFF_SIZES:%=$(outdir)/feta%.otf-table) \
119 » $(BRACES:%=$(outdir)/feta-braces-%.otf-table)
120 SVG_FILES = $(OTF_FILES:%.otf=%.svg) 72 SVG_FILES = $(OTF_FILES:%.otf=%.svg)
121 WOFF_FILES = $(OTF_FILES:%.otf=%.woff) 73 WOFF_FILES = $(OTF_FILES:%.otf=%.woff)
122 74
123 TEXGYRE_OTFS = $(addprefix $(TEXGYRE_DIR)/,$(TEXGYRE_FILES)) 75 TEXGYRE_OTFS = $(addprefix $(TEXGYRE_DIR)/,$(TEXGYRE_FILES))
124 URWOTF_OTFS = $(addprefix $(URWOTF_DIR)/,$(URWOTF_FILES)) 76 URWOTF_OTFS = $(addprefix $(URWOTF_DIR)/,$(URWOTF_FILES))
125 77
126 LILYPOND_FONTS_CONF = $(outdir)/00-lilypond-fonts.conf \ 78 LILYPOND_FONTS_CONF = $(outdir)/00-lilypond-fonts.conf \
127 » » $(outdir)/99-lilypond-fonts.conf 79 $(outdir)/99-lilypond-fonts.conf
128 80
129 LOG_FILES = $(FETA_MF_FILES:%.mf=$(outdir)/%.log) 81 ALL_GEN_FILES = $(OTF_FILES) \
130 LISP_FILES = $(FETA_MF_FILES:%.mf=$(outdir)/%.lisp)
131 ENC_FILES = $(FETA_MF_FILES:%.mf=$(outdir)/%.enc)
132 TFM_FILES = $(FETA_MF_FILES:%.mf=$(outdir)/%.tfm)
133
134 $(outdir)/emmentaler-brace.otf-gtable: $(BRACES:%=$(outdir)/feta-braces-%.otf-gt able)
135 » $(call ly_progress,Making,$@,)
136 » echo '(design_size . 20)' > $@
137
138 $(outdir)/feta%.otf-table: $(outdir)/feta%.lisp $(outdir)/parmesan%.lisp \
139 » $(outdir)/parmesan-noteheads%.lisp \
140 » $(outdir)/feta-noteheads%.lisp \
141 » $(outdir)/feta-flags%.lisp \
142 » $(outdir)/feta-alphabet%.lisp
143 » $(call ly_progress,Making,$@,< lisp)
144 » cat $^ > $@
145
146 $(outdir)/emmentaler-brace.otf-table: $(foreach x, a b c d e f g h i,$(outdir)/f eta-braces-$(x).lisp)
147 » $(call ly_progress,Making,$@,< lisp)
148 » cat $^ > $@
149
150 $(outdir)/emmentaler-brace.otf: $(outdir)/emmentaler-brace.subfonts \
151 » » » » $(outdir)/emmentaler-brace.fontname \
152 » » » » $(outdir)/emmentaler-brace.otf-table \
153 » » » » $(outdir)/emmentaler-brace.otf-gtable \
154 » » » » $(outdir)/emmentaler-brace.pe
155
156 $(outdir)/emmentaler-brace.fontname:
157 » $(call ly_progress,Making,$@,)
158 » printf 'emmentaler-brace' > $@
159
160 $(outdir)/emmentaler-brace.subfonts:
161 » $(call ly_progress,Making,$@,)
162 » echo $(subst .mf,,$(call src-wildcard,feta-braces-[a-z].mf)) > $@
163
164 $(outdir)/emmentaler-%.genpe: $(buildscript-dir)/gen-emmentaler-scripts
165 » $(call ly_progress,Making,$@,)
166 » $< --dir=$(outdir) --design-size=$(patsubst emmentaler-%.genpe,%,$(notdi r $@))
167
168 ALL_GEN_FILES = $(ENC_FILES) \
169 » » $(OTF_FILES) \
170 $(SVG_FILES) \ 82 $(SVG_FILES) \
171 $(WOFF_FILES) \ 83 $(WOFF_FILES) \
172 $(LILYPOND_FONTS_CONF) 84 $(LILYPOND_FONTS_CONF)
173 85
174 INSTALLATION_DIR = $(local_lilypond_datadir)/fonts/source 86 INSTALLATION_DIR = $(local_lilypond_datadir)/fonts/source
175 INSTALLATION_FILES = $(call src-wildcard,*.mf) 87 INSTALLATION_FILES = $(call src-wildcard,*.mf)
176 88
177 INSTALLATION_OUT_SUFFIXES = 1 2 3 89 INSTALLATION_OUT_SUFFIXES = 1 2 3
178 90
179 INSTALLATION_OUT_DIR1 = $(local_lilypond_datadir)/fonts/otf 91 INSTALLATION_OUT_DIR1 = $(local_lilypond_datadir)/fonts/otf
180 INSTALLATION_OUT_FILES1 = $(OTF_FILES) \ 92 INSTALLATION_OUT_FILES1 = $(OTF_FILES) \
181 $(TEXGYRE_OTFS) \ 93 $(TEXGYRE_OTFS) \
182 $(URWOTF_OTFS) 94 $(URWOTF_OTFS)
183 95
184 INSTALLATION_OUT_DIR2 = $(local_lilypond_datadir)/fonts/svg 96 INSTALLATION_OUT_DIR2 = $(local_lilypond_datadir)/fonts/svg
185 INSTALLATION_OUT_FILES2 = $(SVG_FILES) $(WOFF_FILES) 97 INSTALLATION_OUT_FILES2 = $(SVG_FILES) $(WOFF_FILES)
186 98
187 INSTALLATION_OUT_DIR3 = $(local_lilypond_datadir)/fonts 99 INSTALLATION_OUT_DIR3 = $(local_lilypond_datadir)/fonts
188 INSTALLATION_OUT_FILES3 = $(LILYPOND_FONTS_CONF) 100 INSTALLATION_OUT_FILES3 = $(LILYPOND_FONTS_CONF)
189 101
190 export MFINPUTS := .:$(MFINPUTS) 102
103 $(outdir)/emmentaler-brace.otf-gtable: $(BRACES:%=$(outdir)/feta-braces-%.otf-gt able)
104 » $(call ly_progress,Making,$@,)
105 » echo '(design_size . 20)' > $@
106
107 $(outdir)/feta%.otf-table: $(outdir)/feta%.lisp $(outdir)/parmesan%.lisp \
108 » $(outdir)/parmesan-noteheads%.lisp \
109 » $(outdir)/feta-noteheads%.lisp \
110 » $(outdir)/feta-flags%.lisp \
111 » $(outdir)/feta-alphabet%.lisp
112 » $(call ly_progress,Making,$@,< lisp)
113 » cat $^ > $@
114
115 $(outdir)/emmentaler-brace.otf-table: $(foreach x, a b c d e f g h i,$(outdir)/f eta-braces-$(x).lisp)
116 » $(call ly_progress,Making,$@,< lisp)
117 » cat $^ > $@
191 118
192 # A few rules here generate multiple files from one command line. For 119 # A few rules here generate multiple files from one command line. For
193 # treating this case, we only declare one output explicitly, and use a 120 # treating this case, we only declare one output explicitly, and use a
194 # dummy rules for the other outputs. The dummy rule uses 121 # dummy rules for the other outputs. The rules that create multiple
195 # $(UPDATE_TARGET) so the order of writing in the real command does 122 # files should touch all the outputs to ensure consistent timestamps.
196 # not confuse make.
197 UPDATE_TARGET = if test -f $@; then touch $@ ; fi
198 123
199 # only for fonts which 124 # only for fonts which
200 # 125 #
201 # 1. are mentioned in font.scm 126 # 1. are mentioned in font.scm
202 # 127 #
203 # 2. are not included with teTeX 128 # 2. are not included with teTeX
204 # 129 #
205 $(outdir)/%.lisp: $(outdir)/%.log $(outdir)/%.tfm 130 $(outdir)/%.lisp: $(outdir)/%.log $(outdir)/%.tfm
206 $(call ly_progress,Making,$@,< log) 131 $(call ly_progress,Making,$@,< log)
207 $(buildscript-dir)/mf-to-table \ 132 $(buildscript-dir)/mf-to-table \
208 --global-lisp=$(outdir)/$(<F:.log=.otf-gtable) \ 133 --global-lisp=$(outdir)/$(<F:.log=.otf-gtable) \
209 --lisp=$(outdir)/$(<F:.log=.lisp) \ 134 --lisp=$(outdir)/$(<F:.log=.lisp) \
210 --outdir=$(outdir) \ 135 --outdir=$(outdir) \
211 --enc $(outdir)/$(<F:.log=.enc) \ 136 --enc $(outdir)/$(<F:.log=.enc) \
212 $< 137 $<
138 touch $(outdir)/$(<F:.log=.otf-gtable) \
139 $(outdir)/$(<F:.log=.lisp) \
140 $(outdir)/$(<F:.log=.enc)
213 141
214 $(outdir)/%.otf-gtable $(outdir)/%.enc: $(outdir)/%.lisp 142 $(outdir)/%.otf-gtable $(outdir)/%.enc: $(outdir)/%.lisp
215 $(UPDATE_TARGET)
216 143
217 ## Putting pfb here forces all .pfb fonts to be built before
218 # fontforge starts generating emmentaler-*.* fonts.
219 $(outdir)/emmentaler-%.otf: $(outdir)/emmentaler-%.genpe \ 144 $(outdir)/emmentaler-%.otf: $(outdir)/emmentaler-%.genpe \
220 $(outdir)/feta%.pfb \ 145 $(outdir)/feta%.pfb \
221 $(outdir)/feta-noteheads%.pfb \ 146 $(outdir)/feta-noteheads%.pfb \
222 $(outdir)/feta-flags%.pfb \ 147 $(outdir)/feta-flags%.pfb \
223 $(outdir)/feta-alphabet%.pfb \ 148 $(outdir)/feta-alphabet%.pfb \
224 $(outdir)/parmesan%.pfb \ 149 $(outdir)/parmesan%.pfb \
225 $(outdir)/parmesan-noteheads%.pfb \ 150 $(outdir)/parmesan-noteheads%.pfb \
226 $(outdir)/feta%.otf-table \ 151 $(outdir)/feta%.otf-table \
227 » » » $(outdir)/feta%.otf-gtable \ 152 » » » $(outdir)/feta%.otf-gtable
228 » » » | pfb
229 $(call ly_progress,Making,$@,) 153 $(call ly_progress,Making,$@,)
230 cd $(outdir) && $(FONTFORGE) -script $(notdir $<) 154 cd $(outdir) && $(FONTFORGE) -script $(notdir $<)
155 touch $(outdir)/emmentaler-%.svg $(outdir)/emmentaler-%.woff $(outdir)/e mmentaler-%.otf
231 156
232 $(outdir)/emmentaler-%.svg $(outdir)/emmentaler-%.woff: $(outdir)/emmentaler-%.o tf 157 $(outdir)/emmentaler-%.svg $(outdir)/emmentaler-%.woff: $(outdir)/emmentaler-%.o tf
233 $(UPDATE_TARGET)
234 158
235 $(outdir)/emmentaler-brace.otf: $(outdir)/emmentaler-brace.pe\ 159 $(outdir)/emmentaler-brace.otf: $(outdir)/emmentaler-brace.pe\
236 $(foreach s,$(BRACES),$(outdir)/feta-braces-$(s).pfb) \ 160 $(foreach s,$(BRACES),$(outdir)/feta-braces-$(s).pfb) \
237 » » $(outdir)/emmentaler-brace.otf-table $(outdir)/emmentaler -brace.otf-gtable \ 161 » » $(outdir)/emmentaler-brace.otf-table \
238 » » | pfb 162 » » » $(outdir)/emmentaler-brace.otf-gtable \
163 » » » $(outdir)/emmentaler-brace.subfonts
239 $(call ly_progress,Making,$@,) 164 $(call ly_progress,Making,$@,)
240 cd $(outdir) && $(FONTFORGE) -script emmentaler-brace.pe 165 cd $(outdir) && $(FONTFORGE) -script emmentaler-brace.pe
166 touch $(outdir)/emmentaler-brace.svg $(outdir)/emmentaler-brace.woff $(o utdir)/emmentaler-brace.otf
241 167
242 $(outdir)/emmentaler-brace.svg $(outdir)/emmentaler-brace.woff: $(outdir)/emment aler-brace.otf 168 $(outdir)/emmentaler-brace.svg $(outdir)/emmentaler-brace.woff: $(outdir)/emment aler-brace.otf
243 $(UPDATE_TARGET)
244 169
245 default: tree-regen \ 170 default: tree-regen \
246 $(outdir)/fonts.conf 171 $(outdir)/fonts.conf
247 172
248 .PHONY: tree-regen 173 .PHONY: tree-regen
249 174
250 tree-regen: $(ALL_GEN_FILES) 175 tree-regen: $(ALL_GEN_FILES)
251 ${MAKE} -C $(top-build-dir) link-mf-tree 176 ${MAKE} -C $(top-build-dir) link-mf-tree
252 177
253
254 local-clean:
255 rm -f mfplain.mem mfplain.log
256 rm -f *.tfm *.log
257
258
259 $(outdir)/fonts.conf: 178 $(outdir)/fonts.conf:
260 $(call ly_progress,Making,$@,) 179 $(call ly_progress,Making,$@,)
261 echo '<fontconfig><dir>'$(shell cd $(outdir); pwd)'</dir></fontconfig>' > $@ 180 echo '<fontconfig><dir>'$(shell cd $(outdir); pwd)'</dir></fontconfig>' > $@
OLDNEW
« no previous file with comments | « no previous file | mf/invoke-mf2pt1.sh » ('j') | no next file with comments »

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b