]> git.donarmstrong.com Git - lilypond.git/blob - mf/GNUmakefile
* mf/aybabtu.pe.in (i): remove PFAaybabtu generation
[lilypond.git] / mf / GNUmakefile
1 depth = ..
2
3 STEPMAKE_TEMPLATES=metafont install install-out
4 LOCALSTEPMAKE_TEMPLATES=lilypond
5
6 include $(depth)/make/stepmake.make
7
8 AF_FILES = $(call src-wildcard,*.af)
9
10 # hangs on feta23
11 MFTRACE_FLAGS=  # --simplify
12
13 EXTRA_DIST_FILES += README feta.tex
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  $(STAFF_SIZES:%=$(outdir)/emmentaler-%.dep)
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) $(ALL_FONTS:%=$(outdir)/%.svg)
32
33
34 NCSB_SOURCE_FILES=c059013l c059016l c059033l c059036l
35 NCSB_TTFS=$(addprefix $(outdir)/,CenturySchL-Ital.ttf CenturySchL-BoldItal.ttf CenturySchL-Roma.ttf CenturySchL-Bold.ttf)
36 NCSB_INSTALL_DIR=$(local_lilypond_datadir)/fonts/otf
37
38 LOG_FILES = $(FETA_MF_FILES:%.mf=$(outdir)/%.log)
39 LISP_FILES = $(FETA_MF_FILES:%.mf=$(outdir)/%.lisp)
40 TEXTABLES = $(FETA_MF_FILES:%.mf=$(outdir)/%.tex)
41 ENC_FILES = $(TEXTABLES:.tex=.enc)
42 TFM_FILES = $(FETA_MF_FILES:%.mf=$(outdir)/%.tfm)\
43  $(SAUTER_FONTS:%=$(outdir)/%.tfm)
44
45
46 ENCODING_FILE=$(findstring $(<F:.mf=.enc), $(FETA_MF_FILES:.mf=.enc))
47 MFTRACE_FLAGS=$(if $(ENCODING_FILE),--encoding $(ENCODING_FILE),) --no-afm
48
49 $(outdir)/aybabtu.otf-table: $(BRACES:%=$(outdir)/feta-braces-%.otf-table)
50         cat $^ > $@
51
52 $(outdir)/aybabtu.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 define MAKE_OTF
63         (cd $(outdir) && $(FONTFORGE) -script $(1))
64         $(PYTHON) $(buildscript-dir)/substitute-encoding.py --outdir=$(outdir) $(2)
65 endef
66
67 define EMMENTALER_RULE \
68 $(outdir)/$(PFA_PREFIX)emmentaler-$(1).pfa $(outdir)/emmentaler-$(1).otf $(outdir)/emmentaler-$(1).svg: $(outdir)/emmentaler-$(1).pe $(outdir)/feta$(1).pfa  $(outdir)/feta-alphabet$(1).pfa  $(outdir)/parmesan$(1).pfa \
69         $(call MAKE_OTF,emmentaler-$(1).pe, $(outdir)/PFAemmentaler-$(1).pfa)
70 endef
71
72 $(foreach size, $(STAFF_SIZES), $(eval $(call EMMENTALER_RULE,$(size))))
73
74 $(outdir)/$(PFA_PREFIX)aybabtu.pfa $(outdir)/aybabtu.otf $(outdir)/aybabtu.svg: $(outdir)/aybabtu.pe $(foreach s,$(BRACES),$(outdir)/feta-braces-$(s).pfa)
75         $(call MAKE_OTF,aybabtu.pe, $(outdir)/PFAaybabtu.pfa)
76         -rm -f $(outdir)/*.scale.{pfa,afm}
77
78 $(outdir)/%.pfa: $(outdir)/%.log
79
80 $(outdir)/%.otf-table: $(outdir)/%.lisp $(if $(findstring brace,$<),,$(subst feta,parmesan,$<))
81         cat $< \
82                 $(if $(findstring brace,$<),,$(subst feta,parmesan,$<)) \
83                 $(if $(findstring brace,$<),,$(subst feta,feta-alphabet,$<)) > $@
84
85 $(outdir)/aybabtu.otf: $(outdir)/aybabtu.subfonts $(outdir)/aybabtu.fontname $(outdir)/aybabtu.otf-table $(outdir)/aybabtu.otf-gtable $(outdir)/aybabtu.pe
86
87 $(outdir)/aybabtu.otf $(outdir)/aybabtu.svg: $(BRACES:%=$(outdir)/feta-braces-%.pfa)
88
89 $(outdir)/aybabtu.fontname:
90         echo -n 'aybabtu' > $@
91 $(outdir)/aybabtu.subfonts:
92         echo $(subst .mf,,$(call src-wildcard,feta-braces-[a-z].mf)) > $@
93
94 $(PE_SCRIPTS): $(buildscript-dir)/gen-emmentaler-scripts.py
95         $(PYTHON) $< --dir=$(outdir)
96
97 $(outdir)/fonts.cache-1: $(PFA_FILES) $(OTF_FILES)
98         cd $(outdir) ; fc-cache .
99
100 local-install: install-fc-cache
101
102 install-fc-cache:
103         $(foreach suff, $(INSTALLATION_OUT_SUFFIXES), rm -f $(DESTDIR)$(INSTALLATION_OUT_DIR$(suff))/fonts.cache-1 && ) true
104         fc-cache $(foreach suff, $(INSTALLATION_OUT_SUFFIXES), $(DESTDIR)$(INSTALLATION_OUT_DIR$(suff)))
105
106 ALL_FONTS = $(FETA_FONTS) $(SAUTER_FONTS)
107 PFA_FILES = $(ALL_FONTS:%=$(outdir)/%.pfa)
108
109 # Make tfm files first, log files last,
110 # so that normally log files aren't made twice
111 ALL_GEN_FILES= $(TFM_FILES) $(TEXTABLES) $(TFM_FILES) $(LOG_FILES) $(ENC_FILES) $(LISP_FILES) $(FETA_LIST_FILES)  $(OTF_TABLES) $(NCSB_TTFS) $(PFA_FILES) $(OTF_FILES) $(SVG_FILES) $(outdir)/fonts.cache-1
112
113 #PRE_INSTALL=$(MAKE) "$(ALL_GEN_FILES)"
114
115 INSTALLATION_DIR=$(local_lilypond_datadir)/fonts/source
116 INSTALLATION_FILES=$(MF_FILES) $(AF_FILES)
117
118 INSTALLATION_OUT_SUFFIXES=1 2 3 4 5 6
119
120 INSTALLATION_OUT_DIR1=$(local_lilypond_datadir)/tex
121 INSTALLATION_OUT_FILES1=$(TEXTABLES)
122
123 INSTALLATION_OUT_DIR2=$(local_lilypond_datadir)/fonts/otf
124 INSTALLATION_OUT_FILES2=$(OTF_FILES) $(NCSB_TTFS)
125
126 INSTALLATION_OUT_DIR3=$(local_lilypond_datadir)/fonts/tfm
127 INSTALLATION_OUT_FILES3=$(TFM_FILES)
128
129 INSTALLATION_OUT_DIR4=$(local_lilypond_datadir)/fonts/svg
130 INSTALLATION_OUT_FILES4=$(SVG_FILES)
131
132 INSTALLATION_OUT_DIR5=$(local_lilypond_datadir)/fonts/type1
133 INSTALLATION_OUT_FILES5=$(PFA_FILES)
134
135 INSTALLATION_OUT_DIR6=$(local_lilypond_datadir)/ps/
136 INSTALLATION_OUT_FILES6=$(ENC_FILES)
137
138
139 export MFINPUTS:=.:$(MFINPUTS)
140
141
142
143 default: pfa_warning $(ALL_GEN_FILES) $(outdir)/emmentaler-20.otf tree-regen
144
145 .PHONY: tree-regen
146
147 # FIXME: temporary hack: must regenerate after building fonts
148 tree-regen:
149         ${MAKE} -C $(top-build-dir) link-mf-tree
150
151 pfa_warning:
152 ifneq ($(shell $(MFTRACE) --version | sed 's/ .*//'),mftrace)
153         @echo ""
154         @echo "ERROR: mftrace not found"
155         @echo ""
156         @echo "For obtaining PFA/SVG fonts, either install mftrace "
157         @echo "(see http://www.xs4all.nl/~hanwen/mftrace/ ),"
158         @echo "or try one of the following commands in this directory: "
159         @echo ""
160         @echo " make get-fonts "
161         @echo " make get-rpm-fonts "
162         @echo " make get-deb-fonts "
163         @echo ""
164         @echo "These commands will try to download the files from internet."
165         @false
166 endif
167
168
169 debian-mirror=http://ftp.us.debian.org
170 debian-package =lilypond_$(TOPLEVEL_VERSION)-1_i386.deb
171 $(outdir)/$(debian-package):
172         wget --passive-ftp -P $(outdir) $(debian-mirror)/debian/pool/main/l/lilypond/$(debian-package)
173
174 get-deb-fonts: $(outdir)/$(debian-package)
175         rm -rf $(outdir)/./usr
176         ar p $< data.tar.gz | \
177                 tar -C $(outdir) -zvxf - '*.pfa' '*.svg'
178         cp `find $(outdir)/usr/ -name '*.pfa' -o -name '*.svg'` $(outdir)/
179
180
181 redhat-package=lilypond-$(TOPLEVEL_VERSION)-1.i386.rpm
182 $(outdir)/$(redhat-package):
183         wget  --passive-ftp -P $(outdir) http://lilypond.org/download/binaries/Fedora-4/$(redhat-package)
184
185 get-rpm-fonts: $(outdir)/$(redhat-package)
186         cd $(outdir) ; rm -rf usr/ # (root alert!)
187         cd $(outdir) ; rpm2cpio $(redhat-package) | cpio -uid '*.pfa' '*.svg'
188         cp `find $(outdir)/usr/ -name '*.pfa' -o -name '*.svg'` $(outdir)/
189
190 # change this dependency
191 get-fonts: get-rpm-fonts
192 get-pfa: get-rpm-fonts
193
194
195 ##
196 ## todo: this also depends on .tfm, FIXME.
197 $(outdir)/%.lisp $(outdir)/%.otf-gtable $(outdir)/%.enc  $(outdir)/%.tex $(outdir)/%.dep: $(outdir)/%.log $(outdir)/%.tfm
198         $(PYTHON) $(buildscript-dir)/mf-to-table.py --global-lisp=$(outdir)/$(<F:.log=.otf-gtable) --lisp=$(outdir)/$(<F:.log=.lisp) --outdir=$(outdir) --dep $(outdir)/$(<F:.log=.dep) --enc $(outdir)/$(<F:.log=.enc) --tex $(outdir)/$(<F:.log=.tex) $<
199
200 fontdir: $(addprefix $(outdir)/, lilypond.map lilypond.sfd private-fonts fonts.scale fonts.dir Fontmap.lily)
201
202
203 local-clean:
204         rm -f mfplain.mem mfplain.log
205         rm -f *.tfm *.log
206
207 $(outdir)/%.enc.in: %.enc
208         cp $< $@
209
210
211 $(NCSB_TTFS): $(addsuffix .pfb,$(addprefix $(NCSB_DIR)/,$(NCSB_SOURCE_FILES))) $(buildscript-dir)/pfx2ttf.fontforge
212         $(foreach i,$(NCSB_SOURCE_FILES), \
213                 $(FONTFORGE) -script $(buildscript-dir)/pfx2ttf.fontforge \
214                         $(NCSB_DIR)/$(i).pfb $(NCSB_DIR)/$(i).afm $(outdir)/ && ) true