blob: 74ea3ff9834da09f227569ff4f03a6562d857066 [file] [log] [blame]
Ying Wang08800fd2016-03-03 20:57:21 -08001
2# List of variables we want to print in the build banner.
3print_build_config_vars := \
4 PLATFORM_VERSION_CODENAME \
5 PLATFORM_VERSION \
6 TARGET_PRODUCT \
7 TARGET_BUILD_VARIANT \
8 TARGET_BUILD_TYPE \
9 TARGET_BUILD_APPS \
10 TARGET_ARCH \
11 TARGET_ARCH_VARIANT \
12 TARGET_CPU_VARIANT \
13 TARGET_2ND_ARCH \
14 TARGET_2ND_ARCH_VARIANT \
15 TARGET_2ND_CPU_VARIANT \
16 HOST_ARCH \
17 HOST_2ND_ARCH \
18 HOST_OS \
19 HOST_OS_EXTRA \
20 HOST_CROSS_OS \
21 HOST_CROSS_ARCH \
22 HOST_CROSS_2ND_ARCH \
23 HOST_BUILD_TYPE \
24 BUILD_ID \
Alexey Polyudovccdc3112016-08-01 17:41:49 -070025 OUT_DIR \
26 AUX_OS_VARIANT_LIST
Ying Wang08800fd2016-03-03 20:57:21 -080027
28ifeq ($(TARGET_BUILD_PDK),true)
29print_build_config_vars += \
30 TARGET_BUILD_PDK \
31 PDK_FUSION_PLATFORM_ZIP
32endif
33
Bruce Beareb73dc662010-07-12 07:53:28 -070034# ---------------------------------------------------------------
35# the setpath shell function in envsetup.sh uses this to figure out
36# what to add to the path given the config we have chosen.
37ifeq ($(CALLED_FROM_SETUP),true)
38
Dan Willemsen60d9c672016-05-27 15:15:47 -070039ifneq ($(filter /%,$(SOONG_HOST_OUT_EXECUTABLES)),)
40ABP := $(SOONG_HOST_OUT_EXECUTABLES)
Jean-Baptiste Queruffe03c92011-12-06 10:29:46 -080041else
Dan Willemsen60d9c672016-05-27 15:15:47 -070042ABP := $(PWD)/$(SOONG_HOST_OUT_EXECUTABLES)
43endif
44ifneq ($(filter /%,$(HOST_OUT_EXECUTABLES)),)
45ABP := $(ABP):$(HOST_OUT_EXECUTABLES)
46else
47ABP := $(ABP):$(PWD)/$(HOST_OUT_EXECUTABLES)
Jean-Baptiste Queruffe03c92011-12-06 10:29:46 -080048endif
Bruce Beareb73dc662010-07-12 07:53:28 -070049
Bruce Beareb73dc662010-07-12 07:53:28 -070050ANDROID_BUILD_PATHS := $(ABP)
51ANDROID_PREBUILTS := prebuilt/$(HOST_PREBUILT_TAG)
Jing Yuf5172c72012-03-29 20:45:50 -070052ANDROID_GCC_PREBUILTS := prebuilts/gcc/$(HOST_PREBUILT_TAG)
Bruce Beareb73dc662010-07-12 07:53:28 -070053
54# The "dumpvar" stuff lets you say something like
55#
56# CALLED_FROM_SETUP=true \
57# make -f config/envsetup.make dumpvar-TARGET_OUT
58# or
59# CALLED_FROM_SETUP=true \
60# make -f config/envsetup.make dumpvar-abs-HOST_OUT_EXECUTABLES
61#
62# The plain (non-abs) version just dumps the value of the named variable.
63# The "abs" version will treat the variable as a path, and dumps an
64# absolute path to it.
65#
66dumpvar_goals := \
67 $(strip $(patsubst dumpvar-%,%,$(filter dumpvar-%,$(MAKECMDGOALS))))
68ifdef dumpvar_goals
69
70 ifneq ($(words $(dumpvar_goals)),1)
71 $(error Only one "dumpvar-" goal allowed. Saw "$(MAKECMDGOALS)")
72 endif
73
74 # If the goal is of the form "dumpvar-abs-VARNAME", then
75 # treat VARNAME as a path and return the absolute path to it.
76 absolute_dumpvar := $(strip $(filter abs-%,$(dumpvar_goals)))
77 ifdef absolute_dumpvar
78 dumpvar_goals := $(patsubst abs-%,%,$(dumpvar_goals))
Ying Wang80ceadc2016-03-07 11:27:20 -080079 DUMPVAR_VALUE := $(abspath $($(dumpvar_goals)))
Bruce Beareb73dc662010-07-12 07:53:28 -070080 dumpvar_target := dumpvar-abs-$(dumpvar_goals)
81 else
82 DUMPVAR_VALUE := $($(dumpvar_goals))
83 dumpvar_target := dumpvar-$(dumpvar_goals)
84 endif
85
86.PHONY: $(dumpvar_target)
87$(dumpvar_target):
88 @echo $(DUMPVAR_VALUE)
89
90endif # dumpvar_goals
91
92ifneq ($(dumpvar_goals),report_config)
93PRINT_BUILD_CONFIG:=
94endif
95
Ying Wang08800fd2016-03-03 20:57:21 -080096ifneq ($(filter report_config,$(DUMP_MANY_VARS)),)
97# Construct the shell commands that print the config banner.
98report_config_sh := echo '============================================';
99report_config_sh += $(foreach v,$(print_build_config_vars),echo '$v=$($(v))';)
100report_config_sh += echo '============================================';
Colin Cross6b66fcf2016-01-26 15:59:50 -0800101endif
102
Ying Wang08800fd2016-03-03 20:57:21 -0800103# Dump mulitple variables to "<var>=<value>" pairs, one per line.
104# The output may be executed as bash script.
105# Input variables:
106# DUMP_MANY_VARS: the list of variable names.
107# DUMP_VAR_PREFIX: an optional prefix of the variable name added to the output.
108# DUMP_MANY_ABS_VARS: the list of abs variable names.
109# DUMP_ABS_VAR_PREFIX: an optional prefix of the abs variable name added to the output.
110.PHONY: dump-many-vars
111dump-many-vars :
112 @$(foreach v, $(filter-out report_config, $(DUMP_MANY_VARS)),\
113 echo "$(DUMP_VAR_PREFIX)$(v)='$($(v))'";)
114ifneq ($(filter report_config, $(DUMP_MANY_VARS)),)
115 @# Construct a special variable for report_config.
116 @# Escape \` to defer the execution of report_config_sh to preserve the line breaks.
117 @echo "$(DUMP_VAR_PREFIX)report_config=\`$(report_config_sh)\`"
118endif
119 @$(foreach v, $(sort $(DUMP_MANY_ABS_VARS)),\
Ying Wang80ceadc2016-03-07 11:27:20 -0800120 echo "$(DUMP_ABS_VAR_PREFIX)$(v)='$(abspath $($(v)))'";)
Ying Wang08800fd2016-03-03 20:57:21 -0800121
122endif # CALLED_FROM_SETUP
123
124ifneq ($(PRINT_BUILD_CONFIG),)
125$(info ============================================)
126$(foreach v, $(print_build_config_vars),\
127 $(info $v=$($(v))))
Bruce Beareb73dc662010-07-12 07:53:28 -0700128$(info ============================================)
129endif