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