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
This commit is contained in:
Ying Wang 2013-08-01 17:45:35 -07:00
parent 949c4eb073
commit 3670c8449a
1 changed files with 22 additions and 16 deletions

View File

@ -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)