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