OSDN Git Service

Makefile: Add the missing dependency on FUTILITY.
[android-x86/build.git] / core / dumpvar.mk
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   LINEAGE_VERSION \
7   TARGET_PRODUCT \
8   TARGET_BUILD_VARIANT \
9   TARGET_BUILD_TYPE \
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 \
26   OUT_DIR
27
28 ifneq ($(RECOVERY_VARIANT),)
29 print_build_config_vars += \
30   RECOVERY_VARIANT
31 endif
32 ifeq ($(WITH_SU),true)
33 print_build_config_vars += \
34   WITH_SU
35 endif
36 ifeq ($(WITH_GMS),true)
37 print_build_config_vars += \
38   WITH_GMS
39 endif
40
41 ifeq ($(TARGET_BUILD_PDK),true)
42 print_build_config_vars += \
43   TARGET_BUILD_PDK \
44   PDK_FUSION_PLATFORM_ZIP
45 endif
46
47 # ---------------------------------------------------------------
48 # the setpath shell function in envsetup.sh uses this to figure out
49 # what to add to the path given the config we have chosen.
50 ifeq ($(CALLED_FROM_SETUP),true)
51
52 ifneq ($(filter /%,$(HOST_OUT_EXECUTABLES)),)
53 ABP:=$(HOST_OUT_EXECUTABLES)
54 else
55 ABP:=$(PWD)/$(HOST_OUT_EXECUTABLES)
56 endif
57
58 ANDROID_BUILD_PATHS := $(ABP)
59 ANDROID_PREBUILTS := prebuilt/$(HOST_PREBUILT_TAG)
60 ANDROID_GCC_PREBUILTS := prebuilts/gcc/$(HOST_PREBUILT_TAG)
61
62 # The "dumpvar" stuff lets you say something like
63 #
64 #     CALLED_FROM_SETUP=true \
65 #       make -f config/envsetup.make dumpvar-TARGET_OUT
66 # or
67 #     CALLED_FROM_SETUP=true \
68 #       make -f config/envsetup.make dumpvar-abs-HOST_OUT_EXECUTABLES
69 #
70 # The plain (non-abs) version just dumps the value of the named variable.
71 # The "abs" version will treat the variable as a path, and dumps an
72 # absolute path to it.
73 #
74 dumpvar_goals := \
75         $(strip $(patsubst dumpvar-%,%,$(filter dumpvar-%,$(MAKECMDGOALS))))
76 ifdef dumpvar_goals
77
78   ifneq ($(words $(dumpvar_goals)),1)
79     $(error Only one "dumpvar-" goal allowed. Saw "$(MAKECMDGOALS)")
80   endif
81
82   # If the goal is of the form "dumpvar-abs-VARNAME", then
83   # treat VARNAME as a path and return the absolute path to it.
84   absolute_dumpvar := $(strip $(filter abs-%,$(dumpvar_goals)))
85   ifdef absolute_dumpvar
86     dumpvar_goals := $(patsubst abs-%,%,$(dumpvar_goals))
87     DUMPVAR_VALUE := $(abspath $($(dumpvar_goals)))
88     dumpvar_target := dumpvar-abs-$(dumpvar_goals)
89   else
90     DUMPVAR_VALUE := $($(dumpvar_goals))
91     dumpvar_target := dumpvar-$(dumpvar_goals)
92   endif
93
94 .PHONY: $(dumpvar_target)
95 $(dumpvar_target):
96         @echo $(DUMPVAR_VALUE)
97
98 endif # dumpvar_goals
99
100 ifneq ($(dumpvar_goals),report_config)
101 PRINT_BUILD_CONFIG:=
102 endif
103
104 ifneq ($(filter report_config,$(DUMP_MANY_VARS)),)
105 # Construct the shell commands that print the config banner.
106 report_config_sh := echo '============================================';
107 report_config_sh += $(foreach v,$(print_build_config_vars),echo '$v=$($(v))';)
108 report_config_sh += echo '============================================';
109 endif
110
111 # Dump mulitple variables to "<var>=<value>" pairs, one per line.
112 # The output may be executed as bash script.
113 # Input variables:
114 #   DUMP_MANY_VARS: the list of variable names.
115 #   DUMP_VAR_PREFIX: an optional prefix of the variable name added to the output.
116 #   DUMP_MANY_ABS_VARS: the list of abs variable names.
117 #   DUMP_ABS_VAR_PREFIX: an optional prefix of the abs variable name added to the output.
118 .PHONY: dump-many-vars
119 dump-many-vars :
120         @$(foreach v, $(filter-out report_config, $(DUMP_MANY_VARS)),\
121           echo "$(DUMP_VAR_PREFIX)$(v)='$($(v))'";)
122 ifneq ($(filter report_config, $(DUMP_MANY_VARS)),)
123         @# Construct a special variable for report_config.
124         @# Escape \` to defer the execution of report_config_sh to preserve the line breaks.
125         @echo "$(DUMP_VAR_PREFIX)report_config=\`$(report_config_sh)\`"
126 endif
127         @$(foreach v, $(sort $(DUMP_MANY_ABS_VARS)),\
128           echo "$(DUMP_ABS_VAR_PREFIX)$(v)='$(abspath $($(v)))'";)
129
130 endif # CALLED_FROM_SETUP
131
132 ifneq ($(PRINT_BUILD_CONFIG),)
133 $(info ============================================)
134 $(foreach v, $(print_build_config_vars),\
135   $(info $v=$($(v))))
136 $(info ============================================)
137 endif