1# mf/GNUmakefile
2
3depth = ..
4
5STEPMAKE_TEMPLATES = install install-out
6LOCALSTEPMAKE_TEMPLATES = lilypond
7
8# These are the main .mf files.  We don't use $(MF_FILES) here,
9# because there are more .mf files, input'ed into the main files.
10FETA_MF_FILES = $(call src-wildcard,feta[0-9]*.mf) \
11		$(call src-wildcard,feta-braces-[a-z].mf) \
12		$(call src-wildcard,feta-alphabet*[0-9].mf) \
13		$(call src-wildcard,feta-noteheads*[0-9].mf) \
14		$(call src-wildcard,feta-flags*[0-9].mf) \
15		$(call src-wildcard,parmesan[0-9]*.mf) \
16		$(call src-wildcard,parmesan-noteheads*[0-9].mf)
17FETA_FONTS = $(FETA_MF_FILES:.mf=)
18ALL_FONTS = $(FETA_FONTS)
19PFB_FILES = $(ALL_FONTS:%=$(outdir)/%.pfb)
20
21include $(depth)/make/stepmake.make
22
23# Don't remove $(outdir)/.log's.  Logs are a target!
24# we want to see botched results as well.
25# TODO: use the dependency scanning from invoke-mf2pt1.sh here too.
26$(outdir)/%.dvi: %.mf
27	$(call ly_progress,Making,$@,< mf)
28	MFINPUTS=$(src-dir) \
29	  max_print_line=1000 \
30	  $(METAFONT) "\scrollmode; input $<;" $(METAFONT_QUIET)
31	gftodvi $(basename $<)
32	mv $(basename $<).dvi $(outdir)
33	rm $(basename $<).*gf
34
35$(outdir)/%.tfm $(outdir)/%.log $(outdir)/%.pfb: %.mf $(outdir)/mf2pt1.mem invoke-mf2pt1.sh
36	$(call ly_progress,Making,$(outdir)/$*.pfb,< mf)
37	$(src-dir)/invoke-mf2pt1.sh "$(PERL) $(buildscript-dir)/mf2pt1.pl" $< $(outdir)/$*.pfb $(METAFONT_QUIET)
38
39# since recent mpost versions no longer create a mem file, we create a dummy
40# file to satisfy the dependency (which gets overwritten in case an older
41# mpost creates a real mem file)
42$(outdir)/mf2pt1.mem: mf2pt1.mp
43	$(call ly_progress,Making,$@,< mp)
44	cd $(outdir) \
45	   && touch mf2pt1.mem \
46	   && mpost -progname=mpost -ini $(top-src-dir)/mf/mf2pt1.mp \\dump $(METAFONT_QUIET)
47
48ifndef VERBOSE
49METAFONT_QUIET = >/dev/null
50else
51METAFONT_QUIET =
52endif
53
54$(outdir)/emmentaler-brace.subfonts:
55	$(call ly_progress,Making,$@,)
56	echo $(subst .mf,,$(call src-wildcard,feta-braces-[a-z].mf)) > $@
57
58STAFF_SIZES = 11 13 14 16 18 20 23 26
59BRACES = a b c d e f g h i
60
61OTF_FILES = $(STAFF_SIZES:%=$(outdir)/emmentaler-%.otf) \
62           $(outdir)/emmentaler-brace.otf
63SVG_FILES = $(OTF_FILES:%.otf=%.svg)
64WOFF_FILES = $(OTF_FILES:%.otf=%.woff)
65
66TEXGYRE_OTFS = $(addprefix $(TEXGYRE_DIR)/,$(TEXGYRE_FILES))
67URWOTF_OTFS = $(addprefix $(URWOTF_DIR)/,$(URWOTF_FILES))
68
69LILYPOND_FONTS_CONF = $(outdir)/00-lilypond-fonts.conf \
70		      $(outdir)/99-lilypond-fonts.conf
71
72LOG_FILES = $(FETA_MF_FILES:%.mf=$(outdir)/%.log)
73
74ALL_GEN_FILES = $(OTF_FILES) \
75		$(SVG_FILES) \
76		$(WOFF_FILES) \
77		$(LILYPOND_FONTS_CONF)
78
79INSTALLATION_DIR = $(local_lilypond_datadir)/fonts/source
80INSTALLATION_FILES = $(call src-wildcard,*.mf)
81
82INSTALLATION_OUT_SUFFIXES = 1 2 3
83
84INSTALLATION_OUT_DIR1 = $(local_lilypond_datadir)/fonts/otf
85INSTALLATION_OUT_FILES1 = $(OTF_FILES) \
86			  $(TEXGYRE_OTFS) \
87			  $(URWOTF_OTFS)
88
89INSTALLATION_OUT_DIR2 = $(local_lilypond_datadir)/fonts/svg
90INSTALLATION_OUT_FILES2 = $(SVG_FILES) $(WOFF_FILES)
91
92INSTALLATION_OUT_DIR3 = $(local_lilypond_datadir)/fonts
93INSTALLATION_OUT_FILES3 = $(LILYPOND_FONTS_CONF)
94
95
96# only for fonts which
97#
98# 1. are mentioned in font.scm
99#
100# 2. are not included with teTeX
101#
102$(outdir)/%.global-lisp $(outdir)/%.lisp:  $(outdir)/%.log
103	$(call ly_progress,Making,$(outdir)/$*.lisp,< log)
104	$(PYTHON) $(buildscript-dir)/mf-to-table.py $<
105
106$(outdir)/emmentaler-%.svg $(outdir)/emmentaler-%.woff $(outdir)/emmentaler-%.otf: gen-emmentaler.fontforge.py\
107			$(outdir)/feta%.pfb \
108			    $(outdir)/feta-noteheads%.pfb \
109			    $(outdir)/feta-flags%.pfb \
110			    $(outdir)/feta-alphabet%.pfb \
111			    $(outdir)/parmesan%.pfb \
112			    $(outdir)/parmesan-noteheads%.pfb \
113			    $(outdir)/feta%.lisp \
114			    $(outdir)/feta-noteheads%.lisp \
115			    $(outdir)/feta-flags%.lisp \
116			    $(outdir)/feta-alphabet%.lisp \
117			    $(outdir)/parmesan%.lisp \
118			    $(outdir)/parmesan-noteheads%.lisp \
119			    $(outdir)/feta%.global-lisp \
120			    $(outdir)/feta-alphabet%.tfm
121	$(call ly_progress,Making,$@,)
122	$(FONTFORGE) -lang=py -script $< --version=$(VERSION) --in $(outdir)/ --out $(outdir)/emmentaler-$*.otf
123
124
125$(outdir)/emmentaler-brace.otf: gen-emmentaler-brace.fontforge.py \
126		$(foreach s,$(BRACES),$(outdir)/feta-braces-$(s).pfb) \
127		$(foreach s,$(BRACES),$(outdir)/feta-braces-$(s).lisp)
128	$(call ly_progress,Making,$@,)
129	$(FONTFORGE) -lang=py -script $< --version $(VERSION) --out=$(outdir)/emmentaler-brace.otf --in $(outdir)
130	touch $@ $(outdir)/emmentaler-brace.woff $(outdir)/emmentaler-brace.svg
131
132$(outdir)/emmentaler-brace.woff $(outdir)/emmentaler-brace.svg: $(outdir)/emmentaler-brace.otf
133	@true
134
135default: tree-regen
136
137.PHONY: tree-regen
138
139tree-regen: $(ALL_GEN_FILES)
140	${MAKE} -C $(top-build-dir) link-mf-tree
141
142$(outdir)/%.conf: %.conf
143	$(call ly_progress,Copying,$@,)
144	cp $< $@
145