3 STEPMAKE_TEMPLATES=metafont install install-out
5 include $(depth)/make/stepmake.make
7 AF_FILES = $(wildcard *.af)
9 EXTRA_DIST_FILES += README feta.tex
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)
18 FETA_FONTS = $(FETA_MF_FILES:.mf=)
20 XPM_FONTS = feta20 feta-din10 feta-nummer10 feta-braces20 parmesan20
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)
30 ENCODING_FILE=$(findstring $(<:.mf=.enc), $(FETA_MF_FILES:.mf=.enc))
31 MFTRACE_FLAGS=$(if $(ENCODING_FILE),--encoding $(ENCODING_FILE),)
33 # Make tfm files first, log files last,
34 # so that normally log files aren't made twice
35 ALL_GEN_FILES= $(TFM_FILES) $(TEXTABLES) $(AFM_FILES) $(TFM_FILES) $(LOG_FILES) $(ENC_FILES)
37 #PRE_INSTALL=$(MAKE) "$(ALL_GEN_FILES)"
38 INSTALLATION_DIR=$(local_lilypond_datadir)/fonts/source
39 INSTALLATION_FILES=$(MF_FILES) $(AF_FILES)
41 INSTALLATION_OUT_SUFFIXES=1 2 3 4 5
43 INSTALLATION_OUT_DIR1=$(local_lilypond_datadir)/tex
44 INSTALLATION_OUT_FILES1=$(TEXTABLES)
46 INSTALLATION_OUT_DIR2=$(local_lilypond_datadir)/fonts/afm
47 INSTALLATION_OUT_FILES2=$(AFM_FILES)
49 INSTALLATION_OUT_DIR3=$(local_lilypond_datadir)/fonts/tfm
50 INSTALLATION_OUT_FILES3=$(TFM_FILES)
53 SAUTER_FONTS = cmbxti8
55 ALL_FONTS = $(FETA_FONTS) $(SAUTER_FONTS)
58 PFA_FILES = $(ALL_FONTS:%=$(outdir)/%.pfa)
59 PFB_FILES = $(PFA_FILES:%.pfa=%.pfb)
61 ALL_GEN_FILES += $(PFA_FILES) $(outdir)/lilypond.map $(outdir)/fonts.scale
62 INSTALLATION_OUT_DIR4=$(local_lilypond_datadir)/fonts/type1
63 INSTALLATION_OUT_FILES4=$(PFA_FILES) $(outdir)/fonts.scale
65 INSTALLATION_OUT_DIR5=$(local_lilypond_datadir)/dvips/
66 INSTALLATION_OUT_FILES5=$(outdir)/lilypond.map
68 export MFINPUTS:=.:$(MFINPUTS)
70 default: pfa_warning $(ALL_GEN_FILES)
74 ifneq ($(basename $(MFTRACE)),mftrace)
76 @echo "ERROR: mftrace not found"
78 @echo "For obtaining PFA fonts, either install mftrace "
79 @echo "(see http://www.xs4all.nl/~hanwen/mftrace/ ),"
80 @echo "or try one of the following commands in this directory: "
82 @echo " make get-pfa "
83 @echo " make get-rpm-pfa "
84 @echo " make get-deb-pfa "
86 @echo "These commands will try to download the files from the internet."
91 debian-mirror=http://ftp.us.debian.org
92 debian-package =lilypond_$(TOPLEVEL_VERSION)-1_i386.deb
93 $(outdir)/$(debian-package):
94 wget --passive-ftp -P $(outdir) $(debian-mirror)/debian/pool/main/l/lilypond/$(debian-package)
96 get-deb-pfa: $(outdir)/$(debian-package)
97 rm -rf $(outdir)/./usr
98 ar p $< data.tar.gz | \
99 tar -C $(outdir) -zvxf - '*.pfa'
100 touch $(addprefix $(outdir)/, $(addsuffix .bla,$(SAUTER_FONTS)))
101 cp `find $(outdir)/usr/ -name '*.pfa'` $(outdir)/
104 redhat-package=lilypond-$(TOPLEVEL_VERSION)-1.i386.rpm
105 $(outdir)/$(redhat-package):
106 wget --passive-ftp -P $(outdir) ftp://ftp.lilypond.org/pub/LilyPond/binaries/RedHat-9/$(redhat-package)
108 get-rpm-pfa: $(outdir)/$(redhat-package)
109 cd $(outdir) ; rm -rf usr/ # (root alert!)
110 cd $(outdir) ; rpm2cpio $(redhat-package) | cpio -uid '*.pfa'
111 touch $(addprefix $(outdir)/, $(addsuffix .bla,$(SAUTER_FONTS)))
112 cp `find $(outdir)/usr/ -name '*.pfa'` $(outdir)/
114 # change this dependency
119 ## todo: this also depends on .tfm, FIXME.
120 $(outdir)/%.afm $(outdir)/%.enc $(outdir)/%.tex $(outdir)/%list.ly $(outdir)/%.dep: $(outdir)/%.log $(outdir)/%.tfm
121 $(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) $<
123 fontdir: $(addprefix $(outdir)/, lilypond.map lilypond.sfd private-fonts fonts.scale fonts.dir)
126 mapentry=$(1) $(shell fgrep FontName $(outdir)/$(1).afm | sed -e 's/FontName *//') <$(1).pfaX
128 map = $(foreach a,$(2),$(call $(1),$(a)))
129 $(outdir)/lilypond.xmap: $(AFM_FILES)
130 echo '$(call map,mapentry,$(ALL_FONTS))' | \
131 tr 'X' '\n' | sed -e 's/^ *//'> $@
133 # using shell for loop seems most robust
134 $(outdir)/lilypond.map: $(AFM_FILES)
135 for i in $(FETA_FONTS); do echo $$i $$(fgrep FontName $(outdir)/$$i.afm | sed -e 's/FontName *//') '<'$$i.pfa; done > $@
136 for i in $(SAUTER_FONTS); do echo "$$i $$i <$$i.pfa"; done >> $@
139 $(outdir)/fonts.scale: $(PFA_FILES)
140 # cd $(outdir) && echo $(FETA_MF_FILES:.mf=.pfa) $(FETA_MF_FILES:.mf=.pfb) | $(PYTHON) $(topdir)/buildscripts/make-font-dir.py > $(@F)
141 cd $(outdir) && echo *.pfa *.pfb | $(PYTHON) $(topdir)/buildscripts/make-font-dir.py > $(@F)
143 $(outdir)/fonts.dir: $(outdir)/fonts.scale
144 cd $(outdir) && mkfontdir
147 $(outdir)/lilypond.sfd:
148 # cd $(outdir) && echo sketch $(FETA_MF_FILES:.mf=.pfa) | $(PYTHON) $(topdir)/buildscripts/make-font-dir.py > $(@F)
149 cd $(outdir) && echo sketch *.pfa | $(PYTHON) $(topdir)/buildscripts/make-font-dir.py > $(@F)
152 SODIPODI_FONTS = parmesan20 feta-braces0 feta-nummer10 feta20
153 $(outdir)/private-fonts:
154 cd $(outdir) && echo sodipodi $(SODIPODI_FONTS:%=%.pfa) | $(PYTHON) $(topdir)/buildscripts/make-font-dir.py > $(@F)
157 rm -f mfplain.mem mfplain.log
161 pfa: afm $(PFA_FILES) fontdir
162 pfb: afm $(PFB_FILES) fontdir
165 # stupid trick to have separate rules for each PFA font ;
166 # otherwise building PFAs is all-or-nothing.
167 $(SAUTER_FONTS:%=$(outdir)/%.bla):
168 $(foreach i, $@, touch $i && ) true
170 $(outdir)/%.pfa: $(outdir)/%.bla
171 $(MFTRACE) -I $(outdir)/ --pfa --simplify --keep-trying $(notdir $(basename $@)) && mv $(notdir $@) $(outdir)/