avoid running checks/builds when nothing has changed

with some defaults taken from https://tech.davis-hansson.com/p/make/
This commit is contained in:
Damien Elmes 2019-12-18 11:12:17 +10:00
parent ff6b58c265
commit c1cbab0d23
4 changed files with 54 additions and 14 deletions

1
.gitignore vendored
View file

@ -10,3 +10,4 @@ tools/runanki.system
anki/buildhash.py anki/buildhash.py
.mypy_cache .mypy_cache
.pytype .pytype
.build

View file

@ -1,4 +1,16 @@
PREFIX=/usr PREFIX := /usr
SHELL := bash
.SHELLFLAGS := -eu -o pipefail -c
.ONESHELL:
.DELETE_ON_ERROR:
MAKEFLAGS += --warn-undefined-variables
MAKEFLAGS += --no-builtin-rules
RUNARGS :=
.SUFFIXES:
$(shell mkdir -p .build)
.PHONY: all install uninstall
all: all:
@echo "You can run Anki with ./runanki" @echo "You can run Anki with ./runanki"
@ -32,3 +44,43 @@ uninstall:
-xdg-mime uninstall ${DESTDIR}${PREFIX}/share/mime/packages/anki.xml -xdg-mime uninstall ${DESTDIR}${PREFIX}/share/mime/packages/anki.xml
@echo @echo
@echo "Uninstall complete." @echo "Uninstall complete."
.PHONY: clean build run
clean:
rm -rf .build
build: .build/ui
.build/ui: $(shell find designer -name '*.ui')
./tools/build_ui.sh
touch $@
run: build
./runanki ${RUNARGS}
CHECKDEPS := .build/ui $(shell find anki aqt -name '*.py')
.PHONY: check mypy test lint pytype
check: mypy test lint pytype
mypy: .build/mypy
test: .build/test
lint: .build/lint
pytype: .build/pytype
.build/mypy: $(CHECKDEPS)
mypy anki aqt
touch $@
.build/test: $(CHECKDEPS)
./tools/tests.sh
touch $@
.build/lint: $(CHECKDEPS)
pylint -j 0 --rcfile=.pylintrc -f colorized --extension-pkg-whitelist=PyQt5 anki aqt
touch $@
.build/pytype: $(CHECKDEPS)
pytype --config pytype.conf
touch $@

View file

@ -1,6 +0,0 @@
#!/bin/bash
set -e
TOOLS="$(cd "`dirname "$0"`"; pwd)"
pylint -j 0 --rcfile=$TOOLS/../.pylintrc -f colorized --extension-pkg-whitelist=PyQt5 $TOOLS/../anki $TOOLS/../aqt

View file

@ -1,7 +0,0 @@
#!/bin/bash
set -e
TOOLS="$(cd "`dirname "$0"`"; pwd)"
mypy $TOOLS/../anki $TOOLS/../aqt
(cd $TOOLS/.. && pytype --config pytype.conf)