diff options
author | Joe Onorato <> | 2009-04-09 20:36:06 -0700 |
---|---|---|
committer | The Android Open Source Project <initial-contribution@android.com> | 2009-04-09 20:36:06 -0700 |
commit | 214a42bbb6e60f1231aa178c114a55dbe363c845 (patch) | |
tree | 136afbef1f68e2e8dc6daa3a9480e9a492e3572c /core/tasks/sdk-addon.mk | |
parent | 60116fc2cbcd32f63a20c3ab1dd2eaf664de0aa9 (diff) | |
download | build-214a42bbb6e60f1231aa178c114a55dbe363c845.zip build-214a42bbb6e60f1231aa178c114a55dbe363c845.tar.gz build-214a42bbb6e60f1231aa178c114a55dbe363c845.tar.bz2 |
AI 145655: am: CL 145618 am: CL 145333 Cloned from CL 144759 by 'g4 patch'.
Original change by joeo@abreu on 2009/04/06 19:54:13.
Implement SDK add-ons in the build system.
- Add an option to use the standard javadoc doclet instead
of droiddoc, since droiddocs non-sdk templates aren't
ready for prime time.
- Add the notion of a stubs for a library. It's only
implemented for java libraries, but when we do native
libraries in the NDK or sdk-addons, it will work there too.
Original author: joeo
Merged from: //branches/cupcake/...
Original author: android-build
Automated import of CL 145655
Diffstat (limited to 'core/tasks/sdk-addon.mk')
-rw-r--r-- | core/tasks/sdk-addon.mk | 87 |
1 files changed, 87 insertions, 0 deletions
diff --git a/core/tasks/sdk-addon.mk b/core/tasks/sdk-addon.mk new file mode 100644 index 0000000..e0b4c70 --- /dev/null +++ b/core/tasks/sdk-addon.mk @@ -0,0 +1,87 @@ +# Copyright (C) 2009 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. + + +# If they didn't define PRODUCT_SDK_ADDON_NAME, then we won't define +# any of these rules. +addon_name := $(strip $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_SDK_ADDON_NAME)) +ifneq ($(addon_name),) + +intermediates := $(HOST_OUT_INTERMEDIATES)/SDK_ADDON/$(addon_name)_intermediates +full_target := $(HOST_OUT_SDK_ADDON)/$(addon_name).zip +staging := $(intermediates)/$(addon_name) + +sdk_addon_deps := +files_to_copy := + +# Files that are built and then copied into the sdk-addon +ifneq ($(strip $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_SDK_ADDON_COPY_MODULES)),) +$(foreach cf,$(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_SDK_ADDON_COPY_MODULES), \ + $(eval _src := $(call module-stubs-files,$(call word-colon,1,$(cf)))) \ + $(if $(_src),,$(eval $(error Unknown or unlinkable module: $(call word-colon,1,$(cf)). Requested by $(INTERNAL_PRODUCT)))) \ + $(eval _dest := $(call word-colon,2,$(cf))) \ + $(eval files_to_copy += $(_src):$(_dest)) \ + ) +endif + +# Files that are copied directly into the sdk-addon +files_to_copy += $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_SDK_ADDON_COPY_FILES) + +# All SDK add-ons have these files +files_to_copy += \ + $(BUILT_SYSTEMIMAGE):images/system.img \ + $(BUILT_USERDATAIMAGE_TARGET):images/userdata.img \ + $(BUILT_RAMDISK_TARGET):images/ramdisk.img \ + $(target_notice_file_txt):images/NOTICE.txt + +# Generate rules to copy the requested files +$(foreach cf,$(files_to_copy), \ + $(eval _src := $(call word-colon,1,$(cf))) \ + $(eval _dest := $(call append-path,$(staging),$(call word-colon,2,$(cf)))) \ + $(eval $(call copy-one-file,$(_src),$(_dest))) \ + $(eval sdk_addon_deps += $(_dest)) \ + ) + +# We don't know about all of the docs files, so depend on the timestamp for +# that, and record the directory, and the packaging rule will just copy the +# whole thing. +doc_module := $(strip $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_SDK_ADDON_DOC_MODULE)) +ifneq ($(doc_module),) + doc_timestamp := $(call doc-timestamp-for, $(doc_module)) + sdk_addon_deps += $(doc_timestamp) + $(full_target): PRIVATE_DOCS_DIR := $(OUT_DOCS)/$(doc_module) +else + $(full_target): PRIVATE_DOCS_DIR := +endif + +$(full_target): PRIVATE_STAGING_DIR := $(staging) + +$(full_target): $(sdk_addon_deps) | $(ACP) + @echo Packaging SDK Addon: $@ + $(hide) mkdir -p $(PRIVATE_STAGING_DIR)/docs/reference + $(hide) if [ -n "$(PRIVATE_DOCS_DIR)" ] ; then \ + $(ACP) -r $(PRIVATE_DOCS_DIR)/* $(PRIVATE_STAGING_DIR)/docs/reference ;\ + fi + $(hide) mkdir -p $(dir $@) + $(hide) ( F=$$(pwd)/$@ ; cd $(PRIVATE_STAGING_DIR) && zip -rq $$F * ) + +.PHONY: sdk_addon +sdk_addon: $(full_target) + +else # addon_name +ifneq ($(filter sdk_addon,$(MAKECMDGOALS)),) +$(error Trying to build sdk_addon, but product '$(INTERNAL_PRODUCT)' does not define one) +endif +endif # addon_name + |