]> git.donarmstrong.com Git - lilypond.git/blob - mf/GNUmakefile
532a25ec7bad31fea18211e9faa15a82002d6b05
[lilypond.git] / mf / GNUmakefile
1 # mf/GNUmakefile
2
3 depth = ..
4
5 STEPMAKE_TEMPLATES = metafont \
6                      install \
7                      install-out
8 LOCALSTEPMAKE_TEMPLATES = lilypond
9
10 include $(depth)/make/stepmake.make
11
12
13 EXTRA_DIST_FILES += README mf2pt1.mp
14
15 # We don't use $(MF_FILES), because there's more .mf cruft here
16 FETA_MF_FILES = $(call src-wildcard,feta[0-9]*.mf) \
17                 $(call src-wildcard,feta-braces-[a-z].mf) \
18                 $(call src-wildcard,feta-alphabet*[0-9].mf) \
19                 $(call src-wildcard,feta-noteheads*[0-9].mf) \
20                 $(call src-wildcard,feta-flags*[0-9].mf) \
21                 $(call src-wildcard,parmesan[0-9]*.mf) \
22                 $(call src-wildcard,parmesan-noteheads*[0-9].mf)
23
24 STAFF_SIZES = 11 13 14 16 18 20 23 26
25 BRACES = a b c d e f g h i
26
27 OTF_FILES = $(STAFF_SIZES:%=$(outdir)/emmentaler-%.otf) \
28             $(outdir)/emmentaler-brace.otf
29 PE_SCRIPTS = $(STAFF_SIZES:%=$(outdir)/emmentaler-%.pe)
30 OTF_TABLES = $(STAFF_SIZES:%=$(outdir)/feta%.otf-table) \
31              $(BRACES:%=$(outdir)/feta-braces-%.otf-table)
32 FETA_FONTS = $(FETA_MF_FILES:.mf=)
33 SVG_FILES = $(OTF_FILES:%.otf=%.svg)
34 WOFF_FILES = $(OTF_FILES:%.otf=%.woff)
35
36 FC_FIND = $(shell $(FCLIST) --verbose 'Century Schoolbook L:style=$(1)' \
37                   | grep 'file:' \
38                   | sed 's/.*"\([^"]*\)".*/\1/g')
39
40 NCSB_OTFS = $(addprefix $(outdir)/,CenturySchL-Ital.otf \
41                                    CenturySchL-BoldItal.otf \
42                                    CenturySchL-Roma.otf \
43                                    CenturySchL-Bold.otf)
44 NCSB_INSTALL_DIR = $(local_lilypond_datadir)/fonts/otf
45
46 LOG_FILES = $(FETA_MF_FILES:%.mf=$(outdir)/%.log)
47 LISP_FILES = $(FETA_MF_FILES:%.mf=$(outdir)/%.lisp)
48 ENC_FILES = $(FETA_MF_FILES:%.mf=$(outdir)/%.enc)
49 TFM_FILES = $(FETA_MF_FILES:%.mf=$(outdir)/%.tfm)
50
51 $(outdir)/emmentaler-brace.otf-table: $(BRACES:%=$(outdir)/feta-braces-%.otf-table)
52         cat $^ > $@
53
54 $(outdir)/emmentaler-brace.otf-gtable: $(BRACES:%=$(outdir)/feta-braces-%.otf-gtable)
55         echo '(design_size . 20)' > $@
56
57
58 # only for fonts which
59 #
60 # 1. are mentioned in font.scm
61 #
62 # 2. are not included with teTeX
63 #
64
65 $(outdir)/emmentaler-%.otf\
66  $(outdir)/emmentaler-%.svg\
67  $(outdir)/emmentaler-%.woff: $(outdir)/emmentaler-%.pe \
68                             $(outdir)/feta%.pfb \
69                             $(outdir)/feta-noteheads%.pfb \
70                             $(outdir)/feta-flags%.pfb \
71                             $(outdir)/feta-alphabet%.pfb \
72                             $(outdir)/parmesan%.pfb \
73                             $(outdir)/parmesan-noteheads%.pfb \
74                             $(outdir)/feta%.otf-table \
75                             $(outdir)/feta%.otf-gtable
76         cd $(outdir) && $(FONTFORGE) -script $(notdir $(basename ,$@).pe)
77
78 $(outdir)/emmentaler-brace.otf\
79  $(outdir)/emmentaler-brace.svg\
80  $(outdir)/emmentaler-brace.woff: $(outdir)/emmentaler-brace.pe \
81                        $(foreach s,$(BRACES),$(outdir)/feta-braces-$(s).pfb) \
82                        $(outdir)/emmentaler-brace.otf-table $(outdir)/emmentaler-brace.otf-gtable
83         cd $(outdir) && $(FONTFORGE) -script emmentaler-brace.pe
84
85 $(outdir)/%.pfb: $(outdir)/%.log
86
87 $(outdir)/%.otf-table: $(outdir)/%.lisp
88         cat $< $(if $(findstring brace,$<),,$(subst feta,parmesan,$<)) \
89                $(if $(findstring brace,$<),,$(subst feta,parmesan-noteheads,$<)) \
90                $(if $(findstring brace,$<),,$(subst feta,feta-noteheads,$<)) \
91                $(if $(findstring brace,$<),,$(subst feta,feta-flags,$<)) \
92                $(if $(findstring brace,$<),,$(subst feta,feta-alphabet,$<)) > $@
93
94
95 ## ugh -- we want this to prevent failing -j2 compiles.
96 $(outdir)/feta26.otf-table: $(outdir)/feta26.lisp \
97                             $(outdir)/feta-noteheads26.lisp \
98                             $(outdir)/feta-flags26.lisp \
99                             $(outdir)/parmesan26.lisp \
100                             $(outdir)/parmesan-noteheads26.lisp \
101                             $(outdir)/feta-alphabet26.lisp
102 $(outdir)/feta23.otf-table: $(outdir)/feta23.lisp \
103                             $(outdir)/feta-noteheads23.lisp \
104                             $(outdir)/feta-flags23.lisp \
105                             $(outdir)/parmesan23.lisp \
106                             $(outdir)/parmesan-noteheads23.lisp \
107                             $(outdir)/feta-alphabet23.lisp
108 $(outdir)/feta20.otf-table: $(outdir)/feta20.lisp \
109                             $(outdir)/feta-noteheads20.lisp \
110                             $(outdir)/feta-flags20.lisp \
111                             $(outdir)/parmesan20.lisp \
112                             $(outdir)/parmesan-noteheads20.lisp \
113                             $(outdir)/feta-alphabet20.lisp
114 $(outdir)/feta18.otf-table: $(outdir)/feta18.lisp \
115                             $(outdir)/feta-noteheads18.lisp \
116                             $(outdir)/feta-flags18.lisp \
117                             $(outdir)/parmesan18.lisp \
118                             $(outdir)/parmesan-noteheads18.lisp \
119                             $(outdir)/feta-alphabet18.lisp
120 $(outdir)/feta16.otf-table: $(outdir)/feta16.lisp \
121                             $(outdir)/feta-noteheads16.lisp \
122                             $(outdir)/feta-flags16.lisp \
123                             $(outdir)/parmesan16.lisp \
124                             $(outdir)/parmesan-noteheads16.lisp \
125                             $(outdir)/feta-alphabet16.lisp
126 $(outdir)/feta14.otf-table: $(outdir)/feta14.lisp \
127                             $(outdir)/feta-noteheads14.lisp \
128                             $(outdir)/feta-flags14.lisp \
129                             $(outdir)/parmesan14.lisp \
130                             $(outdir)/parmesan-noteheads14.lisp \
131                             $(outdir)/feta-alphabet14.lisp
132 $(outdir)/feta13.otf-table: $(outdir)/feta13.lisp \
133                             $(outdir)/feta-noteheads13.lisp \
134                             $(outdir)/feta-flags13.lisp \
135                             $(outdir)/parmesan13.lisp \
136                             $(outdir)/parmesan-noteheads13.lisp \
137                             $(outdir)/feta-alphabet13.lisp
138 $(outdir)/feta11.otf-table: $(outdir)/feta11.lisp \
139                             $(outdir)/feta-noteheads11.lisp \
140                             $(outdir)/feta-flags11.lisp \
141                             $(outdir)/parmesan11.lisp \
142                             $(outdir)/parmesan-noteheads11.lisp \
143                             $(outdir)/feta-alphabet11.lisp
144
145 $(outdir)/emmentaler-brace.otf: $(outdir)/emmentaler-brace.subfonts \
146                                 $(outdir)/emmentaler-brace.fontname \
147                                 $(outdir)/emmentaler-brace.otf-table \
148                                 $(outdir)/emmentaler-brace.otf-gtable \
149                                 $(outdir)/emmentaler-brace.pe
150
151 $(outdir)/emmentaler-brace.otf\
152  $(outdir)/emmentaler-brace.svg\
153  $(outdir)/emmentaler-brace.woff: $(BRACES:%=$(outdir)/feta-braces-%.pfb)
154
155 $(outdir)/emmentaler-brace.fontname:
156         printf 'emmentaler-brace' > $@
157 $(outdir)/emmentaler-brace.subfonts:
158         echo $(subst .mf,,$(call src-wildcard,feta-braces-[a-z].mf)) > $@
159
160 $(PE_SCRIPTS): $(buildscript-dir)/gen-emmentaler-scripts
161         $< --dir=$(outdir)
162
163 ALL_FONTS = $(FETA_FONTS)
164 PFB_FILES = $(ALL_FONTS:%=$(outdir)/%.pfb)
165
166
167 # Make tfm files first, log files last,
168 # so that normally log files aren't made twice
169 ALL_GEN_FILES = $(LOG_FILES) \
170                 $(ENC_FILES) \
171                 $(LISP_FILES) \
172                 $(OTF_TABLES) \
173                 $(NCSB_OTFS) \
174                 $(OTF_FILES) \
175                 $(SVG_FILES) \
176                 $(WOFF_FILES)
177
178 # PRE_INSTALL=$(MAKE) "$(ALL_GEN_FILES)"
179
180 INSTALLATION_DIR = $(local_lilypond_datadir)/fonts/source
181 INSTALLATION_FILES = $(MF_FILES)
182
183 INSTALLATION_OUT_SUFFIXES = 1 2 3
184
185 INSTALLATION_OUT_DIR1 = $(local_lilypond_datadir)/fonts/otf
186 INSTALLATION_OUT_FILES1 = $(OTF_FILES) \
187                           $(NCSB_OTFS)
188
189 INSTALLATION_OUT_DIR2 = $(local_lilypond_datadir)/fonts/svg
190 INSTALLATION_OUT_FILES2 = $(SVG_FILES) $(WOFF_FILES)
191
192 export MFINPUTS := .:$(MFINPUTS)
193
194
195 default: $(PFB_FILES) $(ALL_GEN_FILES) \
196          $(outdir)/emmentaler-20.otf \
197          tree-regen \
198          $(outdir)/fonts.conf
199
200 .PHONY: tree-regen
201
202 # FIXME: temporary hack: must regenerate after building fonts
203 tree-regen: $(ALL_GEN_FILES)
204         ${MAKE} -C $(top-build-dir) link-mf-tree
205
206 ##
207 ## todo: this also depends on .tfm, FIXME.
208 $(outdir)/%.lisp \
209 $(outdir)/%.otf-gtable \
210 $(outdir)/%.enc \
211 $(outdir)/%.pe: $(outdir)/%.log
212         $(buildscript-dir)/mf-to-table \
213                 --global-lisp=$(outdir)/$(<F:.log=.otf-gtable) \
214                 --lisp=$(outdir)/$(<F:.log=.lisp) \
215                 --outdir=$(outdir) \
216                 --enc $(outdir)/$(<F:.log=.enc) \
217                 $<
218
219 local-clean:
220         rm -f mfplain.mem mfplain.log
221         rm -f *.tfm *.log
222
223
224 $(outdir)/fonts.conf:
225         echo '<fontconfig><dir>'$(shell cd $(outdir); pwd)'</dir></fontconfig>' > $@
226
227 $(NCSB_OTFS): $(NCSB_SOURCE_FILES) \
228               $(auxscript-dir)/pfx2ttf.fontforge
229         $(foreach i, $(basename $(NCSB_SOURCE_FILES)), \
230                 $(FONTFORGE) -script $(auxscript-dir)/pfx2ttf.fontforge \
231                         $(i).pfb $(i).afm $(outdir)/ && ) true
232
233 # eof