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