From 3670c8449a721a987f72c170a123830f0dfcbda5 Mon Sep 17 00:00:00 2001 From: Ying Wang Date: Thu, 1 Aug 2013 17:45:35 -0700 Subject: [PATCH] Split the product-graph build commands 1) As more product configuration files are added to the source tree, the command line has become too long. 2) Escape "(" and ")" that may may appear in PRODUCT_MODEL. Change-Id: I08f278dce434050f013498327c7cbf3592512460 --- core/tasks/product-graph.mk | 38 ++++++++++++++++++++++---------------- 1 file changed, 22 insertions(+), 16 deletions(-) diff --git a/core/tasks/product-graph.mk b/core/tasks/product-graph.mk index 1ccb20bf9..fcec27775 100644 --- a/core/tasks/product-graph.mk +++ b/core/tasks/product-graph.mk @@ -51,26 +51,33 @@ endif really_all_products := $(call gather-all-products) +open_parethesis := ( +close_parenthesis := ) + +# Emit properties of a product node to a file. +# $(1) the product +# $(2) the output file +define emit-product-node-props +$(hide) echo \"$(1)\" [ \ +label=\"$(dir $(1))\\n$(notdir $(1))\\n\\n$(subst $(close_parenthesis),,$(subst $(open_parethesis),,$(PRODUCTS.$(strip $(1)).PRODUCT_MODEL)))\\n$(PRODUCTS.$(strip $(1)).PRODUCT_DEVICE)\" \ +$(if $(filter $(1),$(PRIVATE_PRODUCTS_FILTER)), style=\"filled\" fillcolor=\"#FFFDB0\",) \ +fontcolor=\"darkblue\" href=\"products/$(1).html\" \ +] >> $(2) + +endef + $(products_graph): PRIVATE_PRODUCTS := $(really_all_products) $(products_graph): PRIVATE_PRODUCTS_FILTER := $(products_list) $(products_graph): $(this_makefile) @echo Product graph DOT: $@ for $(PRIVATE_PRODUCTS_FILTER) - $(hide) ( \ - echo 'digraph {'; \ - echo 'graph [ ratio=.5 ];'; \ - $(foreach p,$(PRIVATE_PRODUCTS), \ - $(foreach d,$(PRODUCTS.$(strip $(p)).INHERITS_FROM), echo \"$(d)\" -\> \"$(p)\";)) \ - $(foreach prod, $(PRIVATE_PRODUCTS), \ - echo \"$(prod)\" [ \ - label=\"$(dir $(prod))\\n$(notdir $(prod))\\n\\n$(PRODUCTS.$(strip $(prod)).PRODUCT_MODEL)\\n$(PRODUCTS.$(strip $(prod)).PRODUCT_DEVICE)\" \ - $(if $(filter $(prod),$(PRIVATE_PRODUCTS_FILTER)), style=\"filled\" fillcolor=\"#FFFDB0\",) \ - fontcolor=\"darkblue\" href=\"products/$(prod).html\" \ - ];) \ - echo '}' \ - ) \ - | ./build/tools/filter-product-graph.py $(PRIVATE_PRODUCTS_FILTER) \ - > $@ + $(hide) echo 'digraph {' > $@.in + $(hide) echo 'graph [ ratio=.5 ];' >> $@.in + $(hide) $(foreach p,$(PRIVATE_PRODUCTS), \ + $(foreach d,$(PRODUCTS.$(strip $(p)).INHERITS_FROM), echo \"$(d)\" -\> \"$(p)\" >> $@.in;)) + $(foreach p,$(PRIVATE_PRODUCTS),$(call emit-product-node-props,$(p),$@.in)) + $(hide) echo '}' >> $@.in + $(hide) ./build/tools/filter-product-graph.py $(PRIVATE_PRODUCTS_FILTER) < $@.in > $@ # Evaluates to the name of the product file # $(1) product file @@ -137,4 +144,3 @@ $(products_svg): $(products_graph) $(product_debug_files) dot -Tsvg -Nshape=box -o $@ $< product-graph: $(products_pdf) $(products_svg) - -- 2.11.0