lib/clean.mk: post-build cleanup revisited

The prerequisites for a cleanup after a successful build
were somewhat weird at this point; now the rules are:
- if DEBUG level is more than 1 or CHECK is set, don't do it;
- otherwise if at least one of the following conditions is true:
  + there's more than one target being built in a row;
  + the build was run by e.g. alterator-mkimage;
  + metaprofile directory is read only
  ...then do a distclean.

If these are still weird or feel unsuitable for profile hacking,
drop me a note (or a patch).
This commit is contained in:
Michael Shigorin 2012-07-30 19:24:45 +04:00
parent ea1f039c02
commit 3a8af6b55d
2 changed files with 10 additions and 6 deletions

View File

@ -41,7 +41,7 @@
- CHECK
+ включает режим проверки сборки конфигурации (без сборки образа)
+ значение: пусто (по умолчанию) либо любая строка
+ см. ../lib/build.mk
+ см. ../lib/build.mk, ../lib/clean.mk
- CLEAN
+ экономия RAM+swap при сборке в tmpfs, иначе места на диске
@ -51,9 +51,9 @@
+ см. ../lib/clean.mk
- DEBUG
+ включает средства отладки
+ включает средства отладки, может отключить зачистку после сборки
+ значение: пусто (по умолчанию), 1 или 2
+ см. ../lib/log.mk
+ см. ../lib/log.mk, ../lib/clean.mk
- HOMEPAGE, HOMENAME, HOMEWAIT
+ указывают адрес, название и таймаут перехода для домашней страницы

View File

@ -50,11 +50,15 @@ distclean: clean
} >&2
# builddir existing outside read-only metaprofile is less ephemeral
# than BUILDDIR is -- usually it's unneeded afterwards so just zap it
# than BUILDDIR variable is -- usually it's unneeded afterwards
# so just zap it unless DEBUG has been requested (moreso for multi
# image builds, UI based ones, and readonly metaprofile; or CHECK)
postclean: build-image
@{ \
if [ "$(NUM_TARGETS)" -gt 1 -a -z "$(DEBUG)" -a -z "$(__frontend)" ] ||\
[ ! -L "$(SYMLINK)" -a "0$(DEBUG)" -lt 2 ]; then \
if [ "0$(DEBUG)" -lt 2 -a -z "$(CHECK)" ] && \
[ "$(NUM_TARGETS)" -gt 1 \
-o -n "$(__frontend)" \
-o ! -L "$(SYMLINK)" ]; then \
echo "$(TIME) cleaning up after build"; \
$(MAKE) -C "$(BUILDDIR)" distclean \
GLOBAL_BUILDDIR="$(BUILDDIR)" $(LOG) ||:; \