summaryrefslogtreecommitdiff
path: root/docs/Makefile
diff options
context:
space:
mode:
Diffstat (limited to 'docs/Makefile')
-rw-r--r--docs/Makefile78
1 files changed, 46 insertions, 32 deletions
diff --git a/docs/Makefile b/docs/Makefile
index 4ffa10083..e5eb93384 100644
--- a/docs/Makefile
+++ b/docs/Makefile
@@ -1,25 +1,47 @@
SRCDIR := $(abspath $(lastword $(MAKEFILE_LIST))/../..)
-BIN := $(SRCDIR)/build/venv/bin
FONTDIR := ../build/fonts
+BIN := $(SRCDIR)/build/venv/bin
+VENV := ../build/venv/bin/activate
export PATH := $(BIN):$(PATH)
+HTTP_SERVER_BIND_ADDR ?= 127.0.0.1
+
default:
- @echo "Please specify a target: build, serve or dist" >&2
+ @echo "Please specify a target: build, serve, dist" >&2
build: .ruby-bundle
rm -rf _site
bundle exec jekyll build
-build-archive: .ruby-bundle
- rm -rf _site-archive/inter-website/v3
- mkdir -p _site-archive/inter-website/v3
- bundle exec jekyll build --safe -d _site-archive/inter-website/v3 -b /inter-website/v3/
-
-serve-archive: build-archive
- serve-http -p 8198 _site-archive
+build-tmp: .ruby-bundle
+ rm -rf _site-tmp
+ bundle exec jekyll build --disable-disk-cache -b /tmp/inter-v4-website/ -d _site-tmp
serve: .ruby-bundle
- ./_scripts/serve.sh
+ if [ ! -s lab/fonts ]; then \
+ [ ! -s lab/fonts/fonts ] || rm lab/fonts/fonts; \
+ rm -f lab/fonts && ln -fs ../../build/fonts lab/fonts; \
+ fi
+ @# need to delete generated content so that jekyll, being a little dumb,
+ @# can manage to copy the font files into there again.
+ @# Why not a symlink you ask? Jekyll traverses it and copies the content.
+ @# In the past we tried to work around this by periodically removing the
+ @# copied font files and re-creating the symlink, but it was a frail process.
+ @# For live testing with fonts, you'll instead want to use docs/lab/serve.py
+ rm -rf _site
+ bundle exec jekyll serve -b / --watch \
+ --config _config.yml,_config-dev.yml \
+ --host $(HTTP_SERVER_BIND_ADDR) --port 3002 \
+ --livereload --livereload-port 30002
+
+serve-pub:
+ exec $(MAKE) HTTP_SERVER_BIND_ADDR=0.0.0.0 serve
+
+optimize-images:
+ for f in res/*.png; do \
+ optipng -quiet "$$f" & \
+ done ; \
+ wait
.ruby-bundle: Gemfile Gemfile.lock
@if ! (command -v bundle >/dev/null && command -v jekyll >/dev/null); then \
@@ -32,37 +54,29 @@ serve: .ruby-bundle
# -----------------------------------------------------------------------
-dist: fonts info
- $(BIN)/python3 ../misc/tools/patch-version.py lab/index.html
+dist: fonts info lab/index.html
-info: _data/fontinfo.json \
- lab/glyphinfo.json \
- glyphs/metrics.json
+info: _data/fontinfo.json lab/glyphinfo.json
fonts:
- rm -rf font-files/Inter-* font-files/Inter.var*
+ rm -rf font-files/Inter*
mkdir -p font-files
- cp -a $(FONTDIR)/static/Inter-*.woff2 \
- $(FONTDIR)/static/Inter-*.otf \
- $(FONTDIR)/var/Inter.var.* \
- $(FONTDIR)/var/Inter-roman.var.* \
- $(FONTDIR)/var/Inter-italic.var.* \
+ cp -a $(FONTDIR)/static/Inter*.woff2 \
+ $(FONTDIR)/var/Inter-Variable.woff2 \
+ $(FONTDIR)/var/Inter-Variable-Italic.woff2 \
+ $(FONTDIR)/var/Inter-Variable.ttf \
font-files/
-_data/fontinfo.json: ../misc/tools/fontinfo.py font-files/Inter-Regular.otf
- $(BIN)/python3 ../misc/tools/fontinfo.py -pretty $< > _data/fontinfo.json
+lab/index.html: ../version.txt
+ . $(VENV); python ../misc/tools/patch-version.py $@
+
+_data/fontinfo.json: ../misc/tools/fontinfo.py
+ . $(VENV); python ../misc/tools/fontinfo.py -pretty font-files/Inter-Regular.otf > _data/fontinfo.json
lab/glyphinfo.json: ../misc/tools/gen-glyphinfo.py \
../build/ufo/Inter-Regular.ufo \
../misc/UnicodeData.txt
- $(BIN)/python3 ../misc/tools/gen-glyphinfo.py \
+ . $(VENV); python ../misc/tools/gen-glyphinfo.py \
-ucd ../misc/UnicodeData.txt ../build/ufo/Inter-Regular.ufo > $@
-glyphs/metrics.json: ../misc/tools/gen-metrics-and-svgs.py \
- ../build/ufo/Inter-Regular.ufo
- $(BIN)/python3 ../misc/tools/gen-metrics-and-svgs.py ../build/ufo/Inter-Regular.ufo
- @# Note: this also patches glyphs/index.html
-
-font-files/Inter-Regular.otf: fonts
-
-.PHONY: default build build-archive serve serve-archive dist info fonts
+.PHONY: default build build-tmp serve serve-pub dist info fonts