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