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