blob: 4b3486ace2df5fefa6219c86ea52a6523a51077b [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 \
25 OUT_DIR
26
27ifeq ($(TARGET_BUILD_PDK),true)
28print_build_config_vars += \
29 TARGET_BUILD_PDK \
30 PDK_FUSION_PLATFORM_ZIP
31endif
32
Bruce Beareb73dc662010-07-12 07:53:28 -070033# ---------------------------------------------------------------
34# the setpath shell function in envsetup.sh uses this to figure out
35# what to add to the path given the config we have chosen.
36ifeq ($(CALLED_FROM_SETUP),true)
37
Dan Willemsen60d9c672016-05-27 15:15:47 -070038ifneq ($(filter /%,$(SOONG_HOST_OUT_EXECUTABLES)),)
39ABP := $(SOONG_HOST_OUT_EXECUTABLES)
Jean-Baptiste Queruffe03c92011-12-06 10:29:46 -080040else
Dan Willemsen60d9c672016-05-27 15:15:47 -070041ABP := $(PWD)/$(SOONG_HOST_OUT_EXECUTABLES)
42endif
43ifneq ($(filter /%,$(HOST_OUT_EXECUTABLES)),)
44ABP := $(ABP):$(HOST_OUT_EXECUTABLES)
45else
46ABP := $(ABP):$(PWD)/$(HOST_OUT_EXECUTABLES)
Jean-Baptiste Queruffe03c92011-12-06 10:29:46 -080047endif
Bruce Beareb73dc662010-07-12 07:53:28 -070048
Bruce Beareb73dc662010-07-12 07:53:28 -070049ANDROID_BUILD_PATHS := $(ABP)
50ANDROID_PREBUILTS := prebuilt/$(HOST_PREBUILT_TAG)
Jing Yuf5172c72012-03-29 20:45:50 -070051ANDROID_GCC_PREBUILTS := prebuilts/gcc/$(HOST_PREBUILT_TAG)
Bruce Beareb73dc662010-07-12 07:53:28 -070052
53# The "dumpvar" stuff lets you say something like
54#
55# CALLED_FROM_SETUP=true \
56# make -f config/envsetup.make dumpvar-TARGET_OUT
57# or
58# CALLED_FROM_SETUP=true \
59# make -f config/envsetup.make dumpvar-abs-HOST_OUT_EXECUTABLES
60#
61# The plain (non-abs) version just dumps the value of the named variable.
62# The "abs" version will treat the variable as a path, and dumps an
63# absolute path to it.
64#
65dumpvar_goals := \
66 $(strip $(patsubst dumpvar-%,%,$(filter dumpvar-%,$(MAKECMDGOALS))))
67ifdef dumpvar_goals
68
69 ifneq ($(words $(dumpvar_goals)),1)
70 $(error Only one "dumpvar-" goal allowed. Saw "$(MAKECMDGOALS)")
71 endif
72
73 # If the goal is of the form "dumpvar-abs-VARNAME", then
74 # treat VARNAME as a path and return the absolute path to it.
75 absolute_dumpvar := $(strip $(filter abs-%,$(dumpvar_goals)))
76 ifdef absolute_dumpvar
77 dumpvar_goals := $(patsubst abs-%,%,$(dumpvar_goals))
Ying Wang80ceadc2016-03-07 11:27:20 -080078 DUMPVAR_VALUE := $(abspath $($(dumpvar_goals)))
Bruce Beareb73dc662010-07-12 07:53:28 -070079 dumpvar_target := dumpvar-abs-$(dumpvar_goals)
80 else
81 DUMPVAR_VALUE := $($(dumpvar_goals))
82 dumpvar_target := dumpvar-$(dumpvar_goals)
83 endif
84
85.PHONY: $(dumpvar_target)
86$(dumpvar_target):
87 @echo $(DUMPVAR_VALUE)
88
89endif # dumpvar_goals
90
91ifneq ($(dumpvar_goals),report_config)
92PRINT_BUILD_CONFIG:=
93endif
94
Ying Wang08800fd2016-03-03 20:57:21 -080095ifneq ($(filter report_config,$(DUMP_MANY_VARS)),)
96# Construct the shell commands that print the config banner.
97report_config_sh := echo '============================================';
98report_config_sh += $(foreach v,$(print_build_config_vars),echo '$v=$($(v))';)
99report_config_sh += echo '============================================';
Colin Cross6b66fcf2016-01-26 15:59:50 -0800100endif
101
Ying Wang08800fd2016-03-03 20:57:21 -0800102# Dump mulitple variables to "<var>=<value>" pairs, one per line.
103# The output may be executed as bash script.
104# Input variables:
105# DUMP_MANY_VARS: the list of variable names.
106# DUMP_VAR_PREFIX: an optional prefix of the variable name added to the output.
107# DUMP_MANY_ABS_VARS: the list of abs variable names.
108# DUMP_ABS_VAR_PREFIX: an optional prefix of the abs variable name added to the output.
109.PHONY: dump-many-vars
110dump-many-vars :
111 @$(foreach v, $(filter-out report_config, $(DUMP_MANY_VARS)),\
112 echo "$(DUMP_VAR_PREFIX)$(v)='$($(v))'";)
113ifneq ($(filter report_config, $(DUMP_MANY_VARS)),)
114 @# Construct a special variable for report_config.
115 @# Escape \` to defer the execution of report_config_sh to preserve the line breaks.
116 @echo "$(DUMP_VAR_PREFIX)report_config=\`$(report_config_sh)\`"
117endif
118 @$(foreach v, $(sort $(DUMP_MANY_ABS_VARS)),\
Ying Wang80ceadc2016-03-07 11:27:20 -0800119 echo "$(DUMP_ABS_VAR_PREFIX)$(v)='$(abspath $($(v)))'";)
Ying Wang08800fd2016-03-03 20:57:21 -0800120
121endif # CALLED_FROM_SETUP
122
123ifneq ($(PRINT_BUILD_CONFIG),)
124$(info ============================================)
125$(foreach v, $(print_build_config_vars),\
126 $(info $v=$($(v))))
Bruce Beareb73dc662010-07-12 07:53:28 -0700127$(info ============================================)
128endif