summaryrefslogtreecommitdiff
path: root/Makefile
blob: 6ce4dda73ad10811fa7fa654a6e2e857472185e2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
# Targets:
#    all        Build all styles in all formats (default)
#    all_ttf    Build all styles as TrueType
#    STYLE      Build STYLE in all formats (e.g. MediumItalic)
#    STYLE_ttf  Build STYLE as TrueType (e.g. MediumItalic_ttf)
#    zip        Build all styles as TrueType and package into a zip archive
#
all: all_web all_otf

# generated.make is automatically generated by init.sh and defines depenencies for
# all styles and alias targets
include build/etc/generated.make

res_files := src/fontbuild.cfg src/diacritics.txt src/glyphlist.txt src/glyphorder.txt

# UFO -> TTF & OTF (note that UFO deps are defined by generated.make)
build/tmp/InterfaceTTF/Interface-%.ttf: $(res_files)
	misc/ufocompile --otf $*

build/tmp/InterfaceOTF/Interface-%.otf: build/tmp/InterfaceTTF/Interface-%.ttf $(res_files)
	@true

# build/tmp/ttf -> build (generated.make handles build/tmp/InterfaceTTF/Interface-%.ttf)
build/dist-unhinted/Interface-%.ttf: build/tmp/InterfaceTTF/Interface-%.ttf
	@mkdir -p build/dist-unhinted
	cp -a "$<" "$@"

# OTF
build/dist-unhinted/Interface-%.otf: build/tmp/InterfaceOTF/Interface-%.otf
	cp -a "$<" "$@"

build/dist:
	@mkdir -p build/dist

# autohint
build/dist/Interface-%.ttf: build/dist-unhinted/Interface-%.ttf build/dist
	ttfautohint \
	  --hinting-limit=256 \
	  --hinting-range-min=8 \
	  --hinting-range-max=64 \
	  --fallback-stem-width=256 \
	  --strong-stem-width=D \
	  --no-info \
	  --verbose \
	  "$<" "$@"

# TTF -> WOFF2
build/%.woff2: build/%.ttf
	woff2_compress "$<"

# TTF -> WOFF
build/%.woff: build/%.ttf
	ttf2woff -O -t woff "$<" "$@"

# TTF -> EOT (disabled)
# build/%.eot: build/%.ttf
# 	ttf2eot "$<" > "$@"

# TTF -> zip
zip: all
	@rm -rf build/.zip
	@rm -f build/.zip.zip
	@mkdir -p \
		"build/.zip/Interface (web)" \
		"build/.zip/Interface (hinted TTF)" \
		"build/.zip/Interface (TTF)" \
		"build/.zip/Interface (OTF)"
	cp -a build/dist/*.woff build/dist/*.woff2  "build/.zip/Interface (web)/"
	cp -a build/dist/*.ttf                      "build/.zip/Interface (hinted TTF)/"
	cp -a build/dist-unhinted/*.ttf             "build/.zip/Interface (TTF)/"
	cp -a build/dist-unhinted/*.otf             "build/.zip/Interface (OTF)/"
	cp -a misc/doc/install-*.txt                "build/.zip/"
	cd build/.zip && zip -v -X -r "../../build/.zip.zip" *
	@mkdir -p build/release
	@mv -f build/.zip.zip build/release/Interface-`date '+%Y%m%d'`.zip
	@echo write           build/release/Interface-`date '+%Y%m%d'`.zip
	@rm -rf build/.zip

install_ttf: all_ttf
	@echo "Installing TTF files locally at ~/Library/Fonts/Interface"
	rm -rf ~/Library/Fonts/Interface
	mkdir -p ~/Library/Fonts/Interface
	cp -va build/dist/*.ttf ~/Library/Fonts/Interface

install_otf: all_otf
	@echo "Installing OTF files locally at ~/Library/Fonts/Interface"
	rm -rf ~/Library/Fonts/Interface
	mkdir -p ~/Library/Fonts/Interface
	cp -va build/dist-unhinted/*.otf ~/Library/Fonts/Interface

install: all install_otf

glyphinfo: _local/UnicodeData.txt
	misc/gen-glyphinfo.py -ucd _local/UnicodeData.txt \
	  src/Interface-*.ufo > misc/preview/glyphinfo.json

# Download latest Unicode data
_local/UnicodeData.txt:
	@mkdir -p _local
	curl -s '-#' -o "$@" \
	  http://www.unicode.org/Public/UCD/latest/ucd/UnicodeData.txt

clean:
	rm -vrf build/tmp/* build/dist/Interface-*.*

.PHONY: all web clean install install_otf install_ttf deploy zip glyphinfo