]> git.donarmstrong.com Git - lilypond.git/blob - mf/GNUmakefile
601f61b199af6fa1f489922f096de36b825cf014
[lilypond.git] / mf / GNUmakefile
1 depth = ..
2
3 STEPMAKE_TEMPLATES=metafont install install-out
4
5 include $(depth)/make/stepmake.make 
6
7 AF_FILES = $(wildcard *.af) 
8
9 EXTRA_DIST_FILES += README feta.tex
10
11 # We don't use $(MF_FILES), because there's more .mf cruft here
12 FETA_MF_FILES = $(wildcard feta[0-9]*.mf)\
13         $(wildcard feta-braces-[a-z].mf)\
14         $(wildcard feta-alphabet*[0-9].mf)\
15         $(wildcard parmesan[0-9]*.mf)
16
17 STAFF_SIZES = 11 13 14 16 18 20 23 26
18 BRACES = a b c d e f g h i
19
20 OTF_FILES = $(addsuffix .otf, $(addprefix $(outdir)/emmentaler, $(STAFF_SIZES)))\
21  $(outdir)/aybabtu.otf
22 PE_SCRIPTS = $(addsuffix .pe, $(addprefix $(outdir)/emmentaler, $(STAFF_SIZES))) \
23   $(addsuffix .dep, $(addprefix $(outdir)/emmentaler, $(STAFF_SIZES))) 
24 OTF_TABLES = $(addsuffix .otf-table, $(addprefix $(outdir)/feta, $(STAFF_SIZES))) \
25  $(BRACES:%=$(outdir)/feta-braces-%.otf-table)
26 FETA_FONTS = $(FETA_MF_FILES:.mf=)
27 SVG_FILES = $(OTF_FILES:%.otf=%.svg) $(ALL_FONTS:%=$(outdir)/%.svg)
28 CFF_FILES = $(OTF_FILES:%.otf=%.cff)
29 CFF_PS_FILES = $(OTF_FILES:%.otf=%.cff.ps)
30
31
32 $(outdir)/aybabtu.otf-table: $(BRACES:%=$(outdir)/feta-braces-%.otf-table)
33         cat $^ > $@
34
35 $(outdir)/aybabtu.otf-gtable: $(BRACES:%=$(outdir)/feta-braces-%.otf-gtable)
36         echo '(design_size . 20)' > $@
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) $(outdir)/cmr.enc
42 TFM_FILES = $(FETA_MF_FILES:%.mf=$(outdir)/%.tfm) $(addprefix $(outdir)/,$(addsuffix .tfm,$(SAUTER_FONTS)))
43 FETA_LIST_FILES = $(FETA_MF_FILES:%.mf=$(outdir)/%list.ly)
44
45
46 ENCODING_FILE=$(findstring $(<:.mf=.enc), $(FETA_MF_FILES:.mf=.enc))
47 MFTRACE_FLAGS=$(if $(ENCODING_FILE),--encoding $(ENCODING_FILE),) --no-afm
48
49 # only for fonts which
50 #
51 # 1. are mentioned in font.scm
52 #
53 # 2. are not included with teTeX
54 #
55
56 foe:
57         echo $(MFINPUTS)
58         echo $(TEXMF)
59         kpsewhich exbase.mf
60
61 $(outdir)/%.cff $(outdir)/%.otf $(outdir)/%.svg: $(outdir)/%.pe
62         (cd $(outdir) && fontforge -script $(notdir $<)) 
63
64 $(CFF_PS_FILES): $(CFF_FILES)
65         cd $(outdir) && $(builddir)/lily/$(outconfbase)/lilypond --verbose $(abs-srcdir)/ly/generate-embedded-cff
66
67 $(outdir)/%.otf-table: $(outdir)/%.lisp $(if $(findstring brace,$<),,$(subst feta,parmesan,$<)) 
68         cat $< \
69                 $(if $(findstring brace,$<),,$(subst feta,parmesan,$<)) \
70                 $(if $(findstring brace,$<),,$(subst feta,feta-alphabet,$<)) > $@
71
72 $(outdir)/aybabtu.otf: $(outdir)/aybabtu.subfonts $(outdir)/aybabtu.otf-table $(outdir)/aybabtu.otf-gtable
73
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)
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)
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 45 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)/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
108 INSTALLATION_OUT_DIR5=$(local_lilypond_datadir)/fonts/type1
109 INSTALLATION_OUT_FILES5=$(PFA_FILES)
110
111 INSTALLATION_OUT_DIR6=$(local_lilypond_datadir)/dvips/
112 INSTALLATION_OUT_FILES6=$(outdir)/lilypond.map
113
114 INSTALLATION_OUT_DIR7=$(local_lilypond_datadir)/ps/
115 INSTALLATION_OUT_FILES7=$(ENC_FILES)
116
117 # install in fonts/cff or ps/ directory?
118 INSTALLATION_OUT_DIR8=$(local_lilypond_datadir)/cff
119 INSTALLATION_OUT_FILES8=$(CFF_FILES)
120
121 INSTALLATION_OUT_DIR9=$(local_lilypond_datadir)/svg
122 INSTALLATION_OUT_FILES9=$(SVG_FILES)
123
124
125 export MFINPUTS:=.:$(MFINPUTS)
126
127 default: pfa_warning $(ALL_GEN_FILES) $(outdir)/emmentaler20.otf
128
129 pfa_warning:
130 ifneq ($(shell $(MFTRACE) --version | sed 's/ .*//'),mftrace)
131         @echo ""
132         @echo "ERROR: mftrace not found"
133         @echo ""
134         @echo "For obtaining PFA fonts, either install mftrace "
135         @echo "(see http://www.xs4all.nl/~hanwen/mftrace/ ),"
136         @echo "or try one of the following commands in this directory: "
137         @echo ""
138         @echo " make get-pfa "
139         @echo " make get-rpm-pfa "
140         @echo " make get-deb-pfa "
141         @echo ""
142         @echo "These commands will try to download the files from internet."
143         @false
144 endif
145
146
147 debian-mirror=http://ftp.us.debian.org
148 debian-package =lilypond_$(TOPLEVEL_VERSION)-1_i386.deb
149 $(outdir)/$(debian-package):
150         wget --passive-ftp -P $(outdir) $(debian-mirror)/debian/pool/main/l/lilypond/$(debian-package)
151
152 get-deb-pfa: $(outdir)/$(debian-package)
153         rm -rf $(outdir)/./usr
154         ar p $< data.tar.gz | \
155                 tar -C $(outdir) -zvxf - '*.pfa'
156         cp `find $(outdir)/usr/ -name '*.pfa'` $(outdir)/
157
158
159 redhat-package=lilypond-$(TOPLEVEL_VERSION)-1.i386.rpm
160 $(outdir)/$(redhat-package):
161         wget  --passive-ftp -P $(outdir) http://lilypond.org/download/binaries/Fedora-3/$(redhat-package)
162
163 get-rpm-pfa: $(outdir)/$(redhat-package)
164         cd $(outdir) ; rm -rf usr/ # (root alert!) 
165         cd $(outdir) ; rpm2cpio $(redhat-package) | cpio -uid '*.pfa'
166         cp `find $(outdir)/usr/ -name '*.pfa'` $(outdir)/
167
168 # change this dependency 
169 get-pfa: get-rpm-pfa
170
171
172 ##
173 ## todo: this also depends on .tfm, FIXME.
174 $(outdir)/%.lisp $(outdir)/%.otf-gtable $(outdir)/%.enc  $(outdir)/%.tex $(outdir)/%list.ly $(outdir)/%.dep: $(outdir)/%.log $(outdir)/%.tfm
175         $(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) $<
176
177 fontdir: $(addprefix $(outdir)/, lilypond.map lilypond.sfd private-fonts fonts.scale fonts.dir Fontmap.lily)
178
179
180 $(outdir)/lilypond.map: $(AFM_FILES)
181         for i in $(FETA_FONTS); do echo $$i $$i '<'$$i.pfa; done > $@
182         for i in $(STAFF_SIZES); \
183                 do echo "emmentaler$$i emmentaler-$$i <emmentaler$$i.cff.ps" ; done \
184         >> $@
185
186
187 local-clean:
188         rm -f mfplain.mem mfplain.log 
189         rm -f *.tfm *.log
190
191 $(outdir)/%.enc.in: %.enc
192         cp $< $@