diff --git a/CleanSpec.mk b/CleanSpec.mk index 4cfd21b9c..426e25d12 100644 --- a/CleanSpec.mk +++ b/CleanSpec.mk @@ -643,6 +643,9 @@ $(call add-clean-step, rm -rf $(PRODUCT_OUT)/vendor/odm/build.prop) $(call add-clean-step, rm -rf $(OUT_DIR)/target/product/generic*/*/product) $(call add-clean-step, rm -rf $(OUT_DIR)/target/product/generic*/*/system_ext) +# link_type and jni_link_type files are no longer needed +$(call add-clean-step, find $(OUT_DIR) -type f -name "*link_type" -print0 | xargs -0 rm -f) + # ************************************************ # NEWER CLEAN STEPS MUST BE AT THE END OF THE LIST # ************************************************ diff --git a/core/Makefile b/core/Makefile index f3b4c6a44..40c374fe7 100644 --- a/core/Makefile +++ b/core/Makefile @@ -1346,19 +1346,14 @@ $(installed_system_ext_notice_xml_gz): $(target_system_ext_notice_file_xml_gz) $(installed_odm_notice_xml_gz): $(target_odm_notice_file_xml_gz) $(copy-file-to-target) -# if we've been run my mm, mmm, etc, don't reinstall this every time -ifeq ($(ONE_SHOT_MAKEFILE),) - ALL_DEFAULT_INSTALLED_MODULES += $(installed_notice_html_or_xml_gz) - ALL_DEFAULT_INSTALLED_MODULES += $(installed_vendor_notice_xml_gz) - ALL_DEFAULT_INSTALLED_MODULES += $(installed_product_notice_xml_gz) - ALL_DEFAULT_INSTALLED_MODULES += $(installed_system_ext_notice_xml_gz) - ALL_DEFAULT_INSTALLED_MODULES += $(installed_odm_notice_xml_gz) -endif +ALL_DEFAULT_INSTALLED_MODULES += $(installed_notice_html_or_xml_gz) +ALL_DEFAULT_INSTALLED_MODULES += $(installed_vendor_notice_xml_gz) +ALL_DEFAULT_INSTALLED_MODULES += $(installed_product_notice_xml_gz) +ALL_DEFAULT_INSTALLED_MODULES += $(installed_system_ext_notice_xml_gz) +ALL_DEFAULT_INSTALLED_MODULES += $(installed_odm_notice_xml_gz) endif # PRODUCT_NOTICE_SPLIT -ifeq ($(ONE_SHOT_MAKEFILE),) - ALL_DEFAULT_INSTALLED_MODULES += $(installed_notice_html_or_xml_gz) -endif +ALL_DEFAULT_INSTALLED_MODULES += $(installed_notice_html_or_xml_gz) $(eval $(call combine-notice-files, html, \ $(tools_notice_file_txt), \ diff --git a/core/binary.mk b/core/binary.mk index 8c271d12b..874a4d343 100644 --- a/core/binary.mk +++ b/core/binary.mk @@ -1403,15 +1403,9 @@ built_whole_libraries := \ # libraries have already been linked into the module at that point. # We do, however, care about the NOTICE files for any static # libraries that we use. (see notice_files.mk) -# -# Don't do this in mm, since many of the targets won't exist. -ifeq ($(ONE_SHOT_MAKEFILE),) installed_static_library_notice_file_targets := \ $(foreach lib,$(my_static_libraries) $(my_whole_static_libraries), \ NOTICE-$(if $(LOCAL_IS_HOST_MODULE),HOST$(if $(my_host_cross),_CROSS,),TARGET)-STATIC_LIBRARIES-$(lib)) -else -installed_static_library_notice_file_targets := -endif $(notice_target): | $(installed_static_library_notice_file_targets) $(LOCAL_INSTALLED_MODULE): | $(notice_target) diff --git a/core/config.mk b/core/config.mk index 36b944b82..ee87632e7 100644 --- a/core/config.mk +++ b/core/config.mk @@ -138,6 +138,9 @@ ifdef TARGET_DEVICE_DIR .KATI_READONLY := TARGET_DEVICE_DIR endif +ONE_SHOT_MAKEFILE := +.KATI_READONLY := ONE_SHOT_MAKEFILE + # Set up efficient math functions which are used in make. # Here since this file is included by envsetup as well as during build. include $(BUILD_SYSTEM_COMMON)/math.mk @@ -470,9 +473,6 @@ endif ifneq ($(filter true,$(SOONG_ALLOW_MISSING_DEPENDENCIES)),) ALLOW_MISSING_DEPENDENCIES := true endif -ifneq ($(ONE_SHOT_MAKEFILE),) -ALLOW_MISSING_DEPENDENCIES := true -endif .KATI_READONLY := ALLOW_MISSING_DEPENDENCIES TARGET_BUILD_APPS_USE_PREBUILT_SDK := @@ -604,7 +604,6 @@ TUNE2FS := $(HOST_OUT_EXECUTABLES)/tune2fs$(HOST_EXECUTABLE_SUFFIX) JARJAR := $(HOST_OUT_JAVA_LIBRARIES)/jarjar.jar DATA_BINDING_COMPILER := $(HOST_OUT_JAVA_LIBRARIES)/databinding-compiler.jar FAT16COPY := build/make/tools/fat16copy.py -CHECK_LINK_TYPE := build/make/tools/check_link_type.py CHECK_ELF_FILE := build/make/tools/check_elf_file.py LPMAKE := $(HOST_OUT_EXECUTABLES)/lpmake$(HOST_EXECUTABLE_SUFFIX) BUILD_IMAGE := $(HOST_OUT_EXECUTABLES)/build_image$(HOST_EXECUTABLE_SUFFIX) diff --git a/core/java_common.mk b/core/java_common.mk index ff2886eab..cb88a9e5b 100644 --- a/core/java_common.mk +++ b/core/java_common.mk @@ -494,13 +494,9 @@ ALL_MODULES.$(my_register_name).INTERMEDIATE_SOURCE_DIR := \ ########################################################## # Copy NOTICE files of transitive static dependencies # Don't do this in mm, since many of the targets won't exist. -ifeq ($(ONE_SHOT_MAKEFILE),) installed_static_library_notice_file_targets := \ $(foreach lib,$(LOCAL_STATIC_JAVA_LIBRARIES), \ NOTICE-$(if $(LOCAL_IS_HOST_MODULE),HOST$(if $(my_host_cross),_CROSS,),TARGET)-JAVA_LIBRARIES-$(lib)) -else -installed_static_library_notice_file_targets := -endif $(notice_target): | $(installed_static_library_notice_file_targets) $(LOCAL_INSTALLED_MODULE): | $(notice_target) diff --git a/core/main.mk b/core/main.mk index 608f11b51..9f4b86c5a 100644 --- a/core/main.mk +++ b/core/main.mk @@ -431,43 +431,6 @@ endef subdir_makefiles_inc := . FULL_BUILD := -ifneq ($(ONE_SHOT_MAKEFILE),) -# We've probably been invoked by the "mm" shell function -# with a subdirectory's makefile. -include $(SOONG_ANDROID_MK) $(wildcard $(ONE_SHOT_MAKEFILE)) -# Change CUSTOM_MODULES to include only modules that were -# defined by this makefile; this will install all of those -# modules as a side-effect. Do this after including ONE_SHOT_MAKEFILE -# so that the modules will be installed in the same place they -# would have been with a normal make. -CUSTOM_MODULES := $(sort $(call get-tagged-modules,$(ALL_MODULE_TAGS))) - -# A helper goal printing out install paths -define register_module_install_path -.PHONY: GET-MODULE-INSTALL-PATH-$(1) -GET-MODULE-INSTALL-PATH-$(1): - echo 'INSTALL-PATH: $(1) $(ALL_MODULES.$(1).INSTALLED)' -endef - -SORTED_ALL_MODULES := $(sort $(ALL_MODULES)) -UNIQUE_ALL_MODULES := -$(foreach m,$(SORTED_ALL_MODULES),\ - $(if $(call streq,$(m),$(lastword $(UNIQUE_ALL_MODULES))),,\ - $(eval UNIQUE_ALL_MODULES += $(m)))) -SORTED_ALL_MODULES := - -$(foreach mod,$(UNIQUE_ALL_MODULES),$(if $(ALL_MODULES.$(mod).INSTALLED),\ - $(eval $(call register_module_install_path,$(mod)))\ - $(foreach path,$(ALL_MODULES.$(mod).PATH),\ - $(eval my_path_prefix := GET-INSTALL-PATH-IN)\ - $(foreach component,$(subst /,$(space),$(path)),\ - $(eval my_path_prefix := $$(my_path_prefix)-$$(component))\ - $(eval .PHONY: $$(my_path_prefix))\ - $(eval $$(my_path_prefix): GET-MODULE-INSTALL-PATH-$(mod)))))) -UNIQUE_ALL_MODULES := - -else # ONE_SHOT_MAKEFILE - ifneq ($(dont_bother),true) FULL_BUILD := true # @@ -489,8 +452,6 @@ droid_targets : blueprint_tools endif # dont_bother -endif # ONE_SHOT_MAKEFILE - ifndef subdir_makefiles_total subdir_makefiles_total := $(words init post finish) endif @@ -716,7 +677,7 @@ $(foreach m,$(ALL_MODULES), \ $(eval req_files := )\ $(foreach req_mod,$(req_mods), \ $(eval req_file := $(filter $(TARGET_OUT_ROOT)/%, $(call module-installed-files,$(req_mod)))) \ - $(if $(strip $(req_file))$(ONE_SHOT_MAKEFILE),\ + $(if $(strip $(req_file)),\ ,\ $(error $(m).LOCAL_TARGET_REQUIRED_MODULES : illegal value $(req_mod) : not a device module. If you want to specify host modules to be required to be installed along with your host module, add those module names to LOCAL_REQUIRED_MODULES instead)\ )\ @@ -742,7 +703,7 @@ $(foreach m,$(ALL_MODULES), \ $(eval req_files := )\ $(foreach req_mod,$(req_mods), \ $(eval req_file := $(filter $(HOST_OUT)/%, $(call module-installed-files,$(req_mod)))) \ - $(if $(strip $(req_file))$(ONE_SHOT_MAKEFILE),\ + $(if $(strip $(req_file)),\ ,\ $(error $(m).LOCAL_HOST_REQUIRED_MODULES : illegal value $(req_mod) : not a host module. If you want to specify target modules to be required to be installed along with your target module, add those module names to LOCAL_REQUIRED_MODULES instead)\ )\ @@ -1011,45 +972,6 @@ ifdef link_type_error $(error exiting from previous errors) endif -# The intermediate filename for link type rules -# -# APPS are special -- they have up to three different rules: -# 1. The COMMON rule for Java libraries -# 2. The jni_link_type rule for embedded native code -# 3. The 2ND_jni_link_type for the second architecture native code -define link-type-file -$(eval _ltf_aux_variant:=$(link-type-aux-variant))\ -$(if $(_ltf_aux_variant),$(call aux-variant-load-env,$(_ltf_aux_variant)))\ -$(call intermediates-dir-for,$(link-type-class),$(link-type-name),$(filter AUX HOST HOST_CROSS,$(link-type-prefix)),$(link-type-common),$(link-type-2ndarchprefix),$(filter HOST_CROSS,$(link-type-prefix)))/$(if $(filter APPS,$(link-type-class)),$(if $(link-type-common),,$(link-type-2ndarchprefix)jni_))link_type\ -$(if $(_ltf_aux_variant),$(call aux-variant-load-env,none))\ -$(eval _ltf_aux_variant:=) -endef - -# Write out the file-based link_type rules for the ALLOW_MISSING_DEPENDENCIES -# case. We always need to write the file for mm to work, but only need to -# check it if we weren't able to check it when reading the Android.mk files. -define link-type-file-rule -my_link_type_deps := $(foreach l,$($(1).DEPS),$(call link-type-file,$(l))) -my_link_type_file := $(call link-type-file,$(1)) -$($(1).BUILT): | $$(my_link_type_file) -$$(my_link_type_file): PRIVATE_DEPS := $$(my_link_type_deps) -ifeq ($($(1).MISSING),true) -$$(my_link_type_file): $(CHECK_LINK_TYPE) -endif -$$(my_link_type_file): $$(my_link_type_deps) - @echo Check module type: $$@ - $$(hide) mkdir -p $$(dir $$@) && rm -f $$@ -ifeq ($($(1).MISSING),true) - $$(hide) $(CHECK_LINK_TYPE) --makefile $($(1).MAKEFILE) --module $(link-type-name) \ - --type "$($(1).TYPE)" $(addprefix --allowed ,$($(1).ALLOWED)) \ - $(addprefix --warn ,$($(1).WARN)) $$(PRIVATE_DEPS) -endif - $$(hide) echo "$($(1).TYPE)" >$$@ -endef - -$(foreach lt,$(ALL_LINK_TYPES),\ - $(eval $(call link-type-file-rule,$(lt)))) - # ------------------------------------------------------------------- # Figure out our module sets. # diff --git a/core/tasks/module-info.mk b/core/tasks/module-info.mk index eb313802d..f6cec1525 100644 --- a/core/tasks/module-info.mk +++ b/core/tasks/module-info.mk @@ -24,10 +24,6 @@ $(MODULE_INFO_JSON): $(hide) echo '}' >> $@ -# If ONE_SHOT_MAKEFILE is set, our view of the world is smaller, so don't -# rewrite the file in that came. -ifndef ONE_SHOT_MAKEFILE droidcore: $(MODULE_INFO_JSON) -endif $(call dist-for-goals, general-tests, $(MODULE_INFO_JSON)) diff --git a/core/tasks/sdk-addon.mk b/core/tasks/sdk-addon.mk index 62d9aa6dd..7f777a549 100644 --- a/core/tasks/sdk-addon.mk +++ b/core/tasks/sdk-addon.mk @@ -14,8 +14,6 @@ .PHONY: sdk_addon -ifndef ONE_SHOT_MAKEFILE - # If they didn't define PRODUCT_SDK_ADDON_NAME, then we won't define # any of these rules. addon_name := $(PRODUCT_SDK_ADDON_NAME) @@ -150,5 +148,3 @@ ifneq ($(filter sdk_addon,$(MAKECMDGOALS)),) $(error Trying to build sdk_addon, but product '$(INTERNAL_PRODUCT)' does not define one) endif endif # addon_name - -endif # !ONE_SHOT_MAKEFILE diff --git a/tools/check_link_type.py b/tools/check_link_type.py deleted file mode 100755 index 40754adc6..000000000 --- a/tools/check_link_type.py +++ /dev/null @@ -1,80 +0,0 @@ -#!/usr/bin/env python -# -# Copyright (C) 2016 The Android Open Source Project -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -"""Utility to verify modules link against acceptable module types""" - -from __future__ import print_function -import argparse -import os -import sys - -WARNING_MSG = ('\033[1m%(makefile)s: \033[35mwarning:\033[0m\033[1m ' - '%(module)s (%(type)s) should not link to %(dep_name)s (%(dep_type)s)' - '\033[0m') -ERROR_MSG = ('\033[1m%(makefile)s: \033[31merror:\033[0m\033[1m ' - '%(module)s (%(type)s) should not link to %(dep_name)s (%(dep_type)s)' - '\033[0m') - -def parse_args(): - """Parse commandline arguments.""" - parser = argparse.ArgumentParser(description='Check link types') - parser.add_argument('--makefile', help='Makefile defining module') - parser.add_argument('--module', help='The module being checked') - parser.add_argument('--type', help='The link type of module') - parser.add_argument('--allowed', help='Allow deps to use these types', - action='append', default=[], metavar='TYPE') - parser.add_argument('--warn', help='Warn if deps use these types', - action='append', default=[], metavar='TYPE') - parser.add_argument('deps', help='The dependencies to check', - metavar='DEP', nargs='*') - return parser.parse_args() - -def print_msg(msg, args, dep_name, dep_type): - """Print a warning or error message""" - print(msg % { - "makefile": args.makefile, - "module": args.module, - "type": args.type, - "dep_name": dep_name, - "dep_type": dep_type}, file=sys.stderr) - -def main(): - """Program entry point.""" - args = parse_args() - - failed = False - for dep in args.deps: - dep_name = os.path.basename(os.path.dirname(dep)) - if dep_name.endswith('_intermediates'): - dep_name = dep_name[:len(dep_name)-len('_intermediates')] - - with open(dep, 'r') as dep_file: - dep_types = dep_file.read().strip().split(' ') - - for dep_type in dep_types: - if dep_type in args.allowed: - continue - if dep_type in args.warn: - print_msg(WARNING_MSG, args, dep_name, dep_type) - else: - print_msg(ERROR_MSG, args, dep_name, dep_type) - failed = True - - if failed: - sys.exit(1) - -if __name__ == '__main__': - main()