]> git.donarmstrong.com Git - lilypond.git/blob - mf/GNUmakefile
($(outdir)/emmentaler-%.otf
[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 $(subst otf,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 INSTALLATION_OUT_DIR6=$(local_lilypond_datadir)/ps/
129 INSTALLATION_OUT_FILES6=$(ENC_FILES)
130
131
132 export MFINPUTS:=.:$(MFINPUTS)
133
134
135
136 default: pfa_warning $(ALL_GEN_FILES) $(outdir)/emmentaler-20.otf tree-regen
137
138 .PHONY: tree-regen
139
140 # FIXME: temporary hack: must regenerate after building fonts
141 tree-regen:
142         ${MAKE} -C $(top-build-dir) link-mf-tree
143
144 pfa_warning:
145 ifneq ($(shell $(MFTRACE) --version | sed 's/ .*//'),mftrace)
146         @echo ""
147         @echo "ERROR: mftrace not found"
148         @echo ""
149         @echo "For obtaining PFA/SVG fonts, either install mftrace "
150         @echo "(see http://www.xs4all.nl/~hanwen/mftrace/ ),"
151         @echo "or try one of the following commands in this directory: "
152         @echo ""
153         @echo " make get-fonts "
154         @echo " make get-rpm-fonts "
155         @echo " make get-deb-fonts "
156         @echo ""
157         @echo "These commands will try to download the files from internet."
158         @false
159 endif
160
161
162 debian-mirror=http://ftp.us.debian.org
163 debian-package =lilypond_$(TOPLEVEL_VERSION)-1_i386.deb
164 $(outdir)/$(debian-package):
165         wget --passive-ftp -P $(outdir) $(debian-mirror)/debian/pool/main/l/lilypond/$(debian-package)
166
167 get-deb-fonts: $(outdir)/$(debian-package)
168         rm -rf $(outdir)/./usr
169         ar p $< data.tar.gz | \
170                 tar -C $(outdir) -zvxf - '*.pfa' '*.svg'
171         cp `find $(outdir)/usr/ -name '*.pfa' -o -name '*.svg'` $(outdir)/
172
173
174 redhat-package=lilypond-$(TOPLEVEL_VERSION)-1.i386.rpm
175 $(outdir)/$(redhat-package):
176         wget  --passive-ftp -P $(outdir) http://lilypond.org/download/binaries/Fedora-4/$(redhat-package)
177
178 get-rpm-fonts: $(outdir)/$(redhat-package)
179         cd $(outdir) ; rm -rf usr/ # (root alert!)
180         cd $(outdir) ; rpm2cpio $(redhat-package) | cpio -uid '*.pfa' '*.svg'
181         cp `find $(outdir)/usr/ -name '*.pfa' -o -name '*.svg'` $(outdir)/
182
183 # change this dependency
184 get-fonts: get-rpm-fonts
185 get-pfa: get-rpm-fonts
186
187
188 ##
189 ## todo: this also depends on .tfm, FIXME.
190 $(outdir)/%.lisp $(outdir)/%.otf-gtable $(outdir)/%.enc  $(outdir)/%.tex $(outdir)/%.dep: $(outdir)/%.log $(outdir)/%.tfm
191         $(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) $<
192
193 fontdir: $(addprefix $(outdir)/, lilypond.map lilypond.sfd private-fonts fonts.scale fonts.dir Fontmap.lily)
194
195
196 local-clean:
197         rm -f mfplain.mem mfplain.log
198         rm -f *.tfm *.log
199
200 $(outdir)/%.enc.in: %.enc
201         cp $< $@
202
203
204 $(NCSB_TTFS): $(addsuffix .pfb,$(addprefix $(NCSB_DIR)/,$(NCSB_SOURCE_FILES))) $(buildscript-dir)/pfx2ttf.fontforge
205         $(foreach i,$(NCSB_SOURCE_FILES), \
206                 $(FONTFORGE) -script $(buildscript-dir)/pfx2ttf.fontforge \
207                         $(NCSB_DIR)/$(i).pfb $(NCSB_DIR)/$(i).afm $(outdir)/ && ) true