3 STEPMAKE_TEMPLATES=metafont install install-out
4 LOCALSTEPMAKE_TEMPLATES=lilypond
6 include $(depth)/make/stepmake.make
8 AF_FILES = $(call src-wildcard,*.af)
11 MFTRACE_FLAGS= # --simplify
13 EXTRA_DIST_FILES += README feta.tex
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)
21 STAFF_SIZES = 11 13 14 16 18 20 23 26
22 BRACES = a b c d e f g h i
25 OTF_FILES = $(STAFF_SIZES:%=$(outdir)/emmentaler-%.otf)\
27 PFA_OTF_FILES = $(STAFF_SIZES:%=$(outdir)/$(PFA_PREFIX)emmentaler-%.pfa)\
28 $(outdir)/$(PFA_PREFIX)aybabtu.pfa
29 PE_SCRIPTS = $(STAFF_SIZES:%=$(outdir)/emmentaler-%.pe)\
30 $(STAFF_SIZES:%=$(outdir)/emmentaler-%.dep)
31 OTF_TABLES = $(STAFF_SIZES:%=$(outdir)/feta%.otf-table)\
32 $(BRACES:%=$(outdir)/feta-braces-%.otf-table)
33 FETA_FONTS = $(FETA_MF_FILES:.mf=)
34 SVG_FILES = $(OTF_FILES:%.otf=%.svg) $(ALL_FONTS:%=$(outdir)/%.svg)
37 NCSB_SOURCE_FILES=c059013l c059016l c059033l c059036l
38 NCSB_TTFS=$(addprefix $(outdir)/,CenturySchL-Ital.ttf CenturySchL-BoldItal.ttf CenturySchL-Roma.ttf CenturySchL-Bold.ttf)
39 NCSB_INSTALL_DIR=$(local_lilypond_datadir)/fonts/otf
41 LOG_FILES = $(FETA_MF_FILES:%.mf=$(outdir)/%.log)
42 LISP_FILES = $(FETA_MF_FILES:%.mf=$(outdir)/%.lisp)
43 TEXTABLES = $(FETA_MF_FILES:%.mf=$(outdir)/%.tex)
44 ENC_FILES = $(TEXTABLES:.tex=.enc)
45 TFM_FILES = $(FETA_MF_FILES:%.mf=$(outdir)/%.tfm)\
46 $(SAUTER_FONTS:%=$(outdir)/%.tfm)
49 ENCODING_FILE=$(findstring $(<F:.mf=.enc), $(FETA_MF_FILES:.mf=.enc))
50 MFTRACE_FLAGS=$(if $(ENCODING_FILE),--encoding $(ENCODING_FILE),) --no-afm
52 $(outdir)/aybabtu.otf-table: $(BRACES:%=$(outdir)/feta-braces-%.otf-table)
55 $(outdir)/aybabtu.otf-gtable: $(BRACES:%=$(outdir)/feta-braces-%.otf-gtable)
56 echo '(design_size . 20)' > $@
59 # only for fonts which
61 # 1. are mentioned in font.scm
63 # 2. are not included with teTeX
66 (cd $(outdir) && $(FONTFORGE) -script $(1))
67 $(PYTHON) $(buildscript-dir)/substitute-encoding.py --outdir=$(outdir) $(2)
70 define EMMENTALER_RULE
71 $(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
72 $(call MAKE_OTF,emmentaler-$(1).pe, $(outdir)/PFAemmentaler-$(1).pfa)
75 $(foreach size, $(STAFF_SIZES), $(eval $(call EMMENTALER_RULE,$(size))))
77 $(outdir)/$(PFA_PREFIX)aybabtu.pfa $(outdir)/aybabtu.otf $(outdir)/aybabtu.svg: $(outdir)/aybabtu.pe $(foreach s,$(BRACES),$(outdir)/feta-braces-$(s).pfa)
78 $(call MAKE_OTF,aybabtu.pe, $(outdir)/PFAaybabtu.pfa)
79 -rm -f $(outdir)/*.scale.{pfa,afm}
81 $(outdir)/%.pfa: $(outdir)/%.log
83 $(outdir)/%.otf-table: $(outdir)/%.lisp $(if $(findstring brace,$<),,$(subst feta,parmesan,$<))
85 $(if $(findstring brace,$<),,$(subst feta,parmesan,$<)) \
86 $(if $(findstring brace,$<),,$(subst feta,feta-alphabet,$<)) > $@
88 $(outdir)/aybabtu.otf $(outdir)/$(PFA_PREFIX)aybabtu.pfa: $(outdir)/aybabtu.subfonts $(outdir)/aybabtu.fontname $(outdir)/aybabtu.otf-table $(outdir)/aybabtu.otf-gtable $(outdir)/aybabtu.pe
90 $(outdir)/aybabtu.otf $(outdir)/$(PFA_PREFIX)aybabtu.pfa $(outdir)/aybabtu.svg: $(BRACES:%=$(outdir)/feta-braces-%.pfa)
92 $(outdir)/aybabtu.fontname:
93 echo -n 'aybabtu' > $@
94 $(outdir)/aybabtu.subfonts:
95 echo $(subst .mf,,$(call src-wildcard,feta-braces-[a-z].mf)) > $@
97 $(PE_SCRIPTS): $(buildscript-dir)/gen-emmentaler-scripts.py
98 $(PYTHON) $< --dir=$(outdir)
100 $(outdir)/fonts.cache-1: $(PFA_OTF_FILES) $(PFA_FILES) $(OTF_FILES)
101 cd $(outdir) ; fc-cache .
103 local-install: install-fc-cache
106 $(foreach suff, $(INSTALLATION_OUT_SUFFIXES), rm -f $(DESTDIR)$(INSTALLATION_OUT_DIR$(suff))/fonts.cache-1 && ) true
107 fc-cache $(foreach suff, $(INSTALLATION_OUT_SUFFIXES), $(DESTDIR)$(INSTALLATION_OUT_DIR$(suff)))
109 ALL_FONTS = $(FETA_FONTS) $(SAUTER_FONTS)
110 PFA_FILES = $(ALL_FONTS:%=$(outdir)/%.pfa) $(PFA_OTF_FILES)
112 # Make tfm files first, log files last,
113 # so that normally log files aren't made twice
114 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
116 #PRE_INSTALL=$(MAKE) "$(ALL_GEN_FILES)"
118 INSTALLATION_DIR=$(local_lilypond_datadir)/fonts/source
119 INSTALLATION_FILES=$(MF_FILES) $(AF_FILES)
121 INSTALLATION_OUT_SUFFIXES=1 2 3 4 5 6
123 INSTALLATION_OUT_DIR1=$(local_lilypond_datadir)/tex
124 INSTALLATION_OUT_FILES1=$(TEXTABLES)
126 INSTALLATION_OUT_DIR2=$(local_lilypond_datadir)/fonts/otf
127 INSTALLATION_OUT_FILES2=$(OTF_FILES) $(NCSB_TTFS)
129 INSTALLATION_OUT_DIR3=$(local_lilypond_datadir)/fonts/tfm
130 INSTALLATION_OUT_FILES3=$(TFM_FILES)
132 INSTALLATION_OUT_DIR4=$(local_lilypond_datadir)/fonts/svg
133 INSTALLATION_OUT_FILES4=$(SVG_FILES)
135 INSTALLATION_OUT_DIR5=$(local_lilypond_datadir)/fonts/type1
136 INSTALLATION_OUT_FILES5=$(PFA_FILES)
138 INSTALLATION_OUT_DIR6=$(local_lilypond_datadir)/ps/
139 INSTALLATION_OUT_FILES6=$(ENC_FILES)
142 export MFINPUTS:=.:$(MFINPUTS)
146 default: pfa_warning $(ALL_GEN_FILES) $(outdir)/emmentaler-20.otf tree-regen
150 # FIXME: temporary hack: must regenerate after building fonts
152 ${MAKE} -C $(top-build-dir) link-mf-tree
155 ifneq ($(shell $(MFTRACE) --version | sed 's/ .*//'),mftrace)
157 @echo "ERROR: mftrace not found"
159 @echo "For obtaining PFA/SVG fonts, either install mftrace "
160 @echo "(see http://www.xs4all.nl/~hanwen/mftrace/ ),"
161 @echo "or try one of the following commands in this directory: "
163 @echo " make get-fonts "
164 @echo " make get-rpm-fonts "
165 @echo " make get-deb-fonts "
167 @echo "These commands will try to download the files from internet."
172 debian-mirror=http://ftp.us.debian.org
173 debian-package =lilypond_$(TOPLEVEL_VERSION)-1_i386.deb
174 $(outdir)/$(debian-package):
175 wget --passive-ftp -P $(outdir) $(debian-mirror)/debian/pool/main/l/lilypond/$(debian-package)
177 get-deb-fonts: $(outdir)/$(debian-package)
178 rm -rf $(outdir)/./usr
179 ar p $< data.tar.gz | \
180 tar -C $(outdir) -zvxf - '*.pfa' '*.svg'
181 cp `find $(outdir)/usr/ -name '*.pfa' -o -name '*.svg'` $(outdir)/
184 redhat-package=lilypond-$(TOPLEVEL_VERSION)-1.i386.rpm
185 $(outdir)/$(redhat-package):
186 wget --passive-ftp -P $(outdir) http://lilypond.org/download/binaries/Fedora-4/$(redhat-package)
188 get-rpm-fonts: $(outdir)/$(redhat-package)
189 cd $(outdir) ; rm -rf usr/ # (root alert!)
190 cd $(outdir) ; rpm2cpio $(redhat-package) | cpio -uid '*.pfa' '*.svg'
191 cp `find $(outdir)/usr/ -name '*.pfa' -o -name '*.svg'` $(outdir)/
193 # change this dependency
194 get-fonts: get-rpm-fonts
195 get-pfa: get-rpm-fonts
199 ## todo: this also depends on .tfm, FIXME.
200 $(outdir)/%.lisp $(outdir)/%.otf-gtable $(outdir)/%.enc $(outdir)/%.tex $(outdir)/%.dep: $(outdir)/%.log $(outdir)/%.tfm
201 $(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) $<
203 fontdir: $(addprefix $(outdir)/, lilypond.map lilypond.sfd private-fonts fonts.scale fonts.dir Fontmap.lily)
207 rm -f mfplain.mem mfplain.log
210 $(outdir)/%.enc.in: %.enc
214 $(NCSB_TTFS): $(addsuffix .pfb,$(addprefix $(NCSB_DIR)/,$(NCSB_SOURCE_FILES))) $(buildscript-dir)/pfx2ttf.fontforge
215 $(foreach i,$(NCSB_SOURCE_FILES), \
216 $(FONTFORGE) -script $(buildscript-dir)/pfx2ttf.fontforge \
217 $(NCSB_DIR)/$(i).pfb $(NCSB_DIR)/$(i).afm $(outdir)/ && ) true