mirror of
https://github.com/rsms/inter.git
synced 2024-12-25 08:33:40 +03:00
397 lines
13 KiB
Makefile
397 lines
13 KiB
Makefile
# High-level make targets:
|
|
# all Build everything
|
|
# all_text Build all Inter (non-dislay) fonts
|
|
# all_display Build all Inter Display fonts
|
|
# web Build all web fonts
|
|
# var Build all variable fonts
|
|
# zip Build a complete ZIP archive of all fonts.
|
|
# test Build and test everyything
|
|
# install Build and install all OTF files (macOS only)
|
|
#
|
|
# Style-specific targets:
|
|
# STYLE_otf Build OTF file for STYLE into FONTDIR/const
|
|
# STYLE_ttf Build TTF file for STYLE into FONTDIR/const
|
|
# STYLE_ttf_hinted Build TTF file for STYLE with hints into
|
|
# FONTDIR/const-hinted
|
|
# STYLE_web Build WOFF files for STYLE into FONTDIR/const
|
|
# STYLE_web_hinted Build WOFF files for STYLE with hints into
|
|
# FONTDIR/const-hinted
|
|
# STYLE_check Build & check OTF and TTF files for STYLE
|
|
#
|
|
# "build" directory output structure:
|
|
# fonts
|
|
# const
|
|
# const-hinted
|
|
# var
|
|
#
|
|
FONTDIR = build/fonts
|
|
|
|
all: all_text all_display web
|
|
|
|
# all fonts of a certain type
|
|
all_otf: all_otf_text all_otf_display
|
|
all_ttf: all_ttf_text all_ttf_display all_ttf_text_hinted all_ttf_display_hinted
|
|
|
|
# all fonts of given variant
|
|
all_text: all_otf_text all_ttf_text all_ttf_text_hinted all_var_text web_text
|
|
all_display: all_otf_display all_ttf_display all_ttf_display_hinted all_var_display web_display
|
|
|
|
# web fonts
|
|
web: web_text web_display
|
|
web_text: all_web_text all_web_hinted_text
|
|
web_display: all_web_display all_web_hinted_display
|
|
|
|
# variable fonts
|
|
var: all_var_text all_var_display
|
|
var_text: $(FONTDIR)/var/Inter.var.woff2 $(FONTDIR)/var/Inter.var.otf
|
|
var_display: $(FONTDIR)/var/InterDisplay.var.woff2 $(FONTDIR)/var/InterDisplay.var.otf
|
|
all_var_text: \
|
|
$(FONTDIR)/var/Inter.var.otf \
|
|
$(FONTDIR)/var/Inter.var.woff2 \
|
|
$(FONTDIR)/var/Inter-V.var.otf \
|
|
$(FONTDIR)/var/Inter-V.var.woff2 \
|
|
$(FONTDIR)/var/Inter-roman.var.otf \
|
|
$(FONTDIR)/var/Inter-roman.var.woff2 \
|
|
$(FONTDIR)/var/Inter-italic.var.otf \
|
|
$(FONTDIR)/var/Inter-italic.var.woff2
|
|
all_var_display: \
|
|
$(FONTDIR)/var/InterDisplay.var.otf \
|
|
$(FONTDIR)/var/InterDisplay.var.woff2 \
|
|
$(FONTDIR)/var/InterDisplay-V.var.otf \
|
|
$(FONTDIR)/var/InterDisplay-V.var.woff2 \
|
|
$(FONTDIR)/var/InterDisplay-roman.var.otf \
|
|
$(FONTDIR)/var/InterDisplay-roman.var.woff2 \
|
|
$(FONTDIR)/var/InterDisplay-italic.var.otf \
|
|
$(FONTDIR)/var/InterDisplay-italic.var.woff2
|
|
|
|
.PHONY: all all_otf all_ttf all_text all_display
|
|
.PHONY: web web_text web_display
|
|
.PHONY: var var_text var_display all_var_text all_var_display
|
|
|
|
# Hinted variable font disabled. See https://github.com/rsms/inter/issues/75
|
|
# all_var_hinted: $(FONTDIR)/var-hinted/Inter.var.otf $(FONTDIR)/var-hinted/Inter.var.woff2
|
|
|
|
export PATH := $(PWD)/build/venv/bin:$(PATH)
|
|
|
|
# generated.make is automatically generated by init.sh and defines depenencies for
|
|
# all styles and alias targets
|
|
include build/etc/generated.make
|
|
|
|
|
|
# WOFF2 from OTF
|
|
build/%.var.woff2: build/%.var.otf
|
|
woff2_compress "$<"
|
|
|
|
# WOFF2 from TTF
|
|
build/%.woff2: build/%.ttf
|
|
woff2_compress "$<"
|
|
|
|
# WOFF from TTF
|
|
build/%.woff: build/%.ttf
|
|
ttf2woff -O -t woff "$<" "$@"
|
|
|
|
|
|
|
|
# VF OTF from UFO
|
|
$(FONTDIR)/var/Inter.var.otf: $(all_ufo_masters_text) version.txt
|
|
misc/fontbuild compile-var -o $@ $(FONTBUILD_FLAGS) build/ufo/Inter.designspace
|
|
|
|
$(FONTDIR)/var/Inter-V.var.otf: $(FONTDIR)/var/Inter.var.otf
|
|
misc/fontbuild rename --family "Inter V" -o $@ $<
|
|
|
|
$(FONTDIR)/var/Inter-%.var.otf: build/ufo/Inter-%.designspace $(all_ufo_masters_text) version.txt
|
|
misc/fontbuild compile-var -o $@ $(FONTBUILD_FLAGS) $<
|
|
misc/tools/fix-vf-meta.py $@
|
|
|
|
$(FONTDIR)/var/InterDisplay.var.otf: $(all_ufo_masters_display) version.txt
|
|
misc/fontbuild compile-var -o $@ $(FONTBUILD_FLAGS) build/ufo/InterDisplay.designspace
|
|
|
|
$(FONTDIR)/var/InterDisplay-V.var.otf: $(FONTDIR)/var/InterDisplay.var.otf
|
|
misc/fontbuild rename --family "Inter Display V" -o $@ $<
|
|
|
|
$(FONTDIR)/var/InterDisplay-%.var.otf: build/ufo/InterDisplay-%.designspace $(all_ufo_masters_display) version.txt
|
|
misc/fontbuild compile-var -o $@ $(FONTBUILD_FLAGS) $<
|
|
misc/tools/fix-vf-meta.py $@
|
|
|
|
|
|
# OTF/TTF from UFO
|
|
$(FONTDIR)/const/Inter%.otf: build/ufo/Inter%.ufo version.txt
|
|
misc/fontbuild compile -o $@ $(FONTBUILD_FLAGS) build/ufo/Inter$*.ufo
|
|
|
|
$(FONTDIR)/const/Inter%.ttf: build/ufo/Inter%.ufo version.txt
|
|
misc/fontbuild compile -o $@ $(FONTBUILD_FLAGS) build/ufo/Inter$*.ufo
|
|
|
|
|
|
# DESIGNSPACE from GLYPHS
|
|
build/ufo/Inter-roman.designspace: build/ufo/Inter.designspace
|
|
build/ufo/Inter-italic.designspace: build/ufo/Inter.designspace
|
|
build/ufo/Inter.designspace: src/Inter.glyphs
|
|
@mkdir -p build/ufo
|
|
misc/fontbuild glyphsync -o build/ufo src/Inter.glyphs
|
|
build/ufo/InterDisplay-roman.designspace: build/ufo/InterDisplay.designspace
|
|
build/ufo/InterDisplay-italic.designspace: build/ufo/InterDisplay.designspace
|
|
build/ufo/InterDisplay.designspace: src/InterDisplay.glyphs
|
|
@mkdir -p build/ufo
|
|
misc/fontbuild glyphsync -o build/ufo src/InterDisplay.glyphs
|
|
|
|
|
|
# short-circuit Make for performance
|
|
src/Inter.glyphs:
|
|
@true
|
|
src/InterDisplay.glyphs:
|
|
@true
|
|
|
|
# make sure intermediate files are not gc'd by make
|
|
.PRECIOUS: build/ufo/Inter-*.designspace build/ufo/InterDisplay-*.designspace
|
|
|
|
designspace: build/ufo/Inter.designspace build/ufo/InterDisplay.designspace
|
|
.PHONY: designspace
|
|
|
|
|
|
# features
|
|
src/features: $(wildcard src/features/*)
|
|
@touch "$@"
|
|
@true
|
|
build/ufo/features: src/features
|
|
@mkdir -p build/ufo
|
|
@rm -f build/ufo/features
|
|
@ln -s ../../src/features build/ufo/features
|
|
|
|
# make sure intermediate UFOs are not gc'd by make
|
|
.PRECIOUS: build/ufo/Inter-%.ufo
|
|
|
|
# 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
|
|
$(FONTDIR)/const-hinted/%.ttf: $(FONTDIR)/const/%.ttf
|
|
mkdir -p "$(dir $@)"
|
|
ttfautohint --fallback-stem-width=256 --no-info "$<" "$@"
|
|
|
|
# python -m ttfautohint --fallback-stem-width=256 --no-info "$<" "$@"
|
|
|
|
# $(FONTDIR)/var-hinted/%.ttf: $(FONTDIR)/var/%.ttf
|
|
# mkdir -p "$(dir $@)"
|
|
# ttfautohint --fallback-stem-width=256 --no-info "$<" "$@"
|
|
|
|
# make sure intermediate TTFs are not gc'd by make
|
|
.PRECIOUS: $(FONTDIR)/const/%.ttf
|
|
.PRECIOUS: $(FONTDIR)/const/%.otf
|
|
.PRECIOUS: $(FONTDIR)/const-hinted/%.ttf
|
|
.PRECIOUS: $(FONTDIR)/var/%.var.otf
|
|
|
|
|
|
|
|
# test runs all tests
|
|
# Note: all_check_const is generated by init.sh and runs "fontbuild checkfont"
|
|
# on all otf and ttf files.
|
|
test: check_all_text check_all_display
|
|
misc/fontbuild checkfont $(FONTDIR)/var/*.otf $(FONTDIR)/var/*.woff2
|
|
@echo "test: all ok"
|
|
|
|
# check does the same thing as test, but without any dependency checks, meaning
|
|
# it will check whatever font files are already built.
|
|
check_text:
|
|
misc/fontbuild checkfont \
|
|
$(FONTDIR)/const/Inter-*.ttf \
|
|
$(FONTDIR)/const/Inter-*.otf \
|
|
$(FONTDIR)/const/Inter-*.woff2 \
|
|
$(FONTDIR)/var/Inter.var.otf \
|
|
$(FONTDIR)/var/Inter.var.woff2 \
|
|
$(FONTDIR)/var/Inter-*.var.otf \
|
|
$(FONTDIR)/var/Inter-*.var.woff2
|
|
@echo "check_text: all ok"
|
|
|
|
check_display:
|
|
misc/fontbuild checkfont \
|
|
$(FONTDIR)/const/InterDisplay-*.ttf \
|
|
$(FONTDIR)/const/InterDisplay-*.otf \
|
|
$(FONTDIR)/const/InterDisplay-*.woff2 \
|
|
$(FONTDIR)/var/InterDisplay.var.otf \
|
|
$(FONTDIR)/var/InterDisplay.var.woff2 \
|
|
$(FONTDIR)/var/InterDisplay-*.var.otf \
|
|
$(FONTDIR)/var/InterDisplay-*.var.woff2
|
|
@echo "check_display: all ok"
|
|
|
|
.PHONY: test check check_text check_display
|
|
|
|
|
|
|
|
|
|
# samples renders PDF and PNG samples
|
|
samples: $(FONTDIR)/samples all_samples_pdf all_samples_png
|
|
|
|
$(FONTDIR)/samples/%.pdf: $(FONTDIR)/const/%.otf $(FONTDIR)/samples
|
|
misc/tools/fontsample/fontsample -o "$@" "$<"
|
|
|
|
$(FONTDIR)/samples/%.png: $(FONTDIR)/const/%.otf $(FONTDIR)/samples
|
|
misc/tools/fontsample/fontsample -o "$@" "$<"
|
|
|
|
$(FONTDIR)/samples:
|
|
mkdir -p $@
|
|
|
|
.PHONY: samples
|
|
|
|
|
|
# load version, used by zip and dist
|
|
VERSION := $(shell cat version.txt)
|
|
|
|
# distribution zip files
|
|
ZIP_FILE_DIST := build/release/Inter-${VERSION}.zip
|
|
|
|
zip: all
|
|
$(MAKE) check_text check_display
|
|
bash misc/makezip.sh -all -reveal-in-finder \
|
|
"build/release/Inter-${VERSION}-$(shell git rev-parse --short=10 HEAD).zip"
|
|
|
|
zip_text: all_text
|
|
$(MAKE) check_text
|
|
bash misc/makezip.sh -text -reveal-in-finder \
|
|
"build/release/Inter-${VERSION}-text-$(shell git rev-parse --short=10 HEAD).zip"
|
|
|
|
zip_display: all_display
|
|
$(MAKE) check_display
|
|
bash misc/makezip.sh -display -reveal-in-finder \
|
|
"build/release/Inter-${VERSION}-display-$(shell git rev-parse --short=10 HEAD).zip"
|
|
|
|
|
|
dist_zip: dist_check dist_build
|
|
$(MAKE) check_text
|
|
bash misc/makezip.sh -text -reveal-in-finder "$(ZIP_FILE_DIST)"
|
|
|
|
dist_build: all_text
|
|
misc/tools/versionize.py
|
|
|
|
dist_check:
|
|
@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
|
|
|
|
dist: dist_zip
|
|
$(MAKE) -j docs
|
|
@echo "——————————————————————————————————————————————————————————————————"
|
|
@echo ""
|
|
@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}"
|
|
@echo ""
|
|
@echo "3) Bump version in version.txt (to the next future version)"
|
|
@echo ""
|
|
@echo "——————————————————————————————————————————————————————————————————"
|
|
|
|
.PHONY: zip zip_dist pre_dist dist
|
|
|
|
|
|
|
|
docs: docs_fonts
|
|
$(MAKE) -j docs_info
|
|
|
|
docs_info: docs/_data/fontinfo.json \
|
|
docs/lab/glyphinfo.json \
|
|
docs/glyphs/metrics.json
|
|
|
|
docs_fonts: docs_fonts_text docs_fonts_display
|
|
docs_fonts_pre:
|
|
rm -rf docs/font-files
|
|
mkdir docs/font-files
|
|
|
|
docs_fonts_text: docs_fonts_pre
|
|
cp -a $(FONTDIR)/const/*.woff \
|
|
$(FONTDIR)/const/*.woff2 \
|
|
$(FONTDIR)/const/*.otf \
|
|
$(FONTDIR)/var/Inter.var.* \
|
|
$(FONTDIR)/var/InterDisplay.var.* \
|
|
$(FONTDIR)/var/Inter*-roman.var.* \
|
|
$(FONTDIR)/var/Inter*-italic.var.* \
|
|
docs/font-files/
|
|
|
|
docs_fonts_display: docs_fonts_pre
|
|
cp -a $(FONTDIR)/const/*.woff \
|
|
$(FONTDIR)/const/*.woff2 \
|
|
$(FONTDIR)/const/*.otf \
|
|
$(FONTDIR)/var/Inter.var.* \
|
|
$(FONTDIR)/var/InterDisplay.var.* \
|
|
$(FONTDIR)/var/Inter*-roman.var.* \
|
|
$(FONTDIR)/var/Inter*-italic.var.* \
|
|
docs/font-files/
|
|
|
|
.PHONY: docs docs_info docs_fonts docs_fonts_pre docs_fonts_text docs_fonts_display
|
|
|
|
docs/_data/fontinfo.json: docs/font-files/Inter-Regular.otf misc/tools/fontinfo.py
|
|
misc/tools/fontinfo.py -pretty $< > docs/_data/fontinfo.json
|
|
|
|
docs/lab/glyphinfo.json: misc/tools/gen-glyphinfo.py build/ufo/Inter-Regular.ufo
|
|
misc/tools/gen-glyphinfo.py -ucd misc/UnicodeData.txt build/ufo/Inter-Regular.ufo > $@
|
|
|
|
docs/glyphs/metrics.json: misc/tools/gen-metrics-and-svgs.py build/ufo/Inter-Regular.ufo
|
|
misc/tools/gen-metrics-and-svgs.py build/ufo/Inter-Regular.ufo
|
|
|
|
|
|
# Helper target to download latest Unicode data. Nothing depends on this.
|
|
ucd_version := 12.1.0
|
|
update_UnicodeData:
|
|
@echo "# Unicode $(ucd_version)" > misc/UnicodeData.txt
|
|
curl '-#' "https://www.unicode.org/Public/$(ucd_version)/ucd/UnicodeData.txt" >> misc/UnicodeData.txt
|
|
|
|
|
|
|
|
# install targets
|
|
install_ttf: all_ttf_const
|
|
@echo "Installing TTF files locally at ~/Library/Fonts/Inter"
|
|
rm -rf ~/'Library/Fonts/Inter'
|
|
mkdir -p ~/'Library/Fonts/Inter'
|
|
cp -a $(FONTDIR)/const/*.ttf ~/'Library/Fonts/Inter'
|
|
|
|
install_ttf_hinted: all_ttf_hinted
|
|
@echo "Installing autohinted TTF files locally at ~/Library/Fonts/Inter"
|
|
rm -rf ~/'Library/Fonts/Inter'
|
|
mkdir -p ~/'Library/Fonts/Inter'
|
|
cp -a $(FONTDIR)/const-hinted/*.ttf ~/'Library/Fonts/Inter'
|
|
|
|
install_text_otf: all_otf_text
|
|
@echo "Installing OTF files locally at ~/Library/Fonts/Inter"
|
|
rm -rf ~/'Library/Fonts/Inter'
|
|
mkdir -p ~/'Library/Fonts/Inter'
|
|
cp -a $(FONTDIR)/const/Inter-*.otf ~/'Library/Fonts/Inter'
|
|
|
|
install_display_otf: all_otf_display
|
|
@echo "Installing OTF files locally at ~/Library/Fonts/InterDisplay"
|
|
rm -rf ~/'Library/Fonts/InterDisplay'
|
|
mkdir -p ~/'Library/Fonts/InterDisplay'
|
|
cp -a $(FONTDIR)/const/InterDisplay-*.otf ~/'Library/Fonts/InterDisplay'
|
|
|
|
install_text_var: $(FONTDIR)/var/Inter-V.var.otf
|
|
mkdir -p ~/'Library/Fonts/Inter'
|
|
cp -a $(FONTDIR)/var/Inter-V.var.otf ~/'Library/Fonts/Inter/Inter-V.otf'
|
|
|
|
install_display_var: $(FONTDIR)/var/InterDisplay-V.var.otf
|
|
mkdir -p ~/'Library/Fonts/InterDisplay'
|
|
cp -a $(FONTDIR)/var/Inter-V.var.otf ~/'Library/Fonts/InterDisplay/InterDisplay-V.otf'
|
|
|
|
install: install_text install_display
|
|
install_otf: install_text_otf install_display_otf
|
|
install_text: install_text_otf install_text_var
|
|
install_display: install_display_otf install_display_var
|
|
|
|
# deprecated aliases
|
|
install_var_v:
|
|
@echo 'Please use `make install_text_var` or `make install_display_var` instead.' >&2
|
|
@exit 1
|
|
|
|
.PHONY: install_ttf install_ttf_hinted install_text_otf install_display_otf install_otf
|
|
.PHONY: install_text_var install_display_var install_var_v
|
|
.PHONY: install install_text install_display
|
|
|
|
|
|
# clean removes generated and built fonts in the build directory
|
|
clean:
|
|
rm -rf build/tmp build/fonts build/ufo build/googlefonts
|
|
|
|
.PHONY: clean
|