~ubuntu-branches/ubuntu/precise/lilypond/precise

« back to all changes in this revision

Viewing changes to mf/GNUmakefile

  • Committer: Bazaar Package Importer
  • Author(s): Thomas Bushnell, BSG
  • Date: 2006-12-19 10:18:12 UTC
  • mfrom: (3.1.4 feisty)
  • Revision ID: james.westby@ubuntu.com-20061219101812-7awtjkp0i393wxty
Tags: 2.8.7-3
scripts/midi2ly.py: When setting DATADIR, find Lilypond python files
in the @TOPLEVEL_VERSION@ directory, not 'current'.  Patch thanks to
Chris Lamb (chris@chris-lamb.co.uk).  (Closes: #400550)

Show diffs side-by-side

added added

removed removed

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