| 1 |
SOURCES=$(shell python3 scripts/read-config.py --sources ) |
| 2 |
FAMILY=$(shell python3 scripts/read-config.py --family ) |
| 3 |
DRAWBOT_SCRIPTS=$(shell ls documentation/*.py) |
| 4 |
DRAWBOT_OUTPUT=$(shell ls documentation/*.py | sed 's/\.py/.png/g') |
| 5 |
|
| 6 |
help: |
| 7 |
@echo "###" |
| 8 |
@echo "# Build targets for $(FAMILY)" |
| 9 |
@echo "###" |
| 10 |
@echo |
| 11 |
@echo " make build: Builds the fonts and places them in the fonts/ directory" |
| 12 |
@echo " make test: Tests the fonts with fontbakery" |
| 13 |
@echo " make proof: Creates HTML proof documents in the proof/ directory" |
| 14 |
@echo " make images: Creates PNG specimen images in the documentation/ directory" |
| 15 |
@echo |
| 16 |
|
| 17 |
build: build.stamp |
| 18 |
|
| 19 |
venv: venv/touchfile |
| 20 |
|
| 21 |
venv-test: venv-test/touchfile |
| 22 |
|
| 23 |
customize: venv |
| 24 |
. venv/bin/activate; python3 scripts/customize.py |
| 25 |
|
| 26 |
build.stamp: venv sources/config.yaml $(SOURCES) |
| 27 |
rm -rf fonts |
| 28 |
(for config in sources/config*.yaml; do . venv/bin/activate; gftools builder $$config; done) && touch build.stamp |
| 29 |
|
| 30 |
venv/touchfile: requirements.txt |
| 31 |
test -d venv || python3 -m venv venv |
| 32 |
. venv/bin/activate; pip install -Ur requirements.txt |
| 33 |
touch venv/touchfile |
| 34 |
|
| 35 |
venv-test/touchfile: requirements-test.txt |
| 36 |
test -d venv-test || python3 -m venv venv-test |
| 37 |
. venv-test/bin/activate; pip install -Ur requirements-test.txt |
| 38 |
touch venv-test/touchfile |
| 39 |
|
| 40 |
test: venv-test build.stamp |
| 41 |
TOCHECK=$$(find fonts/variable -type f 2>/dev/null); if [ -z "$$TOCHECK" ]; then TOCHECK=$$(find fonts/ttf -type f 2>/dev/null); fi ; . venv-test/bin/activate; mkdir -p out/ out/fontbakery; fontbakery check-googlefonts -l WARN --full-lists --succinct --badges out/badges --html out/fontbakery/fontbakery-report.html --ghmarkdown out/fontbakery/fontbakery-report.md $$TOCHECK || echo '::warning file=sources/config.yaml,title=Fontbakery failures::The fontbakery QA check reported errors in your font. Please check the generated report.' |
| 42 |
|
| 43 |
proof: venv build.stamp |
| 44 |
TOCHECK=$$(find fonts/variable -type f 2>/dev/null); if [ -z "$$TOCHECK" ]; then TOCHECK=$$(find fonts/ttf -type f 2>/dev/null); fi ; . venv/bin/activate; mkdir -p out/ out/proof; diffenator2 proof $$TOCHECK -o out/proof |
| 45 |
|
| 46 |
images: venv $(DRAWBOT_OUTPUT) |
| 47 |
|
| 48 |
%.png: %.py build.stamp |
| 49 |
. venv/bin/activate; python3 $< --output $@ |
| 50 |
|
| 51 |
clean: |
| 52 |
rm -rf venv |
| 53 |
find . -name "*.pyc" -delete |
| 54 |
|
| 55 |
update-project-template: |
| 56 |
npx update-template https://github.com/googlefonts/googlefonts-project-template/ |
| 57 |
|
| 58 |
update: venv venv-test |
| 59 |
venv/bin/pip install --upgrade pip-tools |
| 60 |
# See https://pip-tools.readthedocs.io/en/latest/#a-note-on-resolvers for |
| 61 |
# the `--resolver` flag below. |
| 62 |
venv/bin/pip-compile --upgrade --verbose --resolver=backtracking requirements.in |
| 63 |
venv/bin/pip-sync requirements.txt |
| 64 |
|
| 65 |
venv-test/bin/pip install --upgrade pip-tools |
| 66 |
venv-test/bin/pip-compile --upgrade --verbose --resolver=backtracking requirements-test.in |
| 67 |
venv-test/bin/pip-sync requirements-test.txt |
| 68 |
|
| 69 |
git commit -m "Update requirements" requirements.txt requirements-test.txt |
| 70 |
git push |