lib/build.mk: different colours for different outcomes
As was (quite reasonably) asked by someone and me too, why should a successful build yield a *red* line (a grep's default)? So now it's new and improved, 25% free and so forth: with a successful build you get a green line, while errors from a broke one result in red ones. Clinically tested in both b/w and w/b colour schemes; in case you're not satisfied, please return original ANSI_OK and ANSI_FAIL values to the colour dealer and pass your favourite ones instead.
This commit is contained in:
parent
ad68750855
commit
b52ff4ef91
10
lib/build.mk
10
lib/build.mk
@ -1,4 +1,6 @@
|
||||
# step 4 is kicked off here but actually done by image.in/Makefile
|
||||
ANSI_OK ?= 1;32
|
||||
ANSI_FAIL ?= 1;31
|
||||
|
||||
ifndef MKIMAGE_PROFILES
|
||||
$(error this makefile is designed to be included in toplevel one)
|
||||
@ -25,6 +27,7 @@ IMAGEDIR ?= $(shell [ -d "$$HOME/out" -a -w "$$HOME/out" ] \
|
||||
&& echo "$$HOME/out" \
|
||||
|| echo "$(BUILDDIR)/out" )
|
||||
|
||||
# poehali
|
||||
build: profile/populate
|
||||
@echo -n "$(TIME) starting image build"
|
||||
@if [ -n "$(DEBUG)" ]; then \
|
||||
@ -39,13 +42,16 @@ build: profile/populate
|
||||
@if $(START) $(MAKE) -C $(BUILDDIR)/ $(LOG); then \
|
||||
echo "$(TIME) done (`tail -1 $(BUILDLOG) | cut -f1 -d.`)"; \
|
||||
tail -200 "$(BUILDLOG)" \
|
||||
| grep --color=always '^\*\* image: .*' $(SHORTEN) ||:; \
|
||||
| GREP_COLOR="$(ANSI_OK)" \
|
||||
grep --color=always '^\*\* image: .*' $(SHORTEN) ||:; \
|
||||
else \
|
||||
echo "$(TIME) failed, see log: $(BUILDLOG)" $(SHORTEN); \
|
||||
if [ -z "$(DEBUG)" ]; then \
|
||||
echo "$(TIME) (you might want to re-run with DEBUG=1)"; \
|
||||
fi; \
|
||||
tail -200 "$(BUILDLOG)" | egrep "^(E:|[Ee]rror|[Ww]arning).*"; \
|
||||
tail -200 "$(BUILDLOG)" \
|
||||
| GREP_COLOR="$(ANSI_FAIL)" \
|
||||
egrep --color=always "^(E:|[Ee]rror|[Ww]arning).*"; \
|
||||
df -P $(BUILDDIR) | awk 'END { if ($$4 < $(LOWSPACE)) \
|
||||
{ print "NB: low space on "$$6" ("$$5" used)"}}'; \
|
||||
fi
|
||||
|
Loading…
Reference in New Issue
Block a user