Merge "Deprecate implicit make rules"

am: 6d3acda913

Change-Id: Ic04398750a692d3bbae34b78420d61c6e5ee2356
This commit is contained in:
Dan Willemsen 2018-06-20 21:13:33 -07:00 committed by android-build-merger
commit 45883d45ec
3 changed files with 31 additions and 5 deletions

View file

@ -1,5 +1,30 @@
# Build System Changes for Android.mk Writers # Build System Changes for Android.mk Writers
## Implicit make rules are deprecated {#implicit_rules}
Implicit rules look something like the following:
``` make
$(TARGET_OUT_SHARED_LIBRARIES)/%_vendor.so: $(TARGET_OUT_SHARED_LIBRARIES)/%.so
...
%.o : %.foo
...
```
These can have wide ranging effects across unrelated modules, so they're now deprecated. Instead, use static pattern rules, which are similar, but explicitly match the specified outputs:
``` make
libs := $(foreach lib,libfoo libbar,$(TARGET_OUT_SHARED_LIBRARIES)/$(lib)_vendor.so)
$(libs): %_vendor.so: %.so
...
files := $(wildcard $(LOCAL_PATH)/*.foo)
gen := $(patsubst $(LOCAL_PATH)/%.foo,$(intermediates)/%.o,$(files))
$(gen): %.o : %.foo
...
```
## Removing '/' from Valid Module Names {#name_slash} ## Removing '/' from Valid Module Names {#name_slash}
The build system uses module names in path names in many places. Having an The build system uses module names in path names in many places. Having an

View file

@ -1602,10 +1602,15 @@ built_whole_libraries := \
# libraries have already been linked into the module at that point. # libraries have already been linked into the module at that point.
# We do, however, care about the NOTICE files for any static # We do, however, care about the NOTICE files for any static
# libraries that we use. (see notice_files.mk) # 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 := \ installed_static_library_notice_file_targets := \
$(foreach lib,$(my_static_libraries) $(my_whole_static_libraries), \ $(foreach lib,$(my_static_libraries) $(my_whole_static_libraries), \
NOTICE-$(if $(LOCAL_IS_HOST_MODULE),HOST,TARGET)-STATIC_LIBRARIES-$(lib)) NOTICE-$(if $(LOCAL_IS_HOST_MODULE),HOST,TARGET)-STATIC_LIBRARIES-$(lib))
else
installed_static_library_notice_file_targets :=
endif
# Default is -fno-rtti. # Default is -fno-rtti.
ifeq ($(strip $(LOCAL_RTTI_FLAG)),) ifeq ($(strip $(LOCAL_RTTI_FLAG)),)

View file

@ -420,10 +420,6 @@ include $(SOONG_ANDROID_MK) $(wildcard $(ONE_SHOT_MAKEFILE))
# would have been with a normal make. # would have been with a normal make.
CUSTOM_MODULES := $(sort $(call get-tagged-modules,$(ALL_MODULE_TAGS))) CUSTOM_MODULES := $(sort $(call get-tagged-modules,$(ALL_MODULE_TAGS)))
FULL_BUILD := FULL_BUILD :=
# Stub out the notice targets, which probably aren't defined
# when using ONE_SHOT_MAKEFILE.
NOTICE-HOST-%: ;
NOTICE-TARGET-%: ;
# A helper goal printing out install paths # A helper goal printing out install paths
define register_module_install_path define register_module_install_path