From 16ab351bf80a97abbbdd24d9a5c8a5417c0470c5 Mon Sep 17 00:00:00 2001 From: Damien Elmes Date: Tue, 7 Apr 2020 10:56:41 +1000 Subject: [PATCH] avoid unnecessary work in 'make build' --- Makefile | 7 ++++--- pylib/Makefile | 5 ++++- qt/Makefile | 5 ++++- rspy/Makefile | 6 ++++-- 4 files changed, 16 insertions(+), 7 deletions(-) diff --git a/Makefile b/Makefile index 3ebd8156a..879729f46 100644 --- a/Makefile +++ b/Makefile @@ -145,9 +145,10 @@ clean: clean-dist $(SUBMAKE) -C $$dir clean; \ done +# remove any files in dist/ folder without current build hash .PHONY: clean-dist -clean-dist: - rm -rf dist +clean-dist: buildhash + find dist \! -name "*$$(cat meta/buildhash)*" -type f -delete .PHONY: check check: pyenv buildhash prepare @@ -181,7 +182,7 @@ add-buildhash: fi; \ ver="$$(cat meta/version)"; \ hash="$$(cat meta/buildhash)"; \ - ${RENAME_BIN} "s/-$${ver}(\.|-)/-$${ver}+$${hash}\$$1/" dist/*-"$${ver}"* + ${RENAME_BIN} -f "s/-$${ver}(\.|-)/-$${ver}+$${hash}\$$1/" dist/*-"$${ver}"* .PHONY: pull-i18n diff --git a/pylib/Makefile b/pylib/Makefile index dba14b0c8..7782bdd84 100644 --- a/pylib/Makefile +++ b/pylib/Makefile @@ -99,10 +99,13 @@ CHECKDEPS := $(shell ${FIND} anki tests -name '*.py' | grep -v buildinfo.py) ###################### .PHONY: build -build: $(BUILD_STEPS) $(CHECKDEPS) +build: .build/build + +.build/build: $(BUILD_STEPS) $(CHECKDEPS) rm -rf dist build python setup.py -q bdist_wheel rsync -a dist/*.whl ../dist/ + touch $@ # prepare code for running in place .PHONY: develop diff --git a/qt/Makefile b/qt/Makefile index 6c1de33df..d4687647e 100644 --- a/qt/Makefile +++ b/qt/Makefile @@ -127,10 +127,13 @@ CHECKDEPS := $(shell ${FIND} aqt tests -name '*.py' | grep -v buildinfo.py) ###################### .PHONY: build -build: $(BUILD_STEPS) +build: .build/build + +.build/build: $(BUILD_STEPS) $(CHECKDEPS) rm -rf dist build python setup.py -q bdist_wheel rsync -a dist/*.whl ../dist/ + touch $@ .PHONY: develop develop: $(BUILD_STEPS) diff --git a/rspy/Makefile b/rspy/Makefile index 8f962ca8e..c6dd10aac 100644 --- a/rspy/Makefile +++ b/rspy/Makefile @@ -60,11 +60,13 @@ DEPS := .build/tools .build/vernum ../meta/buildhash \ CARGO_TARGET_DIR="$(RSPY_TARGET_DIR)" maturin develop $(DEVFLAGS) touch $@ -build: $(DEPS) - rm -rf "$(OUTDIR)"/ankirspy* +build: .build/build + +.build/build: $(DEPS) touch ../proto/backend.proto FTL_TEMPLATE_DIRS="$(QT_FTL_TEMPLATES)" FTL_LOCALE_DIRS="$(QT_FTL_LOCALES)" \ maturin build -i "${PYTHON_FILE}" -o "$(OUTDIR)" $(BUILDFLAGS) + touch $@ check: .build/check