]> git.donarmstrong.com Git - lilypond.git/blob - mf/GNUmakefile
Generate a .pe script for one design size at a time.
[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 OTF_TABLES = $(STAFF_SIZES:%=$(outdir)/feta%.otf-table) \
34              $(BRACES:%=$(outdir)/feta-braces-%.otf-table)
35 SVG_FILES = $(OTF_FILES:%.otf=%.svg)
36 WOFF_FILES = $(OTF_FILES:%.otf=%.woff)
37
38 NCSB_OTFS = $(addprefix $(outdir)/,CenturySchL-Ital.otf \
39                                    CenturySchL-BoldItal.otf \
40                                    CenturySchL-Roma.otf \
41                                    CenturySchL-Bold.otf)
42
43 LOG_FILES = $(FETA_MF_FILES:%.mf=$(outdir)/%.log)
44 LISP_FILES = $(FETA_MF_FILES:%.mf=$(outdir)/%.lisp)
45 ENC_FILES = $(FETA_MF_FILES:%.mf=$(outdir)/%.enc)
46 TFM_FILES = $(FETA_MF_FILES:%.mf=$(outdir)/%.tfm)
47
48 $(outdir)/emmentaler-brace.otf-table: $(BRACES:%=$(outdir)/feta-braces-%.otf-table)
49         cat $^ > $@
50
51 $(outdir)/emmentaler-brace.otf-gtable: $(BRACES:%=$(outdir)/feta-braces-%.otf-gtable)
52         echo '(design_size . 20)' > $@
53
54 $(outdir)/%.otf-table: $(outdir)/%.lisp
55         cat $< $(if $(findstring brace,$<),,$(subst feta,parmesan,$<)) \
56                $(if $(findstring brace,$<),,$(subst feta,parmesan-noteheads,$<)) \
57                $(if $(findstring brace,$<),,$(subst feta,feta-noteheads,$<)) \
58                $(if $(findstring brace,$<),,$(subst feta,feta-flags,$<)) \
59                $(if $(findstring brace,$<),,$(subst feta,feta-alphabet,$<)) > $@
60
61
62 $(outdir)/emmentaler-brace.otf: $(outdir)/emmentaler-brace.subfonts \
63                                 $(outdir)/emmentaler-brace.fontname \
64                                 $(outdir)/emmentaler-brace.otf-table \
65                                 $(outdir)/emmentaler-brace.otf-gtable \
66                                 $(outdir)/emmentaler-brace.pe
67
68 $(outdir)/emmentaler-brace.fontname:
69         printf 'emmentaler-brace' > $@
70 $(outdir)/emmentaler-brace.subfonts:
71         echo $(subst .mf,,$(call src-wildcard,feta-braces-[a-z].mf)) > $@
72
73 $(outdir)/emmentaler-%.genpe: $(buildscript-dir)/gen-emmentaler-scripts
74         $< --dir=$(outdir) --design-size=$(patsubst emmentaler-%.genpe,%,$(notdir $@))
75
76 # Generate emmentaler-*.pe scripts first, and *.otf, *.svg, *.woff files last,
77 # so that normally these files aren't regenerated on a subsequent call to make.
78 ALL_GEN_FILES = $(PE_SCRIPTS) \
79                 $(LOG_FILES) \
80                 $(ENC_FILES) \
81                 $(LISP_FILES) \
82                 $(OTF_TABLES) \
83                 $(NCSB_OTFS) \
84                 $(OTF_FILES) \
85                 $(SVG_FILES) \
86                 $(WOFF_FILES)
87
88 # PRE_INSTALL=$(MAKE) "$(ALL_GEN_FILES)"
89
90 INSTALLATION_DIR = $(local_lilypond_datadir)/fonts/source
91 INSTALLATION_FILES = $(MF_FILES)
92
93 INSTALLATION_OUT_SUFFIXES = 1 2
94
95 INSTALLATION_OUT_DIR1 = $(local_lilypond_datadir)/fonts/otf
96 INSTALLATION_OUT_FILES1 = $(OTF_FILES) \
97                           $(NCSB_OTFS)
98
99 INSTALLATION_OUT_DIR2 = $(local_lilypond_datadir)/fonts/svg
100 INSTALLATION_OUT_FILES2 = $(SVG_FILES) $(WOFF_FILES)
101
102 export MFINPUTS := .:$(MFINPUTS)
103
104 # A few rules here generate multiple files from one command line.  For
105 # treating this case, we only declare one output explicitly, and use a
106 # dummy rules for the other outputs. The dummy rule uses
107 # $(UPDATE_TARGET) so the order of writing in the real command does
108 # not confuse make.
109 UPDATE_TARGET = if test -f $@; then touch $@ ; fi
110
111 # only for fonts which
112 #
113 # 1. are mentioned in font.scm
114 #
115 # 2. are not included with teTeX
116 #
117 $(outdir)/%.lisp: $(outdir)/%.log $(outdir)/%.tfm
118         $(buildscript-dir)/mf-to-table \
119                 --global-lisp=$(outdir)/$(<F:.log=.otf-gtable) \
120                 --lisp=$(outdir)/$(<F:.log=.lisp) \
121                 --outdir=$(outdir) \
122                 --enc $(outdir)/$(<F:.log=.enc) \
123                 $<
124
125 $(outdir)/%.otf-gtable $(outdir)/%.enc: $(outdir)/%.lisp
126         $(UPDATE_TARGET)
127
128 ## Putting pfb here forces all .pfb fonts to be built before
129 # fontforge starts generating emmentaler-*.* fonts.
130 $(outdir)/emmentaler-%.otf: $(outdir)/emmentaler-%.genpe \
131                             $(outdir)/feta%.pfb \
132                             $(outdir)/feta-noteheads%.pfb \
133                             $(outdir)/feta-flags%.pfb \
134                             $(outdir)/feta-alphabet%.pfb \
135                             $(outdir)/parmesan%.pfb \
136                             $(outdir)/parmesan-noteheads%.pfb \
137                             $(outdir)/feta%.otf-table \
138                             $(outdir)/feta%.otf-gtable \
139                             | pfb
140         cd $(outdir) && $(FONTFORGE) -script $(notdir $<)
141
142 $(outdir)/emmentaler-%.svg $(outdir)/emmentaler-%.woff: $(outdir)/emmentaler-%.otf
143         $(UPDATE_TARGET)
144
145 $(outdir)/emmentaler-brace.otf: $(outdir)/emmentaler-brace.pe\
146                        $(foreach s,$(BRACES),$(outdir)/feta-braces-$(s).pfb) \
147                        $(outdir)/emmentaler-brace.otf-table $(outdir)/emmentaler-brace.otf-gtable \
148                        | pfb
149         cd $(outdir) && $(FONTFORGE) -script emmentaler-brace.pe
150
151 $(outdir)/emmentaler-brace.svg $(outdir)/emmentaler-brace.woff: $(outdir)/emmentaler-brace.otf
152         $(UPDATE_TARGET)
153
154 default: $(ALL_GEN_FILES) \
155          $(outdir)/emmentaler-20.otf \
156          tree-regen \
157          $(outdir)/fonts.conf
158
159 .PHONY: tree-regen
160
161 # FIXME: temporary hack: must regenerate after building fonts
162 tree-regen: $(ALL_GEN_FILES)
163         ${MAKE} -C $(top-build-dir) link-mf-tree
164
165
166 local-clean:
167         rm -f mfplain.mem mfplain.log
168         rm -f *.tfm *.log
169
170
171 $(outdir)/fonts.conf:
172         echo '<fontconfig><dir>'$(shell cd $(outdir); pwd)'</dir></fontconfig>' > $@
173
174
175 $(outdir)/CenturySchL-Roma.otf: $(NCSB_SOURCE_FILES) \
176               $(auxscript-dir)/pfx2ttf.fontforge
177         $(foreach i, $(basename $(NCSB_SOURCE_FILES)), \
178                 $(FONTFORGE) -script $(auxscript-dir)/pfx2ttf.fontforge \
179                         $(i).pfb $(i).afm $(outdir)/ && ) true
180
181 $(addprefix $(outdir)/,CenturySchL-Ital.otf \
182         CenturySchL-Bold.otf \
183         CenturySchL-BoldItal.otf): $(outdir)/CenturySchL-Roma.otf
184         $(UPDATE_TARGET)