product-graph.mk revision 8b46e302e6ed30e72ece1680767d00fc4241f2d5
1# 2# Copyright (C) 2009 The Android Open Source Project 3# 4# Licensed under the Apache License, Version 2.0 (the "License"); 5# you may not use this file except in compliance with the License. 6# You may obtain a copy of the License at 7# 8# http://www.apache.org/licenses/LICENSE-2.0 9# 10# Unless required by applicable law or agreed to in writing, software 11# distributed under the License is distributed on an "AS IS" BASIS, 12# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13# See the License for the specific language governing permissions and 14# limitations under the License. 15# 16 17products_pdf := $(OUT_DIR)/products.pdf 18products_graph := $(products_pdf:%.pdf=%.dot) 19ifeq ($(strip $(ANDROID_PRODUCT_GRAPH)),) 20products_list := $(INTERNAL_PRODUCT) 21else 22ifeq ($(strip $(ANDROID_PRODUCT_GRAPH)),--all) 23products_list := --all 24else 25products_list := $(foreach prod,$(ANDROID_PRODUCT_GRAPH),$(call resolve-short-product-name,$(prod))) 26endif 27endif 28 29$(products_graph): PRIVATE_PRODUCTS := $(products_list) 30 31$(products_graph): 32 @echo Product graph DOT: $@ for $(PRIVATE_PRODUCTS) 33 $(hide) ( \ 34 echo 'digraph {'; \ 35 echo 'graph [ ratio=.5 ];'; \ 36 $(foreach p,$(ALL_PRODUCTS), \ 37 $(foreach d,$(PRODUCTS.$(strip $(p)).INHERITS_FROM), \ 38 echo \"$(d)\" -\> \"$(p)\";)) \ 39 $(foreach prod, \ 40 $(sort $(foreach p,$(ALL_PRODUCTS), \ 41 $(foreach d,$(PRODUCTS.$(strip $(p)).INHERITS_FROM), $(d))) \ 42 $(foreach p,$(ALL_PRODUCTS),$(p))), \ 43 echo \"$(prod)\" [ \ 44 label=\"$(dir $(prod))\\n$(notdir $(prod))\\n\\n$(PRODUCTS.$(strip $(prod)).PRODUCT_MODEL)\\n$(PRODUCTS.$(strip $(prod)).PRODUCT_DEVICE)\" \ 45 $(if $(filter $(prod),$(PRIVATE_PRODUCTS)), \ 46 style=\"filled\" fillcolor=\"#FFFDB0\",) \ 47 ];) \ 48 echo '}' \ 49 ) \ 50 | ./build/tools/filter-product-graph.py $(PRIVATE_PRODUCTS) \ 51 > $@ 52 53# This rule doesn't include any nodes that don't inherit from 54# anything or don't have anything inherit from them, to make the 55# graph more readable. To add that, add this line to the rule 56# below: 57# $(foreach p,$(ALL_PRODUCTS), echo \"$(p)\";) \ 58 59$(products_pdf): $(products_graph) 60 @echo Product graph PDF: $@ 61 dot -Tpdf -Nshape=box -o $@ $< 62 63product-graph: $(products_pdf) 64 65