454e7162f3
It's hard to tell a successful build from a failed one if downstream hides the exit code; it's useless to continue a `for' loop if a pipe shoves that to a subshell; well it seems that a bashism is worth a thousand quirks with extra fds here. Minor regexp enhancements are also due. reports.mk made a bit more resilient/prudent either.
58 lines
1.5 KiB
Makefile
58 lines
1.5 KiB
Makefile
# collect what's left
|
|
|
|
ifneq (,$(REPORT))
|
|
|
|
include lib/common.mk
|
|
|
|
BUILDDIR := $(shell sed -n 's/^.* BUILDDIR = \(.*\)/\1/p' "$(REPORT_PATH)")
|
|
BUILDLOG := $(BUILDDIR)/$(BUILD_LOG)
|
|
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
|
|
# contained reports as these are very ephemeral between builds
|
|
ifneq (1,$(NUM_TARGETS))
|
|
SHORTEN := >/dev/null
|
|
endif
|
|
|
|
all: reports/targets reports/scripts
|
|
@if [ -n "$(IMAGE_OUTPATH)" ]; then \
|
|
cp -a $(REPORTDIR) $(IMAGE_OUTPATH).reports; \
|
|
fi
|
|
|
|
reports/prep:
|
|
@mkdir -p "$(REPORTDIR)"
|
|
|
|
reports/scripts: reports/prep
|
|
@OUT="$(REPORTDIR)/$(@F).log"; \
|
|
grep "^mki.*scripts: Run: " $(BUILDLOG) \
|
|
| sed -rn "s,^.*($(BUILDDIR)|$(SYMLINK))/(.*)'$$,\2,p" > "$$OUT" \
|
|
&& if [ -s "$$OUT" ]; then \
|
|
echo "** scripts report: $$OUT" $(SHORTEN); \
|
|
fi
|
|
|
|
reports/targets: reports/prep
|
|
@if ! [ -n "$(REPORT_PATH)" -a -s "$(REPORT_PATH)" ]; then \
|
|
exit 0; \
|
|
fi; \
|
|
if type -t dot >&/dev/null; then \
|
|
OUT="$(REPORTDIR)/$(@F).png"; \
|
|
report-targets < "$(REPORT_PATH)" \
|
|
| dot -Tpng -o "$$OUT" \
|
|
&& if [ -s "$$OUT" ]; then \
|
|
echo "** target graph report: $$OUT"; \
|
|
fi; \
|
|
else \
|
|
OUT="$(BUILDDIR)/targets.dot"; \
|
|
report-targets < "$(REPORT_PATH)" > "$$OUT" \
|
|
&& if [ -s "$$OUT" ]; then \
|
|
echo "** graphviz missing, " \
|
|
"target graph dot file: $$OUT"; \
|
|
fi; \
|
|
fi $(SHORTEN); \
|
|
mv "$(REPORT_PATH)" "$(REPORTDIR)/$(@F).log"
|
|
|
|
else
|
|
all:; @:
|
|
endif
|