inter/Makefile

205 lines
6.9 KiB
Makefile
Raw Normal View History

2017-08-22 09:05:20 +02:00
# Targets:
# all Build all styles in all formats (default)
# all_ttf Build all styles as TrueType
# all_otf Build all styles as OpenType
# all_hinted Build all styles as autohinted TrueType
# STYLE Build STYLE in all formats (e.g. MediumItalic)
# STYLE_hinted Build STYLE in TTF and web formats with autohints
# STYLE_ttf Build STYLE as TrueType (e.g. MediumItalic_ttf)
# zip Build all styles as TrueType and package into a zip archive
# install Build all (web, ttf and otf) and install. Mac-only for now.
# dist Create a new release distribution. Does everything.
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
VERSION := $(shell cat version.txt)
2017-08-22 09:05:20 +02:00
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.%: master_ufo_regular
misc/fontbuild compile -o $@ src/Inter-UI-Regular.ufo
build/unhinted/Inter-UI-Black.%: master_ufo_black
misc/fontbuild compile -o $@ src/Inter-UI-Black.ufo
build/unhinted/Inter-UI-%.otf: build/ufo/Inter-UI-%.ufo
misc/fontbuild compile -o $@ $<
2017-08-22 09:05:20 +02:00
build/unhinted/Inter-UI-%.ttf: build/ufo/Inter-UI-%.ufo
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
# instance UFOs <- master UFOs
build/ufo/Inter-UI-%.ufo: master_ufo_regular master_ufo_black
misc/fontbuild instancegen src/Inter-UI.designspace $*
# master UFOs <- designspace
master_ufo_regular: src/Inter-UI.designspace $(Regular_ufo_d)
master_ufo_black: src/Inter-UI.designspace $(Black_ufo_d)
# Note: The seemingly convoluted dependency graph above is required to
# make sure that glyphsync and instancegen are not run in parallel.
.PHONY: master_ufo_regular master_ufo_black
# 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
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
# zip intermediate
build/.zip.zip: all_otf all_ttf
$(MAKE) all_web all_web_hinted -j
2017-08-22 09:05:20 +02:00
@rm -rf build/.zip
@rm -f build/.zip.zip
@mkdir -p \
"build/.zip/Inter UI (web)" \
"build/.zip/Inter UI (web hinted)" \
"build/.zip/Inter UI (TTF)" \
"build/.zip/Inter UI (TTF hinted)" \
"build/.zip/Inter UI (OTF)"
@cp -a build/unhinted/*.woff build/unhinted/*.woff2 \
"build/.zip/Inter UI (web)/"
2018-02-18 09:28:04 +01:00
@cp -a misc/doc/inter-ui.css "build/.zip/Inter UI (web)/"
@cp -a build/hinted/*.woff build/hinted/*.woff2 \
"build/.zip/Inter UI (web hinted)/"
2018-02-18 09:28:04 +01:00
@cp -a misc/doc/inter-ui.css "build/.zip/Inter UI (web hinted)/"
@cp -a build/unhinted/*.ttf "build/.zip/Inter UI (TTF)/"
@cp -a build/hinted/*.ttf "build/.zip/Inter UI (TTF hinted)/"
@cp -a build/unhinted/*.otf "build/.zip/Inter UI (OTF)/"
@cp -a misc/doc/*.txt "build/.zip/"
@cp -a LICENSE.txt "build/.zip/"
2017-08-22 21:46:29 +02:00
cd build/.zip && zip -v -X -r "../../build/.zip.zip" * >/dev/null && cd ../..
2017-08-22 09:05:20 +02:00
@rm -rf build/.zip
2017-08-22 21:46:29 +02:00
# zip
build/release/Inter-UI-%.zip: build/.zip.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}
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
dist: zip_dist
$(MAKE) geninfo copy_docs_fonts -j8
misc/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 "——————————————————————————————————————————————————————————————————"
2017-09-12 07:42:54 +02:00
copy_docs_fonts:
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
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
2017-08-28 11:36:40 +02:00
2018-02-20 10:38:51 +01:00
geninfo: docs/_data/fontinfo.json docs/lab/glyphinfo.json docs/glyphs/metrics.json
2017-08-28 11:36:40 +02:00
src/glyphorder.txt: src/Inter-UI-Regular.ufo/lib.plist src/Inter-UI-Black.ufo/lib.plist src/diacritics.txt misc/gen-glyphorder.py
misc/gen-glyphorder.py src/Inter-UI-*.ufo > src/glyphorder.txt
2017-08-28 11:36:40 +02:00
2018-02-20 10:38:51 +01:00
docs/_data/fontinfo.json: misc/fontinfo.py docs/font-files/Inter-UI-*.otf
misc/fontinfo.py -pretty docs/font-files/Inter-UI-Regular.otf > docs/_data/fontinfo.json
docs/lab/glyphinfo.json: _local/UnicodeData.txt src/glyphorder.txt src/fontbuild.cfg misc/gen-glyphinfo.py
2017-08-22 09:05:20 +02:00
misc/gen-glyphinfo.py -ucd _local/UnicodeData.txt \
src/Inter-UI-*.ufo > docs/lab/glyphinfo.json
2017-08-22 09:05:20 +02:00
docs/glyphs/metrics.json: src/glyphorder.txt src/fontbuild.cfg misc/gen-metrics-and-svgs.py $(Regular_ufo_d)
misc/gen-metrics-and-svgs.py -f src/Inter-UI-Regular.ufo
2017-08-28 11:36:40 +02:00
2017-08-22 09:05:20 +02:00
# 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 -rvf build/tmp build/hinted build/unhinted
2017-08-22 09:05:20 +02:00
.PHONY: all web clean install install_otf install_ttf deploy zip zip_dist pre_dist dist geninfo copy_docs_fonts all_hinted test glyphsync