summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYann E. MORIN <yann.morin.1998@free.fr>2013-12-28 17:39:13 (GMT)
committer Thomas Petazzoni <thomas.petazzoni@free-electrons.com>2013-12-29 11:13:25 (GMT)
commitf1fedbb246ae90bf30e4342202b11bc3030d9ca7 (patch)
tree93367bed426d13533a6ce51d9b3d60e15e99650d
parent0cfe3ab88c6e1410ca719801147b1ba566c86d0d (diff)
downloadbuildroot-f1fedbb246ae90bf30e4342202b11bc3030d9ca7.tar.gz
buildroot-f1fedbb246ae90bf30e4342202b11bc3030d9ca7.tar.bz2
graphs: support generating png graphs
PDF files can not be easily embedded in other documents (eg. ODT, or HTML). Add support for generating PNG graphs, by setting the GRAPH_OUT=pdf|png on the command line: make GRAPH_OUT=png graph-build graph-depends The default is still to generate PDF graphs. Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr> Cc: Thomas Petazzoni <thomas.petazzoni@free-electrons.com> Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
-rw-r--r--Makefile9
-rw-r--r--docs/manual/common-usage.txt2
-rw-r--r--package/pkg-generic.mk2
-rwxr-xr-xsupport/scripts/graph-build-time3
4 files changed, 10 insertions, 6 deletions
diff --git a/Makefile b/Makefile
index 8107865..4320e7b 100644
--- a/Makefile
+++ b/Makefile
@@ -121,6 +121,9 @@ else
$(shell echo BR2_EXTERNAL ?= $(BR2_EXTERNAL) > $(BR2_EXTERNAL_FILE))
endif
+# Need that early, before we scan packages
+# Avoids doing the $(or...) everytime
+BR2_GRAPH_OUT := $(or $(GRAPH_OUT),pdf)
BUILD_DIR:=$(BASE_DIR)/build
STAMP_DIR:=$(BASE_DIR)/stamps
@@ -635,17 +638,17 @@ graph-build: $(O)/build/build-time.log
@install -d $(O)/graphs
$(foreach o,name build duration,./support/scripts/graph-build-time \
--type=histogram --order=$(o) --input=$(<) \
- --output=$(O)/graphs/build.hist-$(o).pdf \
+ --output=$(O)/graphs/build.hist-$(o).$(BR2_GRAPH_OUT) \
$(if $(GRAPH_ALT),--alternate-colors)$(sep))
$(foreach t,packages steps,./support/scripts/graph-build-time \
--type=pie-$(t) --input=$(<) \
- --output=$(O)/graphs/build.pie-$(t).pdf \
+ --output=$(O)/graphs/build.pie-$(t).$(BR2_GRAPH_OUT) \
$(if $(GRAPH_ALT),--alternate-colors)$(sep))
graph-depends:
@$(INSTALL) -d $(O)/graphs
@./support/scripts/graph-depends \
- |dot -Tpdf -o $(O)/graphs/$(@).pdf
+ |dot -T$(BR2_GRAPH_OUT) -o $(O)/graphs/$(@).$(BR2_GRAPH_OUT)
else # ifeq ($(BR2_HAVE_DOT_CONFIG),y)
diff --git a/docs/manual/common-usage.txt b/docs/manual/common-usage.txt
index 7c76942..c7e4568 100644
--- a/docs/manual/common-usage.txt
+++ b/docs/manual/common-usage.txt
@@ -88,6 +88,8 @@ to +make+ or set in the environment:
is the recommended way of setting it.
* +GRAPH_ALT+, if set and non-empty, to use an alternate color-scheme in
build-time graphs
+* +GRAPH_OUT+ to set the filetype of generated graphs, either +pdf+ (the
+ default), or +png+.
An example that uses config files located in the toplevel directory and
in your $HOME:
diff --git a/package/pkg-generic.mk b/package/pkg-generic.mk
index 8005ce9..b519d69 100644
--- a/package/pkg-generic.mk
+++ b/package/pkg-generic.mk
@@ -471,7 +471,7 @@ $(1)-show-depends:
$(1)-graph-depends:
@$(INSTALL) -d $(O)/graphs
@./support/scripts/graph-depends $(1) \
- |dot -Tpdf -o $(O)/graphs/$$(@).pdf
+ |dot -T$(BR2_GRAPH_OUT) -o $(O)/graphs/$$(@).$(BR2_GRAPH_OUT)
$(1)-dirclean: $$($(2)_TARGET_DIRCLEAN)
diff --git a/support/scripts/graph-build-time b/support/scripts/graph-build-time
index 2216db2..00c2349 100755
--- a/support/scripts/graph-build-time
+++ b/support/scripts/graph-build-time
@@ -51,7 +51,6 @@
import matplotlib
import numpy
-matplotlib.use('PDF')
import matplotlib.pyplot as plt
import matplotlib.font_manager as fm
@@ -264,7 +263,7 @@ parser.add_argument("--alternate-colors", '-c', action="store_true",
parser.add_argument("--input", '-i', metavar="OUTPUT",
help="Input file (usually $(O)/build/build-time.log)")
parser.add_argument("--output", '-o', metavar="OUTPUT", required=True,
- help="Output file (PDF extension)")
+ help="Output file (.pdf or .png extension)")
args = parser.parse_args()
d = read_data(args.input)