Raphael | 2ff496b | 2011-02-15 16:08:36 -0800 | [diff] [blame] | 1 | # Makefile to build the SDK repository packages. |
| 2 | |
| 3 | .PHONY: sdk_repo |
| 4 | |
Raphael | 4802378 | 2011-02-23 16:46:42 -0800 | [diff] [blame] | 5 | SDK_REPO_DEPS := |
| 6 | SDK_REPO_XML_ARGS := |
| 7 | |
Raphael | 2ff496b | 2011-02-15 16:08:36 -0800 | [diff] [blame] | 8 | # Define the name of a package zip file to generate |
| 9 | # $1=OS (e.g. linux-x86, windows, etc) |
| 10 | # $2=sdk zip (e.g. out/host/linux.../android-eng-sdk.zip) |
| 11 | # $3=package to create (e.g. tools, docs, etc.) |
| 12 | # |
| 13 | define sdk-repo-pkg-zip |
Raphael | 4802378 | 2011-02-23 16:46:42 -0800 | [diff] [blame] | 14 | $(dir $(2))/sdk-repo-$(1)-$(3)-$(FILE_NAME_TAG).zip |
Raphael | 2ff496b | 2011-02-15 16:08:36 -0800 | [diff] [blame] | 15 | endef |
| 16 | |
| 17 | # Defines the rule to build an SDK repository package by zipping all |
| 18 | # the content of the given directory. |
| 19 | # E.g. given a folder out/host/linux.../sdk/android-eng-sdk/tools |
| 20 | # this generates an sdk-repo-linux-tools that contains tools/* |
| 21 | # |
| 22 | # $1=OS (e.g. linux-x86, windows, etc) |
| 23 | # $2=sdk zip (e.g. out/host/linux.../android-eng-sdk.zip) |
| 24 | # $3=package to create (e.g. tools, docs, etc.) |
| 25 | # |
| 26 | # The rule depends on the SDK zip file, which is defined by $2. |
| 27 | # |
| 28 | define mk-sdk-repo-pkg-1 |
| 29 | $(call sdk-repo-pkg-zip,$(1),$(2),$(3)): $(2) |
| 30 | @echo "Building SDK repository package $(3) from $(notdir $(2))" |
Raphael | 4802378 | 2011-02-23 16:46:42 -0800 | [diff] [blame] | 31 | $(hide) cd $(basename $(2)) && \ |
| 32 | zip -9rq ../$(notdir $(call sdk-repo-pkg-zip,$(1),$(2),$(3))) $(3)/* |
Raphael | 2ff496b | 2011-02-15 16:08:36 -0800 | [diff] [blame] | 33 | $(call dist-for-goals, sdk_repo, $(call sdk-repo-pkg-zip,$(1),$(2),$(3))) |
Raphael | 4802378 | 2011-02-23 16:46:42 -0800 | [diff] [blame] | 34 | SDK_REPO_XML_ARGS += $(3) $(1) \ |
| 35 | $(call sdk-repo-pkg-zip,$(1),$(2),$(3)):$(notdir $(call sdk-repo-pkg-zip,$(1),$(2),$(3))) |
Raphael | 2ff496b | 2011-02-15 16:08:36 -0800 | [diff] [blame] | 36 | endef |
| 37 | |
| 38 | # Defines the rule to build an SDK repository package when the |
| 39 | # package directory contains a single platform-related inner directory. |
| 40 | # E.g. given a folder out/host/linux.../sdk/android-eng-sdk/samples/android-N |
| 41 | # this generates an sdk-repo-linux-samples that contains android-N/* |
| 42 | # |
| 43 | # $1=OS (e.g. linux-x86, windows, etc) |
| 44 | # $2=sdk zip (e.g. out/host/linux.../android-eng-sdk.zip) |
| 45 | # $3=package to create (e.g. platforms, samples, etc.) |
| 46 | # |
| 47 | # The rule depends on the SDK zip file, which is defined by $2. |
| 48 | # |
| 49 | define mk-sdk-repo-pkg-2 |
| 50 | $(call sdk-repo-pkg-zip,$(1),$(2),$(3)): $(2) |
| 51 | @echo "Building SDK repository package $(3) from $(notdir $(2))" |
Raphael | 4802378 | 2011-02-23 16:46:42 -0800 | [diff] [blame] | 52 | $(hide) cd $(basename $(2))/$(3) && \ |
| 53 | zip -9rq ../../$(notdir $(call sdk-repo-pkg-zip,$(1),$(2),$(3))) * |
Raphael | 2ff496b | 2011-02-15 16:08:36 -0800 | [diff] [blame] | 54 | $(call dist-for-goals, sdk_repo, $(call sdk-repo-pkg-zip,$(1),$(2),$(3))) |
Raphael | 4802378 | 2011-02-23 16:46:42 -0800 | [diff] [blame] | 55 | SDK_REPO_XML_ARGS += $(3) $(1) \ |
| 56 | $(call sdk-repo-pkg-zip,$(1),$(2),$(3)):$(notdir $(call sdk-repo-pkg-zip,$(1),$(2),$(3))) |
Raphael | 2ff496b | 2011-02-15 16:08:36 -0800 | [diff] [blame] | 57 | endef |
| 58 | |
Raphael Moll | da9eabd | 2011-09-28 11:18:34 -0700 | [diff] [blame^] | 59 | # Defines the rule to build an SDK sources package. |
| 60 | # |
| 61 | # $1=OS (e.g. linux-x86, windows, etc) |
| 62 | # $2=sdk zip (e.g. out/host/linux.../android-eng-sdk.zip) |
| 63 | # $3=package to create, must be "sources" |
| 64 | # |
| 65 | define mk-sdk-repo-sources |
| 66 | $(call sdk-repo-pkg-zip,$(1),$(2),$(3)): $(2) $(TOPDIR)development/sdk/source_source.properties |
| 67 | @echo "Building SDK sources package" |
| 68 | $(hide) $(TOPDIR)development/build/tools/mk_sources_zip.py \ |
| 69 | $(TOPDIR)development/sdk/source_source.properties \ |
| 70 | $(call sdk-repo-pkg-zip,$(1),$(2),$(3)) \ |
| 71 | $(TOPDIR). |
| 72 | $(call dist-for-goals, sdk_repo, $(call sdk-repo-pkg-zip,$(1),$(2),$(3))) |
| 73 | SDK_REPO_XML_ARGS += $(3) $(1) \ |
| 74 | $(call sdk-repo-pkg-zip,$(1),$(2),$(3)):$(notdir $(call sdk-repo-pkg-zip,$(1),$(2),$(3))) |
| 75 | endef |
Raphael | 2ff496b | 2011-02-15 16:08:36 -0800 | [diff] [blame] | 76 | |
Raphael | 4802378 | 2011-02-23 16:46:42 -0800 | [diff] [blame] | 77 | # ----------------------------------------------------------------- |
Raphael | 2ff496b | 2011-02-15 16:08:36 -0800 | [diff] [blame] | 78 | # Rules for win_sdk |
| 79 | |
| 80 | ifneq ($(WIN_SDK_ZIP),) |
| 81 | |
| 82 | # docs, platforms and samples have nothing OS-dependent right now. |
| 83 | $(eval $(call mk-sdk-repo-pkg-1,windows,$(WIN_SDK_ZIP),tools)) |
| 84 | $(eval $(call mk-sdk-repo-pkg-1,windows,$(WIN_SDK_ZIP),platform-tools)) |
| 85 | |
| 86 | SDK_REPO_DEPS += \ |
Raphael Moll | 4dedff6 | 2011-09-27 20:17:07 -0700 | [diff] [blame] | 87 | $(call sdk-repo-pkg-zip,windows,$(WIN_SDK_ZIP),tools) \ |
Raphael | 2ff496b | 2011-02-15 16:08:36 -0800 | [diff] [blame] | 88 | $(call sdk-repo-pkg-zip,windows,$(WIN_SDK_ZIP),platform-tools) |
| 89 | |
| 90 | endif |
| 91 | |
Raphael | 4802378 | 2011-02-23 16:46:42 -0800 | [diff] [blame] | 92 | # ----------------------------------------------------------------- |
Raphael | 2ff496b | 2011-02-15 16:08:36 -0800 | [diff] [blame] | 93 | # Rules for main host sdk |
| 94 | |
| 95 | ifneq ($(filter sdk win_sdk,$(MAKECMDGOALS)),) |
| 96 | |
| 97 | $(eval $(call mk-sdk-repo-pkg-1,$(HOST_OS),$(MAIN_SDK_ZIP),tools)) |
| 98 | $(eval $(call mk-sdk-repo-pkg-1,$(HOST_OS),$(MAIN_SDK_ZIP),platform-tools)) |
| 99 | $(eval $(call mk-sdk-repo-pkg-1,$(HOST_OS),$(MAIN_SDK_ZIP),docs)) |
| 100 | $(eval $(call mk-sdk-repo-pkg-2,$(HOST_OS),$(MAIN_SDK_ZIP),platforms)) |
| 101 | $(eval $(call mk-sdk-repo-pkg-2,$(HOST_OS),$(MAIN_SDK_ZIP),samples)) |
Raphael Moll | 4dedff6 | 2011-09-27 20:17:07 -0700 | [diff] [blame] | 102 | $(eval $(call mk-sdk-repo-pkg-2,$(HOST_OS),$(MAIN_SDK_ZIP),system-images)) |
Raphael Moll | da9eabd | 2011-09-28 11:18:34 -0700 | [diff] [blame^] | 103 | $(eval $(call mk-sdk-repo-sources,$(HOST_OS),$(MAIN_SDK_ZIP),sources)) |
Raphael | 2ff496b | 2011-02-15 16:08:36 -0800 | [diff] [blame] | 104 | |
| 105 | SDK_REPO_DEPS += \ |
| 106 | $(call sdk-repo-pkg-zip,$(HOST_OS),$(MAIN_SDK_ZIP),tools) \ |
| 107 | $(call sdk-repo-pkg-zip,$(HOST_OS),$(MAIN_SDK_ZIP),platform-tools) \ |
| 108 | $(call sdk-repo-pkg-zip,$(HOST_OS),$(MAIN_SDK_ZIP),docs) \ |
| 109 | $(call sdk-repo-pkg-zip,$(HOST_OS),$(MAIN_SDK_ZIP),platforms) \ |
| 110 | $(call sdk-repo-pkg-zip,$(HOST_OS),$(MAIN_SDK_ZIP),samples) \ |
Raphael Moll | da9eabd | 2011-09-28 11:18:34 -0700 | [diff] [blame^] | 111 | $(call sdk-repo-pkg-zip,$(HOST_OS),$(MAIN_SDK_ZIP),system-images) \ |
| 112 | $(call sdk-repo-pkg-zip,$(HOST_OS),$(MAIN_SDK_ZIP),sources) |
Raphael | 2ff496b | 2011-02-15 16:08:36 -0800 | [diff] [blame] | 113 | |
| 114 | endif |
| 115 | |
Raphael | 4802378 | 2011-02-23 16:46:42 -0800 | [diff] [blame] | 116 | # ----------------------------------------------------------------- |
Raphael | 2ff496b | 2011-02-15 16:08:36 -0800 | [diff] [blame] | 117 | # Rules for sdk addon |
| 118 | |
| 119 | ifneq ($(ADDON_SDK_ZIP),) |
| 120 | |
| 121 | # ADDON_SDK_ZIP is defined in build/core/tasks/sdk-addon.sh and is |
| 122 | # already packaged correctly. All we have to do is dist it with |
| 123 | # a different destination name. |
| 124 | |
Raphael | 4802378 | 2011-02-23 16:46:42 -0800 | [diff] [blame] | 125 | RENAMED_ADDON_ZIP := $(ADDON_SDK_ZIP):$(notdir $(call sdk-repo-pkg-zip,$(HOST_OS),$(ADDON_SDK_ZIP),addon)) |
| 126 | |
| 127 | $(call dist-for-goals, sdk_repo, $(RENAMED_ADDON_ZIP)) |
| 128 | |
| 129 | # Also generate the addon.xml using the latest schema and the renamed addon zip |
| 130 | |
| 131 | SDK_ADDON_XML := $(dir $(ADDON_SDK_ZIP))/addon.xml |
| 132 | |
| 133 | SDK_ADDON_XSD := \ |
| 134 | $(lastword \ |
| 135 | $(wildcard \ |
| 136 | $(TOPDIR)sdk/sdkmanager/libs/sdklib/src/com/android/sdklib/repository/sdk-addon-*.xsd \ |
| 137 | )) |
| 138 | |
| 139 | $(SDK_ADDON_XML): $(ADDON_SDK_ZIP) |
| 140 | $(hide) $(TOPDIR)development/build/tools/mk_sdk_repo_xml.sh \ |
| 141 | $(SDK_ADDON_XML) $(SDK_ADDON_XSD) add-on $(HOST_OS) $(RENAMED_ADDON_ZIP) |
| 142 | |
| 143 | $(call dist-for-goals, sdk_repo, $(SDK_ADDON_XML)) |
Raphael | 2ff496b | 2011-02-15 16:08:36 -0800 | [diff] [blame] | 144 | |
| 145 | endif |
| 146 | |
Raphael | 4802378 | 2011-02-23 16:46:42 -0800 | [diff] [blame] | 147 | # ----------------------------------------------------------------- |
| 148 | # Rules for the SDK Repository XML |
Raphael | 2ff496b | 2011-02-15 16:08:36 -0800 | [diff] [blame] | 149 | |
Raphael | 4802378 | 2011-02-23 16:46:42 -0800 | [diff] [blame] | 150 | SDK_REPO_XML := $(HOST_OUT)/sdk/repository.xml |
| 151 | |
| 152 | ifneq ($(SDK_REPO_XML_ARGS),) |
| 153 | |
| 154 | # Pickup the most recent xml schema |
| 155 | SDK_REPO_XSD := \ |
| 156 | $(lastword \ |
| 157 | $(wildcard \ |
| 158 | $(TOPDIR)sdk/sdkmanager/libs/sdklib/src/com/android/sdklib/repository/sdk-repository-*.xsd \ |
| 159 | )) |
| 160 | |
| 161 | $(SDK_REPO_XML): $(SDK_REPO_DEPS) |
| 162 | $(hide) $(TOPDIR)development/build/tools/mk_sdk_repo_xml.sh \ |
| 163 | $(SDK_REPO_XML) $(SDK_REPO_XSD) $(SDK_REPO_XML_ARGS) |
| 164 | |
| 165 | $(call dist-for-goals, sdk_repo, $(SDK_REPO_XML)) |
| 166 | |
| 167 | else |
| 168 | |
| 169 | $(SDK_REPO_XML): ; |
| 170 | |
| 171 | endif |
| 172 | |
| 173 | # ----------------------------------------------------------------- |
| 174 | |
| 175 | sdk_repo: $(SDK_REPO_DEPS) $(SDK_REPO_XML) |
Raphael | 2ff496b | 2011-02-15 16:08:36 -0800 | [diff] [blame] | 176 | @echo "Packing of SDK repository done" |
| 177 | |