From 931d23e86cd1d8f058272b8e30000aaccf323951 Mon Sep 17 00:00:00 2001 From: Michael Shigorin Date: Mon, 9 Apr 2012 14:40:42 +0300 Subject: [PATCH] reports.mk: handle missing gra{phviz,cefully} If there's no dot(1) then its input file should just be stored; thanks glebfm@ for reminding about this. --- reports.mk | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/reports.mk b/reports.mk index 5778f086..44fc2430 100644 --- a/reports.mk +++ b/reports.mk @@ -3,12 +3,17 @@ all: reports/targets reports/targets: - @if [ -n "$$REPORT_PATH" -a -s "$$REPORT_PATH" ]; then \ - BUILDDIR="`sed -n 's/^.* BUILDDIR = \(.*\)/\1/p' \ - "$$REPORT_PATH"`"; \ + @if ! [ -n "$$REPORT_PATH" -a -s "$$REPORT_PATH" ]; then \ + exit 0; \ + fi; \ + BUILDDIR="`sed -n 's/^.* BUILDDIR = \(.*\)/\1/p' "$$REPORT_PATH"`"; \ + if type -t dot >&/dev/null; then \ REPORT_IMAGE="$$BUILDDIR/targets.png"; \ report-targets < "$$REPORT_PATH" \ | dot -Tpng -o "$$REPORT_IMAGE" \ - && echo "** target graph report: $$REPORT_IMAGE" \ - && mv "$$REPORT_PATH" "$$BUILDDIR/targets.log"; \ - fi + && echo "** target graph report: $$REPORT_IMAGE"; \ + else \ + REPORT_DOT="$$BUILDDIR/targets.dot"; \ + report-targets < "$$REPORT_PATH" > "$$REPORT_DOT" \ + && echo "** graphviz missing, target graph dot file: $$REPORT_DOT"; \ + fi && mv "$$REPORT_PATH" "$$BUILDDIR/targets.log"