Debian Codegraph @

Makefile

raw symbols SCIP
1 # List all targets with 'make list'
2 SRCDIR := $(abspath $(lastword $(MAKEFILE_LIST))/..)
3 FONTDIR := build/fonts
4 UFODIR := build/ufo
5 BIN := $(SRCDIR)/build/venv/bin
6 VENV := build/venv/bin/activate
7 VERSION := $(shell cat version.txt)
8 MAKEFILE := $(lastword $(MAKEFILE_LIST))
9
10 export PATH := $(BIN):$(PATH)
11
12 default: all
13
14 # arguments to fontmake
15 FM_ARGS :=
16 ifndef DEBUG
17 FM_ARGS += --verbose WARNING
18 endif
19
20 # ---------------------------------------------------------------------------------
21 # intermediate sources
22
23 $(UFODIR)/%.glyphs: src/%.glyphspackage | $(UFODIR) venv
24 . $(VENV) ; build/venv/bin/glyphspkg -o $(dir $@) $^
25
26 # features
27 build/features_data: $(UFODIR)/features $(wildcard src/features/*)
28 touch "$@"
29 $(UFODIR)/features:
30 @mkdir -p $(UFODIR)
31 @rm -f $(UFODIR)/features
32 @ln -s ../../src/features $(UFODIR)/features
33
34 # designspace & master UFOs
35 $(UFODIR)/%.var.designspace: $(UFODIR)/%.designspace misc/tools/gen-var-designspace.py | venv
36 . $(VENV) ; python misc/tools/gen-var-designspace.py $< $@
37
38 $(UFODIR)/%.designspace: $(UFODIR)/%.glyphs $(UFODIR)/features misc/tools/postprocess-designspace.py | venv
39 . $(VENV) ; fontmake $(FM_ARGS) -o ufo -g $< --designspace-path $@ \
40 --master-dir $(UFODIR) --instance-dir $(UFODIR)
41 . $(VENV) ; python misc/tools/postprocess-designspace.py $@
42
43 # instance UFOs from designspace
44 $(UFODIR)/Inter%Italic.ufo: $(UFODIR)/Inter-Italic.designspace misc/tools/gen-instance-ufo.sh | venv
45 . $(VENV) ; bash misc/tools/gen-instance-ufo.sh $< $@
46 $(UFODIR)/Inter%.ufo: $(UFODIR)/Inter-Roman.designspace misc/tools/gen-instance-ufo.sh | venv
47 . $(VENV) ; bash misc/tools/gen-instance-ufo.sh $< $@
48
49 # designspace & master UFOs (for editing)
50 build/ufo-editable/%.designspace: $(UFODIR)/%.glyphs $(UFODIR)/features misc/tools/postprocess-designspace.py | venv
51 @mkdir -p $(dir $@)
52 . $(VENV) ; fontmake $(FM_ARGS) -o ufo -g $< --designspace-path $@ \
53 --master-dir $(dir $@) --instance-dir $(dir $@)
54 . $(VENV) ; python misc/tools/postprocess-designspace.py --editable $@
55
56 # instance UFOs from designspace (for editing)
57 build/ufo-editable/Inter%Italic.ufo: build/ufo-editable/Inter-Italic.designspace misc/tools/gen-instance-ufo.sh | venv
58 . $(VENV) ; bash misc/tools/gen-instance-ufo.sh $< $@
59 build/ufo-editable/Inter%.ufo: build/ufo-editable/Inter-Roman.designspace misc/tools/gen-instance-ufo.sh | venv
60 . $(VENV) ; bash misc/tools/gen-instance-ufo.sh $< $@
61
62 editable-ufos: build/ufo-editable/.ok
63 @echo "Editable designspace & UFOs can be found here:"
64 @echo " $(PWD)/build/ufo-editable"
65
66 build/ufo-editable/.ok: build/ufo-editable/Inter-Roman.designspace build/ufo-editable/Inter-Italic.designspace
67 @rm -f build/ufo-editable/features
68 @ln -s ../../src/features build/ufo-editable/features
69 $(MAKE) \
70 build/ufo-editable/Inter-Light.ufo \
71 build/ufo-editable/Inter-ExtraLight.ufo \
72 build/ufo-editable/Inter-Medium.ufo \
73 build/ufo-editable/Inter-SemiBold.ufo \
74 build/ufo-editable/Inter-Bold.ufo \
75 build/ufo-editable/Inter-ExtraBold.ufo \
76 \
77 build/ufo-editable/Inter-LightItalic.ufo \
78 build/ufo-editable/Inter-ExtraLightItalic.ufo \
79 build/ufo-editable/Inter-MediumItalic.ufo \
80 build/ufo-editable/Inter-SemiBoldItalic.ufo \
81 build/ufo-editable/Inter-BoldItalic.ufo \
82 build/ufo-editable/Inter-ExtraBoldItalic.ufo \
83 \
84 build/ufo-editable/InterDisplay-Light.ufo \
85 build/ufo-editable/InterDisplay-ExtraLight.ufo \
86 build/ufo-editable/InterDisplay-Medium.ufo \
87 build/ufo-editable/InterDisplay-SemiBold.ufo \
88 build/ufo-editable/InterDisplay-Bold.ufo \
89 build/ufo-editable/InterDisplay-ExtraBold.ufo \
90 \
91 build/ufo-editable/InterDisplay-LightItalic.ufo \
92 build/ufo-editable/InterDisplay-ExtraLightItalic.ufo \
93 build/ufo-editable/InterDisplay-MediumItalic.ufo \
94 build/ufo-editable/InterDisplay-SemiBoldItalic.ufo \
95 build/ufo-editable/InterDisplay-BoldItalic.ufo \
96 build/ufo-editable/InterDisplay-ExtraBoldItalic.ufo
97 @touch $@
98 @echo ""
99
100 # make sure intermediate files are not rm'd by make
101 .PRECIOUS: \
102 $(UFODIR)/Inter-Black.ufo \
103 $(UFODIR)/Inter-Regular.ufo \
104 $(UFODIR)/Inter-Thin.ufo \
105 $(UFODIR)/Inter-Light.ufo \
106 $(UFODIR)/Inter-ExtraLight.ufo \
107 $(UFODIR)/Inter-Medium.ufo \
108 $(UFODIR)/Inter-SemiBold.ufo \
109 $(UFODIR)/Inter-Bold.ufo \
110 $(UFODIR)/Inter-ExtraBold.ufo \
111 \
112 $(UFODIR)/Inter-BlackItalic.ufo \
113 $(UFODIR)/Inter-Italic.ufo \
114 $(UFODIR)/Inter-ThinItalic.ufo \
115 $(UFODIR)/Inter-LightItalic.ufo \
116 $(UFODIR)/Inter-ExtraLightItalic.ufo \
117 $(UFODIR)/Inter-MediumItalic.ufo \
118 $(UFODIR)/Inter-SemiBoldItalic.ufo \
119 $(UFODIR)/Inter-BoldItalic.ufo \
120 $(UFODIR)/Inter-ExtraBoldItalic.ufo \
121 \
122 $(UFODIR)/InterDisplay-Black.ufo \
123 $(UFODIR)/InterDisplay-Regular.ufo \
124 $(UFODIR)/InterDisplay-Thin.ufo \
125 $(UFODIR)/InterDisplay-Light.ufo \
126 $(UFODIR)/InterDisplay-ExtraLight.ufo \
127 $(UFODIR)/InterDisplay-Medium.ufo \
128 $(UFODIR)/InterDisplay-SemiBold.ufo \
129 $(UFODIR)/InterDisplay-Bold.ufo \
130 $(UFODIR)/InterDisplay-ExtraBold.ufo \
131 \
132 $(UFODIR)/InterDisplay-BlackItalic.ufo \
133 $(UFODIR)/InterDisplay-Italic.ufo \
134 $(UFODIR)/InterDisplay-ThinItalic.ufo \
135 $(UFODIR)/InterDisplay-LightItalic.ufo \
136 $(UFODIR)/InterDisplay-ExtraLightItalic.ufo \
137 $(UFODIR)/InterDisplay-MediumItalic.ufo \
138 $(UFODIR)/InterDisplay-SemiBoldItalic.ufo \
139 $(UFODIR)/InterDisplay-BoldItalic.ufo \
140 $(UFODIR)/InterDisplay-ExtraBoldItalic.ufo \
141 \
142 $(UFODIR)/Inter-Roman.glyphs \
143 $(UFODIR)/Inter-Italic.glyphs \
144 $(UFODIR)/Inter-Roman.designspace \
145 $(UFODIR)/Inter-Italic.designspace \
146 $(UFODIR)/Inter-Roman.var.designspace \
147 $(UFODIR)/Inter-Italic.var.designspace
148
149 # ---------------------------------------------------------------------------------
150 # products
151
152 # arguments to fontmake
153 FM_ARGS_2 := $(FM_ARGS) \
154 --overlaps-backend pathops \
155 --flatten-components \
156 --no-autohint
157 ifndef DEBUG
158 FM_ARGS_2 += --production-names
159 else
160 FM_ARGS_2 += --no-production-names
161 endif
162
163
164 $(FONTDIR)/static/%.otf: $(UFODIR)/%.ufo build/features_data | $(FONTDIR)/static venv
165 . $(VENV) ; fontmake -u $< -o otf --output-path [email protected] $(FM_ARGS_2)
166 . $(VENV) ; psautohint -o $@ [email protected]
167 @rm [email protected]
168
169 $(FONTDIR)/static/%.ttf: $(UFODIR)/%.ufo build/features_data | $(FONTDIR)/static venv
170 . $(VENV) ; fontmake -u $< -o ttf --output-path $@ $(FM_ARGS_2)
171
172
173 AUTOHINT_ARGS := --stem-width-mode=qqq --no-info
174
175 $(FONTDIR)/static-hinted/Inter-Regular.ttf: $(FONTDIR)/static/Inter-Regular.ttf | $(FONTDIR)/static-hinted venv
176 . $(VENV) ; python -m ttfautohint $(AUTOHINT_ARGS) "$<" "$@"
177
178 $(FONTDIR)/static-hinted/InterDisplay-Regular.ttf: $(FONTDIR)/static/InterDisplay-Regular.ttf | $(FONTDIR)/static-hinted venv
179 . $(VENV) ; python -m ttfautohint $(AUTOHINT_ARGS) "$<" "$@"
180
181 $(FONTDIR)/static-hinted/Inter-Italic.ttf: $(FONTDIR)/static/Inter-Italic.ttf | $(FONTDIR)/static-hinted venv
182 . $(VENV) ; python -m ttfautohint $(AUTOHINT_ARGS) "$<" "$@"
183
184 $(FONTDIR)/static-hinted/InterDisplay-Italic.ttf: $(FONTDIR)/static/InterDisplay-Italic.ttf | $(FONTDIR)/static-hinted venv
185 . $(VENV) ; python -m ttfautohint $(AUTOHINT_ARGS) "$<" "$@"
186
187 $(FONTDIR)/static-hinted/InterDisplay-%Italic.ttf: $(FONTDIR)/static/InterDisplay-%Italic.ttf | $(FONTDIR)/static-hinted/InterDisplay-Italic.ttf $(FONTDIR)/static-hinted venv
188 . $(VENV) ; python -m ttfautohint $(AUTOHINT_ARGS) \
189 --reference $(FONTDIR)/static-hinted/InterDisplay-Italic.ttf "$<" "$@"
190
191 $(FONTDIR)/static-hinted/InterDisplay-%.ttf: $(FONTDIR)/static/InterDisplay-%.ttf | $(FONTDIR)/static-hinted/InterDisplay-Regular.ttf $(FONTDIR)/static-hinted venv
192 . $(VENV) ; python -m ttfautohint $(AUTOHINT_ARGS) \
193 --reference $(FONTDIR)/static-hinted/InterDisplay-Regular.ttf "$<" "$@"
194
195 $(FONTDIR)/static-hinted/Inter-%Italic.ttf: $(FONTDIR)/static/Inter-%Italic.ttf | $(FONTDIR)/static-hinted/Inter-Italic.ttf $(FONTDIR)/static-hinted venv
196 . $(VENV) ; python -m ttfautohint $(AUTOHINT_ARGS) \
197 --reference $(FONTDIR)/static-hinted/Inter-Italic.ttf "$<" "$@"
198
199 $(FONTDIR)/static-hinted/Inter-%.ttf: $(FONTDIR)/static/Inter-%.ttf | $(FONTDIR)/static-hinted/Inter-Regular.ttf $(FONTDIR)/static-hinted venv
200 . $(VENV) ; python -m ttfautohint $(AUTOHINT_ARGS) \
201 --reference $(FONTDIR)/static-hinted/Inter-Regular.ttf "$<" "$@"
202
203
204 $(FONTDIR)/var/.%.var.ttf: $(UFODIR)/%.var.designspace build/features_data | $(FONTDIR)/var venv
205 . $(VENV) ; fontmake -o variable -m $< --output-path $@ $(FM_ARGS_2)
206
207 $(FONTDIR)/var/.%.var.otf: $(UFODIR)/%.var.designspace build/features_data | $(FONTDIR)/var venv
208 . $(VENV) ; fontmake -o variable-cff2 -m $< --output-path $@ $(FM_ARGS_2)
209
210
211 %.woff2: %.ttf | venv
212 . $(VENV) ; misc/tools/woff2 compress -o "$@" "$<"
213
214
215 $(FONTDIR)/var/InterVariable.ttf: $(FONTDIR)/var/.Inter-Roman.var.ttf misc/tools/bake-vf.py
216 . $(VENV) ; python misc/tools/bake-vf.py $< -o $@
217
218 $(FONTDIR)/var/InterVariable-Italic.ttf: $(FONTDIR)/var/.Inter-Italic.var.ttf misc/tools/bake-vf.py
219 . $(VENV) ; python misc/tools/bake-vf.py $< -o $@
220
221
222 $(FONTDIR)/static:
223 mkdir -p $@
224 $(FONTDIR)/static-hinted:
225 mkdir -p $@
226 $(FONTDIR)/var:
227 mkdir -p $@
228 $(UFODIR):
229 mkdir -p $@
230
231
232 var: \
233 $(FONTDIR)/var/InterVariable.ttf \
234 $(FONTDIR)/var/InterVariable-Italic.ttf
235
236 googlefonts: var
237 . $(VENV) ; gftools fix-family $(FONTDIR)/var/*.ttf \
238 --rename-family "Inter" \
239 --include-source-fixes \
240 -o $(FONTDIR)/googlefonts;
241 . $(VENV) ; gftools fontsetter $(FONTDIR)/googlefonts/Inter[opsz,wght].ttf src/googlefonts-fixes.yaml -o $(FONTDIR)/googlefonts/Inter[opsz,wght].ttf;
242 . $(VENV) ; gftools fontsetter $(FONTDIR)/googlefonts/Inter-Italic[opsz,wght].ttf src/googlefonts-fixes.yaml -o $(FONTDIR)/googlefonts/Inter-Italic[opsz,wght].ttf;
243
244 var_web: \
245 $(FONTDIR)/var/InterVariable.woff2 \
246 $(FONTDIR)/var/InterVariable-Italic.woff2
247
248 web: var_web static_web static_web_hinted
249
250 static: \
251 $(FONTDIR)/static-hinted/Inter.ttc
252
253 STATIC_TEXT_FONTS := \
254 Inter-Regular \
255 Inter-Black \
256 Inter-BlackItalic \
257 Inter-Italic \
258 Inter-Thin \
259 Inter-ThinItalic \
260 Inter-Light \
261 Inter-LightItalic \
262 Inter-ExtraLight \
263 Inter-ExtraLightItalic \
264 Inter-Medium \
265 Inter-MediumItalic \
266 Inter-SemiBold \
267 Inter-SemiBoldItalic \
268 Inter-Bold \
269 Inter-BoldItalic \
270 Inter-ExtraBold \
271 Inter-ExtraBoldItalic
272
273 STATIC_DISPLAY_FONTS := \
274 InterDisplay-Black \
275 InterDisplay-BlackItalic \
276 InterDisplay-Regular \
277 InterDisplay-Italic \
278 InterDisplay-Thin \
279 InterDisplay-ThinItalic \
280 InterDisplay-Light \
281 InterDisplay-LightItalic \
282 InterDisplay-ExtraLight \
283 InterDisplay-ExtraLightItalic \
284 InterDisplay-Medium \
285 InterDisplay-MediumItalic \
286 InterDisplay-SemiBold \
287 InterDisplay-SemiBoldItalic \
288 InterDisplay-Bold \
289 InterDisplay-BoldItalic \
290 InterDisplay-ExtraBold \
291 InterDisplay-ExtraBoldItalic
292
293 STATIC_FONTS := $(STATIC_TEXT_FONTS) $(STATIC_DISPLAY_FONTS)
294 STATIC_FONTS_OTF := $(patsubst %,$(FONTDIR)/static/%.otf,$(STATIC_FONTS))
295 STATIC_FONTS_TTF := $(patsubst %,$(FONTDIR)/static-hinted/%.ttf,$(STATIC_FONTS))
296 STATIC_FONTS_WEB := $(patsubst %,$(FONTDIR)/static/%.woff2,$(STATIC_FONTS))
297 STATIC_FONTS_WEB_HINTED := $(patsubst %,$(FONTDIR)/static-hinted/%.woff2,$(STATIC_FONTS))
298
299 $(FONTDIR)/static/Inter.otc: $(STATIC_FONTS_OTF)
300 . $(VENV) ; python -m fontTools.ttLib.__main__ -o $@ $^
301
302 $(FONTDIR)/static-hinted/Inter.ttc: $(STATIC_FONTS_TTF)
303 . $(VENV) ; python -m fontTools.ttLib.__main__ -o $@ $^
304
305 static_otf: $(STATIC_FONTS_OTF)
306 static_ttf: $(STATIC_FONTS_TTF)
307 static_web: $(STATIC_FONTS_WEB)
308 static_web_hinted: $(STATIC_FONTS_WEB_HINTED)
309
310 all: var googlefonts static web static_otf
311
312 .PHONY: \
313 all var var_web web \
314 static static_otf static_ttf static_web static_web_hinted
315
316 # ---------------------------------------------------------------------------------
317 # testing
318
319 test: test_var test_static
320 test_var: \
321 build/fontbakery-report-var.txt
322 test_static: \
323 build/fontbakery-report-text.txt \
324 build/fontbakery-report-display.txt
325
326 # disabled fontbakery tests:
327 FBAKE_DISABLED =
328 FBAKE_DISABLED_STATIC =
329
330 FBAKE_DISABLED += com.google.fonts/check/fontbakery_version
331 # Calls a server to see if there's a newer version of fontbakery and
332 # FAILs if there is. This breaks reproducible builds.
333
334 FBAKE_DISABLED += com.google.fonts/check/family/win_ascent_and_descent
335 # "FAIL OS/2.usWinAscent value should be equal or greater than 2269,
336 # but got 1984 instead"
337 # "FAIL OS/2.usWinDescent value should be equal or greater than 660,
338 # but got 494 instead"
339
340
341 FBAKE_DISABLED_STATIC += com.google.fonts/check/family/underline_thickness
342 # "Fonts have consistent underline thickness"
343 # Inter explicitly have varying underline thickness, matching wght
344
345 FBAKE_DISABLED_STATIC += com.google.fonts/check/contour_count
346 # This test is pedantic; generates warnings when the number of contours are different
347 # than what is usually seen in other fonts. No real world impact.
348
349 # The following test are minor issues, left enabled for the var tests
350 # but disabled for the static tests to reduce noise
351
352 FBAKE_DISABLED_STATIC += com.google.fonts/check/legacy_accents
353 # "Glyph <NAME> has a legacy accent component (hungarumlaut)"
354 # TODO: improve the design of Hungar* composite glyphs to use marks
355
356 FBAKE_DISABLED_STATIC += com.google.fonts/check/gdef_mark_chars
357 # "Check mark characters are in GDEF mark glyph class"
358 # "WARN The following mark characters could be in the GDEF mark glyph
359 # class: uni0488 (U+0488), uni0489 (U+0489), uni20DD (U+20DD), uni20DE (U+20DE)"
360
361 FBAKE_DISABLED_STATIC += com.google.fonts/check/gdef_spacing_marks
362 # "Check glyphs in mark glyph class are non-spacing"
363 # "WARN The following spacing glyphs may be in the GDEF mark glyph class by mistake:
364 # dotbelow (U+0323)
365
366 # FBAKE_ARGS are common args for all fontbakery targets
367 FBAKE_ARGS = \
368 check-universal \
369 --no-colors \
370 --no-progress \
371 --loglevel WARN \
372 --succinct \
373 --full-lists \
374 -j \
375 $(patsubst %,-x %,$(FBAKE_DISABLED))
376
377 FBAKE_ARGS_STATIC = $(FBAKE_ARGS) $(patsubst %,-x %,$(FBAKE_DISABLED_STATIC))
378
379 STATIC_TEXT_FONTS_TTF = $(patsubst %,$(FONTDIR)/static-hinted/%.ttf,$(STATIC_TEXT_FONTS))
380 STATIC_DISPLAY_FONTS_TTF = $(patsubst %,$(FONTDIR)/static-hinted/%.ttf,$(STATIC_DISPLAY_FONTS))
381
382 build/fontbakery-report-var.txt: $(FONTDIR)/var/InterVariable.ttf $(FONTDIR)/var/InterVariable-Italic.ttf | venv
383 @echo "fontbakery InterVariable -> $(@) ..."
384 @. $(VENV) ; fontbakery $(FBAKE_ARGS) $^ > $@ \
385 || (cat $@; echo "report at $@"; touch -m -t 199001010000 $@; exit 1)
386 @echo "fontbakery InterVariable: PASS"
387 @grep -E -A7 '^Total:' $@ | tail -6 | sed -E 's/^ +/ /g'
388
389 build/fontbakery-report-text.txt: $(STATIC_TEXT_FONTS_TTF) | venv
390 @echo "fontbakery Inter -> $@ ..."
391 @. $(VENV) ; fontbakery $(FBAKE_ARGS_STATIC) $^ > $@ \
392 || (cat $@; echo "report at $@"; touch -m -t 199001010000 $@; exit 1)
393 @echo "fontbakery Inter: PASS"
394 @grep -E -A7 '^Total:' $@ | tail -6 | sed -E 's/^ +/ /g'
395
396 build/fontbakery-report-display.txt: $(STATIC_DISPLAY_FONTS_TTF) | venv
397 @echo "fontbakery InterDisplay -> $@ ..."
398 @. $(VENV) ; fontbakery $(FBAKE_ARGS_STATIC) $^ > $@ \
399 || (cat $@; echo "report at $@"; touch -m -t 199001010000 $@; exit 1)
400 @echo "fontbakery InterDisplay: PASS"
401 @grep -E -A7 '^Total:' $@ | tail -6 | sed -E 's/^ +/ /g'
402
403 .PHONY: test test_var
404
405 # ---------------------------------------------------------------------------------
406 # zip
407
408 zip: all
409 bash misc/makezip2.sh -reveal-in-finder \
410 "build/release/Inter-$(VERSION)-$(shell git rev-parse --short=10 HEAD).zip"
411
412 zip_beta: \
413 $(FONTDIR)/var/InterVariable.ttf \
414 $(FONTDIR)/var/InterVariable.woff2 \
415 $(FONTDIR)/var/InterVariable-Italic.ttf \
416 $(FONTDIR)/var/InterVariable-Italic.woff2
417 mkdir -p build/release
418 zip -j -q -X "build/release/Inter_beta-$(VERSION)-$(shell date '+%Y%m%d_%H%M')-$(shell git rev-parse --short=10 HEAD).zip" $^
419
420 .PHONY: zip zip_beta
421
422 # ---------------------------------------------------------------------------------
423 # distribution
424 # - preflight checks for existing version archive and dirty git state.
425 # - step1 rebuilds from scratch, since font version & ID is based on git hash.
426 # - step2 runs tests, then makes a zip archive and updates the website (docs/ dir.)
427
428 DIST_ZIP = build/release/Inter-${VERSION}.zip
429 DIST_ZIP_GF = $(SRCDIR)/build/release/Inter-$(VERSION)-GoogleFonts.zip
430
431 dist:
432 @echo "——————————————————————————————————————————————————————————————————"
433 @echo "Creating distribution for version ${VERSION}"
434 @echo "——————————————————————————————————————————————————————————————————"
435 @# check for existing version archive
436 @if [ -f "${DIST_ZIP}" ]; then \
437 echo "${DIST_ZIP} already exists. Bump version or rm zip file to continue." >&2; \
438 exit 1; \
439 fi
440 @# check for uncommitted changes
441 @git status --short | grep -qv '??' && (\
442 echo "Warning: uncommitted changes:" >&2; git status --short | grep -v '??' ;\
443 [ -t 1 ] || exit 1 ; \
444 printf "Press ENTER to continue or ^C to cancel " ; read X) || true
445 @#
446 $(MAKE) -f $(MAKEFILE) -j$(nproc) clean
447 $(MAKE) -f $(MAKEFILE) -j$(nproc) all googlefonts
448 $(MAKE) -f $(MAKEFILE) -j$(nproc) test
449 $(MAKE) -f $(MAKEFILE) -j$(nproc) dist_zip dist_zip_gf dist_docs
450 $(MAKE) -f $(MAKEFILE) dist_postflight
451
452 dist_zip: | venv
453 bash misc/makezip2.sh -reveal-in-finder "$(DIST_ZIP)"
454
455 dist_zip_gf: | venv
456 cd "$(FONTDIR)/googlefonts" && zip -q -X -r "$(DIST_ZIP_GF)" *.ttf
457
458 dist_gf: googlefonts
459 $(MAKE) -f $(MAKEFILE) dist_zip_gf
460
461 dist_docs:
462 $(MAKE) -C docs -j$(nproc) dist
463
464 dist_postflight:
465 @echo "——————————————————————————————————————————————————————————————————"
466 @echo ""
467 @echo "Next steps:"
468 @echo ""
469 @echo "1) Commit & push changes"
470 @echo ""
471 @echo "2) Create new release with ${DIST_ZIP} at"
472 @echo " https://github.com/rsms/inter/releases/new?tag=v${VERSION}"
473 @echo ""
474 @echo "3) Bump version in version.txt (to the next future version)"
475 @echo " and commit & push changes"
476 @echo ""
477 @echo "——————————————————————————————————————————————————————————————————"
478
479 .PHONY: dist dist_preflight dist_step1 dist_step2 dist_zip dist_docs dist_postflight
480 .PHONY: dist_zip_gf dist_gf
481
482
483 # ---------------------------------------------------------------------------------
484 # install
485
486 INSTALLDIR := $(HOME)/Library/Fonts/Inter
487
488 install: install_var install_ttf
489
490 install_var: \
491 $(INSTALLDIR)/InterVariable.ttf \
492 $(INSTALLDIR)/InterVariable-Italic.ttf
493
494 install_ttf: $(INSTALLDIR)/Inter.ttc
495 install_otf: $(INSTALLDIR)/Inter.otc
496
497 $(INSTALLDIR)/%.ttc: $(FONTDIR)/static-hinted/%.ttc | $(INSTALLDIR)
498 @# remove conflicting OTF fonts
499 rm -f $(INSTALLDIR)/Inter*.otf $(INSTALLDIR)/Inter*.otc
500 cp -a $^ $@
501
502 $(INSTALLDIR)/%.otc: $(FONTDIR)/static/%.otc | $(INSTALLDIR)
503 @# remove conflicting TTF fonts
504 @rm -fv $(INSTALLDIR)/Inter*.ttc
505 cp -a $^ $@
506
507 $(INSTALLDIR)/InterVariable.ttf: $(FONTDIR)/var/InterVariable.ttf | $(INSTALLDIR)
508 @# remove font with legacy name
509 @rm -fv $(INSTALLDIR)/InterVariable.ttf
510 cp -a $^ $@
511
512 $(INSTALLDIR)/InterVariable-Italic.ttf: $(FONTDIR)/var/InterVariable-Italic.ttf | $(INSTALLDIR)
513 @# remove font with legacy name
514 @rm -fv $(INSTALLDIR)/InterVariable-Italic.ttf
515 cp -a $^ $@
516
517 $(INSTALLDIR)/%.otf: $(FONTDIR)/static/%.otf | $(INSTALLDIR)
518 @# remove conflicting TTF fonts
519 rm -f $(INSTALLDIR)/{Inter,InterDisplay}-*.ttf
520 cp -a $^ $@
521
522 $(INSTALLDIR):
523 mkdir -p $@
524
525 .PHONY: install install_var install_ttf install_otf
526
527 # ---------------------------------------------------------------------------------
528 # debug
529
530 build/ttx/Inter-Var%: $(FONTDIR)/var/Inter-Var%.ttf
531 rm -rf "build/ttx/$(basename $(notdir $^))"
532 mkdir -p "build/ttx/$(basename $(notdir $^))"
533 cp $^ "build/ttx/$(basename $(notdir $^))/$(notdir $^)"
534 ttx -x glyf -x GPOS -x GSUB -x gvar -i -f -s \
535 "build/ttx/$(basename $(notdir $^))/$(notdir $^)"
536 @echo "Dumped $(notdir $^) to build/ttx/$(basename $(notdir $^))/"
537
538 build/ttx/%: $(FONTDIR)/static/%.ttf
539 rm -rf "build/ttx/$(basename $(notdir $^))"
540 mkdir -p "build/ttx/$(basename $(notdir $^))"
541 cp $^ "build/ttx/$(basename $(notdir $^))/$(notdir $^)"
542 ttx -x glyf -x GPOS -x GSUB -i -f -s "build/ttx/$(basename $(notdir $^))/$(notdir $^)"
543 @echo "Dumped $(notdir $^) to build/ttx/$(basename $(notdir $^))/"
544
545 ttx_var_roman: build/ttx/InterVariable
546 ttx_var_italic: build/ttx/InterVariable-Italic
547 ttx_var: ttx_var_roman ttx_var_italic
548 ttx_static: $(patsubst %,build/ttx/%,$(STATIC_FONTS))
549
550 .PHONY: ttx_var ttx_var_roman ttx_var_italic ttx_static
551
552 # ---------------------------------------------------------------------------------
553 # misc
554
555 clean:
556 @for f in build/tmp build/fonts build/ufo build/googlefonts build/ttx; do \
557 [ ! -e $$f ] || echo "rm -rf $$f"; (rm -rf $$f; rm -rf $$f) & \
558 done; wait
559
560 docs:
561 $(MAKE) -C docs serve
562
563 # update_ucd downloads the latest Unicode data (Nothing depends on this target)
564 ucd_version := 12.1.0
565 update_ucd:
566 @echo "# Unicode $(ucd_version)" > misc/UnicodeData.txt
567 curl '-#' "https://www.unicode.org/Public/$(ucd_version)/ucd/UnicodeData.txt" \
568 >> misc/UnicodeData.txt
569
570 .PHONY: clean docs update_ucd
571
572 # ---------------------------------------------------------------------------------
573 # list make targets
574 #
575 # We copy the Makefile (first in MAKEFILE_LIST) and disable the include to only list
576 # primary targets, avoiding the generated targets.
577 list:
578 @mkdir -p build/etc \
579 && cat $(MAKEFILE) \
580 | sed 's/include /#include /g' > build/etc/Makefile-list \
581 && $(MAKE) -pRrq -f build/etc/Makefile-list : 2>/dev/null \
582 | awk -v RS= -F: '/^# File/,/^# Finished Make data base/ {if ($$1 !~ "^[#.]") {print $$1}}' \
583 | sort \
584 | egrep -v -e '^_|/' \
585 | egrep -v -e '^[^[:alnum:]]' -e '^$@$$'
586
587 .PHONY: list
588
589 # ---------------------------------------------------------------------------------
590 # initialize toolchain
591
592 venv: build/venv/config2.stamp
593
594 build/venv/config2.stamp: Pipfile.lock Pipfile
595 @mkdir -p build
596 [ ! -f build/venv/config.stamp ] || rm -rf build/venv
597 [ -d build/venv ] || python3 -m venv build/venv
598 . $(VENV) ; pip install pipenv==2023.8.28
599 . $(VENV) ; pipenv install
600 touch $@
601
602 venv-update:
603 . $(VENV) ; pipenv update
604
605 reset: clean
606 rm -rf build/venv
607
608 .PHONY: venv venv-update reset