]> git.donarmstrong.com Git - lilypond.git/blob - mf/GNUmakefile
explicit rules for emmentaler/aybabtu
[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 PFA_PREFIX = PFA
24
25 OTF_FILES = $(STAFF_SIZES:%=$(outdir)/emmentaler-%.otf)\
26  $(outdir)/aybabtu.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)
35
36
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
40
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)
47
48
49 ENCODING_FILE=$(findstring $(<F:.mf=.enc), $(FETA_MF_FILES:.mf=.enc))
50 MFTRACE_FLAGS=$(if $(ENCODING_FILE),--encoding $(ENCODING_FILE),) --no-afm
51
52 $(outdir)/aybabtu.otf-table: $(BRACES:%=$(outdir)/feta-braces-%.otf-table)
53         cat $^ > $@
54
55 $(outdir)/aybabtu.otf-gtable: $(BRACES:%=$(outdir)/feta-braces-%.otf-gtable)
56         echo '(design_size . 20)' > $@
57
58
59 # only for fonts which
60 #
61 # 1. are mentioned in font.scm
62 #
63 # 2. are not included with teTeX
64 #
65 define MAKE_OTF
66         (cd $(outdir) && $(FONTFORGE) -script $(1))
67         $(PYTHON) $(buildscript-dir)/substitute-encoding.py --outdir=$(outdir) $(2)
68 endef
69
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)
73 endef
74
75 $(foreach size, $(STAFF_SIZES), $(eval $(call EMMENTALER_RULE,$(size))))
76
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}
80
81 $(outdir)/%.pfa: $(outdir)/%.log
82
83 $(outdir)/%.otf-table: $(outdir)/%.lisp $(if $(findstring brace,$<),,$(subst feta,parmesan,$<))
84         cat $< \
85                 $(if $(findstring brace,$<),,$(subst feta,parmesan,$<)) \
86                 $(if $(findstring brace,$<),,$(subst feta,feta-alphabet,$<)) > $@
87
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
89
90 $(outdir)/aybabtu.otf $(outdir)/$(PFA_PREFIX)aybabtu.pfa $(outdir)/aybabtu.svg: $(BRACES:%=$(outdir)/feta-braces-%.pfa)
91
92 $(outdir)/aybabtu.fontname:
93         echo -n 'aybabtu' > $@
94 $(outdir)/aybabtu.subfonts:
95         echo $(subst .mf,,$(call src-wildcard,feta-braces-[a-z].mf)) > $@
96
97 $(PE_SCRIPTS): $(buildscript-dir)/gen-emmentaler-scripts.py
98         $(PYTHON) $< --dir=$(outdir)
99
100 $(outdir)/fonts.cache-1: $(PFA_OTF_FILES) $(PFA_FILES) $(OTF_FILES)
101         cd $(outdir) ; fc-cache .
102
103 local-install: install-fc-cache
104
105 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)))
108
109 ALL_FONTS = $(FETA_FONTS) $(SAUTER_FONTS)
110 PFA_FILES = $(ALL_FONTS:%=$(outdir)/%.pfa) $(PFA_OTF_FILES)
111
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
115
116 #PRE_INSTALL=$(MAKE) "$(ALL_GEN_FILES)"
117
118 INSTALLATION_DIR=$(local_lilypond_datadir)/fonts/source
119 INSTALLATION_FILES=$(MF_FILES) $(AF_FILES)
120
121 INSTALLATION_OUT_SUFFIXES=1 2 3 4 5 6
122
123 INSTALLATION_OUT_DIR1=$(local_lilypond_datadir)/tex
124 INSTALLATION_OUT_FILES1=$(TEXTABLES)
125
126 INSTALLATION_OUT_DIR2=$(local_lilypond_datadir)/fonts/otf
127 INSTALLATION_OUT_FILES2=$(OTF_FILES) $(NCSB_TTFS)
128
129 INSTALLATION_OUT_DIR3=$(local_lilypond_datadir)/fonts/tfm
130 INSTALLATION_OUT_FILES3=$(TFM_FILES)
131
132 INSTALLATION_OUT_DIR4=$(local_lilypond_datadir)/fonts/svg
133 INSTALLATION_OUT_FILES4=$(SVG_FILES)
134
135 INSTALLATION_OUT_DIR5=$(local_lilypond_datadir)/fonts/type1
136 INSTALLATION_OUT_FILES5=$(PFA_FILES)
137
138 INSTALLATION_OUT_DIR6=$(local_lilypond_datadir)/ps/
139 INSTALLATION_OUT_FILES6=$(ENC_FILES)
140
141
142 export MFINPUTS:=.:$(MFINPUTS)
143
144
145
146 default: pfa_warning $(ALL_GEN_FILES) $(outdir)/emmentaler-20.otf tree-regen
147
148 .PHONY: tree-regen
149
150 # FIXME: temporary hack: must regenerate after building fonts
151 tree-regen:
152         ${MAKE} -C $(top-build-dir) link-mf-tree
153
154 pfa_warning:
155 ifneq ($(shell $(MFTRACE) --version | sed 's/ .*//'),mftrace)
156         @echo ""
157         @echo "ERROR: mftrace not found"
158         @echo ""
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: "
162         @echo ""
163         @echo " make get-fonts "
164         @echo " make get-rpm-fonts "
165         @echo " make get-deb-fonts "
166         @echo ""
167         @echo "These commands will try to download the files from internet."
168         @false
169 endif
170
171
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)
176
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)/
182
183
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)
187
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)/
192
193 # change this dependency
194 get-fonts: get-rpm-fonts
195 get-pfa: get-rpm-fonts
196
197
198 ##
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) $<
202
203 fontdir: $(addprefix $(outdir)/, lilypond.map lilypond.sfd private-fonts fonts.scale fonts.dir Fontmap.lily)
204
205
206 local-clean:
207         rm -f mfplain.mem mfplain.log
208         rm -f *.tfm *.log
209
210 $(outdir)/%.enc.in: %.enc
211         cp $< $@
212
213
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