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.
This commit is contained in:
parent
813571cb10
commit
30b1aa9be6
11
Makefile
11
Makefile
@ -42,10 +42,15 @@ help:
|
||||
|
||||
### suboptimal but at least clear, reliable and convenient
|
||||
all:
|
||||
@for i in $(DISTROS); do \
|
||||
echo "** building $$i:"; \
|
||||
$(MAKE) --no-print-directory BUILDDIR=$(BUILDDIR) $$i; \
|
||||
@n=1; sum=$(words $(DISTROS)); \
|
||||
for distro in $(DISTROS); do \
|
||||
echo "** building $$distro:"; \
|
||||
$(MAKE) --no-print-directory \
|
||||
ALL=$$n/$$sum \
|
||||
BUILDDIR=$(BUILDDIR) \
|
||||
$$distro; \
|
||||
echo; \
|
||||
n=$$(($$n+1)); \
|
||||
done
|
||||
|
||||
$(IMAGES): debug \
|
||||
|
16
lib/build.mk
16
lib/build.mk
@ -14,24 +14,28 @@ IMAGEDIR ?= $(shell [ -d "$$HOME/out" -a -w "$$HOME/out" ] \
|
||||
|| echo "$(BUILDDIR)/out" )
|
||||
|
||||
build: profile/populate
|
||||
@echo -n "** starting image build"
|
||||
@echo -n "$(TIME) starting image build"
|
||||
@if [ -n "$(DEBUG)" ]; then \
|
||||
echo ": tail -f $(BUILDLOG)" $(SHORTEN); \
|
||||
else \
|
||||
echo " (coffee time)"; \
|
||||
if [ -n "$(ALL)" ]; then \
|
||||
echo " [$(ALL)]"; \
|
||||
else \
|
||||
echo " (coffee time)"; \
|
||||
fi; \
|
||||
fi
|
||||
@if time -f "%E %PCPU %Mk" $(ARCH) \
|
||||
$(MAKE) -C $(BUILDDIR)/ $(LOG); \
|
||||
then \
|
||||
echo "** build done (`tail -1 $(BUILDLOG) | cut -f1 -d. \
|
||||
echo "$(TIME) build done (`tail -1 $(BUILDLOG) | cut -f1 -d. \
|
||||
|| echo "no log"`)"; \
|
||||
else \
|
||||
echo "** build failed, see log: $(BUILDLOG)" $(SHORTEN); \
|
||||
echo "$(TIME) build failed, see log: $(BUILDLOG)" $(SHORTEN); \
|
||||
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; \
|
||||
tail -100 "$(BUILDLOG)" | egrep "^E:|[Ee]rror|[Ww]arning"; \
|
||||
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
|
||||
@if [ -n "$(BELL)" ]; then echo -ne '\a' >&2; fi
|
||||
|
10
lib/clean.mk
10
lib/clean.mk
@ -8,16 +8,17 @@
|
||||
ifdef CLEAN
|
||||
export GLOBAL_CLEAN_WORKDIR = clean-current
|
||||
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
|
||||
|
||||
# ordinary clean: destroys workdirs but not the corresponding results
|
||||
clean:
|
||||
@echo '** cleaning up $(WARNING)'
|
||||
@echo "$(TIME) cleaning up $(WARNING)"
|
||||
@find -name '*~' -delete >&/dev/null ||:
|
||||
@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
|
||||
|
||||
# there can be some sense in writing log here even if normally
|
||||
@ -26,7 +27,8 @@ clean:
|
||||
distclean: clean
|
||||
@if [ -L build -a -d build/ ]; then \
|
||||
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 $(shell readlink build); \
|
||||
fi
|
||||
|
@ -22,6 +22,8 @@ MAKE += -s
|
||||
LOG = 2>>$(BUILDLOG) >/dev/null
|
||||
endif
|
||||
|
||||
# in build.mk, naive TIME gets expanded a bit too early (no need to export btw)
|
||||
DATE = $(shell date +%Y%m%d)
|
||||
TIME = `date +%H:%M:%S`
|
||||
|
||||
export BUILDLOG DATE DEBUG GLOBAL_DEBUG GLOBAL_VERBOSE LOG MAKE SHELL
|
||||
|
@ -35,7 +35,7 @@ SHORTEN = $(shell \
|
||||
|
||||
# step 1: initialize the off-tree mkimage profile (BUILDDIR)
|
||||
profile/init: distclean
|
||||
@echo -n "** initializing BUILDDIR: "
|
||||
@echo -n "$(TIME) initializing BUILDDIR: "
|
||||
@rsync -qaH --delete image.in/ "$(BUILDDIR)"/
|
||||
@mkdir "$(BUILDDIR)"/.mki # mkimage toplevel marker
|
||||
@$(call put,ifndef DISTCFG_MK)
|
||||
@ -71,7 +71,7 @@ profile/init: distclean
|
||||
fi $(SHORTEN)
|
||||
|
||||
profile/bare: profile/init
|
||||
@echo "** preparing distro config$${DEBUG:+: see $(CONFIG)}" \
|
||||
@echo "$(TIME) preparing distro config$${DEBUG:+: see $(CONFIG)}" \
|
||||
$(SHORTEN)
|
||||
@$(call try,MKIMAGE_PREFIX,/usr/share/mkimage)
|
||||
@$(call try,GLOBAL_VERBOSE,)
|
||||
|
Loading…
Reference in New Issue
Block a user