Loading core/base_rules.mk +5 −0 Original line number Diff line number Diff line Loading @@ -101,6 +101,7 @@ endif ifneq (true,$(LOCAL_UNINSTALLABLE_MODULE)) my_module_path := $(strip $(LOCAL_MODULE_PATH)) my_module_relative_path := $(strip $(LOCAL_MODULE_RELATIVE_PATH)) ifeq ($(my_module_path),) ifdef LOCAL_IS_HOST_MODULE partition_tag := Loading @@ -123,6 +124,9 @@ ifeq ($(my_module_path),) $(error $(LOCAL_PATH): unhandled install path "$(install_path_var) for $(LOCAL_MODULE)") endif endif ifneq ($(my_module_relative_path),) my_module_path := $(my_module_path)/$(my_module_relative_path) endif endif # not LOCAL_UNINSTALLABLE_MODULE ifneq ($(strip $(LOCAL_BUILT_MODULE)$(LOCAL_INSTALLED_MODULE)),) Loading @@ -143,6 +147,7 @@ $(module_id) := $(LOCAL_PATH) intermediates := $(call local-intermediates-dir,,$(LOCAL_2ND_ARCH_VAR_PREFIX)) intermediates.COMMON := $(call local-intermediates-dir,COMMON) generated_sources_dir := $(call local-generated-sources-dir) ########################################################### # Pick a name for the intermediate and final targets Loading core/binary.mk +8 −1 Original line number Diff line number Diff line Loading @@ -377,8 +377,15 @@ endif ########################################################### $(my_generated_sources): PRIVATE_MODULE := $(my_register_name) ALL_GENERATED_SOURCES += $(my_generated_sources) my_gen_sources_copy := $(patsubst $(generated_sources_dir)/%,$(intermediates)/%,$(filter $(generated_sources_dir)/%,$(my_generated_sources))) $(my_gen_sources_copy): $(intermediates)/% : $(generated_sources_dir)/% | $(ACP) @echo "Copy: $@" $(copy-file-to-target) my_generated_sources := $(patsubst $(generated_sources_dir)/%,$(intermediates)/%,$(my_generated_sources)) ALL_GENERATED_SOURCES += $(my_generated_sources) ########################################################### ## Compile the .proto files to .cc and then to .o Loading core/build-system.html +30 −12 Original line number Diff line number Diff line Loading @@ -383,7 +383,7 @@ the rest of them easier to read, and you can always refer back to the templates if you need them again later.</p> <p>By default, on the target these are built into /system/bin, and on the host, they're built into <combo>/host/bin. These can be overridden by setting <code>LOCAL_MODULE_PATH</code>. See <code>LOCAL_MODULE_PATH</code> or <code>LOCAL_MODULE_RELATIVE_PATH</code>. See <a href="#moving-targets">Putting targets elsewhere</a> for more.</p> Loading @@ -409,8 +409,8 @@ a couple of examples. <code>$@</code> is the make built-in variable for need to change.</p> <p>You need to put this after you have declared <code>LOCAL_PATH</code> and <code>LOCAL_MODULE</code>, because the <code>$(local-intermediates-dir)</code> and <code>$(local-host-intermediates-dir)</code> macros use these variables <code>LOCAL_MODULE</code>, because the <code>$(local-generated-sources-dir)</code> and <code>$(local-host-generated-sources-dir)</code> macros use these variables to determine where to put the files. <h5>Example 1</h5> Loading @@ -419,7 +419,7 @@ chartables.c, which doesn't depend on anything. And is built by the tool built to $(HOST_OUT_EXECUTABLES)/dftables. Note on the second to last line that a dependency is created on the tool.</p> <pre> intermediates:= $(local-intermediates-dir) intermediates:= $(local-generated-sources-dir) GEN := $(intermediates)/<font color=red>chartables.c</font> $(GEN): PRIVATE_CUSTOM_TOOL = <font color=red>$(HOST_OUT_EXECUTABLES)/dftables $@</font> $(GEN): <font color=red>$(HOST_OUT_EXECUTABLES)/dftables</font> Loading @@ -433,7 +433,7 @@ a file. Pretend that it does something useful. Note how we use a target-specific variable called PRIVATE_INPUT_FILE to store the name of the input file.</p> <pre> intermediates:= $(local-intermediates-dir) intermediates:= $(local-generated-sources-dir) GEN := $(intermediates)/<font color=red>file.c</font> $(GEN): PRIVATE_INPUT_FILE := $(LOCAL_PATH)/<font color=red>input.file</font> $(GEN): PRIVATE_CUSTOM_TOOL = <font color=red>cat $(PRIVATE_INPUT_FILE) > $@</font> Loading @@ -447,7 +447,7 @@ LOCAL_GENERATED_SOURCES += $(GEN) name, and use the same tool, you can combine them. (here the *.lut.h files are the generated ones, and the *.cpp files are the input files)</p> <pre> intermediates:= $(local-intermediates-dir) intermediates:= $(local-generated-sources-dir) GEN := $(addprefix $(intermediates)<font color=red>/kjs/, \ array_object.lut.h \ bool_object.lut.h \</font> Loading Loading @@ -533,16 +533,27 @@ endif <h3><a name="moving-modules"/>Putting modules elsewhere</h3> <p>If you have modules that normally go somewhere, and you need to have them build somewhere else, read this. One use of this is putting files on the root filesystem instead of where they normally go in /system. Add these lines to your Android.mk:</p> build somewhere else, read this.</p> <p>If you have modules that need to go in a subdirectory of their normal location, for example HAL modules that need to go in /system/lib/hw or /vendor/lib/hw, set LOCAL_MODULE_RELATIVE_PATH in your Android.mk, for example:</p> <pre> LOCAL_MODULE_RELATIVE_PATH := hw </pre> <p>If you have modules that need to go in an entirely different location, for example the root filesystem instead of in /system, add these lines to your Android.mk:</p> <pre> LOCAL_MODULE_PATH := $(TARGET_ROOT_OUT_SBIN) LOCAL_UNSTRIPPED_PATH := $(TARGET_ROOT_OUT_SBIN_UNSTRIPPED) </pre> <p>For executables and libraries, you need to also specify a <code>LOCAL_UNSTRIPPED_PATH</code> location, because on target builds, we keep the unstripped executables so GDB can find the symbols.</code> <p>For executables and libraries, you need to specify a <code>LOCAL_UNSTRIPPED_PATH</code> location if you specified a <code>LOCAL_MODULE_PATH</code>, because on target builds, we keep the unstripped executables so GDB can find the symbols. <code>LOCAL_UNSTRIPPED_PATH</code> is not necessary if you only specified <code>LOCAL_MODULE_RELATIVE_PATH</code>.</p> <p>Look in <code>config/envsetup.make</code> for all of the variables defining places to build things.</p> <p>FYI: If you're installing an executable to /sbin, you probably also want to Loading Loading @@ -818,6 +829,13 @@ so the unstripped binary has somewhere to go. An error will occur if you forget to.</p> <p>See <a href="#moving-modules">Putting modules elsewhere</a> for more.</p> <h4>LOCAL_MODULE_RELATIVE_PATH</h4> <p>Instructs the build system to put the module in a subdirectory under the directory that is normal for its type. If you set this you do not need to set <code>LOCAL_UNSTRIPPED_PATH</code>, the unstripped binaries will also use the relative path.</p> <p>See <a href="#moving-modules">Putting modules elsewhere</a> for more.</p> <h4>LOCAL_UNSTRIPPED_PATH</h4> <p>Instructs the build system to put the unstripped version of the module somewhere other than what's normal for its type. Usually, you override this Loading core/clear_vars.mk +1 −0 Original line number Diff line number Diff line Loading @@ -4,6 +4,7 @@ LOCAL_MODULE:= LOCAL_MODULE_PATH:= LOCAL_MODULE_RELATIVE_PATH := LOCAL_MODULE_STEM:= LOCAL_DONT_CHECK_MODULE:= LOCAL_CHECKED_MODULE:= Loading core/definitions.mk +45 −0 Original line number Diff line number Diff line Loading @@ -461,6 +461,51 @@ $(strip \ ) endef ########################################################### ## The generated sources directory. Placing generated ## source files directly in the intermediates directory ## causes problems for multiarch builds, where there are ## two intermediates directories for a single target. Put ## them in a separate directory, and they will be copied to ## each intermediates directory automatically. ########################################################### # $(1): target class, like "APPS" # $(2): target name, like "NotePad" # $(3): if non-empty, this is a HOST target. # $(4): if non-empty, force the generated sources to be COMMON define generated-sources-dir-for $(strip \ $(eval _idfClass := $(strip $(1))) \ $(if $(_idfClass),, \ $(error $(LOCAL_PATH): Class not defined in call to generated-sources-dir-for)) \ $(eval _idfName := $(strip $(2))) \ $(if $(_idfName),, \ $(error $(LOCAL_PATH): Name not defined in call to generated-sources-dir-for)) \ $(eval _idfPrefix := $(if $(strip $(3)),HOST,TARGET)) \ $(if $(filter $(_idfPrefix)-$(_idfClass),$(COMMON_MODULE_CLASSES))$(4), \ $(eval _idfIntBase := $($(_idfPrefix)_OUT_GEN_COMMON)) \ , \ $(eval _idfIntBase := $($(_idfPrefix)_OUT_GEN)) \ ) \ $(_idfIntBase)/$(_idfClass)/$(_idfName)_intermediates \ ) endef # Uses LOCAL_MODULE_CLASS, LOCAL_MODULE, and LOCAL_IS_HOST_MODULE # to determine the generated sources directory. # # $(1): if non-empty, force the intermediates to be COMMON define local-generated-sources-dir $(strip \ $(if $(strip $(LOCAL_MODULE_CLASS)),, \ $(error $(LOCAL_PATH): LOCAL_MODULE_CLASS not defined before call to local-generated-sources-dir)) \ $(if $(strip $(LOCAL_MODULE)),, \ $(error $(LOCAL_PATH): LOCAL_MODULE not defined before call to local-generated-sources-dir)) \ $(call generated-sources-dir-for,$(LOCAL_MODULE_CLASS),$(LOCAL_MODULE),$(LOCAL_IS_HOST_MODULE),$(1)) \ ) endef ########################################################### ## Convert "path/to/libXXX.so" to "-lXXX". ## Any "path/to/libXXX.a" elements pass through unchanged. Loading Loading
core/base_rules.mk +5 −0 Original line number Diff line number Diff line Loading @@ -101,6 +101,7 @@ endif ifneq (true,$(LOCAL_UNINSTALLABLE_MODULE)) my_module_path := $(strip $(LOCAL_MODULE_PATH)) my_module_relative_path := $(strip $(LOCAL_MODULE_RELATIVE_PATH)) ifeq ($(my_module_path),) ifdef LOCAL_IS_HOST_MODULE partition_tag := Loading @@ -123,6 +124,9 @@ ifeq ($(my_module_path),) $(error $(LOCAL_PATH): unhandled install path "$(install_path_var) for $(LOCAL_MODULE)") endif endif ifneq ($(my_module_relative_path),) my_module_path := $(my_module_path)/$(my_module_relative_path) endif endif # not LOCAL_UNINSTALLABLE_MODULE ifneq ($(strip $(LOCAL_BUILT_MODULE)$(LOCAL_INSTALLED_MODULE)),) Loading @@ -143,6 +147,7 @@ $(module_id) := $(LOCAL_PATH) intermediates := $(call local-intermediates-dir,,$(LOCAL_2ND_ARCH_VAR_PREFIX)) intermediates.COMMON := $(call local-intermediates-dir,COMMON) generated_sources_dir := $(call local-generated-sources-dir) ########################################################### # Pick a name for the intermediate and final targets Loading
core/binary.mk +8 −1 Original line number Diff line number Diff line Loading @@ -377,8 +377,15 @@ endif ########################################################### $(my_generated_sources): PRIVATE_MODULE := $(my_register_name) ALL_GENERATED_SOURCES += $(my_generated_sources) my_gen_sources_copy := $(patsubst $(generated_sources_dir)/%,$(intermediates)/%,$(filter $(generated_sources_dir)/%,$(my_generated_sources))) $(my_gen_sources_copy): $(intermediates)/% : $(generated_sources_dir)/% | $(ACP) @echo "Copy: $@" $(copy-file-to-target) my_generated_sources := $(patsubst $(generated_sources_dir)/%,$(intermediates)/%,$(my_generated_sources)) ALL_GENERATED_SOURCES += $(my_generated_sources) ########################################################### ## Compile the .proto files to .cc and then to .o Loading
core/build-system.html +30 −12 Original line number Diff line number Diff line Loading @@ -383,7 +383,7 @@ the rest of them easier to read, and you can always refer back to the templates if you need them again later.</p> <p>By default, on the target these are built into /system/bin, and on the host, they're built into <combo>/host/bin. These can be overridden by setting <code>LOCAL_MODULE_PATH</code>. See <code>LOCAL_MODULE_PATH</code> or <code>LOCAL_MODULE_RELATIVE_PATH</code>. See <a href="#moving-targets">Putting targets elsewhere</a> for more.</p> Loading @@ -409,8 +409,8 @@ a couple of examples. <code>$@</code> is the make built-in variable for need to change.</p> <p>You need to put this after you have declared <code>LOCAL_PATH</code> and <code>LOCAL_MODULE</code>, because the <code>$(local-intermediates-dir)</code> and <code>$(local-host-intermediates-dir)</code> macros use these variables <code>LOCAL_MODULE</code>, because the <code>$(local-generated-sources-dir)</code> and <code>$(local-host-generated-sources-dir)</code> macros use these variables to determine where to put the files. <h5>Example 1</h5> Loading @@ -419,7 +419,7 @@ chartables.c, which doesn't depend on anything. And is built by the tool built to $(HOST_OUT_EXECUTABLES)/dftables. Note on the second to last line that a dependency is created on the tool.</p> <pre> intermediates:= $(local-intermediates-dir) intermediates:= $(local-generated-sources-dir) GEN := $(intermediates)/<font color=red>chartables.c</font> $(GEN): PRIVATE_CUSTOM_TOOL = <font color=red>$(HOST_OUT_EXECUTABLES)/dftables $@</font> $(GEN): <font color=red>$(HOST_OUT_EXECUTABLES)/dftables</font> Loading @@ -433,7 +433,7 @@ a file. Pretend that it does something useful. Note how we use a target-specific variable called PRIVATE_INPUT_FILE to store the name of the input file.</p> <pre> intermediates:= $(local-intermediates-dir) intermediates:= $(local-generated-sources-dir) GEN := $(intermediates)/<font color=red>file.c</font> $(GEN): PRIVATE_INPUT_FILE := $(LOCAL_PATH)/<font color=red>input.file</font> $(GEN): PRIVATE_CUSTOM_TOOL = <font color=red>cat $(PRIVATE_INPUT_FILE) > $@</font> Loading @@ -447,7 +447,7 @@ LOCAL_GENERATED_SOURCES += $(GEN) name, and use the same tool, you can combine them. (here the *.lut.h files are the generated ones, and the *.cpp files are the input files)</p> <pre> intermediates:= $(local-intermediates-dir) intermediates:= $(local-generated-sources-dir) GEN := $(addprefix $(intermediates)<font color=red>/kjs/, \ array_object.lut.h \ bool_object.lut.h \</font> Loading Loading @@ -533,16 +533,27 @@ endif <h3><a name="moving-modules"/>Putting modules elsewhere</h3> <p>If you have modules that normally go somewhere, and you need to have them build somewhere else, read this. One use of this is putting files on the root filesystem instead of where they normally go in /system. Add these lines to your Android.mk:</p> build somewhere else, read this.</p> <p>If you have modules that need to go in a subdirectory of their normal location, for example HAL modules that need to go in /system/lib/hw or /vendor/lib/hw, set LOCAL_MODULE_RELATIVE_PATH in your Android.mk, for example:</p> <pre> LOCAL_MODULE_RELATIVE_PATH := hw </pre> <p>If you have modules that need to go in an entirely different location, for example the root filesystem instead of in /system, add these lines to your Android.mk:</p> <pre> LOCAL_MODULE_PATH := $(TARGET_ROOT_OUT_SBIN) LOCAL_UNSTRIPPED_PATH := $(TARGET_ROOT_OUT_SBIN_UNSTRIPPED) </pre> <p>For executables and libraries, you need to also specify a <code>LOCAL_UNSTRIPPED_PATH</code> location, because on target builds, we keep the unstripped executables so GDB can find the symbols.</code> <p>For executables and libraries, you need to specify a <code>LOCAL_UNSTRIPPED_PATH</code> location if you specified a <code>LOCAL_MODULE_PATH</code>, because on target builds, we keep the unstripped executables so GDB can find the symbols. <code>LOCAL_UNSTRIPPED_PATH</code> is not necessary if you only specified <code>LOCAL_MODULE_RELATIVE_PATH</code>.</p> <p>Look in <code>config/envsetup.make</code> for all of the variables defining places to build things.</p> <p>FYI: If you're installing an executable to /sbin, you probably also want to Loading Loading @@ -818,6 +829,13 @@ so the unstripped binary has somewhere to go. An error will occur if you forget to.</p> <p>See <a href="#moving-modules">Putting modules elsewhere</a> for more.</p> <h4>LOCAL_MODULE_RELATIVE_PATH</h4> <p>Instructs the build system to put the module in a subdirectory under the directory that is normal for its type. If you set this you do not need to set <code>LOCAL_UNSTRIPPED_PATH</code>, the unstripped binaries will also use the relative path.</p> <p>See <a href="#moving-modules">Putting modules elsewhere</a> for more.</p> <h4>LOCAL_UNSTRIPPED_PATH</h4> <p>Instructs the build system to put the unstripped version of the module somewhere other than what's normal for its type. Usually, you override this Loading
core/clear_vars.mk +1 −0 Original line number Diff line number Diff line Loading @@ -4,6 +4,7 @@ LOCAL_MODULE:= LOCAL_MODULE_PATH:= LOCAL_MODULE_RELATIVE_PATH := LOCAL_MODULE_STEM:= LOCAL_DONT_CHECK_MODULE:= LOCAL_CHECKED_MODULE:= Loading
core/definitions.mk +45 −0 Original line number Diff line number Diff line Loading @@ -461,6 +461,51 @@ $(strip \ ) endef ########################################################### ## The generated sources directory. Placing generated ## source files directly in the intermediates directory ## causes problems for multiarch builds, where there are ## two intermediates directories for a single target. Put ## them in a separate directory, and they will be copied to ## each intermediates directory automatically. ########################################################### # $(1): target class, like "APPS" # $(2): target name, like "NotePad" # $(3): if non-empty, this is a HOST target. # $(4): if non-empty, force the generated sources to be COMMON define generated-sources-dir-for $(strip \ $(eval _idfClass := $(strip $(1))) \ $(if $(_idfClass),, \ $(error $(LOCAL_PATH): Class not defined in call to generated-sources-dir-for)) \ $(eval _idfName := $(strip $(2))) \ $(if $(_idfName),, \ $(error $(LOCAL_PATH): Name not defined in call to generated-sources-dir-for)) \ $(eval _idfPrefix := $(if $(strip $(3)),HOST,TARGET)) \ $(if $(filter $(_idfPrefix)-$(_idfClass),$(COMMON_MODULE_CLASSES))$(4), \ $(eval _idfIntBase := $($(_idfPrefix)_OUT_GEN_COMMON)) \ , \ $(eval _idfIntBase := $($(_idfPrefix)_OUT_GEN)) \ ) \ $(_idfIntBase)/$(_idfClass)/$(_idfName)_intermediates \ ) endef # Uses LOCAL_MODULE_CLASS, LOCAL_MODULE, and LOCAL_IS_HOST_MODULE # to determine the generated sources directory. # # $(1): if non-empty, force the intermediates to be COMMON define local-generated-sources-dir $(strip \ $(if $(strip $(LOCAL_MODULE_CLASS)),, \ $(error $(LOCAL_PATH): LOCAL_MODULE_CLASS not defined before call to local-generated-sources-dir)) \ $(if $(strip $(LOCAL_MODULE)),, \ $(error $(LOCAL_PATH): LOCAL_MODULE not defined before call to local-generated-sources-dir)) \ $(call generated-sources-dir-for,$(LOCAL_MODULE_CLASS),$(LOCAL_MODULE),$(LOCAL_IS_HOST_MODULE),$(1)) \ ) endef ########################################################### ## Convert "path/to/libXXX.so" to "-lXXX". ## Any "path/to/libXXX.a" elements pass through unchanged. Loading