The Android Open Source Project | 6a5f7f0 | 2009-03-05 14:34:30 -0800 | [diff] [blame] | 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 | |
Joe Onorato | 8815542 | 2012-07-23 13:51:44 -0700 | [diff] [blame] | 17 | # the foreach and the if remove the single space entries that creep in because of the evals |
| 18 | define gather-all-products |
| 19 | $(sort $(foreach p, \ |
| 20 | $(eval _all_products_visited := ) |
| 21 | $(call all-products-inner, $(ALL_PRODUCTS)) \ |
| 22 | , $(if $(strip $(p)),$(strip $(p)),)) \ |
| 23 | ) |
| 24 | endef |
| 25 | |
| 26 | define all-products-inner |
| 27 | $(foreach p,$(1),\ |
| 28 | $(if $(filter $(p),$(_all_products_visited)),, \ |
| 29 | $(p) \ |
| 30 | $(eval _all_products_visited += $(p)) \ |
| 31 | $(call all-products-inner, $(PRODUCTS.$(strip $(p)).INHERITS_FROM)) |
| 32 | ) \ |
| 33 | ) |
| 34 | endef |
| 35 | |
| 36 | |
Ying Wang | 67132ba | 2015-10-28 16:42:39 -0700 | [diff] [blame] | 37 | this_makefile := build/core/product-graph.mk |
Joe Onorato | 8815542 | 2012-07-23 13:51:44 -0700 | [diff] [blame] | 38 | |
| 39 | products_svg := $(OUT_DIR)/products.svg |
The Android Open Source Project | 6a5f7f0 | 2009-03-05 14:34:30 -0800 | [diff] [blame] | 40 | products_pdf := $(OUT_DIR)/products.pdf |
Joe Onorato | 8815542 | 2012-07-23 13:51:44 -0700 | [diff] [blame] | 41 | products_graph := $(OUT_DIR)/products.dot |
Joe Onorato | 8b46e30 | 2012-05-07 17:15:15 -0700 | [diff] [blame] | 42 | ifeq ($(strip $(ANDROID_PRODUCT_GRAPH)),) |
| 43 | products_list := $(INTERNAL_PRODUCT) |
| 44 | else |
| 45 | ifeq ($(strip $(ANDROID_PRODUCT_GRAPH)),--all) |
| 46 | products_list := --all |
| 47 | else |
| 48 | products_list := $(foreach prod,$(ANDROID_PRODUCT_GRAPH),$(call resolve-short-product-name,$(prod))) |
| 49 | endif |
| 50 | endif |
| 51 | |
Joe Onorato | 8815542 | 2012-07-23 13:51:44 -0700 | [diff] [blame] | 52 | really_all_products := $(call gather-all-products) |
The Android Open Source Project | 6a5f7f0 | 2009-03-05 14:34:30 -0800 | [diff] [blame] | 53 | |
Ying Wang | 3670c84 | 2013-08-01 17:45:35 -0700 | [diff] [blame] | 54 | open_parethesis := ( |
| 55 | close_parenthesis := ) |
| 56 | |
| 57 | # Emit properties of a product node to a file. |
| 58 | # $(1) the product |
| 59 | # $(2) the output file |
| 60 | define emit-product-node-props |
| 61 | $(hide) echo \"$(1)\" [ \ |
| 62 | 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)\" \ |
| 63 | $(if $(filter $(1),$(PRIVATE_PRODUCTS_FILTER)), style=\"filled\" fillcolor=\"#FFFDB0\",) \ |
Marcos Marado | a69822c | 2014-10-22 14:19:34 +0100 | [diff] [blame] | 64 | colorscheme=\"svg\" fontcolor=\"darkblue\" href=\"products/$(1).html\" \ |
Ying Wang | 3670c84 | 2013-08-01 17:45:35 -0700 | [diff] [blame] | 65 | ] >> $(2) |
| 66 | |
| 67 | endef |
| 68 | |
Joe Onorato | 8815542 | 2012-07-23 13:51:44 -0700 | [diff] [blame] | 69 | $(products_graph): PRIVATE_PRODUCTS := $(really_all_products) |
| 70 | $(products_graph): PRIVATE_PRODUCTS_FILTER := $(products_list) |
| 71 | |
| 72 | $(products_graph): $(this_makefile) |
| 73 | @echo Product graph DOT: $@ for $(PRIVATE_PRODUCTS_FILTER) |
Ying Wang | 3670c84 | 2013-08-01 17:45:35 -0700 | [diff] [blame] | 74 | $(hide) echo 'digraph {' > $@.in |
| 75 | $(hide) echo 'graph [ ratio=.5 ];' >> $@.in |
| 76 | $(hide) $(foreach p,$(PRIVATE_PRODUCTS), \ |
| 77 | $(foreach d,$(PRODUCTS.$(strip $(p)).INHERITS_FROM), echo \"$(d)\" -\> \"$(p)\" >> $@.in;)) |
| 78 | $(foreach p,$(PRIVATE_PRODUCTS),$(call emit-product-node-props,$(p),$@.in)) |
| 79 | $(hide) echo '}' >> $@.in |
| 80 | $(hide) ./build/tools/filter-product-graph.py $(PRIVATE_PRODUCTS_FILTER) < $@.in > $@ |
Joe Onorato | 3366c07 | 2009-08-08 12:14:37 -0700 | [diff] [blame] | 81 | |
Joe Onorato | 8815542 | 2012-07-23 13:51:44 -0700 | [diff] [blame] | 82 | # Evaluates to the name of the product file |
| 83 | # $(1) product file |
| 84 | define product-debug-filename |
| 85 | $(OUT_DIR)/products/$(strip $(1)).html |
| 86 | endef |
| 87 | |
| 88 | # Makes a rule for the product debug info |
| 89 | # $(1) product file |
| 90 | define transform-product-debug |
| 91 | $(OUT_DIR)/products/$(strip $(1)).txt: $(this_makefile) |
| 92 | @echo Product debug info file: $$@ |
| 93 | $(hide) rm -f $$@ |
| 94 | $(hide) mkdir -p $$(dir $$@) |
| 95 | $(hide) echo 'FILE=$(strip $(1))' >> $$@ |
| 96 | $(hide) echo 'PRODUCT_NAME=$$(PRODUCTS.$(strip $(1)).PRODUCT_NAME)' >> $$@ |
| 97 | $(hide) echo 'PRODUCT_MODEL=$$(PRODUCTS.$(strip $(1)).PRODUCT_MODEL)' >> $$@ |
| 98 | $(hide) echo 'PRODUCT_LOCALES=$$(PRODUCTS.$(strip $(1)).PRODUCT_LOCALES)' >> $$@ |
| 99 | $(hide) echo 'PRODUCT_AAPT_CONFIG=$$(PRODUCTS.$(strip $(1)).PRODUCT_AAPT_CONFIG)' >> $$@ |
| 100 | $(hide) echo 'PRODUCT_AAPT_PREF_CONFIG=$$(PRODUCTS.$(strip $(1)).PRODUCT_AAPT_PREF_CONFIG)' >> $$@ |
| 101 | $(hide) echo 'PRODUCT_PACKAGES=$$(PRODUCTS.$(strip $(1)).PRODUCT_PACKAGES)' >> $$@ |
| 102 | $(hide) echo 'PRODUCT_DEVICE=$$(PRODUCTS.$(strip $(1)).PRODUCT_DEVICE)' >> $$@ |
| 103 | $(hide) echo 'PRODUCT_MANUFACTURER=$$(PRODUCTS.$(strip $(1)).PRODUCT_MANUFACTURER)' >> $$@ |
| 104 | $(hide) echo 'PRODUCT_PROPERTY_OVERRIDES=$$(PRODUCTS.$(strip $(1)).PRODUCT_PROPERTY_OVERRIDES)' >> $$@ |
| 105 | $(hide) echo 'PRODUCT_DEFAULT_PROPERTY_OVERRIDES=$$(PRODUCTS.$(strip $(1)).PRODUCT_DEFAULT_PROPERTY_OVERRIDES)' >> $$@ |
| 106 | $(hide) echo 'PRODUCT_CHARACTERISTICS=$$(PRODUCTS.$(strip $(1)).PRODUCT_CHARACTERISTICS)' >> $$@ |
| 107 | $(hide) echo 'PRODUCT_COPY_FILES=$$(PRODUCTS.$(strip $(1)).PRODUCT_COPY_FILES)' >> $$@ |
| 108 | $(hide) echo 'PRODUCT_OTA_PUBLIC_KEYS=$$(PRODUCTS.$(strip $(1)).PRODUCT_OTA_PUBLIC_KEYS)' >> $$@ |
| 109 | $(hide) echo 'PRODUCT_EXTRA_RECOVERY_KEYS=$$(PRODUCTS.$(strip $(1)).PRODUCT_EXTRA_RECOVERY_KEYS)' >> $$@ |
| 110 | $(hide) echo 'PRODUCT_PACKAGE_OVERLAYS=$$(PRODUCTS.$(strip $(1)).PRODUCT_PACKAGE_OVERLAYS)' >> $$@ |
| 111 | $(hide) echo 'DEVICE_PACKAGE_OVERLAYS=$$(PRODUCTS.$(strip $(1)).DEVICE_PACKAGE_OVERLAYS)' >> $$@ |
Joe Onorato | 8815542 | 2012-07-23 13:51:44 -0700 | [diff] [blame] | 112 | $(hide) echo 'PRODUCT_SDK_ADDON_NAME=$$(PRODUCTS.$(strip $(1)).PRODUCT_SDK_ADDON_NAME)' >> $$@ |
| 113 | $(hide) echo 'PRODUCT_SDK_ADDON_COPY_FILES=$$(PRODUCTS.$(strip $(1)).PRODUCT_SDK_ADDON_COPY_FILES)' >> $$@ |
| 114 | $(hide) echo 'PRODUCT_SDK_ADDON_COPY_MODULES=$$(PRODUCTS.$(strip $(1)).PRODUCT_SDK_ADDON_COPY_MODULES)' >> $$@ |
| 115 | $(hide) echo 'PRODUCT_SDK_ADDON_DOC_MODULES=$$(PRODUCTS.$(strip $(1)).PRODUCT_SDK_ADDON_DOC_MODULES)' >> $$@ |
| 116 | $(hide) echo 'PRODUCT_DEFAULT_WIFI_CHANNELS=$$(PRODUCTS.$(strip $(1)).PRODUCT_DEFAULT_WIFI_CHANNELS)' >> $$@ |
| 117 | $(hide) echo 'PRODUCT_DEFAULT_DEV_CERTIFICATE=$$(PRODUCTS.$(strip $(1)).PRODUCT_DEFAULT_DEV_CERTIFICATE)' >> $$@ |
| 118 | $(hide) echo 'PRODUCT_RESTRICT_VENDOR_FILES=$$(PRODUCTS.$(strip $(1)).PRODUCT_RESTRICT_VENDOR_FILES)' >> $$@ |
Joe Onorato | 8815542 | 2012-07-23 13:51:44 -0700 | [diff] [blame] | 119 | $(hide) echo 'PRODUCT_VENDOR_KERNEL_HEADERS=$$(PRODUCTS.$(strip $(1)).PRODUCT_VENDOR_KERNEL_HEADERS)' >> $$@ |
| 120 | |
| 121 | $(call product-debug-filename, $(p)): \ |
| 122 | $(OUT_DIR)/products/$(strip $(1)).txt \ |
| 123 | build/tools/product_debug.py \ |
| 124 | $(this_makefile) |
| 125 | @echo Product debug html file: $$@ |
| 126 | $(hide) mkdir -p $$(dir $$@) |
| 127 | $(hide) cat $$< | build/tools/product_debug.py > $$@ |
| 128 | endef |
| 129 | |
| 130 | product_debug_files:= |
| 131 | $(foreach p,$(really_all_products), \ |
| 132 | $(eval $(call transform-product-debug, $(p))) \ |
| 133 | $(eval product_debug_files += $(call product-debug-filename, $(p))) \ |
| 134 | ) |
The Android Open Source Project | 6a5f7f0 | 2009-03-05 14:34:30 -0800 | [diff] [blame] | 135 | |
Joe Onorato | 3366c07 | 2009-08-08 12:14:37 -0700 | [diff] [blame] | 136 | $(products_pdf): $(products_graph) |
| 137 | @echo Product graph PDF: $@ |
| 138 | dot -Tpdf -Nshape=box -o $@ $< |
The Android Open Source Project | 6a5f7f0 | 2009-03-05 14:34:30 -0800 | [diff] [blame] | 139 | |
Joe Onorato | 8815542 | 2012-07-23 13:51:44 -0700 | [diff] [blame] | 140 | $(products_svg): $(products_graph) $(product_debug_files) |
| 141 | @echo Product graph SVG: $@ |
| 142 | dot -Tsvg -Nshape=box -o $@ $< |
| 143 | |
| 144 | product-graph: $(products_pdf) $(products_svg) |