inter/Makefile

234 lines
7.9 KiB
Makefile
Raw Normal View History

2017-08-22 09:05:20 +02:00
# Targets:
# all Build everything (default; implies all_fonts)
# test Build and test (check) everyything (implies all_check)
# install Build and install all OTF files. (currently Mac-only)
# zip Build a complete release-grade ZIP archive of all fonts.
# dist Create a new release distribution. Does everything.
#
# all_fonts Build all styles in all formats
# all_otf Build all OTF files into build/unhinted
# all_ttf Build all TTF files into build/unhinted
# all_ttf_hinted Build all TTF files with hints into build/hinted
# all_web Build all WOFF files into build/unhinted
# all_web_hinted Build all WOFF files with hints into build/hinted
# all_check Build & check all OTF and TTF files
#
# Style-specific targets:
# STYLE_otf Build OTF file for STYLE into build/unhinted
# STYLE_ttf Build TTF file for STYLE into build/unhinted
# STYLE_ttf_hinted Build TTF file for STYLE with hints into build/hinted
# STYLE_web Build WOFF files for STYLE into build/unhinted
# STYLE_web_hinted Build WOFF files for STYLE with hints into build/hinted
# STYLE_check Build & check OTF and TTF files for STYLE
2017-08-22 09:05:20 +02:00
#
all: all_fonts
all_unhinted: all_ttf all_otf all_web
all_hinted: all_ttf_hinted all_web_hinted
export PATH := $(PWD)/build/venv/bin:$(PATH)
2017-08-22 21:46:29 +02:00
2017-08-22 09:05:20 +02:00
# generated.make is automatically generated by init.sh and defines depenencies for
# all styles and alias targets
include build/etc/generated.make
# 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 "$<" > "$@"
# UFO -> OTF, TTF
build/unhinted/Inter-UI-Regular.%: src/Inter-UI.designspace $(Regular_ufo_d)
misc/fontbuild compile -o $@ src/Inter-UI-Regular.ufo
build/unhinted/Inter-UI-Black.%: src/Inter-UI.designspace $(Black_ufo_d)
misc/fontbuild compile -o $@ src/Inter-UI-Black.ufo
build/unhinted/Inter-UI-%.otf: build/ufo/Inter-UI-%.ufo src/Inter-UI.designspace $(Regular_ufo_d) $(Black_ufo_d)
misc/fontbuild compile -o $@ $<
2017-08-22 09:05:20 +02:00
build/unhinted/Inter-UI-%.ttf: build/ufo/Inter-UI-%.ufo src/Inter-UI.designspace $(Regular_ufo_d) $(Black_ufo_d)
misc/fontbuild compile -o $@ $<
2017-08-22 09:05:20 +02:00
# designspace <- glyphs file
src/Inter-UI.designspace: src/Inter-UI.glyphs
misc/fontbuild glyphsync $<
2017-08-22 09:05:20 +02:00
src/Inter-UI.glyphs:
@true
$(Regular_ufo_d):
@true
$(Black_ufo_d):
@true
# instance UFOs <- master UFOs
build/ufo/Inter-UI-%.ufo: src/Inter-UI.designspace $(Regular_ufo_d) $(Black_ufo_d)
misc/fontbuild instancegen src/Inter-UI.designspace $*
# Note: The seemingly convoluted dependency graph above is required to
# make sure that glyphsync and instancegen are not run in parallel.
# hinted TTF files via autohint
build/hinted/%.ttf: build/unhinted/%.ttf
@mkdir -p build/hinted
@echo ttfautohint "$<" "$@"
@ttfautohint \
2017-08-22 09:05:20 +02:00
--hinting-limit=256 \
--hinting-range-min=8 \
--hinting-range-max=64 \
--fallback-stem-width=256 \
--no-info \
--verbose \
"$<" "$@"
# test runs all tests
# Note: all_check is generated by init.sh and runs "fontbuild checkfont"
# on all otf and ttf files.
test: all_check
2017-08-22 09:05:20 +02:00
# load version, used by zip and dist
VERSION := $(shell cat version.txt)
# distribution zip files
ZIP_FILE_DIST := build/release/Inter-UI-${VERSION}.zip
ZIP_FILE_DEV := build/release/Inter-UI-${VERSION}-$(shell git rev-parse --short=10 HEAD).zip
2017-08-22 21:46:29 +02:00
# intermediate zip target that creates a zip file at build/tmp/a.zip
build/tmp/a.zip: all_fonts
@rm -rf build/tmp/zip
@rm -f build/tmp/a.zip
2017-08-22 09:05:20 +02:00
@mkdir -p \
"build/tmp/zip/Inter UI (web)" \
"build/tmp/zip/Inter UI (web hinted)" \
"build/tmp/zip/Inter UI (TTF)" \
"build/tmp/zip/Inter UI (TTF hinted)" \
"build/tmp/zip/Inter UI (OTF)"
cp -a build/unhinted/*.woff build/unhinted/*.woff2 \
"build/tmp/zip/Inter UI (web)/"
cp -a build/hinted/*.woff build/hinted/*.woff2 \
"build/tmp/zip/Inter UI (web hinted)/"
cp -a build/unhinted/*.ttf "build/tmp/zip/Inter UI (TTF)/"
cp -a build/hinted/*.ttf "build/tmp/zip/Inter UI (TTF hinted)/"
cp -a build/unhinted/*.otf "build/tmp/zip/Inter UI (OTF)/"
cp -a misc/dist/inter-ui.css "build/tmp/zip/Inter UI (web)/"
cp -a misc/dist/inter-ui.css "build/tmp/zip/Inter UI (web hinted)/"
cp -a misc/dist/*.txt "build/tmp/zip/"
cp -a LICENSE.txt "build/tmp/zip/"
cd build/tmp/zip && zip -q -X -r "../../../$@" * && cd ../..
@rm -rf build/tmp/zip
2017-08-22 09:05:20 +02:00
2017-08-22 21:46:29 +02:00
# zip
build/release/Inter-UI-%.zip: build/tmp/a.zip
2017-08-22 21:46:29 +02:00
@mkdir -p "$(shell dirname "$@")"
@mv -f "$<" "$@"
@echo write "$@"
zip: ${ZIP_FILE_DEV}
zip_dist: pre_dist test ${ZIP_FILE_DIST}
.PHONY: zip zip_dist
2017-08-22 21:46:29 +02:00
2017-08-24 09:45:10 +02:00
pre_dist:
2017-08-22 21:46:29 +02:00
@echo "Creating distribution for version ${VERSION}"
@if [ -f "${ZIP_FILE_DIST}" ]; \
then echo "${ZIP_FILE_DIST} already exists. Bump version or remove the zip file to continue." >&2; \
exit 1; \
fi
2017-09-25 19:38:15 +02:00
# foo_dist: | foo_zip_dist foo_docs_info foo_docs_fonts
# @echo dist
# foo_zip_dist:
# @echo zip_dist start
# @sleep 1
# @echo zip_dist done
# foo_docs_info:
# @echo docs_info
# foo_docs_fonts:
# @echo docs_fonts
# .PHONY: foo_dist foo_zip_dist foo_docs_info foo_docs_fonts
dist: zip_dist docs_info docs_fonts
# $(MAKE) docs_info docs_fonts -j
misc/tools/versionize-css.py
2017-08-22 21:46:29 +02:00
@echo "——————————————————————————————————————————————————————————————————"
@echo ""
2017-09-12 07:42:54 +02:00
@echo "Next steps:"
@echo ""
@echo "1) Commit & push changes"
@echo ""
@echo "2) Create new release with ${ZIP_FILE_DIST} at"
@echo " https://github.com/rsms/inter/releases/new?tag=v${VERSION}"
2017-08-22 21:46:29 +02:00
@echo ""
2017-09-12 07:42:54 +02:00
@echo "3) Bump version in src/fontbuild.cfg and commit"
2017-08-22 21:46:29 +02:00
@echo ""
@echo "——————————————————————————————————————————————————————————————————"
docs_info: docs/_data/fontinfo.json docs/lab/glyphinfo.json docs/glyphs/metrics.json
docs_fonts:
2017-09-12 07:42:54 +02:00
rm -rf docs/font-files
mkdir docs/font-files
cp -a build/unhinted/*.woff build/unhinted/*.woff2 build/unhinted/*.otf docs/font-files/
2017-09-12 07:42:54 +02:00
2018-09-04 02:00:19 +02:00
docs/_data/fontinfo.json: docs/font-files/Inter-UI-Regular.otf misc/tools/fontinfo.py
misc/tools/fontinfo.py -pretty $< > docs/_data/fontinfo.json
docs/lab/glyphinfo.json: build/tmp/UnicodeData.txt misc/tools/gen-glyphinfo.py
misc/tools/gen-glyphinfo.py -ucd $< src/Inter-UI-*.ufo > $@
2018-09-04 02:00:19 +02:00
docs/glyphs/metrics.json: $(Regular_ufo_d) misc/tools/gen-metrics-and-svgs.py
misc/tools/gen-metrics-and-svgs.py src/Inter-UI-Regular.ufo
# Download latest Unicode data
build/tmp/UnicodeData.txt:
@mkdir -p build/tmp
@echo fetch http://www.unicode.org/Public/UCD/latest/ucd/UnicodeData.txt
@curl '-#' -o "$@" http://www.unicode.org/Public/UCD/latest/ucd/UnicodeData.txt
# install targets
install_ttf: all_ttf_unhinted
$(MAKE) all_web -j
@echo "Installing TTF files locally at ~/Library/Fonts/Inter UI"
rm -rf ~/'Library/Fonts/Inter UI'
mkdir -p ~/'Library/Fonts/Inter UI'
cp -va build/unhinted/*.ttf ~/'Library/Fonts/Inter UI'
install_ttf_hinted: all_ttf
$(MAKE) all_web -j
@echo "Installing autohinted TTF files locally at ~/Library/Fonts/Inter UI"
rm -rf ~/'Library/Fonts/Inter UI'
mkdir -p ~/'Library/Fonts/Inter UI'
cp -va build/hinted/*.ttf ~/'Library/Fonts/Inter UI'
2017-08-22 09:05:20 +02:00
install_otf: all_otf
$(MAKE) all_web -j
@echo "Installing OTF files locally at ~/Library/Fonts/Inter UI"
rm -rf ~/'Library/Fonts/Inter UI'
mkdir -p ~/'Library/Fonts/Inter UI'
cp -va build/unhinted/*.otf ~/'Library/Fonts/Inter UI'
2017-08-22 09:05:20 +02:00
install: install_otf
2017-08-22 09:05:20 +02:00
# clean removes generated and built fonts in the build directory
2017-08-22 09:05:20 +02:00
clean:
rm -rvf build/tmp build/hinted build/unhinted build/otf
2017-08-22 09:05:20 +02:00
.PHONY: all web clean install install_otf install_ttf deploy pre_dist dist geninfo copy_docs_fonts all_hinted test glyphsync