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.
This commit is contained in:
Michael Shigorin 2012-04-09 14:40:42 +03:00
parent 6fee43e9cb
commit 931d23e86c

View File

@ -3,12 +3,17 @@
all: reports/targets all: reports/targets
reports/targets: reports/targets:
@if [ -n "$$REPORT_PATH" -a -s "$$REPORT_PATH" ]; then \ @if ! [ -n "$$REPORT_PATH" -a -s "$$REPORT_PATH" ]; then \
BUILDDIR="`sed -n 's/^.* BUILDDIR = \(.*\)/\1/p' \ exit 0; \
"$$REPORT_PATH"`"; \ fi; \
BUILDDIR="`sed -n 's/^.* BUILDDIR = \(.*\)/\1/p' "$$REPORT_PATH"`"; \
if type -t dot >&/dev/null; then \
REPORT_IMAGE="$$BUILDDIR/targets.png"; \ REPORT_IMAGE="$$BUILDDIR/targets.png"; \
report-targets < "$$REPORT_PATH" \ report-targets < "$$REPORT_PATH" \
| dot -Tpng -o "$$REPORT_IMAGE" \ | dot -Tpng -o "$$REPORT_IMAGE" \
&& echo "** target graph report: $$REPORT_IMAGE" \ && echo "** target graph report: $$REPORT_IMAGE"; \
&& mv "$$REPORT_PATH" "$$BUILDDIR/targets.log"; \ else \
fi 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"