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