From 674f7db26e74dc536d4f0e091da2546fa929db20 Mon Sep 17 00:00:00 2001 From: Michael Shigorin Date: Tue, 13 Aug 2013 22:32:27 +0400 Subject: [PATCH] clean.mk: allow to forbid cleanup explicitly The behaviour that sort of settled didn't actually follow the principle of the least surprise when one really wanted to have BUILDDIR available for inspection; DEBUG=2 would be effective to achieve that but CLEAN=0 would not. Thanks led@ for spotting and reporting this. --- doc/params.txt | 2 +- lib/clean.mk | 10 +++++++--- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/doc/params.txt b/doc/params.txt index 0d580220..40cd857f 100644 --- a/doc/params.txt +++ b/doc/params.txt @@ -47,7 +47,7 @@ ** экономия RAM+swap при сборке в tmpfs, иначе места на диске ** очистка рабочего каталога после успешной сборки очередной стадии ** может помешать использовать некоторые варианты отладки -** значение: любая строка; по умолчанию пусто при DEBUG, иначе 1 +** значение: пусто, 0, 1, 2; по умолчанию пусто при DEBUG, иначе 1 ** см. ../lib/clean.mk * DEBUG diff --git a/lib/clean.mk b/lib/clean.mk index b99d1bac..569f1a24 100644 --- a/lib/clean.mk +++ b/lib/clean.mk @@ -53,10 +53,14 @@ distclean: clean # than BUILDDIR variable is -- usually it's unneeded afterwards postclean: build-image @{ \ - if [ "0$(DEBUG)" -lt 2 -a -z "$(CHECK)$(REPORT)" ] && \ - [ "$(NUM_TARGETS)" -gt 1 \ + if [ "$(CLEAN)" != 0 ] && \ + [ "0$(DEBUG)" -lt 2 ] && \ + [ -z "$(CHECK)" ] && \ + [ -z "$(REPORT)" ] && \ + [ "$(NUM_TARGETS)" -gt 1 \ -o -n "$(__frontend)" \ - -o ! -L "$(SYMLINK)" ]; then \ + -o ! -L "$(SYMLINK)" ]; \ + then \ echo "$(TIME) cleaning up after build"; \ $(MAKE) -C "$(BUILDDIR)" distclean \ GLOBAL_BUILDDIR="$(BUILDDIR)" $(LOG) ||:; \