Commit 0439df31 authored by Michael Shigorin's avatar Michael Shigorin

reports.mk: fixups and hardening

No need for .reports/ in toplevel directory even after build failure, and a few more hasty hacking fixups are also due, shame on me.
parent 7d09fed7
......@@ -6,7 +6,7 @@ include lib/common.mk
BUILDDIR := $(shell sed -n 's/^.* BUILDDIR = \(.*\)/\1/p' "$(REPORT_PATH)")
BUILDLOG := $(BUILDDIR)/$(BUILD_LOG)
REPORTDIR := $(BUILDDIR)/reports/
REPORTDIR := $(BUILDDIR)/reports
IMAGE_OUTPATH := $(shell sed -n 's/^IMAGE_OUTPATH = \(.*\)/\1/p' $(BUILDLOG))
# for a multi-image build there's no sense to refer to buildroot
......@@ -16,7 +16,9 @@ SHORTEN := >/dev/null
endif
all: reports/targets reports/scripts
@cp -a $(REPORTDIR) $(IMAGE_OUTPATH).reports
@if [ -n "$(IMAGE_OUTPATH)" ]; then \
cp -a $(REPORTDIR) $(IMAGE_OUTPATH).reports; \
fi
reports/prep:
@mkdir -p "$(REPORTDIR)"
......@@ -25,14 +27,14 @@ reports/scripts: reports/prep
@grep "^mki.*scripts: Run: " $(BUILDLOG) \
| sed -rn "s,^.*($(BUILDDIR)|$(SYMLINK))/(.*)'$$,\2,p" \
> "$(REPORTDIR)/$*.log" \
&& echo "** scripts report: $(BUILDDIR)/$(@F).log" $(SHORTEN)
&& echo "** scripts report: $(REPORTDIR)/$(@F).log" $(SHORTEN)
reports/targets: reports/prep
@if ! [ -n "$(REPORT_PATH)" -a -s "$(REPORT_PATH)" ]; then \
exit 0; \
fi; \
if type -t dot >&/dev/null; then \
REPORT_IMAGE="$(BUILDDIR)/$@.png"; \
REPORT_IMAGE="$(REPORTDIR)/$(@F).png"; \
report-targets < "$(REPORT_PATH)" \
| dot -Tpng -o "$$REPORT_IMAGE" \
&& echo "** target graph report: $$REPORT_IMAGE"; \
......
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