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