Skip to contentSkip to conversation

Makefile: test if dot exists before using it in graph-depends

PATCH New Thomas Petazzoni 2 participants 2 messages Jun 13, 2014 Kbuild

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Makefile: test if dot exists before using it in graph-depends

The 'graph-depends' logic uses the 'dot' program from Graphviz to draw the dependency graph, but it doesn't check its existence before starting the generation of the graph, which can lead to user confusion as reported in:

http://lists.busybox.net/pipermail/buildroot/2014-June/099278.html

With this commit, we first test if the 'dot' program is available, and if it's not, we error out with a clear error message:

$ make graph-depends
ERROR: The 'dot' program from Graphviz is needed for graph-depends
make: *** [graph-depends] Error 1
---
 Makefile | 2 ++
 1 file changed, 2 insertions(+)
Makefile +2 -0
index 5501068..db8fd15 100644
@@ -674,6 +674,8 @@ graph-build: $(O)/build/build-time.log
 				   $(if $(BR2_GRAPH_ALT),--alternate-colors)$(sep))
 
 graph-depends:
+	@dot -? >/dev/null 2>&1 || \
+		(echo "ERROR: The 'dot' program from Graphviz is needed for graph-depends"; exit 1)
 	@$(INSTALL) -d $(O)/graphs
 	@cd "$(CONFIG_DIR)"; \
 	$(TOPDIR)/support/scripts/graph-depends $(BR2_GRAPH_DEPS_OPTS) \
Signature · 1 line
2.0.0
#1 lore raw

PATCH 1/1 Makefile: test if dot exists before using it in graph-depends

Quoted 29 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Thomas" == Thomas Petazzoni <[email protected]> writes:

The 'graph-depends' logic uses the 'dot' program from Graphviz to draw the dependency graph, but it doesn't check its existence before starting the generation of the graph, which can lead to user confusion as reported in:

http://lists.busybox.net/pipermail/buildroot/2014-June/099278.html

With this commit, we first test if the 'dot' program is available, and if it's not, we error out with a clear error message:

$ make graph-depends
ERROR: The 'dot' program from Graphviz is needed for graph-depends
make: *** [graph-depends] Error 1
---
 Makefile | 2 ++
 1 file changed, 2 insertions(+)
Makefile +0 -0
index 5501068..db8fd15 100644

Makefile graph-build: $(O)/build/build-time.log · line 678

Quoted 5 lines
Makefile +2 -0
@@ -674,6 +674,8 @@ graph-build: $(O)/build/build-time.log
 				   $(if $(BR2_GRAPH_ALT),--alternate-colors)$(sep))
 
 graph-depends:
+	@dot -? >/dev/null 2>&1 || \
+		(echo "ERROR: The 'dot' program from Graphviz is needed for graph-depends"; exit 1)

Error messages should go to stderr, not stdout.

Committed with that fixed, thanks.

Signature · 1 line
Bye, Peter Korsgaard