Commit 30b1aa9b authored by Michael Shigorin's avatar Michael Shigorin

toplevel build report now timestamped

Thanks torabora@ for yet again seemingly obvious feature request which strangely managed to evade implementation before. On an afterthought, mass builds would suggest too much coffee instead of a progress indicator -- so implemented the latter. NB: the actual downstream-make-calling rule would expand the "naive" $(shell date) too early: the rule is evaluated before starting its execution, and as it's the time consuming one the shell evaluation was in need, not make's. The result is less generally available (needs to be double quoted and won't work inside e.g. awk programs) but way more precise.
parent 813571cb
...@@ -42,10 +42,15 @@ help: ...@@ -42,10 +42,15 @@ help:
### suboptimal but at least clear, reliable and convenient ### suboptimal but at least clear, reliable and convenient
all: all:
@for i in $(DISTROS); do \ @n=1; sum=$(words $(DISTROS)); \
echo "** building $$i:"; \ for distro in $(DISTROS); do \
$(MAKE) --no-print-directory BUILDDIR=$(BUILDDIR) $$i; \ echo "** building $$distro:"; \
$(MAKE) --no-print-directory \
ALL=$$n/$$sum \
BUILDDIR=$(BUILDDIR) \
$$distro; \
echo; \ echo; \
n=$$(($$n+1)); \
done done
$(IMAGES): debug \ $(IMAGES): debug \
......
...@@ -14,24 +14,28 @@ IMAGEDIR ?= $(shell [ -d "$$HOME/out" -a -w "$$HOME/out" ] \ ...@@ -14,24 +14,28 @@ IMAGEDIR ?= $(shell [ -d "$$HOME/out" -a -w "$$HOME/out" ] \
|| echo "$(BUILDDIR)/out" ) || echo "$(BUILDDIR)/out" )
build: profile/populate build: profile/populate
@echo -n "** starting image build" @echo -n "$(TIME) starting image build"
@if [ -n "$(DEBUG)" ]; then \ @if [ -n "$(DEBUG)" ]; then \
echo ": tail -f $(BUILDLOG)" $(SHORTEN); \ echo ": tail -f $(BUILDLOG)" $(SHORTEN); \
else \ else \
echo " (coffee time)"; \ if [ -n "$(ALL)" ]; then \
echo " [$(ALL)]"; \
else \
echo " (coffee time)"; \
fi; \
fi fi
@if time -f "%E %PCPU %Mk" $(ARCH) \ @if time -f "%E %PCPU %Mk" $(ARCH) \
$(MAKE) -C $(BUILDDIR)/ $(LOG); \ $(MAKE) -C $(BUILDDIR)/ $(LOG); \
then \ then \
echo "** build done (`tail -1 $(BUILDLOG) | cut -f1 -d. \ echo "$(TIME) build done (`tail -1 $(BUILDLOG) | cut -f1 -d. \
|| echo "no log"`)"; \ || echo "no log"`)"; \
else \ else \
echo "** build failed, see log: $(BUILDLOG)" $(SHORTEN); \ echo "$(TIME) build failed, see log: $(BUILDLOG)" $(SHORTEN); \
if [ -z "$(DEBUG)" ]; then \ if [ -z "$(DEBUG)" ]; then \
echo " (you might want to re-run with DEBUG=1)"; \ echo "$(TIME) (you might want to re-run with DEBUG=1)"; \
fi; \ fi; \
tail -100 "$(BUILDLOG)" | egrep "^E:|[Ee]rror|[Ww]arning"; \ tail -100 "$(BUILDLOG)" | egrep "^E:|[Ee]rror|[Ww]arning"; \
df -P $(BUILDDIR) | awk 'END { if ($$4 < 1024) \ df -P $(BUILDDIR) | awk 'END { if ($$4 < 1024) \
{ print "** NB: low space on "$$6" ("$$5" used)"}}'; \ { print "NB: low space on "$$6" ("$$5" used)"}}'; \
fi fi
@if [ -n "$(BELL)" ]; then echo -ne '\a' >&2; fi @if [ -n "$(BELL)" ]; then echo -ne '\a' >&2; fi
...@@ -8,16 +8,17 @@ ...@@ -8,16 +8,17 @@
ifdef CLEAN ifdef CLEAN
export GLOBAL_CLEAN_WORKDIR = clean-current export GLOBAL_CLEAN_WORKDIR = clean-current
ifdef DEBUG ifdef DEBUG
WARNING = (both CLEAN and DEBUG defined, debug options will be limited) WARNING = (NB: DEBUG scope is limited when CLEAN is enabled)
endif endif
endif endif
# ordinary clean: destroys workdirs but not the corresponding results # ordinary clean: destroys workdirs but not the corresponding results
clean: clean:
@echo '** cleaning up $(WARNING)' @echo "$(TIME) cleaning up $(WARNING)"
@find -name '*~' -delete >&/dev/null ||: @find -name '*~' -delete >&/dev/null ||:
@if [ -L build -a -d build/ ]; then \ @if [ -L build -a -d build/ ]; then \
$(MAKE) -C build $@ GLOBAL_BUILDDIR=$(shell readlink build) $(LOG) ||:; \ $(MAKE) -C build $@ \
GLOBAL_BUILDDIR=$(shell readlink build) $(LOG) ||:; \
fi fi
# there can be some sense in writing log here even if normally # there can be some sense in writing log here even if normally
...@@ -26,7 +27,8 @@ clean: ...@@ -26,7 +27,8 @@ clean:
distclean: clean distclean: clean
@if [ -L build -a -d build/ ]; then \ @if [ -L build -a -d build/ ]; then \
rm -rf build/.git; \ rm -rf build/.git; \
$(MAKE) -C build $@ GLOBAL_BUILDDIR=$(shell readlink build) $(LOG) || \ $(MAKE) -C build $@ \
GLOBAL_BUILDDIR=$(shell readlink build) $(LOG) || \
rm -rf build/; \ rm -rf build/; \
rm -rf $(shell readlink build); \ rm -rf $(shell readlink build); \
fi fi
......
...@@ -22,6 +22,8 @@ MAKE += -s ...@@ -22,6 +22,8 @@ MAKE += -s
LOG = 2>>$(BUILDLOG) >/dev/null LOG = 2>>$(BUILDLOG) >/dev/null
endif endif
# in build.mk, naive TIME gets expanded a bit too early (no need to export btw)
DATE = $(shell date +%Y%m%d) DATE = $(shell date +%Y%m%d)
TIME = `date +%H:%M:%S`
export BUILDLOG DATE DEBUG GLOBAL_DEBUG GLOBAL_VERBOSE LOG MAKE SHELL export BUILDLOG DATE DEBUG GLOBAL_DEBUG GLOBAL_VERBOSE LOG MAKE SHELL
...@@ -35,7 +35,7 @@ SHORTEN = $(shell \ ...@@ -35,7 +35,7 @@ SHORTEN = $(shell \
# step 1: initialize the off-tree mkimage profile (BUILDDIR) # step 1: initialize the off-tree mkimage profile (BUILDDIR)
profile/init: distclean profile/init: distclean
@echo -n "** initializing BUILDDIR: " @echo -n "$(TIME) initializing BUILDDIR: "
@rsync -qaH --delete image.in/ "$(BUILDDIR)"/ @rsync -qaH --delete image.in/ "$(BUILDDIR)"/
@mkdir "$(BUILDDIR)"/.mki # mkimage toplevel marker @mkdir "$(BUILDDIR)"/.mki # mkimage toplevel marker
@$(call put,ifndef DISTCFG_MK) @$(call put,ifndef DISTCFG_MK)
...@@ -71,7 +71,7 @@ profile/init: distclean ...@@ -71,7 +71,7 @@ profile/init: distclean
fi $(SHORTEN) fi $(SHORTEN)
profile/bare: profile/init profile/bare: profile/init
@echo "** preparing distro config$${DEBUG:+: see $(CONFIG)}" \ @echo "$(TIME) preparing distro config$${DEBUG:+: see $(CONFIG)}" \
$(SHORTEN) $(SHORTEN)
@$(call try,MKIMAGE_PREFIX,/usr/share/mkimage) @$(call try,MKIMAGE_PREFIX,/usr/share/mkimage)
@$(call try,GLOBAL_VERBOSE,) @$(call try,GLOBAL_VERBOSE,)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment