make: updated makefile + init script with githook for running the init script

This commit is contained in:
Rasmus Andersson 2020-04-05 14:18:45 -07:00
parent c2a946c8c8
commit 2065cd3073
4 changed files with 276 additions and 105 deletions

134
Makefile
View file

@ -1,25 +1,12 @@
# Targets:
# High-level make targets:
# all Build everything
# test Build and test 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_const Build all non-variable files
# all_const_hinted Build all non-variable files with hints
# all_var Build all variable files
# all_var_hinted Build all variable files with hints (disabled)
#
# all_otf Build all OTF files into FONTDIR/const
# all_ttf Build all TTF files into FONTDIR/const
# all_ttf_hinted Build all TTF files with hints into FONTDIR/const-hinted
# all_web, web Build all WOFF files into FONTDIR/const
# all_web_hinted Build all WOFF files with hints into FONTDIR/const-hinted
# all_var Build all variable font files into FONTDIR/var
# all_var_hinted Build all variable font files with hints into
# FONTDIR/var-hinted
#
# designspace Build build/ufo/Inter.designspace from src/Inter.glyphs
# 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
@ -36,24 +23,29 @@
# const
# const-hinted
# var
# var-hinted (disabled)
#
FONTDIR = build/fonts
all: all_const all_const_hinted all_var
web: all_web
.PHONY: all web
all: all_text all_display web
all_const: all_otf all_ttf all_web
all_const_hinted: all_ttf_hinted all_web_hinted
var: var_text 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: \
# 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 \
@ -61,7 +53,8 @@ all_var: \
$(FONTDIR)/var/Inter-roman.var.otf \
$(FONTDIR)/var/Inter-roman.var.woff2 \
$(FONTDIR)/var/Inter-italic.var.otf \
$(FONTDIR)/var/Inter-italic.var.woff2 \
$(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 \
@ -71,11 +64,12 @@ all_var: \
$(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
# .PHONY: all_var_hinted
.PHONY: all_const all_const_hinted var var_text var_display all_var
export PATH := $(PWD)/build/venv/bin:$(PATH)
@ -189,29 +183,38 @@ $(FONTDIR)/const-hinted/%.ttf: $(FONTDIR)/const/%.ttf
# check var
test_var: all_var
misc/fontbuild checkfont $(FONTDIR)/var/*.otf $(FONTDIR)/var/*.woff2
# test runs all tests
# Note: all_check_const is generated by init.sh and runs "fontbuild checkfont"
# on all otf and ttf files.
test: all_check_const test_var
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:
check_text:
misc/fontbuild checkfont \
$(FONTDIR)/const/*.ttf \
$(FONTDIR)/const/*.otf \
$(FONTDIR)/const/*.woff2 \
$(FONTDIR)/var/*.otf \
$(FONTDIR)/var/*.woff2
@echo "check: all ok"
$(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"
.PHONY: test check
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
@ -297,15 +300,26 @@ build/release/Inter-%.zip: build/tmp/a.zip
@sh -c "if [ -f /usr/bin/open ]; then /usr/bin/open --reveal '$@'; fi"
zip: all
$(MAKE) check
$(MAKE) build/release/Inter-${VERSION}-$(shell git rev-parse --short=10 HEAD).zip
$(MAKE) check_text check_display
bash misc/makezip.sh -all \
"build/release/Inter-${VERSION}-$(shell git rev-parse --short=10 HEAD).zip"
zip_text: all
$(MAKE) check_text
bash misc/makezip.sh -text \
"build/release/Inter-${VERSION}-text-$(shell git rev-parse --short=10 HEAD).zip"
zip_display: all
$(MAKE) check_display
bash misc/makezip.sh -display \
"build/release/Inter-${VERSION}-display-$(shell git rev-parse --short=10 HEAD).zip"
zip_dist: pre_dist
$(MAKE) check
$(MAKE) ${ZIP_FILE_DIST}
$(MAKE) check_text
bash misc/makezip.sh -text "build/release/Inter-${VERSION}.zip"
# distribution
pre_dist: all
pre_dist: all_text
@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; \
@ -381,13 +395,13 @@ install_ttf_hinted: all_ttf_hinted
mkdir -p ~/'Library/Fonts/Inter'
cp -a $(FONTDIR)/const-hinted/*.ttf ~/'Library/Fonts/Inter'
install_text_otf: all_text_otf
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_display_otf
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'