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