Ying Wang | 956dccc | 2015-08-28 11:47:03 -0700 | [diff] [blame] | 1 | # Common to host and target Java modules. |
| 2 | |
Colin Cross | 3277ba3 | 2017-12-06 14:37:06 -0800 | [diff] [blame] | 3 | my_soong_problems := |
| 4 | |
| 5 | ifneq ($(filter ../%,$(LOCAL_SRC_FILES)),) |
| 6 | my_soong_problems += dotdot_srcs |
| 7 | endif |
| 8 | |
Ying Wang | 956dccc | 2015-08-28 11:47:03 -0700 | [diff] [blame] | 9 | ########################################################### |
Neil Fuller | ad02251 | 2016-01-29 14:22:29 +0000 | [diff] [blame] | 10 | ## Java version |
| 11 | ########################################################### |
Neil Fuller | decb797 | 2016-03-04 18:00:00 +0000 | [diff] [blame] | 12 | # Use the LOCAL_JAVA_LANGUAGE_VERSION if it is set, otherwise |
| 13 | # use one based on the LOCAL_SDK_VERSION. If it is < 24 |
| 14 | # pass "1.7" to the tools, if it is unset, >= 24 or "current" |
| 15 | # pass "1.8". |
| 16 | # |
| 17 | # The LOCAL_SDK_VERSION behavior is to ensure that, by default, |
| 18 | # code that is expected to run on older releases of Android |
| 19 | # does not use any 1.8 language features that are not supported |
| 20 | # on earlier runtimes (like default / static interface methods). |
| 21 | # Modules can override this logic by specifying |
| 22 | # LOCAL_JAVA_LANGUAGE_VERSION explicitly. |
Neil Fuller | ad02251 | 2016-01-29 14:22:29 +0000 | [diff] [blame] | 23 | ifeq (,$(LOCAL_JAVA_LANGUAGE_VERSION)) |
Colin Cross | f960257 | 2017-10-12 13:34:40 -0700 | [diff] [blame] | 24 | ifneq (,$(filter $(LOCAL_SDK_VERSION), $(TARGET_SDK_VERSIONS_WITHOUT_JAVA_18_SUPPORT))) |
Nicolas Geoffray | 8d772e2 | 2016-02-29 12:07:00 +0000 | [diff] [blame] | 25 | LOCAL_JAVA_LANGUAGE_VERSION := 1.7 |
Colin Cross | f960257 | 2017-10-12 13:34:40 -0700 | [diff] [blame] | 26 | else ifneq (,$(filter $(LOCAL_SDK_VERSION), $(TARGET_SDK_VERSIONS_WITHOUT_JAVA_19_SUPPORT))) |
| 27 | LOCAL_JAVA_LANGUAGE_VERSION := 1.8 |
| 28 | else ifneq (,$(LOCAL_SDK_VERSION)$(TARGET_BUILD_APPS)) |
| 29 | # TODO(ccross): allow 1.9 for current and unbundled once we have SDK system modules |
| 30 | LOCAL_JAVA_LANGUAGE_VERSION := 1.8 |
Neil Fuller | decb797 | 2016-03-04 18:00:00 +0000 | [diff] [blame] | 31 | else |
Tobias Thierer | f6bd495 | 2017-11-15 20:55:03 +0000 | [diff] [blame] | 32 | # DEFAULT_JAVA_LANGUAGE_VERSION is 1.8, unless TARGET_OPENJDK9 in which case it is 1.9 |
Colin Cross | f960257 | 2017-10-12 13:34:40 -0700 | [diff] [blame] | 33 | LOCAL_JAVA_LANGUAGE_VERSION := $(DEFAULT_JAVA_LANGUAGE_VERSION) |
Nicolas Geoffray | 8d772e2 | 2016-02-29 12:07:00 +0000 | [diff] [blame] | 34 | endif |
Neil Fuller | ad02251 | 2016-01-29 14:22:29 +0000 | [diff] [blame] | 35 | endif |
| 36 | LOCAL_JAVACFLAGS += -source $(LOCAL_JAVA_LANGUAGE_VERSION) -target $(LOCAL_JAVA_LANGUAGE_VERSION) |
| 37 | |
| 38 | ########################################################### |
Tobias Thierer | 7e99d45 | 2017-12-20 18:36:56 +0000 | [diff] [blame] | 39 | |
| 40 | # OpenJDK versions up to 8 shipped with bootstrap and tools jars |
| 41 | # (rt.jar, jce.jar, tools.jar etc.). These are no longer part of |
| 42 | # OpenJDK 9, but we still make them available for host tools that |
| 43 | # are targeting older versions. |
| 44 | USE_HOST_BOOTSTRAP_JARS := true |
| 45 | ifeq (,$(filter $(LOCAL_JAVA_LANGUAGE_VERSION), 1.6 1.7 1.8)) |
| 46 | USE_HOST_BOOTSTRAP_JARS := false |
| 47 | endif |
| 48 | |
| 49 | ########################################################### |
| 50 | |
| 51 | # Drop HOST_JDK_TOOLS_JAR from classpath when targeting versions > 9 (which don't have it). |
| 52 | # TODO: Remove HOST_JDK_TOOLS_JAR and all references to it once host |
| 53 | # bootstrap jars are no longer supported (ie. when USE_HOST_BOOTSTRAP_JARS |
| 54 | # is always false). http://b/38418220 |
| 55 | ifneq ($(USE_HOST_BOOTSTRAP_JARS),true) |
| 56 | LOCAL_CLASSPATH := $(filter-out $(HOST_JDK_TOOLS_JAR),$(LOCAL_CLASSPATH)) |
| 57 | endif |
| 58 | |
| 59 | ########################################################### |
Ying Wang | 956dccc | 2015-08-28 11:47:03 -0700 | [diff] [blame] | 60 | ## .proto files: Compile proto files to .java |
| 61 | ########################################################### |
Joe Onorato | bfc7811 | 2017-10-07 23:44:05 -0400 | [diff] [blame] | 62 | ifeq ($(strip $(LOCAL_PROTOC_OPTIMIZE_TYPE)),) |
| 63 | LOCAL_PROTOC_OPTIMIZE_TYPE := lite |
| 64 | endif |
Ying Wang | 956dccc | 2015-08-28 11:47:03 -0700 | [diff] [blame] | 65 | proto_sources := $(filter %.proto,$(LOCAL_SRC_FILES)) |
| 66 | # Because names of the .java files compiled from .proto files are unknown until the |
| 67 | # .proto files are compiled, we use a timestamp file as depedency. |
| 68 | proto_java_sources_file_stamp := |
| 69 | ifneq ($(proto_sources),) |
| 70 | proto_sources_fullpath := $(addprefix $(LOCAL_PATH)/, $(proto_sources)) |
| 71 | |
Dan Willemsen | cf324af | 2016-12-21 17:37:00 -0800 | [diff] [blame] | 72 | proto_java_intemediate_dir := $(intermediates.COMMON)/proto |
Ying Wang | 956dccc | 2015-08-28 11:47:03 -0700 | [diff] [blame] | 73 | proto_java_sources_file_stamp := $(proto_java_intemediate_dir)/Proto.stamp |
| 74 | proto_java_sources_dir := $(proto_java_intemediate_dir)/src |
| 75 | |
| 76 | $(proto_java_sources_file_stamp): PRIVATE_PROTO_INCLUDES := $(TOP) |
| 77 | $(proto_java_sources_file_stamp): PRIVATE_PROTO_SRC_FILES := $(proto_sources_fullpath) |
| 78 | $(proto_java_sources_file_stamp): PRIVATE_PROTO_JAVA_OUTPUT_DIR := $(proto_java_sources_dir) |
| 79 | ifeq ($(LOCAL_PROTOC_OPTIMIZE_TYPE),micro) |
| 80 | $(proto_java_sources_file_stamp): PRIVATE_PROTO_JAVA_OUTPUT_OPTION := --javamicro_out |
| 81 | else |
| 82 | ifeq ($(LOCAL_PROTOC_OPTIMIZE_TYPE),nano) |
| 83 | $(proto_java_sources_file_stamp): PRIVATE_PROTO_JAVA_OUTPUT_OPTION := --javanano_out |
| 84 | else |
Joe Onorato | c05a8ee | 2016-10-05 18:01:10 -0700 | [diff] [blame] | 85 | ifeq ($(LOCAL_PROTOC_OPTIMIZE_TYPE),stream) |
| 86 | $(proto_java_sources_file_stamp): PRIVATE_PROTO_JAVA_OUTPUT_OPTION := --javastream_out |
| 87 | $(proto_java_sources_file_stamp): $(HOST_OUT_EXECUTABLES)/protoc-gen-javastream |
| 88 | else |
Ying Wang | 956dccc | 2015-08-28 11:47:03 -0700 | [diff] [blame] | 89 | $(proto_java_sources_file_stamp): PRIVATE_PROTO_JAVA_OUTPUT_OPTION := --java_out |
Joe Onorato | c05a8ee | 2016-10-05 18:01:10 -0700 | [diff] [blame] | 90 | endif |
Ying Wang | 956dccc | 2015-08-28 11:47:03 -0700 | [diff] [blame] | 91 | endif |
| 92 | endif |
| 93 | $(proto_java_sources_file_stamp): PRIVATE_PROTOC_FLAGS := $(LOCAL_PROTOC_FLAGS) |
Joe Onorato | bfc7811 | 2017-10-07 23:44:05 -0400 | [diff] [blame] | 94 | $(proto_java_sources_file_stamp): PRIVATE_PROTO_JAVA_OUTPUT_PARAMS := $(if $(filter lite,$(LOCAL_PROTOC_OPTIMIZE_TYPE)),lite$(if $(LOCAL_PROTO_JAVA_OUTPUT_PARAMS),:,),)$(LOCAL_PROTO_JAVA_OUTPUT_PARAMS) |
Ying Wang | 956dccc | 2015-08-28 11:47:03 -0700 | [diff] [blame] | 95 | $(proto_java_sources_file_stamp) : $(proto_sources_fullpath) $(PROTOC) |
| 96 | $(call transform-proto-to-java) |
| 97 | |
| 98 | #TODO: protoc should output the dependencies introduced by imports. |
Ying Wang | d5ffec9 | 2016-03-01 22:05:25 -0800 | [diff] [blame] | 99 | |
| 100 | ALL_MODULES.$(my_register_name).PROTO_FILES := $(proto_sources_fullpath) |
Ying Wang | 956dccc | 2015-08-28 11:47:03 -0700 | [diff] [blame] | 101 | endif # proto_sources |
| 102 | |
| 103 | ######################################### |
| 104 | ## Java resources |
| 105 | |
| 106 | # Look for resource files in any specified directories. |
| 107 | # Non-java and non-doc files will be picked up as resources |
| 108 | # and included in the output jar file. |
| 109 | java_resource_file_groups := |
| 110 | |
| 111 | LOCAL_JAVA_RESOURCE_DIRS := $(strip $(LOCAL_JAVA_RESOURCE_DIRS)) |
| 112 | ifneq ($(LOCAL_JAVA_RESOURCE_DIRS),) |
| 113 | # This makes a list of words like |
| 114 | # <dir1>::<file1>:<file2> <dir2>::<file1> <dir3>: |
| 115 | # where each of the files is relative to the directory it's grouped with. |
| 116 | # Directories that don't contain any resource files will result in groups |
| 117 | # that end with a colon, and they are stripped out in the next step. |
| 118 | java_resource_file_groups += \ |
| 119 | $(foreach dir,$(LOCAL_JAVA_RESOURCE_DIRS), \ |
| 120 | $(subst $(space),:,$(strip \ |
| 121 | $(LOCAL_PATH)/$(dir): \ |
Dan Willemsen | 7c3e3f8 | 2015-09-29 16:30:21 -0700 | [diff] [blame] | 122 | $(patsubst ./%,%,$(sort $(shell cd $(LOCAL_PATH)/$(dir) && \ |
Ying Wang | 956dccc | 2015-08-28 11:47:03 -0700 | [diff] [blame] | 123 | find . \ |
| 124 | -type d -a -name ".svn" -prune -o \ |
| 125 | -type f \ |
| 126 | -a \! -name "*.java" \ |
| 127 | -a \! -name "package.html" \ |
| 128 | -a \! -name "overview.html" \ |
| 129 | -a \! -name ".*.swp" \ |
| 130 | -a \! -name ".DS_Store" \ |
| 131 | -a \! -name "*~" \ |
| 132 | -print \ |
Dan Willemsen | 7c3e3f8 | 2015-09-29 16:30:21 -0700 | [diff] [blame] | 133 | ))) \ |
Ying Wang | 956dccc | 2015-08-28 11:47:03 -0700 | [diff] [blame] | 134 | )) \ |
| 135 | ) |
| 136 | java_resource_file_groups := $(filter-out %:,$(java_resource_file_groups)) |
| 137 | endif # LOCAL_JAVA_RESOURCE_DIRS |
| 138 | |
Ying Wang | 956dccc | 2015-08-28 11:47:03 -0700 | [diff] [blame] | 139 | ifneq ($(LOCAL_JAVA_RESOURCE_FILES),) |
Colin Cross | 34a9885 | 2017-09-22 13:34:10 -0700 | [diff] [blame] | 140 | # Converts LOCAL_JAVA_RESOURCE_FILES := <file> to $(dir $(file))::$(notdir $(file)) |
| 141 | # and LOCAL_JAVA_RESOURCE_FILES := <dir>:<file> to <dir>::<file> |
| 142 | java_resource_file_groups += $(strip $(foreach res,$(LOCAL_JAVA_RESOURCE_FILES), \ |
| 143 | $(eval _file := $(call word-colon,2,$(res))) \ |
| 144 | $(if $(_file), \ |
| 145 | $(eval _base := $(call word-colon,1,$(res))), \ |
| 146 | $(eval _base := $(dir $(res))) \ |
| 147 | $(eval _file := $(notdir $(res)))) \ |
| 148 | $(if $(filter /%, \ |
| 149 | $(filter-out $(OUT_DIR)/%,$(_base) $(_file))), \ |
| 150 | $(call pretty-error,LOCAL_JAVA_RESOURCE_FILES may not include absolute paths: $(_base) $(_file))) \ |
| 151 | $(patsubst %/,%,$(_base))::$(_file))) |
| 152 | |
Ying Wang | 956dccc | 2015-08-28 11:47:03 -0700 | [diff] [blame] | 153 | endif # LOCAL_JAVA_RESOURCE_FILES |
| 154 | |
| 155 | ifdef java_resource_file_groups |
| 156 | # The full paths to all resources, used for dependencies. |
| 157 | java_resource_sources := \ |
| 158 | $(foreach group,$(java_resource_file_groups), \ |
| 159 | $(addprefix $(word 1,$(subst :,$(space),$(group)))/, \ |
| 160 | $(wordlist 2,9999,$(subst :,$(space),$(group))) \ |
| 161 | ) \ |
| 162 | ) |
| 163 | # The arguments to jar that will include these files in a jar file. |
| 164 | # Quote the file name to handle special characters (such as #) correctly. |
| 165 | extra_jar_args := \ |
| 166 | $(foreach group,$(java_resource_file_groups), \ |
| 167 | $(addprefix -C "$(word 1,$(subst :,$(space),$(group)))" , \ |
| 168 | $(foreach w, $(wordlist 2,9999,$(subst :,$(space),$(group))), "$(w)" ) \ |
| 169 | ) \ |
| 170 | ) |
| 171 | java_resource_file_groups := |
| 172 | else |
| 173 | java_resource_sources := |
| 174 | extra_jar_args := |
| 175 | endif # java_resource_file_groups |
| 176 | |
Ying Wang | f8d15d6 | 2016-04-26 15:49:56 -0700 | [diff] [blame] | 177 | ##################################### |
| 178 | ## Warn if there is unrecognized file in LOCAL_SRC_FILES. |
| 179 | my_unknown_src_files := $(filter-out \ |
Colin Cross | 1e047d3 | 2018-03-12 18:23:15 -0700 | [diff] [blame] | 180 | %.java %.aidl %.proto %.logtags, \ |
Ying Wang | f8d15d6 | 2016-04-26 15:49:56 -0700 | [diff] [blame] | 181 | $(LOCAL_SRC_FILES) $(LOCAL_INTERMEDIATE_SOURCES) $(LOCAL_GENERATED_SOURCES)) |
| 182 | ifneq ($(my_unknown_src_files),) |
| 183 | $(warning $(LOCAL_MODULE_MAKEFILE): $(LOCAL_MODULE): Unused source files: $(my_unknown_src_files)) |
| 184 | endif |
| 185 | |
Ying Wang | 956dccc | 2015-08-28 11:47:03 -0700 | [diff] [blame] | 186 | ###################################### |
| 187 | ## PRIVATE java vars |
| 188 | # LOCAL_SOURCE_FILES_ALL_GENERATED is set only if the module does not have static source files, |
| 189 | # but generated source files in its LOCAL_INTERMEDIATE_SOURCE_DIR. |
| 190 | # You have to set up the dependency in some other way. |
Colin Cross | 11e2d55 | 2018-03-07 15:44:54 -0800 | [diff] [blame] | 191 | need_compile_java := $(strip $(all_java_sources)$(LOCAL_SRCJARS)$(all_res_assets)$(java_resource_sources))$(LOCAL_STATIC_JAVA_LIBRARIES)$(filter true,$(LOCAL_SOURCE_FILES_ALL_GENERATED)) |
Ying Wang | 956dccc | 2015-08-28 11:47:03 -0700 | [diff] [blame] | 192 | ifdef need_compile_java |
| 193 | |
Colin Cross | e8ee68b | 2017-04-07 16:28:41 -0700 | [diff] [blame] | 194 | annotation_processor_flags := |
| 195 | annotation_processor_deps := |
| 196 | |
| 197 | ifdef LOCAL_ANNOTATION_PROCESSORS |
Nan Zhang | 9bd5405 | 2017-09-13 13:13:53 -0700 | [diff] [blame] | 198 | annotation_processor_jars := $(call java-lib-files,$(LOCAL_ANNOTATION_PROCESSORS),true) |
Colin Cross | e8ee68b | 2017-04-07 16:28:41 -0700 | [diff] [blame] | 199 | annotation_processor_flags += -processorpath $(call normalize-path-list,$(annotation_processor_jars)) |
| 200 | annotation_processor_deps += $(annotation_processor_jars) |
| 201 | |
| 202 | # b/25860419: annotation processors must be explicitly specified for grok |
| 203 | annotation_processor_flags += $(foreach class,$(LOCAL_ANNOTATION_PROCESSOR_CLASSES),-processor $(class)) |
| 204 | |
| 205 | annotation_processor_jars := |
| 206 | endif |
| 207 | |
Colin Cross | 9b2e4c6 | 2017-09-26 14:55:43 -0700 | [diff] [blame] | 208 | full_static_java_libs := $(call java-lib-files,$(LOCAL_STATIC_JAVA_LIBRARIES),$(LOCAL_IS_HOST_MODULE)) |
| 209 | full_static_java_header_libs := $(call java-lib-header-files,$(LOCAL_STATIC_JAVA_LIBRARIES),$(LOCAL_IS_HOST_MODULE)) |
Nan Zhang | b3ec534 | 2017-08-31 21:43:04 +0000 | [diff] [blame] | 210 | |
Ying Wang | 956dccc | 2015-08-28 11:47:03 -0700 | [diff] [blame] | 211 | $(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_STATIC_JAVA_LIBRARIES := $(full_static_java_libs) |
Nan Zhang | b3ec534 | 2017-08-31 21:43:04 +0000 | [diff] [blame] | 212 | $(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_STATIC_JAVA_HEADER_LIBRARIES := $(full_static_java_header_libs) |
Ying Wang | 956dccc | 2015-08-28 11:47:03 -0700 | [diff] [blame] | 213 | |
| 214 | $(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_RESOURCE_DIR := $(LOCAL_RESOURCE_DIR) |
| 215 | $(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_ASSET_DIR := $(LOCAL_ASSET_DIR) |
| 216 | |
| 217 | $(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_CLASS_INTERMEDIATES_DIR := $(intermediates.COMMON)/classes |
Colin Cross | e8ee68b | 2017-04-07 16:28:41 -0700 | [diff] [blame] | 218 | $(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_ANNO_INTERMEDIATES_DIR := $(intermediates.COMMON)/anno |
Ying Wang | 956dccc | 2015-08-28 11:47:03 -0700 | [diff] [blame] | 219 | $(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_SOURCE_INTERMEDIATES_DIR := $(intermediates.COMMON)/src |
Dan Willemsen | cf324af | 2016-12-21 17:37:00 -0800 | [diff] [blame] | 220 | $(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_HAS_PROTO_SOURCES := $(if $(proto_sources),true) |
| 221 | $(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_PROTO_SOURCE_INTERMEDIATES_DIR := $(intermediates.COMMON)/proto |
| 222 | $(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_HAS_RS_SOURCES := |
Ying Wang | 956dccc | 2015-08-28 11:47:03 -0700 | [diff] [blame] | 223 | $(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_JAVA_SOURCES := $(all_java_sources) |
Colin Cross | dfc45ec | 2017-05-26 15:22:02 -0700 | [diff] [blame] | 224 | $(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_JAVA_SOURCE_LIST := $(java_source_list_file) |
Ying Wang | 956dccc | 2015-08-28 11:47:03 -0700 | [diff] [blame] | 225 | |
| 226 | $(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_RMTYPEDEFS := $(LOCAL_RMTYPEDEFS) |
| 227 | |
Colin Cross | 1d1e5ef | 2017-09-23 18:19:05 -0700 | [diff] [blame] | 228 | full_java_bootclasspath_libs := |
| 229 | empty_bootclasspath := |
Colin Cross | f960257 | 2017-10-12 13:34:40 -0700 | [diff] [blame] | 230 | my_system_modules := |
Colin Cross | 1d1e5ef | 2017-09-23 18:19:05 -0700 | [diff] [blame] | 231 | |
Ying Wang | 956dccc | 2015-08-28 11:47:03 -0700 | [diff] [blame] | 232 | ifndef LOCAL_IS_HOST_MODULE |
Anton Hansson | f5cefdc | 2018-04-12 16:17:55 +0100 | [diff] [blame^] | 233 | sdk_libs := |
Colin Cross | f6bc1a1 | 2017-09-23 19:47:37 -0700 | [diff] [blame] | 234 | ifeq ($(LOCAL_SDK_VERSION),) |
| 235 | ifeq ($(LOCAL_NO_STANDARD_LIBRARIES),true) |
| 236 | # No bootclasspath. But we still need "" to prevent javac from using default host bootclasspath. |
Colin Cross | 1d1e5ef | 2017-09-23 18:19:05 -0700 | [diff] [blame] | 237 | empty_bootclasspath := "" |
Colin Cross | f960257 | 2017-10-12 13:34:40 -0700 | [diff] [blame] | 238 | # Most users of LOCAL_NO_STANDARD_LIBRARIES really mean no framework libs, |
| 239 | # and manually add back the core libs. The ones that don't are in soong |
| 240 | # now, so just always assume that they want the default system modules |
| 241 | my_system_modules := $(DEFAULT_SYSTEM_MODULES) |
Colin Cross | f6bc1a1 | 2017-09-23 19:47:37 -0700 | [diff] [blame] | 242 | else # LOCAL_NO_STANDARD_LIBRARIES |
Colin Cross | 98caed6 | 2017-10-25 17:33:38 -0700 | [diff] [blame] | 243 | full_java_bootclasspath_libs := $(call java-lib-header-files,$(TARGET_DEFAULT_BOOTCLASSPATH_LIBRARIES) $(TARGET_DEFAULT_JAVA_LIBRARIES)) |
| 244 | LOCAL_JAVA_LIBRARIES := $(filter-out $(TARGET_DEFAULT_BOOTCLASSPATH_LIBRARIES) $(TARGET_DEFAULT_JAVA_LIBRARIES),$(LOCAL_JAVA_LIBRARIES)) |
Colin Cross | f960257 | 2017-10-12 13:34:40 -0700 | [diff] [blame] | 245 | my_system_modules := $(DEFAULT_SYSTEM_MODULES) |
Colin Cross | f6bc1a1 | 2017-09-23 19:47:37 -0700 | [diff] [blame] | 246 | endif # LOCAL_NO_STANDARD_LIBRARIES |
| 247 | else |
Colin Cross | b541aae | 2017-09-23 19:52:43 -0700 | [diff] [blame] | 248 | ifeq ($(LOCAL_NO_STANDARD_LIBRARIES),true) |
| 249 | $(call pretty-error,Must not define both LOCAL_NO_STANDARD_LIBRARIES and LOCAL_SDK_VERSION) |
| 250 | endif |
| 251 | ifeq ($(strip $(filter $(LOCAL_SDK_VERSION),$(TARGET_AVAILABLE_SDK_VERSIONS))),) |
| 252 | $(call pretty-error,Invalid LOCAL_SDK_VERSION '$(LOCAL_SDK_VERSION)' \ |
| 253 | Choices are: $(TARGET_AVAILABLE_SDK_VERSIONS)) |
| 254 | endif |
Colin Cross | f6bc1a1 | 2017-09-23 19:47:37 -0700 | [diff] [blame] | 255 | ifeq ($(LOCAL_SDK_VERSION)$(TARGET_BUILD_APPS),current) |
| 256 | # LOCAL_SDK_VERSION is current and no TARGET_BUILD_APPS. |
Colin Cross | 1d1e5ef | 2017-09-23 18:19:05 -0700 | [diff] [blame] | 257 | full_java_bootclasspath_libs := $(call java-lib-header-files,android_stubs_current) |
Colin Cross | f6bc1a1 | 2017-09-23 19:47:37 -0700 | [diff] [blame] | 258 | else ifeq ($(LOCAL_SDK_VERSION)$(TARGET_BUILD_APPS),system_current) |
Colin Cross | 1d1e5ef | 2017-09-23 18:19:05 -0700 | [diff] [blame] | 259 | full_java_bootclasspath_libs := $(call java-lib-header-files,android_system_stubs_current) |
Colin Cross | f6bc1a1 | 2017-09-23 19:47:37 -0700 | [diff] [blame] | 260 | else ifeq ($(LOCAL_SDK_VERSION)$(TARGET_BUILD_APPS),test_current) |
Colin Cross | 1d1e5ef | 2017-09-23 18:19:05 -0700 | [diff] [blame] | 261 | full_java_bootclasspath_libs := $(call java-lib-header-files,android_test_stubs_current) |
Jiyong Park | 5ebca30 | 2018-01-31 00:14:55 +0900 | [diff] [blame] | 262 | else ifeq ($(LOCAL_SDK_VERSION)$(TARGET_BUILD_APPS),core_current) |
| 263 | full_java_bootclasspath_libs := $(call java-lib-header-files,core.current.stubs) |
Colin Cross | f6bc1a1 | 2017-09-23 19:47:37 -0700 | [diff] [blame] | 264 | else |
Anton Hansson | f5cefdc | 2018-04-12 16:17:55 +0100 | [diff] [blame^] | 265 | # TARGET_BUILD_APPS or numbered SDK. Use the modules defined in prebuilts/sdk/Android.mk. |
Anton Hansson | 400673c | 2018-04-10 16:16:33 +0100 | [diff] [blame] | 266 | _module_name := $(call resolve-prebuilt-sdk-module,$(LOCAL_SDK_VERSION)) |
| 267 | full_java_bootclasspath_libs := $(call java-lib-header-files,$(_module_name)) |
Anton Hansson | f5cefdc | 2018-04-12 16:17:55 +0100 | [diff] [blame^] | 268 | sdk_libs := $(foreach lib_name,$(LOCAL_SDK_LIBRARIES),$(call resolve-prebuilt-sdk-module,$(LOCAL_SDK_VERSION),$(lib_name))) |
Anton Hansson | 400673c | 2018-04-10 16:16:33 +0100 | [diff] [blame] | 269 | _module_name := |
Jiyong Park | 5ebca30 | 2018-01-31 00:14:55 +0900 | [diff] [blame] | 270 | endif # current, system_current, system_${VER}, test_current or core_current |
Colin Cross | f6bc1a1 | 2017-09-23 19:47:37 -0700 | [diff] [blame] | 271 | endif # LOCAL_SDK_VERSION |
Ying Wang | 956dccc | 2015-08-28 11:47:03 -0700 | [diff] [blame] | 272 | |
Allen Hair | 1d226aa | 2017-10-31 14:05:35 -0700 | [diff] [blame] | 273 | ifneq ($(LOCAL_NO_STANDARD_LIBRARIES),true) |
| 274 | ifneq ($(LOCAL_MODULE),jacocoagent) |
| 275 | ifeq ($(EMMA_INSTRUMENT),true) |
| 276 | ifneq ($(EMMA_INSTRUMENT_STATIC),true) |
| 277 | # For instrumented build, if Jacoco is not being included statically |
| 278 | # in instrumented packages then include Jacoco classes into the |
| 279 | # bootclasspath. |
| 280 | full_java_bootclasspath_libs += $(call java-lib-header-files,jacocoagent) |
| 281 | endif # EMMA_INSTRUMENT_STATIC |
| 282 | endif # EMMA_INSTRUMENT |
| 283 | endif # LOCAL_MODULE == jacocoagent |
| 284 | endif # LOCAL_NO_STANDARD_LIBRARIES |
| 285 | |
Colin Cross | f6bc1a1 | 2017-09-23 19:47:37 -0700 | [diff] [blame] | 286 | # In order to compile lambda code javac requires various invokedynamic- |
| 287 | # related classes to be present. This change adds stubs needed for |
| 288 | # javac to compile lambdas. |
Colin Cross | 5d969a3 | 2017-09-22 15:03:38 -0700 | [diff] [blame] | 289 | ifneq ($(LOCAL_NO_STANDARD_LIBRARIES),true) |
| 290 | ifdef TARGET_BUILD_APPS |
| 291 | full_java_bootclasspath_libs += $(call java-lib-header-files,sdk-core-lambda-stubs) |
| 292 | else |
| 293 | full_java_bootclasspath_libs += $(call java-lib-header-files,core-lambda-stubs) |
Colin Cross | f6bc1a1 | 2017-09-23 19:47:37 -0700 | [diff] [blame] | 294 | endif |
| 295 | endif |
Anton Hansson | f5cefdc | 2018-04-12 16:17:55 +0100 | [diff] [blame^] | 296 | full_shared_java_libs := $(call java-lib-files,$(LOCAL_JAVA_LIBRARIES) $(sdk_libs),$(LOCAL_IS_HOST_MODULE)) |
| 297 | full_shared_java_header_libs := $(call java-lib-header-files,$(LOCAL_JAVA_LIBRARIES) $(sdk_libs),$(LOCAL_IS_HOST_MODULE)) |
| 298 | sdk_libs := |
Ying Wang | 956dccc | 2015-08-28 11:47:03 -0700 | [diff] [blame] | 299 | else # LOCAL_IS_HOST_MODULE |
| 300 | |
Colin Cross | f6bc1a1 | 2017-09-23 19:47:37 -0700 | [diff] [blame] | 301 | ifeq ($(USE_CORE_LIB_BOOTCLASSPATH),true) |
| 302 | ifeq ($(LOCAL_NO_STANDARD_LIBRARIES),true) |
Colin Cross | 1d1e5ef | 2017-09-23 18:19:05 -0700 | [diff] [blame] | 303 | empty_bootclasspath := "" |
Colin Cross | f6bc1a1 | 2017-09-23 19:47:37 -0700 | [diff] [blame] | 304 | else |
Colin Cross | b541aae | 2017-09-23 19:52:43 -0700 | [diff] [blame] | 305 | full_java_bootclasspath_libs := $(call java-lib-header-files,$(addsuffix -hostdex,$(TARGET_DEFAULT_BOOTCLASSPATH_LIBRARIES)),true) |
Colin Cross | f6bc1a1 | 2017-09-23 19:47:37 -0700 | [diff] [blame] | 306 | endif |
Ying Wang | 956dccc | 2015-08-28 11:47:03 -0700 | [diff] [blame] | 307 | |
Colin Cross | f960257 | 2017-10-12 13:34:40 -0700 | [diff] [blame] | 308 | my_system_modules := $(DEFAULT_SYSTEM_MODULES) |
Colin Cross | f6bc1a1 | 2017-09-23 19:47:37 -0700 | [diff] [blame] | 309 | full_shared_java_libs := $(call java-lib-files,$(LOCAL_JAVA_LIBRARIES),true) |
| 310 | full_shared_java_header_libs := $(call java-lib-header-files,$(LOCAL_JAVA_LIBRARIES),true) |
| 311 | else # !USE_CORE_LIB_BOOTCLASSPATH |
Tobias Thierer | 7e99d45 | 2017-12-20 18:36:56 +0000 | [diff] [blame] | 312 | # Give host-side tools a version of OpenJDK's standard libraries |
| 313 | # close to what they're targeting. As of Dec 2017, AOSP is only |
| 314 | # bundling OpenJDK 8 and 9, so nothing < 8 is available. |
| 315 | # |
| 316 | # When building with OpenJDK 8, the following should have no |
| 317 | # effect since those jars would be available by default. |
| 318 | # |
| 319 | # When building with OpenJDK 9 but targeting a version < 1.8, |
| 320 | # putting them on the bootclasspath means that: |
| 321 | # a) code can't (accidentally) refer to OpenJDK 9 specific APIs |
| 322 | # b) references to existing APIs are not reinterpreted in an |
| 323 | # OpenJDK 9-specific way, eg. calls to subclasses of |
| 324 | # java.nio.Buffer as in http://b/70862583 |
| 325 | ifeq ($(USE_HOST_BOOTSTRAP_JARS),true) |
| 326 | full_java_bootclasspath_libs += $(ANDROID_JAVA8_HOME)/jre/lib/jce.jar |
| 327 | full_java_bootclasspath_libs += $(ANDROID_JAVA8_HOME)/jre/lib/rt.jar |
| 328 | endif |
Colin Cross | f6bc1a1 | 2017-09-23 19:47:37 -0700 | [diff] [blame] | 329 | full_shared_java_libs := $(addprefix $(HOST_OUT_JAVA_LIBRARIES)/,\ |
| 330 | $(addsuffix $(COMMON_JAVA_PACKAGE_SUFFIX),$(LOCAL_JAVA_LIBRARIES))) |
Colin Cross | 98caed6 | 2017-10-25 17:33:38 -0700 | [diff] [blame] | 331 | full_shared_java_header_libs := $(full_shared_java_libs) |
Colin Cross | f6bc1a1 | 2017-09-23 19:47:37 -0700 | [diff] [blame] | 332 | endif # USE_CORE_LIB_BOOTCLASSPATH |
Ying Wang | 956dccc | 2015-08-28 11:47:03 -0700 | [diff] [blame] | 333 | endif # !LOCAL_IS_HOST_MODULE |
| 334 | |
Colin Cross | 1d1e5ef | 2017-09-23 18:19:05 -0700 | [diff] [blame] | 335 | ifdef empty_bootclasspath |
| 336 | ifdef full_java_bootclasspath_libs |
| 337 | $(call pretty-error,internal error: empty_bootclasspath and full_java_bootclasspath_libs should not both be set) |
| 338 | endif |
| 339 | endif |
| 340 | |
Colin Cross | f960257 | 2017-10-12 13:34:40 -0700 | [diff] [blame] | 341 | full_java_system_modules_deps := |
| 342 | my_system_modules_dir := |
| 343 | $(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_USE_SYSTEM_MODULES := |
| 344 | ifeq ($(LOCAL_JAVA_LANGUAGE_VERSION),1.9) |
| 345 | $(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_USE_SYSTEM_MODULES := true |
| 346 | ifdef my_system_modules |
| 347 | ifneq ($(my_system_modules),none) |
| 348 | ifndef SOONG_SYSTEM_MODULES_$(my_system_modules) |
| 349 | $(call pretty-error, Invalid system modules $(my_system_modules)) |
| 350 | endif |
| 351 | full_java_system_modules_deps := $(SOONG_SYSTEM_MODULES_$(my_system_modules)) |
| 352 | my_system_modules_dir := $(patsubst %/lib/modules,%,$(SOONG_SYSTEM_MODULES_$(my_system_modules))) |
| 353 | endif |
| 354 | endif |
| 355 | endif |
| 356 | |
Colin Cross | b541aae | 2017-09-23 19:52:43 -0700 | [diff] [blame] | 357 | $(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_BOOTCLASSPATH := $(full_java_bootclasspath_libs) |
| 358 | $(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_EMPTY_BOOTCLASSPATH := $(empty_bootclasspath) |
Tobias Thierer | 0276db1 | 2017-11-01 16:53:09 +0000 | [diff] [blame] | 359 | $(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_SYSTEM_MODULES := $(my_system_modules) |
| 360 | $(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_SYSTEM_MODULES_DIR := $(my_system_modules_dir) |
| 361 | $(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_SYSTEM_MODULES_LIBS := $(call java-lib-files,$(SOONG_SYSTEM_MODULES_LIBS_$(my_system_modules))) |
Tobias Thierer | f795dcb | 2018-01-09 20:33:08 +0000 | [diff] [blame] | 362 | $(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_PATCH_MODULE := $(LOCAL_PATCH_MODULE) |
Colin Cross | 1d1e5ef | 2017-09-23 18:19:05 -0700 | [diff] [blame] | 363 | |
Ying Wang | 956dccc | 2015-08-28 11:47:03 -0700 | [diff] [blame] | 364 | ifndef LOCAL_IS_HOST_MODULE |
| 365 | # This is set by packages that are linking to other packages that export |
| 366 | # shared libraries, allowing them to make use of the code in the linked apk. |
| 367 | apk_libraries := $(sort $(LOCAL_APK_LIBRARIES) $(LOCAL_RES_LIBRARIES)) |
| 368 | ifneq ($(apk_libraries),) |
Colin Cross | 9b2e4c6 | 2017-09-26 14:55:43 -0700 | [diff] [blame] | 369 | link_apk_libraries := $(call app-lib-files,$(apk_libraries)) |
| 370 | link_apk_header_libs := $(call app-lib-header-files,$(apk_libraries)) |
Ying Wang | 956dccc | 2015-08-28 11:47:03 -0700 | [diff] [blame] | 371 | |
| 372 | # link against the jar with full original names (before proguard processing). |
| 373 | full_shared_java_libs += $(link_apk_libraries) |
Colin Cross | 98caed6 | 2017-10-25 17:33:38 -0700 | [diff] [blame] | 374 | full_shared_java_header_libs += $(link_apk_header_libs) |
Ying Wang | 956dccc | 2015-08-28 11:47:03 -0700 | [diff] [blame] | 375 | endif |
| 376 | |
| 377 | # This is set by packages that contain instrumentation, allowing them to |
| 378 | # link against the package they are instrumenting. Currently only one such |
| 379 | # package is allowed. |
| 380 | LOCAL_INSTRUMENTATION_FOR := $(strip $(LOCAL_INSTRUMENTATION_FOR)) |
| 381 | ifdef LOCAL_INSTRUMENTATION_FOR |
| 382 | ifneq ($(words $(LOCAL_INSTRUMENTATION_FOR)),1) |
| 383 | $(error \ |
| 384 | $(LOCAL_PATH): Multiple LOCAL_INSTRUMENTATION_FOR members defined) |
| 385 | endif |
| 386 | |
| 387 | link_instr_intermediates_dir.COMMON := $(call intermediates-dir-for, \ |
| 388 | APPS,$(LOCAL_INSTRUMENTATION_FOR),,COMMON) |
| 389 | # link against the jar with full original names (before proguard processing). |
Colin Cross | 950f1ef | 2017-04-05 15:30:42 -0700 | [diff] [blame] | 390 | link_instr_classes_jar := $(link_instr_intermediates_dir.COMMON)/classes-pre-proguard.jar |
Colin Cross | 7dc9043 | 2017-09-26 16:17:24 -0700 | [diff] [blame] | 391 | ifneq ($(TURBINE_ENABLED),false) |
| 392 | link_instr_classes_header_jar := $(link_instr_intermediates_dir.COMMON)/classes-header.jar |
| 393 | else |
| 394 | link_instr_classes_header_jar := $(link_instr_intermediates_dir.COMMON)/classes.jar |
| 395 | endif |
Colin Cross | 98caed6 | 2017-10-25 17:33:38 -0700 | [diff] [blame] | 396 | full_shared_java_libs += $(link_instr_classes_jar) |
| 397 | full_shared_java_header_libs += $(link_instr_classes_header_jar) |
Ying Wang | 956dccc | 2015-08-28 11:47:03 -0700 | [diff] [blame] | 398 | endif # LOCAL_INSTRUMENTATION_FOR |
| 399 | endif # LOCAL_IS_HOST_MODULE |
| 400 | |
| 401 | endif # need_compile_java |
| 402 | |
| 403 | # We may want to add jar manifest or jar resource files even if there is no java code at all. |
| 404 | $(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_EXTRA_JAR_ARGS := $(extra_jar_args) |
| 405 | jar_manifest_file := |
| 406 | ifneq ($(strip $(LOCAL_JAR_MANIFEST)),) |
| 407 | jar_manifest_file := $(LOCAL_PATH)/$(LOCAL_JAR_MANIFEST) |
| 408 | $(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_JAR_MANIFEST := $(jar_manifest_file) |
| 409 | else |
| 410 | $(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_JAR_MANIFEST := |
| 411 | endif |
| 412 | |
| 413 | ########################################################## |
Ying Wang | 956dccc | 2015-08-28 11:47:03 -0700 | [diff] [blame] | 414 | |
Colin Cross | 98caed6 | 2017-10-25 17:33:38 -0700 | [diff] [blame] | 415 | full_java_libs := $(full_shared_java_libs) $(full_static_java_libs) $(LOCAL_CLASSPATH) |
| 416 | full_java_header_libs := $(full_shared_java_header_libs) $(full_static_java_header_libs) |
| 417 | |
Ying Wang | 6f9bd2a | 2016-03-29 12:41:42 -0700 | [diff] [blame] | 418 | $(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_ALL_JAVA_LIBRARIES := $(full_java_libs) |
Nan Zhang | b3ec534 | 2017-08-31 21:43:04 +0000 | [diff] [blame] | 419 | $(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_ALL_JAVA_HEADER_LIBRARIES := $(full_java_header_libs) |
Colin Cross | 98caed6 | 2017-10-25 17:33:38 -0700 | [diff] [blame] | 420 | $(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_SHARED_JAVA_HEADER_LIBRARIES := $(full_shared_java_header_libs) |
Ying Wang | 956dccc | 2015-08-28 11:47:03 -0700 | [diff] [blame] | 421 | |
| 422 | ALL_MODULES.$(my_register_name).INTERMEDIATE_SOURCE_DIR := \ |
| 423 | $(ALL_MODULES.$(my_register_name).INTERMEDIATE_SOURCE_DIR) $(LOCAL_INTERMEDIATE_SOURCE_DIR) |
| 424 | |
| 425 | ########################################################### |
Dan Willemsen | 62dfb59 | 2016-07-08 21:33:05 -0700 | [diff] [blame] | 426 | # Verify that all libraries are safe to use |
| 427 | ########################################################### |
| 428 | ifndef LOCAL_IS_HOST_MODULE |
Dan Willemsen | 62dfb59 | 2016-07-08 21:33:05 -0700 | [diff] [blame] | 429 | ifeq ($(LOCAL_SDK_VERSION),system_current) |
Dan Willemsen | b47d4e9 | 2017-04-08 00:31:31 -0700 | [diff] [blame] | 430 | my_link_type := java:system |
| 431 | my_warn_types := java:platform |
Jiyong Park | 5ebca30 | 2018-01-31 00:14:55 +0900 | [diff] [blame] | 432 | my_allowed_types := java:sdk java:system java:core |
Sundong Ahn | 5a44d1f | 2017-10-16 19:20:34 +0900 | [diff] [blame] | 433 | else ifneq (,$(call has-system-sdk-version,$(LOCAL_SDK_VERSION))) |
| 434 | my_link_type := java:system |
| 435 | my_warn_types := java:platform |
Jiyong Park | 5ebca30 | 2018-01-31 00:14:55 +0900 | [diff] [blame] | 436 | my_allowed_types := java:sdk java:system java:core |
| 437 | else ifeq ($(LOCAL_SDK_VERSION),core_current) |
| 438 | my_link_type := java:core |
| 439 | my_warn_types := |
| 440 | my_allowed_types := java:core |
Dan Willemsen | 62dfb59 | 2016-07-08 21:33:05 -0700 | [diff] [blame] | 441 | else ifneq ($(LOCAL_SDK_VERSION),) |
Dan Willemsen | b47d4e9 | 2017-04-08 00:31:31 -0700 | [diff] [blame] | 442 | my_link_type := java:sdk |
| 443 | my_warn_types := java:system java:platform |
Jiyong Park | 5ebca30 | 2018-01-31 00:14:55 +0900 | [diff] [blame] | 444 | my_allowed_types := java:sdk java:core |
Dan Willemsen | 62dfb59 | 2016-07-08 21:33:05 -0700 | [diff] [blame] | 445 | else |
Dan Willemsen | b47d4e9 | 2017-04-08 00:31:31 -0700 | [diff] [blame] | 446 | my_link_type := java:platform |
| 447 | my_warn_types := |
Jiyong Park | 5ebca30 | 2018-01-31 00:14:55 +0900 | [diff] [blame] | 448 | my_allowed_types := java:sdk java:system java:platform java:core |
Dan Willemsen | 62dfb59 | 2016-07-08 21:33:05 -0700 | [diff] [blame] | 449 | endif |
Dan Willemsen | 62dfb59 | 2016-07-08 21:33:05 -0700 | [diff] [blame] | 450 | |
Dan Willemsen | bb6393c | 2017-11-17 15:39:52 -0800 | [diff] [blame] | 451 | ifdef LOCAL_AAPT2_ONLY |
| 452 | my_link_type += aapt2_only |
| 453 | endif |
| 454 | ifdef LOCAL_USE_AAPT2 |
| 455 | my_allowed_types += aapt2_only |
| 456 | endif |
| 457 | |
| 458 | my_link_deps := $(addprefix JAVA_LIBRARIES:,$(LOCAL_STATIC_JAVA_LIBRARIES) $(LOCAL_JAVA_LIBRARIES)) |
Dan Willemsen | b47d4e9 | 2017-04-08 00:31:31 -0700 | [diff] [blame] | 459 | my_link_deps += $(addprefix APPS:,$(apk_libraries)) |
| 460 | |
| 461 | my_2nd_arch_prefix := $(LOCAL_2ND_ARCH_VAR_PREFIX) |
| 462 | my_common := COMMON |
| 463 | include $(BUILD_SYSTEM)/link_type.mk |
Dan Willemsen | 62dfb59 | 2016-07-08 21:33:05 -0700 | [diff] [blame] | 464 | endif # !LOCAL_IS_HOST_MODULE |
Colin Cross | 3277ba3 | 2017-12-06 14:37:06 -0800 | [diff] [blame] | 465 | |
| 466 | ifneq ($(LOCAL_MODULE_MAKEFILE),$(SOONG_ANDROID_MK)) |
| 467 | |
| 468 | SOONG_CONV.$(LOCAL_MODULE).PROBLEMS := \ |
| 469 | $(SOONG_CONV.$(LOCAL_MODULE).PROBLEMS) $(my_soong_problems) |
| 470 | SOONG_CONV.$(LOCAL_MODULE).DEPS := \ |
| 471 | $(SOONG_CONV.$(LOCAL_MODULE).DEPS) \ |
| 472 | $(LOCAL_STATIC_JAVA_LIBRARIES) \ |
| 473 | $(LOCAL_JAVA_LIBRARIES) \ |
| 474 | $(LOCAL_JNI_SHARED_LIBRARIES) |
| 475 | SOONG_CONV.$(LOCAL_MODULE).TYPE := java |
| 476 | SOONG_CONV := $(SOONG_CONV) $(LOCAL_MODULE) |
| 477 | |
| 478 | endif |