]> git.donarmstrong.com Git - lilypond.git/blob - mf/GNUmakefile
* scm/font.scm (paper20-font-vector): cmcsc klugdge.
[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*[0-9].mf)\
14         $(wildcard feta-din*[0-9].mf)\
15         $(wildcard feta-nummer*[0-9].mf)\
16         $(wildcard parmesan[0-9]*.mf)
17
18 FETA_FONTS = $(FETA_MF_FILES:.mf=)
19
20 XPM_FONTS = feta20 feta-din10 feta-nummer10 feta-braces20 parmesan20
21
22 LOG_FILES = $(FETA_MF_FILES:%.mf=$(outdir)/%.log)
23 TEXTABLES = $(FETA_MF_FILES:%.mf=$(outdir)/%.tex)
24 AFM_FILES = $(FETA_MF_FILES:%.mf=$(outdir)/%.afm) \
25         $(AF_FILES:%.af=$(outdir)/%.afm)
26 ENC_FILES = $(TEXTABLES:.tex=.enc)
27 TFM_FILES = $(FETA_MF_FILES:%.mf=$(outdir)/%.tfm)
28 FETA_LIST_FILES = $(FETA_MF_FILES:%.mf=$(outdir)/%list.ly)
29
30
31 ENCODING_FILE=$(findstring $(<:.mf=.enc), $(FETA_MF_FILES:.mf=.enc))
32 MFTRACE_FLAGS=$(if $(ENCODING_FILE),--encoding $(ENCODING_FILE),)
33
34 SAUTER_FONTS = cmr10 \
35         cmbxti6 cmbxti7 cmbxti8 cmbxti12 cmbxti14 \
36         cmcsc7 cmcsc8 cmcsc10 cmcsc12 \
37         cmcsc12 cmbx14 cmbx17 \
38         cmtt5 cmtt6 cmtt7 cmtt17 \
39         cmti5 cmti6 \
40         cmss5 cmss6 cmss7 cmss8
41 # in tetex: cmbx5 cmbx6
42 # not used: cmxbti14
43
44 ALL_FONTS = $(FETA_FONTS) $(SAUTER_FONTS)
45 PFA_FILES = $(ALL_FONTS:%=$(outdir)/%.pfa)
46 PFB_FILES = $(PFA_FILES:%.pfa=%.pfb)
47
48 # Make tfm files first, log files last, 
49 # so that normally log files aren't made twice
50 ALL_GEN_FILES= $(TFM_FILES) $(TEXTABLES) $(AFM_FILES) $(TFM_FILES) $(LOG_FILES) $(ENC_FILES) $(FETA_LIST_FILES) $(PFA_FILES) $(outdir)/lilypond.map $(outdir)/fonts.scale $(outdir)/Fontmap.lily
51
52 #PRE_INSTALL=$(MAKE) "$(ALL_GEN_FILES)"
53 INSTALLATION_DIR=$(local_lilypond_datadir)/fonts/source
54 INSTALLATION_FILES=$(MF_FILES) $(AF_FILES)
55
56 INSTALLATION_OUT_SUFFIXES=1 2 3 4 5 6
57
58 INSTALLATION_OUT_DIR1=$(local_lilypond_datadir)/tex
59 INSTALLATION_OUT_FILES1=$(TEXTABLES)
60
61 INSTALLATION_OUT_DIR2=$(local_lilypond_datadir)/fonts/afm
62 INSTALLATION_OUT_FILES2=$(AFM_FILES)
63
64 INSTALLATION_OUT_DIR3=$(local_lilypond_datadir)/fonts/tfm
65 INSTALLATION_OUT_FILES3=$(TFM_FILES)
66
67 INSTALLATION_OUT_DIR4=$(local_lilypond_datadir)/ly
68 INSTALLATION_OUT_FILES4=$(FETA_LIST_FILES)
69
70 INSTALLATION_OUT_DIR5=$(local_lilypond_datadir)/fonts/type1
71 INSTALLATION_OUT_FILES5=$(PFA_FILES) $(outdir)/fonts.scale $(outdir)/Fontmap $(outdir)/Fontmap.lily
72
73 INSTALLATION_OUT_DIR6=$(local_lilypond_datadir)/dvips/
74 INSTALLATION_OUT_FILES6=$(outdir)/lilypond.map
75
76 export MFINPUTS:=.:$(MFINPUTS)
77
78 default: pfa_warning $(ALL_GEN_FILES)
79
80
81 pfa_warning:
82 ifneq ($(notdir $(MFTRACE)),mftrace)
83         @echo ""
84         @echo "ERROR: mftrace not found"
85         @echo ""
86         @echo "For obtaining PFA fonts, either install mftrace "
87         @echo "(see http://www.xs4all.nl/~hanwen/mftrace/ ),"
88         @echo "or try one of the following commands in this directory: "
89         @echo ""
90         @echo " make get-pfa "
91         @echo " make get-rpm-pfa "
92         @echo " make get-deb-pfa "
93         @echo ""
94         @echo "These commands will try to download the files from the internet."
95         @false
96 endif
97
98
99 debian-mirror=http://ftp.us.debian.org
100 debian-package =lilypond_$(TOPLEVEL_VERSION)-1_i386.deb
101 $(outdir)/$(debian-package):
102         wget --passive-ftp -P $(outdir) $(debian-mirror)/debian/pool/main/l/lilypond/$(debian-package)
103
104 get-deb-pfa: $(outdir)/$(debian-package)
105         rm -rf $(outdir)/./usr
106         ar p $< data.tar.gz | \
107                 tar -C $(outdir) -zvxf - '*.pfa'
108         touch $(addprefix $(outdir)/, $(addsuffix .bla,$(SAUTER_FONTS)))
109         cp `find $(outdir)/usr/ -name '*.pfa'` $(outdir)/
110
111
112 redhat-package=lilypond-$(TOPLEVEL_VERSION)-1.i386.rpm
113 $(outdir)/$(redhat-package):
114         wget  --passive-ftp -P $(outdir) http://lilypond.org/download/binaries/RedHat-9/$(redhat-package)
115
116 get-rpm-pfa: $(outdir)/$(redhat-package)
117         cd $(outdir) ; rm -rf usr/ # (root alert!) 
118         cd $(outdir) ; rpm2cpio $(redhat-package) | cpio -uid '*.pfa'
119         touch $(addprefix $(outdir)/, $(addsuffix .bla,$(SAUTER_FONTS)))
120         cp `find $(outdir)/usr/ -name '*.pfa'` $(outdir)/
121
122 # change this dependency 
123 get-pfa: get-rpm-pfa
124
125
126 ##
127 ## todo: this also depends on .tfm, FIXME.
128 $(outdir)/%.afm  $(outdir)/%.enc  $(outdir)/%.tex $(outdir)/%list.ly $(outdir)/%.dep: $(outdir)/%.log $(outdir)/%.tfm
129         $(PYTHON) $(buildscript-dir)/mf-to-table.py --package=$(topdir) --outdir=$(outdir) --dep $(outdir)/$(<F:.log=.dep)  --afm $(outdir)/$(<F:.log=.afm)  --enc $(outdir)/$(<F:.log=.enc) --tex $(outdir)/$(<F:.log=.tex) --ly $(outdir)/$(<F:.log=list.ly) $<
130
131 fontdir: $(addprefix $(outdir)/, lilypond.map lilypond.sfd private-fonts fonts.scale fonts.dir Fontmap.lily)
132
133 ## Urg
134 mapentry=$(1) $(shell fgrep FontName $(outdir)/$(1).afm | sed -e 's/FontName *//') <$(1).pfaX
135
136 map = $(foreach a,$(2),$(call $(1),$(a)))
137 $(outdir)/lilypond.xmap: $(AFM_FILES)
138         echo '$(call map,mapentry,$(ALL_FONTS))' | \
139                 tr 'X' '\n' | sed -e 's/^ *//'> $@
140
141 # using shell for loop seems most robust
142 $(outdir)/lilypond.map: $(AFM_FILES)
143         for i in $(FETA_FONTS); do echo $$i $$(fgrep FontName $(outdir)/$$i.afm | sed -e 's/FontName *//') '<'$$i.pfa; done > $@
144         for i in $(SAUTER_FONTS); do echo "$$i $$i <$$i.pfa"; done >> $@
145
146 $(outdir)/Fontmap:
147         echo '%!' > $@
148         echo '% Override default GS Fontmap' >> $@
149         echo '% To let gs load fonts from builddir, do:' >> $@
150         echo '% export GS_LIB=$$(pwd)/mf/out:' >> $@
151         echo '% See Fontmap.GS for the syntax of real Fontmap files.' >> $@
152         echo '(Fontmap.GS) .runlibfile' >> $@
153         echo '(Fontmap.lily) .runlibfile' >> $@
154
155 $(outdir)/Fontmap.lily: $(AFM_FILES) $(outdir)/Fontmap
156         echo '%!' > $@
157         for i in $(FETA_FONTS); do echo "/$$(fgrep FontName $(outdir)/$$i.afm | sed -e 's/FontName *//') ($$i.pfa);"; done >> $@
158         for i in $(SAUTER_FONTS); do echo "$$i ($$i.pfa);"; done >> $@
159
160
161 $(outdir)/fonts.scale: $(PFA_FILES)
162 #       cd $(outdir) && echo $(FETA_MF_FILES:.mf=.pfa) $(FETA_MF_FILES:.mf=.pfb) | $(PYTHON) $(topdir)/buildscripts/make-font-dir.py  > $(@F)
163         cd $(outdir) && echo *.pfa *.pfb | $(PYTHON) $(topdir)/buildscripts/make-font-dir.py  > $(@F)
164
165 $(outdir)/fonts.dir: $(outdir)/fonts.scale
166         cd $(outdir) && mkfontdir
167
168 # Sketch map file
169 $(outdir)/lilypond.sfd:
170 #       cd $(outdir) && echo sketch $(FETA_MF_FILES:.mf=.pfa) | $(PYTHON) $(topdir)/buildscripts/make-font-dir.py  > $(@F)
171         cd $(outdir) && echo sketch *.pfa | $(PYTHON) $(topdir)/buildscripts/make-font-dir.py  > $(@F)
172
173 # Sodipodi map file
174 SODIPODI_FONTS = parmesan20 feta-braces0 feta-nummer10 feta20
175 $(outdir)/private-fonts:
176         cd $(outdir) && echo sodipodi $(SODIPODI_FONTS:%=%.pfa) | $(PYTHON) $(topdir)/buildscripts/make-font-dir.py  > $(@F)
177
178 local-clean:
179         rm -f mfplain.mem mfplain.log 
180         rm -f *.tfm *.log
181
182 afm: $(AFM_FILES)
183 pfa: afm $(PFA_FILES) fontdir
184 pfb: afm $(PFB_FILES) fontdir
185
186
187 # stupid trick to have separate rules for each PFA font ;
188 # otherwise building PFAs is all-or-nothing.
189 $(SAUTER_FONTS:%=$(outdir)/%.bla):
190         $(foreach i, $@, touch $i && ) true
191
192 $(outdir)/%.pfa: $(outdir)/%.bla
193         $(MFTRACE) -I $(outdir)/ --pfa --simplify --keep-trying $(notdir $(basename $@))  && mv $(notdir $@) $(outdir)/
194