]> git.donarmstrong.com Git - lilypond.git/blob - mf/GNUmakefile
* lily/main.cc (setup_paths): either add mf/out to search path or
[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 = $(wildcard *.af) 
9
10 EXTRA_DIST_FILES += README feta.tex
11
12 # We don't use $(MF_FILES), because there's more .mf cruft here
13 FETA_MF_FILES = $(wildcard feta[0-9]*.mf)\
14         $(wildcard feta-braces-[a-z].mf)\
15         $(wildcard feta-alphabet*[0-9].mf)\
16         $(wildcard parmesan[0-9]*.mf)
17
18 STAFF_SIZES = 11 13 14 16 18 20 23 26
19 BRACES = a b c d e f g h i
20
21 OTF_FILES = $(addsuffix .otf, $(addprefix $(outdir)/emmentaler-, $(STAFF_SIZES)))\
22  $(outdir)/aybabtu.otf
23 PFA_OTF_FILES = $(addsuffix .pfa, $(addprefix $(outdir)/PFAemmentaler-, $(STAFF_SIZES)))\
24  $(outdir)/PFAaybabtu.pfa
25 PE_SCRIPTS = $(addsuffix .pe, $(addprefix $(outdir)/emmentaler-, $(STAFF_SIZES))) \
26   $(addsuffix .dep, $(addprefix $(outdir)/emmentaler-, $(STAFF_SIZES))) 
27 OTF_TABLES = $(addsuffix .otf-table, $(addprefix $(outdir)/feta, $(STAFF_SIZES))) \
28  $(BRACES:%=$(outdir)/feta-braces-%.otf-table)
29 FETA_FONTS = $(FETA_MF_FILES:.mf=)
30 SVG_FILES = $(OTF_FILES:%.otf=%.svg) $(ALL_FONTS:%=$(outdir)/%.svg)
31 CFF_FILES = $(OTF_FILES:%.otf=%.cff)
32 CFF_PS_FILES = $(OTF_FILES:%.otf=%.cff.ps)
33
34
35 $(outdir)/aybabtu.otf-table: $(BRACES:%=$(outdir)/feta-braces-%.otf-table)
36         cat $^ > $@
37
38 $(outdir)/aybabtu.otf-gtable: $(BRACES:%=$(outdir)/feta-braces-%.otf-gtable)
39         echo '(design_size . 20)' > $@
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) $(outdir)/cmr.enc
45 TFM_FILES = $(FETA_MF_FILES:%.mf=$(outdir)/%.tfm) $(addprefix $(outdir)/,$(addsuffix .tfm,$(SAUTER_FONTS)))
46 FETA_LIST_FILES = $(FETA_MF_FILES:%.mf=$(outdir)/%list.ly)
47
48
49 ENCODING_FILE=$(findstring $(<:.mf=.enc), $(FETA_MF_FILES:.mf=.enc))
50 MFTRACE_FLAGS=$(if $(ENCODING_FILE),--encoding $(ENCODING_FILE),) --no-afm
51
52 # only for fonts which
53 #
54 # 1. are mentioned in font.scm
55 #
56 # 2. are not included with teTeX
57 #
58
59 $(outdir)/%.cff.ps $(outdir)/PFA%.pfa $(outdir)/%.cff $(outdir)/%.otf $(outdir)/%.svg: $(outdir)/%.pe
60         (cd $(outdir) && $(FONTFORGE) -script $(notdir $<))
61         $(PYTHON) $(buildscript-dir)/ps-embed-cff.py $(basename $<).cff `cat $(basename $<).fontname` $(basename $<).cff.ps
62         -rm $(outdir)/*.scale.pfa
63
64
65 $(outdir)/%.otf-table: $(outdir)/%.lisp $(if $(findstring brace,$<),,$(subst feta,parmesan,$<)) 
66         cat $< \
67                 $(if $(findstring brace,$<),,$(subst feta,parmesan,$<)) \
68                 $(if $(findstring brace,$<),,$(subst feta,feta-alphabet,$<)) > $@
69
70 $(outdir)/aybabtu.otf: $(outdir)/aybabtu.subfonts  $(outdir)/aybabtu.fontname $(outdir)/aybabtu.otf-table $(outdir)/aybabtu.otf-gtable $(outdir)/aybabtu.pe
71
72 $(outdir)/aybabtu.fontname:
73         echo -n 'aybabtu' > $@ 
74 $(outdir)/aybabtu.subfonts: 
75         echo $(subst .mf,,$(wildcard feta-braces-[a-z].mf)) > $@
76
77 $(PE_SCRIPTS): $(buildscript-dir)/gen-emmentaler-scripts.py
78         $(PYTHON) $< --dir=$(outdir)
79
80
81 ALL_FONTS = $(FETA_FONTS) $(SAUTER_FONTS)
82 PFA_FILES = $(ALL_FONTS:%=$(outdir)/%.pfa) $(PFA_OTF_FILES)
83
84 # Make tfm files first, log files last, 
85 # so that normally log files aren't made twice
86 ALL_GEN_FILES= $(TFM_FILES) $(TEXTABLES) $(TFM_FILES) $(LOG_FILES) $(ENC_FILES) $(LISP_FILES) $(FETA_LIST_FILES)  $(OTF_TABLES) $(PFA_FILES) $(outdir)/lilypond.map $(OTF_FILES) $(SVG_FILES) $(CFF_PS_FILES) $(CFF_FILES)
87
88 #PRE_INSTALL=$(MAKE) "$(ALL_GEN_FILES)"
89 INSTALLATION_DIR=$(local_lilypond_datadir)/fonts/source
90 INSTALLATION_FILES=$(MF_FILES) $(AF_FILES)
91
92 INSTALLATION_OUT_SUFFIXES=1 2 3 4 5 6 7 8 9
93
94 INSTALLATION_OUT_DIR1=$(local_lilypond_datadir)/tex
95 INSTALLATION_OUT_FILES1=$(TEXTABLES)
96
97 # must not be installed with .cff, pango/fontconfig does not like .cff fonts 
98 INSTALLATION_OUT_DIR2=$(local_lilypond_datadir)/fonts/otf
99 INSTALLATION_OUT_FILES2=$(OTF_FILES)
100
101 INSTALLATION_OUT_DIR3=$(local_lilypond_datadir)/fonts/tfm
102 INSTALLATION_OUT_FILES3=$(TFM_FILES)
103
104 INSTALLATION_OUT_DIR4=$(local_lilypond_datadir)/ps
105 INSTALLATION_OUT_FILES4=$(CFF_PS_FILES)
106
107 INSTALLATION_OUT_DIR5=$(local_lilypond_datadir)/fonts/type1
108 INSTALLATION_OUT_FILES5=$(PFA_FILES)
109
110 INSTALLATION_OUT_DIR6=$(local_lilypond_datadir)/fonts/map
111 INSTALLATION_OUT_FILES6=$(outdir)/lilypond.map
112
113 INSTALLATION_OUT_DIR7=$(local_lilypond_datadir)/fonts/cff/
114 INSTALLATION_OUT_FILES7=$(CFF_FILES)
115
116 INSTALLATION_OUT_DIR7=$(local_lilypond_datadir)/ps/
117 INSTALLATION_OUT_FILES7=$(ENC_FILES)
118
119 INSTALLATION_OUT_DIR9=$(local_lilypond_datadir)/fonts/svg
120 INSTALLATION_OUT_FILES9=$(SVG_FILES)
121
122
123 export MFINPUTS:=.:$(MFINPUTS)
124
125 default: pfa_warning $(ALL_GEN_FILES) $(outdir)/emmentaler-20.otf
126
127 pfa_warning:
128 ifneq ($(shell $(MFTRACE) --version | sed 's/ .*//'),mftrace)
129         @echo ""
130         @echo "ERROR: mftrace not found"
131         @echo ""
132         @echo "For obtaining PFA fonts, either install mftrace "
133         @echo "(see http://www.xs4all.nl/~hanwen/mftrace/ ),"
134         @echo "or try one of the following commands in this directory: "
135         @echo ""
136         @echo " make get-pfa "
137         @echo " make get-rpm-pfa "
138         @echo " make get-deb-pfa "
139         @echo ""
140         @echo "These commands will try to download the files from internet."
141         @false
142 endif
143
144
145 debian-mirror=http://ftp.us.debian.org
146 debian-package =lilypond_$(TOPLEVEL_VERSION)-1_i386.deb
147 $(outdir)/$(debian-package):
148         wget --passive-ftp -P $(outdir) $(debian-mirror)/debian/pool/main/l/lilypond/$(debian-package)
149
150 get-deb-pfa: $(outdir)/$(debian-package)
151         rm -rf $(outdir)/./usr
152         ar p $< data.tar.gz | \
153                 tar -C $(outdir) -zvxf - '*.pfa'
154         cp `find $(outdir)/usr/ -name '*.pfa'` $(outdir)/
155
156
157 redhat-package=lilypond-$(TOPLEVEL_VERSION)-1.i386.rpm
158 $(outdir)/$(redhat-package):
159         wget  --passive-ftp -P $(outdir) http://lilypond.org/download/binaries/Fedora-3/$(redhat-package)
160
161 get-rpm-pfa: $(outdir)/$(redhat-package)
162         cd $(outdir) ; rm -rf usr/ # (root alert!) 
163         cd $(outdir) ; rpm2cpio $(redhat-package) | cpio -uid '*.pfa'
164         cp `find $(outdir)/usr/ -name '*.pfa'` $(outdir)/
165
166 # change this dependency 
167 get-pfa: get-rpm-pfa
168
169
170 ##
171 ## todo: this also depends on .tfm, FIXME.
172 $(outdir)/%.lisp $(outdir)/%.otf-gtable $(outdir)/%.enc  $(outdir)/%.tex $(outdir)/%list.ly $(outdir)/%.dep: $(outdir)/%.log $(outdir)/%.tfm
173         $(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) --ly $(outdir)/$(<F:.log=list.ly) $<
174
175 fontdir: $(addprefix $(outdir)/, lilypond.map lilypond.sfd private-fonts fonts.scale fonts.dir Fontmap.lily)
176
177
178 $(outdir)/lilypond.map:
179         for i in $(FETA_FONTS); do echo $$i $$i '<'$$i.pfa; done > $@
180         for i in $(STAFF_SIZES); \
181                 do echo "Emmentaler-$$i Emmentaler-$$i <emmentaler-$$i.cff.ps" ; done \
182         >> $@
183         echo "Aybabtu-Regular Aybabtu-Regular <aybabtu.cff.ps" >> $@
184
185 $(outdir)/Fontmap.lily: 
186         for i in $(FETA_FONTS); do echo "/$$i ($$i.pfa);" ; done > $@
187         for i in $(STAFF_SIZES); \
188                 do echo "/Emmentaler-$$i (emmentaler-$$i.cff.ps);" ; done \
189                 do echo "/PFAEmmentaler-$$i (PFAemmentaler-$$i.pfa);" ; done \
190         >> $@
191         echo "/Aybabtu (aybabtu.cff.ps);" >> $@
192         echo "/PFAAybabtu (PFAaybabtu.pfa);" >> $@
193
194 local-clean:
195         rm -f mfplain.mem mfplain.log 
196         rm -f *.tfm *.log
197
198 $(outdir)/%.enc.in: %.enc
199         cp $< $@
200
201 # teTeX-2.0.x compatibility.
202 local-install:
203         -$(INSTALL) -d $(DESTDIR)$(local_lilypond_datadir)/dvips
204         (cd $(DESTDIR)$(local_lilypond_datadir)/dvips && ln -sf ../fonts/map .)
205
206 local-uninstall:
207         -rm -f $(DESTDIR)$(local_lilypond_datadir)/dvips/map
208         -rmdir $(DESTDIR)$(local_lilypond_datadir)/dvips