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.
This commit is contained in:
Michael Shigorin 2013-08-13 22:32:27 +04:00
parent 891f982e92
commit 674f7db26e
2 changed files with 8 additions and 4 deletions

View File

@ -47,7 +47,7 @@
** экономия RAM+swap при сборке в tmpfs, иначе места на диске
** очистка рабочего каталога после успешной сборки очередной стадии
** может помешать использовать некоторые варианты отладки
** значение: любая строка; по умолчанию пусто при DEBUG, иначе 1
** значение: пусто, 0, 1, 2; по умолчанию пусто при DEBUG, иначе 1
** см. ../lib/clean.mk
* DEBUG

View File

@ -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) ||:; \