]> git.donarmstrong.com Git - lilypond.git/blob - mf/GNUmakefile
9da619c823df9cda42b3874466293b928b3ab900
[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 # These are the main .mf files.  We don't use $(MF_FILES) here,
11 # because there are more .mf files, input'ed into the main files.
12 FETA_MF_FILES = $(call src-wildcard,feta[0-9]*.mf) \
13                 $(call src-wildcard,feta-braces-[a-z].mf) \
14                 $(call src-wildcard,feta-alphabet*[0-9].mf) \
15                 $(call src-wildcard,feta-noteheads*[0-9].mf) \
16                 $(call src-wildcard,feta-flags*[0-9].mf) \
17                 $(call src-wildcard,parmesan[0-9]*.mf) \
18                 $(call src-wildcard,parmesan-noteheads*[0-9].mf)
19 FETA_FONTS = $(FETA_MF_FILES:.mf=)
20 ALL_FONTS = $(FETA_FONTS)
21 PFB_FILES = $(ALL_FONTS:%=$(outdir)/%.pfb)
22
23 include $(depth)/make/stepmake.make
24
25
26 EXTRA_DIST_FILES += README mf2pt1.mp
27
28 STAFF_SIZES = 11 13 14 16 18 20 23 26
29 BRACES = a b c d e f g h i
30
31 OTF_FILES = $(STAFF_SIZES:%=$(outdir)/emmentaler-%.otf) \
32             $(outdir)/emmentaler-brace.otf
33 PE_SCRIPTS = $(STAFF_SIZES:%=$(outdir)/emmentaler-%.pe)
34 OTF_TABLES = $(STAFF_SIZES:%=$(outdir)/feta%.otf-table) \
35              $(BRACES:%=$(outdir)/feta-braces-%.otf-table)
36 SVG_FILES = $(OTF_FILES:%.otf=%.svg)
37 WOFF_FILES = $(OTF_FILES:%.otf=%.woff)
38
39 NCSB_OTFS = $(addprefix $(outdir)/,CenturySchL-Ital.otf \
40                                    CenturySchL-BoldItal.otf \
41                                    CenturySchL-Roma.otf \
42                                    CenturySchL-Bold.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
57 ## ugh -- we want this to prevent failing -j2 compiles.
58 define FETAxx-PREREQUISITES
59
60
61 $(outdir)/feta$(i).otf-table: $(outdir)/feta$(i).lisp \
62                             $(outdir)/feta-noteheads$(i).lisp \
63                             $(outdir)/feta-flags$(i).lisp \
64                             $(outdir)/parmesan$(i).lisp \
65                             $(outdir)/parmesan-noteheads$(i).lisp \
66                             $(outdir)/feta-alphabet$(i).lisp
67 endef
68
69 $(eval $(foreach i,$(STAFF_SIZES),$(FETAxx-PREREQUISITES)))
70
71 $(outdir)/%.otf-table: $(outdir)/%.lisp
72         cat $< $(if $(findstring brace,$<),,$(subst feta,parmesan,$<)) \
73                $(if $(findstring brace,$<),,$(subst feta,parmesan-noteheads,$<)) \
74                $(if $(findstring brace,$<),,$(subst feta,feta-noteheads,$<)) \
75                $(if $(findstring brace,$<),,$(subst feta,feta-flags,$<)) \
76                $(if $(findstring brace,$<),,$(subst feta,feta-alphabet,$<)) > $@
77
78
79 $(outdir)/emmentaler-brace.otf: $(outdir)/emmentaler-brace.subfonts \
80                                 $(outdir)/emmentaler-brace.fontname \
81                                 $(outdir)/emmentaler-brace.otf-table \
82                                 $(outdir)/emmentaler-brace.otf-gtable \
83                                 $(outdir)/emmentaler-brace.pe
84
85 $(outdir)/emmentaler-brace.otf\
86  $(outdir)/emmentaler-brace.svg\
87  $(outdir)/emmentaler-brace.woff: $(BRACES:%=$(outdir)/feta-braces-%.pfb)
88
89 $(outdir)/emmentaler-brace.fontname:
90         printf 'emmentaler-brace' > $@
91 $(outdir)/emmentaler-brace.subfonts:
92         echo $(subst .mf,,$(call src-wildcard,feta-braces-[a-z].mf)) > $@
93
94 $(PE_SCRIPTS): $(buildscript-dir)/gen-emmentaler-scripts
95         $< --dir=$(outdir)
96
97
98 # Generate emmentaler-*.pe scripts first, and *.otf, *.svg, *.woff files last,
99 # so that normally these files aren't regenerated on a subsequent call to make.
100 ALL_GEN_FILES = $(PE_SCRIPTS) \
101                 $(LOG_FILES) \
102                 $(ENC_FILES) \
103                 $(LISP_FILES) \
104                 $(OTF_TABLES) \
105                 $(NCSB_OTFS) \
106                 $(OTF_FILES) \
107                 $(SVG_FILES) \
108                 $(WOFF_FILES)
109
110 # PRE_INSTALL=$(MAKE) "$(ALL_GEN_FILES)"
111
112 INSTALLATION_DIR = $(local_lilypond_datadir)/fonts/source
113 INSTALLATION_FILES = $(MF_FILES)
114
115 INSTALLATION_OUT_SUFFIXES = 1 2
116
117 INSTALLATION_OUT_DIR1 = $(local_lilypond_datadir)/fonts/otf
118 INSTALLATION_OUT_FILES1 = $(OTF_FILES) \
119                           $(NCSB_OTFS)
120
121 INSTALLATION_OUT_DIR2 = $(local_lilypond_datadir)/fonts/svg
122 INSTALLATION_OUT_FILES2 = $(SVG_FILES) $(WOFF_FILES)
123
124 export MFINPUTS := .:$(MFINPUTS)
125
126 # only for fonts which
127 #
128 # 1. are mentioned in font.scm
129 #
130 # 2. are not included with teTeX
131 #
132 $(outdir)/%.lisp \
133 $(outdir)/%.otf-gtable \
134 $(outdir)/%.enc \
135 $(outdir)/%.pe: $(outdir)/%.log $(outdir)/%.tfm
136         $(buildscript-dir)/mf-to-table \
137                 --global-lisp=$(outdir)/$(<F:.log=.otf-gtable) \
138                 --lisp=$(outdir)/$(<F:.log=.lisp) \
139                 --outdir=$(outdir) \
140                 --enc $(outdir)/$(<F:.log=.enc) \
141                 $<
142
143 ## Putting pfb here forces all .pfb fonts to be built before
144 # fontforge starts generating emmentaler-*.* fonts.
145 $(outdir)/emmentaler-%.otf \
146 $(outdir)/emmentaler-%.svg \
147 $(outdir)/emmentaler-%.woff: $(outdir)/emmentaler-%.pe \
148                             $(outdir)/feta%.pfb \
149                             $(outdir)/feta-noteheads%.pfb \
150                             $(outdir)/feta-flags%.pfb \
151                             $(outdir)/feta-alphabet%.pfb \
152                             $(outdir)/parmesan%.pfb \
153                             $(outdir)/parmesan-noteheads%.pfb \
154                             $(outdir)/feta%.otf-table \
155                             $(outdir)/feta%.otf-gtable \
156                             | pfb
157         cd $(outdir) && $(FONTFORGE) -script $(notdir $<)
158
159 $(outdir)/emmentaler-brace.otf\
160  $(outdir)/emmentaler-brace.svg\
161  $(outdir)/emmentaler-brace.woff: $(outdir)/emmentaler-brace.pe\
162                        $(foreach s,$(BRACES),$(outdir)/feta-braces-$(s).pfb) \
163                        $(outdir)/emmentaler-brace.otf-table $(outdir)/emmentaler-brace.otf-gtable \
164                        | pfb
165         cd $(outdir) && $(FONTFORGE) -script emmentaler-brace.pe
166
167 default: $(ALL_GEN_FILES) \
168          $(outdir)/emmentaler-20.otf \
169          tree-regen \
170          $(outdir)/fonts.conf
171
172 .PHONY: tree-regen
173
174 # FIXME: temporary hack: must regenerate after building fonts
175 tree-regen: $(ALL_GEN_FILES)
176         ${MAKE} -C $(top-build-dir) link-mf-tree
177
178 $(outdir)/%.lisp \
179 $(outdir)/%.otf-gtable \
180 $(outdir)/%.enc \
181 $(outdir)/%.pe: $(outdir)/%.log $(outdir)/%.tfm
182         $(buildscript-dir)/mf-to-table \
183                 --global-lisp=$(outdir)/$(<F:.log=.otf-gtable) \
184                 --lisp=$(outdir)/$(<F:.log=.lisp) \
185                 --outdir=$(outdir) \
186                 --enc $(outdir)/$(<F:.log=.enc) \
187                 $<
188
189 local-clean:
190         rm -f mfplain.mem mfplain.log
191         rm -f *.tfm *.log
192
193
194 $(outdir)/fonts.conf:
195         echo '<fontconfig><dir>'$(shell cd $(outdir); pwd)'</dir></fontconfig>' > $@
196
197 $(NCSB_OTFS): $(NCSB_SOURCE_FILES) \
198               $(auxscript-dir)/pfx2ttf.fontforge
199         $(foreach i, $(basename $(NCSB_SOURCE_FILES)), \
200                 $(FONTFORGE) -script $(auxscript-dir)/pfx2ttf.fontforge \
201                         $(i).pfb $(i).afm $(outdir)/ && ) true
202 # eof