Debian Codegraph @

Makefile

raw
1 #!/usr/bin/make -f
2
3 NAME=Gayathri
4 FONTS=Regular Bold Thin
5 INSTALLPATH=/usr/share/fonts/opentype/malayalam
6 PY=python3
7 version=`cat VERSION`
8 TOOLDIR=tools
9 SRCDIR=sources
10 designspace=$(SRCDIR)/GayathriProject.designspace
11 tests=tests
12 BLDDIR=build
13 default: otf
14 all: clean lint otf ttf webfonts test
15 OTF=$(FONTS:%=$(BLDDIR)/$(NAME)-%.otf)
16 TTF=$(FONTS:%=$(BLDDIR)/$(NAME)-%.ttf)
17 WOFF2=$(FONTS:%=$(BLDDIR)/$(NAME)-%.woff2)
18 PDFS=$(FONTS:%=$(BLDDIR)/$(NAME)-%-ligatures.pdf) \
19 $(FONTS:%=$(BLDDIR)/$(NAME)-%-content.pdf) \
20 $(FONTS:%=$(BLDDIR)/$(NAME)-%-kerning.pdf) \
21 $(FONTS:%=$(BLDDIR)/$(NAME)-%-table.pdf)
22
23 $(BLDDIR)/%.otf: $(SRCDIR)/%.ufo
24 @echo " BUILD $(@F)"
25 @fontmake --validate-ufo --verbose=WARNING -o otf --output-dir $(BLDDIR) -u $<
26
27 $(BLDDIR)/%.ttf: $(SRCDIR)/%.ufo
28 @echo " BUILD $(@F)"
29 @fontmake --verbose=WARNING -o ttf -e 0.01 --flatten-components --filter DecomposeTransformedComponentsFilter --output-dir $(BLDDIR) -u $<
30
31 $(BLDDIR)/%.woff2: $(BLDDIR)/%.otf
32 @echo "WEBFONT $(@F)"
33 @fonttools ttLib.woff2 compress $<
34
35 $(BLDDIR)/%-table.pdf: $(BLDDIR)/%.ttf
36 @echo " TEST $(@F)"
37 @fntsample --font-file $< --output-file $(BLDDIR)/$(@F) \
38 --style="header-font: Noto Sans Bold 12" \
39 --style="font-name-font: Noto Serif Bold 12" \
40 --style="table-numbers-font: Noto Sans 10" \
41 --style="cell-numbers-font:Noto Sans Mono 8"
42
43 $(BLDDIR)/%-ligatures.pdf: $(BLDDIR)/%.ttf
44 @echo " TEST $(@F)"
45 @hb-view $< --font-size 14 --margin 100 --line-space 1.5 \
46 --foreground=333333 --text-file $(tests)/ligatures.txt \
47 --output-file $(BLDDIR)/$(@F);
48
49 $(BLDDIR)/%-kerning.pdf: $(BLDDIR)/%.ttf
50 @echo " TEST $(@F)"
51 @hb-view $< --font-size 14 --margin 100 --line-space 1.5 \
52 --foreground=333333 --text-file $(tests)/kerning.txt \
53 --output-file $(BLDDIR)/$(@F);
54
55 $(BLDDIR)/%-content.pdf: $(BLDDIR)/%.ttf
56 @echo " TEST $(@F)"
57 @hb-view $< --font-size 14 --margin 100 --line-space 1.5 \
58 --foreground=333333 --text-file $(tests)/content.txt \
59 --output-file $(BLDDIR)/$(@F);
60
61 ttf: $(TTF)
62 otf: $(OTF)
63 webfonts: $(WOFF2)
64 lint: ufolint
65 ufo: glyphs ufonormalizer lint
66
67 ufolint: $(SRCDIR)/*.ufo
68 $@ $^
69 ufonormalizer: $(SRCDIR)/*.ufo
70 @for variant in $^;do \
71 ufonormalizer -m $$variant;\
72 done;
73 install: otf
74 @mkdir -p ${DESTDIR}${INSTALLPATH}
75 install -D -m 0644 $(BLDDIR)/*.otf ${DESTDIR}${INSTALLPATH}/
76
77 test: ttf otf $(PDFS)
78 # fontbakery check-fontval $(BLDDIR)/*.ttf <- enable when https://github.com/microsoft/Font-Validator/issues/62 fixed
79 fontbakery check-ufo-sources $(SRCDIR)/*.ufo
80 fontbakery check-opentype $(BLDDIR)/*.otf
81 fontbakery check-googlefonts -x com.google.fonts/check/version_bump -x com.google.fonts/check/repo/zip_files -x com.google.fonts/check/license/OFL_body_text -x com.google.fonts/check/fontdata_namecheck $(BLDDIR)/*.ttf
82
83 glyphs: $(FONTS:%=$(SRCDIR)/$(NAME)-%/glyphs)
84
85 $(SRCDIR)/$(NAME)-%/glyphs:
86 @for svg in `ls $(SRCDIR)/design/$*/*.svg`;do \
87 $(PY) tools/import-svg-to-ufo.py -c $(SRCDIR)/design/config/$*.yaml $$svg; \
88 done;
89
90 clean:
91 @rm -rf $(BLDDIR)