Skip to content

Commit

Permalink
I want my Makefile
Browse files Browse the repository at this point in the history
  • Loading branch information
jenskutilek committed Sep 28, 2024
1 parent df1e340 commit df9f5bc
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 56 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
- name: Build Debian Package
run: scripts/prepare-deb.sh
- name: Build
run: make -f private-build/Makefile dist
run: make dist
- name: Release
uses: softprops/[email protected]
with:
Expand Down
84 changes: 29 additions & 55 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,70 +1,44 @@
SOURCES=$(shell python3 scripts/read-config.py --sources )
FAMILY=$(shell python3 scripts/read-config.py --family )
DRAWBOT_SCRIPTS=$(shell ls documentation/*.py)
DRAWBOT_OUTPUT=$(shell ls documentation/*.py | sed 's/\.py/.png/g')
ARCHIVE = sudo.zip
DISTDIR = dist
FONTDIR = sudo
prefix = /usr/local

help:
@echo "###"
@echo "# Build targets for $(FAMILY)"
@echo "###"
@echo
@echo " make build: Builds the fonts and places them in the fonts/ directory"
@echo " make test: Tests the fonts with fontbakery"
@echo " make proof: Creates HTML proof documents in the proof/ directory"
@echo " make images: Creates PNG specimen images in the documentation/ directory"
@echo
.PHONY: all
all: build

build: build.stamp

venv: venv/touchfile
.PHONY: build
build: $(FONTDIR)

venv-test: venv-test/touchfile

customize: venv
. venv/bin/activate; python3 scripts/customize.py

build.stamp: venv sources/config.yaml $(SOURCES)
rm -rf fonts
(for config in sources/config*.yaml; do . venv/bin/activate; gftools builder $$config; done) && touch build.stamp

venv/touchfile: requirements.txt
test -d venv || python3 -m venv venv
. venv/bin/activate; pip install -Ur requirements.txt
touch venv/touchfile
.PHONY: clean
clean:
$(MAKE) -C $(FONTDIR) clean

venv-test/touchfile: requirements-test.txt
test -d venv-test || python3 -m venv venv-test
. venv-test/bin/activate; pip install -Ur requirements-test.txt
touch venv-test/touchfile

test: venv-test build.stamp
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.'
.PHONY: dist
dist: webfonts $(DISTDIR)/$(ARCHIVE)

proof: venv build.stamp
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

images: venv $(DRAWBOT_OUTPUT)
.PHONY: $(FONTDIR)
$(FONTDIR):
$(MAKE) -C $@

%.png: %.py build.stamp
. venv/bin/activate; python3 $< --output $@

clean:
rm -rf venv
find . -name "*.pyc" -delete
$(DISTDIR)/$(ARCHIVE): $(FONTDIR)
if test -e $(DISTDIR); then \
rm -f $(DISTDIR)/$(ARCHIVE); \
else \
mkdir $(DISTDIR); \
fi
zip -r $(DISTDIR)/$(ARCHIVE) $(FONTDIR)/ --exclude "*.DS_Store" "*Makefile"

update-project-template:
npx update-template https://github.com/googlefonts/googlefonts-project-template/

update: venv venv-test
venv/bin/pip install --upgrade pip-tools
# See https://pip-tools.readthedocs.io/en/latest/#a-note-on-resolvers for
# the `--resolver` flag below.
venv/bin/pip-compile --upgrade --verbose --resolver=backtracking requirements.in
venv/bin/pip-sync requirements.txt
.PHONY: install-debian
install-debian:
$(MAKE) -C $(FONTDIR) install-debian

venv-test/bin/pip install --upgrade pip-tools
venv-test/bin/pip-compile --upgrade --verbose --resolver=backtracking requirements-test.in
venv-test/bin/pip-sync requirements-test.txt

git commit -m "Update requirements" requirements.txt requirements-test.txt
git push
.PHONY: webfonts
webfonts:
$(MAKE) -C $(FONTDIR) webfonts

0 comments on commit df9f5bc

Please sign in to comment.