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