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)
28 FETA_LIST_FILES = $(FETA_MF_FILES:%.mf=$(outdir)/%list.ly)
31 ENCODING_FILE=$(findstring $(<:.mf=.enc), $(FETA_MF_FILES:.mf=.enc))
32 MFTRACE_FLAGS=$(if $(ENCODING_FILE),--encoding $(ENCODING_FILE),)
34 SAUTER_FONTS = cmbxti8
35 MORE_SAUTER_FONTS = cmbxti7 cmbxti8 cmbxti12 cmbxti14 \
36 cmcsc7 cmcsc12 cmtt17 cmbx14 cmbx17 cmtt6 cmbx6 cmbx5 cmbxti5 \
37 cmti6 cmti5 cmss5 cmss6 cmss7
39 ALL_FONTS = $(FETA_FONTS) $(SAUTER_FONTS)
40 PFA_FILES = $(ALL_FONTS:%=$(outdir)/%.pfa)
41 PFB_FILES = $(PFA_FILES:%.pfa=%.pfb)
43 # Make tfm files first, log files last,
44 # so that normally log files aren't made twice
45 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
47 #PRE_INSTALL=$(MAKE) "$(ALL_GEN_FILES)"
48 INSTALLATION_DIR=$(local_lilypond_datadir)/fonts/source
49 INSTALLATION_FILES=$(MF_FILES) $(AF_FILES)
51 INSTALLATION_OUT_SUFFIXES=1 2 3 4 5 6
53 INSTALLATION_OUT_DIR1=$(local_lilypond_datadir)/tex
54 INSTALLATION_OUT_FILES1=$(TEXTABLES)
56 INSTALLATION_OUT_DIR2=$(local_lilypond_datadir)/fonts/afm
57 INSTALLATION_OUT_FILES2=$(AFM_FILES)
59 INSTALLATION_OUT_DIR3=$(local_lilypond_datadir)/fonts/tfm
60 INSTALLATION_OUT_FILES3=$(TFM_FILES)
62 INSTALLATION_OUT_DIR4=$(local_lilypond_datadir)/ly
63 INSTALLATION_OUT_FILES4=$(FETA_LIST_FILES)
65 INSTALLATION_OUT_DIR5=$(local_lilypond_datadir)/fonts/type1
66 INSTALLATION_OUT_FILES5=$(PFA_FILES) $(outdir)/fonts.scale $(outdir)/Fontmap $(outdir)/Fontmap.lily
68 INSTALLATION_OUT_DIR6=$(local_lilypond_datadir)/dvips/
69 INSTALLATION_OUT_FILES6=$(outdir)/lilypond.map
71 export MFINPUTS:=.:$(MFINPUTS)
73 default: pfa_warning $(ALL_GEN_FILES)
77 ifneq ($(notdir $(MFTRACE)),mftrace)
79 @echo "ERROR: mftrace not found"
81 @echo "For obtaining PFA fonts, either install mftrace "
82 @echo "(see http://www.xs4all.nl/~hanwen/mftrace/ ),"
83 @echo "or try one of the following commands in this directory: "
85 @echo " make get-pfa "
86 @echo " make get-rpm-pfa "
87 @echo " make get-deb-pfa "
89 @echo "These commands will try to download the files from the internet."
94 debian-mirror=http://ftp.us.debian.org
95 debian-package =lilypond_$(TOPLEVEL_VERSION)-1_i386.deb
96 $(outdir)/$(debian-package):
97 wget --passive-ftp -P $(outdir) $(debian-mirror)/debian/pool/main/l/lilypond/$(debian-package)
99 get-deb-pfa: $(outdir)/$(debian-package)
100 rm -rf $(outdir)/./usr
101 ar p $< data.tar.gz | \
102 tar -C $(outdir) -zvxf - '*.pfa'
103 touch $(addprefix $(outdir)/, $(addsuffix .bla,$(SAUTER_FONTS)))
104 cp `find $(outdir)/usr/ -name '*.pfa'` $(outdir)/
107 redhat-package=lilypond-$(TOPLEVEL_VERSION)-1.i386.rpm
108 $(outdir)/$(redhat-package):
109 wget --passive-ftp -P $(outdir) http://lilypond.org/download/binaries/RedHat-9/$(redhat-package)
111 get-rpm-pfa: $(outdir)/$(redhat-package)
112 cd $(outdir) ; rm -rf usr/ # (root alert!)
113 cd $(outdir) ; rpm2cpio $(redhat-package) | cpio -uid '*.pfa'
114 touch $(addprefix $(outdir)/, $(addsuffix .bla,$(SAUTER_FONTS)))
115 cp `find $(outdir)/usr/ -name '*.pfa'` $(outdir)/
117 # change this dependency
122 ## todo: this also depends on .tfm, FIXME.
123 $(outdir)/%.afm $(outdir)/%.enc $(outdir)/%.tex $(outdir)/%list.ly $(outdir)/%.dep: $(outdir)/%.log $(outdir)/%.tfm
124 $(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) $<
126 fontdir: $(addprefix $(outdir)/, lilypond.map lilypond.sfd private-fonts fonts.scale fonts.dir Fontmap.lily)
129 mapentry=$(1) $(shell fgrep FontName $(outdir)/$(1).afm | sed -e 's/FontName *//') <$(1).pfaX
131 map = $(foreach a,$(2),$(call $(1),$(a)))
132 $(outdir)/lilypond.xmap: $(AFM_FILES)
133 echo '$(call map,mapentry,$(ALL_FONTS))' | \
134 tr 'X' '\n' | sed -e 's/^ *//'> $@
136 # using shell for loop seems most robust
137 $(outdir)/lilypond.map: $(AFM_FILES)
138 for i in $(FETA_FONTS); do echo $$i $$(fgrep FontName $(outdir)/$$i.afm | sed -e 's/FontName *//') '<'$$i.pfa; done > $@
139 for i in $(SAUTER_FONTS); do echo "$$i $$i <$$i.pfa"; done >> $@
143 echo '% Override default GS Fontmap' >> $@
144 echo '% To let gs load fonts from builddir, do:' >> $@
145 echo '% export GS_LIB=$$(pwd)/mf/out:' >> $@
146 echo '% See Fontmap.GS for the syntax of real Fontmap files.' >> $@
147 echo '(Fontmap.GS) .runlibfile' >> $@
148 echo '(Fontmap.lily) .runlibfile' >> $@
150 $(outdir)/Fontmap.lily: $(AFM_FILES) $(outdir)/Fontmap
152 for i in $(FETA_FONTS); do echo "/$$(fgrep FontName $(outdir)/$$i.afm | sed -e 's/FontName *//') ($$i.pfa);"; done >> $@
153 for i in $(SAUTER_FONTS); do echo "$$i ($$i.pfa);"; done >> $@
156 $(outdir)/fonts.scale: $(PFA_FILES)
157 # cd $(outdir) && echo $(FETA_MF_FILES:.mf=.pfa) $(FETA_MF_FILES:.mf=.pfb) | $(PYTHON) $(topdir)/buildscripts/make-font-dir.py > $(@F)
158 cd $(outdir) && echo *.pfa *.pfb | $(PYTHON) $(topdir)/buildscripts/make-font-dir.py > $(@F)
160 $(outdir)/fonts.dir: $(outdir)/fonts.scale
161 cd $(outdir) && mkfontdir
164 $(outdir)/lilypond.sfd:
165 # cd $(outdir) && echo sketch $(FETA_MF_FILES:.mf=.pfa) | $(PYTHON) $(topdir)/buildscripts/make-font-dir.py > $(@F)
166 cd $(outdir) && echo sketch *.pfa | $(PYTHON) $(topdir)/buildscripts/make-font-dir.py > $(@F)
169 SODIPODI_FONTS = parmesan20 feta-braces0 feta-nummer10 feta20
170 $(outdir)/private-fonts:
171 cd $(outdir) && echo sodipodi $(SODIPODI_FONTS:%=%.pfa) | $(PYTHON) $(topdir)/buildscripts/make-font-dir.py > $(@F)
174 rm -f mfplain.mem mfplain.log
178 pfa: afm $(PFA_FILES) fontdir
179 pfb: afm $(PFB_FILES) fontdir
182 # stupid trick to have separate rules for each PFA font ;
183 # otherwise building PFAs is all-or-nothing.
184 $(SAUTER_FONTS:%=$(outdir)/%.bla):
185 $(foreach i, $@, touch $i && ) true
187 $(outdir)/%.pfa: $(outdir)/%.bla
188 $(MFTRACE) -I $(outdir)/ --pfa --simplify --keep-trying $(notdir $(basename $@)) && mv $(notdir $@) $(outdir)/