Raphael | 922ee89 | 2011-02-15 16:08:36 -0800 | [diff] [blame] | 1 | # Makefile to build the SDK repository packages. |
| 2 | |
| 3 | .PHONY: sdk_repo |
| 4 | |
Raphael | 31d15b9 | 2011-02-23 16:46:42 -0800 | [diff] [blame] | 5 | SDK_REPO_DEPS := |
| 6 | SDK_REPO_XML_ARGS := |
| 7 | |
Raphael | 922ee89 | 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 | 31d15b9 | 2011-02-23 16:46:42 -0800 | [diff] [blame] | 14 | $(dir $(2))/sdk-repo-$(1)-$(3)-$(FILE_NAME_TAG).zip |
Raphael | 922ee89 | 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 | 31d15b9 | 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 | 922ee89 | 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 | 31d15b9 | 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 | 922ee89 | 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 | 31d15b9 | 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 | 922ee89 | 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 | 31d15b9 | 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 | 922ee89 | 2011-02-15 16:08:36 -0800 | [diff] [blame] | 57 | endef |
| 58 | |
| 59 | |
Raphael | 31d15b9 | 2011-02-23 16:46:42 -0800 | [diff] [blame] | 60 | # ----------------------------------------------------------------- |
Raphael | 922ee89 | 2011-02-15 16:08:36 -0800 | [diff] [blame] | 61 | # Rules for win_sdk |
| 62 | |
| 63 | ifneq ($(WIN_SDK_ZIP),) |
| 64 | |
| 65 | # docs, platforms and samples have nothing OS-dependent right now. |
| 66 | $(eval $(call mk-sdk-repo-pkg-1,windows,$(WIN_SDK_ZIP),tools)) |
| 67 | $(eval $(call mk-sdk-repo-pkg-1,windows,$(WIN_SDK_ZIP),platform-tools)) |
| 68 | |
| 69 | SDK_REPO_DEPS += \ |
| 70 | $(call sdk-repo-pkg-zip,windows,$(WIN_SDK_ZIP),tools) \ |
| 71 | $(call sdk-repo-pkg-zip,windows,$(WIN_SDK_ZIP),platform-tools) |
| 72 | |
| 73 | endif |
| 74 | |
Raphael | 31d15b9 | 2011-02-23 16:46:42 -0800 | [diff] [blame] | 75 | # ----------------------------------------------------------------- |
Raphael | 922ee89 | 2011-02-15 16:08:36 -0800 | [diff] [blame] | 76 | # Rules for main host sdk |
| 77 | |
| 78 | ifneq ($(filter sdk win_sdk,$(MAKECMDGOALS)),) |
| 79 | |
| 80 | $(eval $(call mk-sdk-repo-pkg-1,$(HOST_OS),$(MAIN_SDK_ZIP),tools)) |
| 81 | $(eval $(call mk-sdk-repo-pkg-1,$(HOST_OS),$(MAIN_SDK_ZIP),platform-tools)) |
| 82 | $(eval $(call mk-sdk-repo-pkg-1,$(HOST_OS),$(MAIN_SDK_ZIP),docs)) |
| 83 | $(eval $(call mk-sdk-repo-pkg-2,$(HOST_OS),$(MAIN_SDK_ZIP),platforms)) |
| 84 | $(eval $(call mk-sdk-repo-pkg-2,$(HOST_OS),$(MAIN_SDK_ZIP),samples)) |
| 85 | |
| 86 | SDK_REPO_DEPS += \ |
| 87 | $(call sdk-repo-pkg-zip,$(HOST_OS),$(MAIN_SDK_ZIP),tools) \ |
| 88 | $(call sdk-repo-pkg-zip,$(HOST_OS),$(MAIN_SDK_ZIP),platform-tools) \ |
| 89 | $(call sdk-repo-pkg-zip,$(HOST_OS),$(MAIN_SDK_ZIP),docs) \ |
| 90 | $(call sdk-repo-pkg-zip,$(HOST_OS),$(MAIN_SDK_ZIP),platforms) \ |
| 91 | $(call sdk-repo-pkg-zip,$(HOST_OS),$(MAIN_SDK_ZIP),samples) \ |
| 92 | |
| 93 | endif |
| 94 | |
Raphael | 31d15b9 | 2011-02-23 16:46:42 -0800 | [diff] [blame] | 95 | # ----------------------------------------------------------------- |
Raphael | 922ee89 | 2011-02-15 16:08:36 -0800 | [diff] [blame] | 96 | # Rules for sdk addon |
| 97 | |
| 98 | ifneq ($(ADDON_SDK_ZIP),) |
| 99 | |
| 100 | # ADDON_SDK_ZIP is defined in build/core/tasks/sdk-addon.sh and is |
| 101 | # already packaged correctly. All we have to do is dist it with |
| 102 | # a different destination name. |
| 103 | |
Raphael | 31d15b9 | 2011-02-23 16:46:42 -0800 | [diff] [blame] | 104 | RENAMED_ADDON_ZIP := $(ADDON_SDK_ZIP):$(notdir $(call sdk-repo-pkg-zip,$(HOST_OS),$(ADDON_SDK_ZIP),addon)) |
| 105 | |
| 106 | $(call dist-for-goals, sdk_repo, $(RENAMED_ADDON_ZIP)) |
| 107 | |
| 108 | # Also generate the addon.xml using the latest schema and the renamed addon zip |
| 109 | |
| 110 | SDK_ADDON_XML := $(dir $(ADDON_SDK_ZIP))/addon.xml |
| 111 | |
| 112 | SDK_ADDON_XSD := \ |
| 113 | $(lastword \ |
| 114 | $(wildcard \ |
| 115 | $(TOPDIR)sdk/sdkmanager/libs/sdklib/src/com/android/sdklib/repository/sdk-addon-*.xsd \ |
| 116 | )) |
| 117 | |
| 118 | $(SDK_ADDON_XML): $(ADDON_SDK_ZIP) |
| 119 | $(hide) $(TOPDIR)development/build/tools/mk_sdk_repo_xml.sh \ |
| 120 | $(SDK_ADDON_XML) $(SDK_ADDON_XSD) add-on $(HOST_OS) $(RENAMED_ADDON_ZIP) |
| 121 | |
| 122 | $(call dist-for-goals, sdk_repo, $(SDK_ADDON_XML)) |
Raphael | 922ee89 | 2011-02-15 16:08:36 -0800 | [diff] [blame] | 123 | |
| 124 | endif |
| 125 | |
Raphael | 31d15b9 | 2011-02-23 16:46:42 -0800 | [diff] [blame] | 126 | # ----------------------------------------------------------------- |
| 127 | # Rules for the SDK Repository XML |
Raphael | 922ee89 | 2011-02-15 16:08:36 -0800 | [diff] [blame] | 128 | |
Raphael | 31d15b9 | 2011-02-23 16:46:42 -0800 | [diff] [blame] | 129 | SDK_REPO_XML := $(HOST_OUT)/sdk/repository.xml |
| 130 | |
| 131 | ifneq ($(SDK_REPO_XML_ARGS),) |
| 132 | |
| 133 | # Pickup the most recent xml schema |
| 134 | SDK_REPO_XSD := \ |
| 135 | $(lastword \ |
| 136 | $(wildcard \ |
| 137 | $(TOPDIR)sdk/sdkmanager/libs/sdklib/src/com/android/sdklib/repository/sdk-repository-*.xsd \ |
| 138 | )) |
| 139 | |
| 140 | $(SDK_REPO_XML): $(SDK_REPO_DEPS) |
| 141 | $(hide) $(TOPDIR)development/build/tools/mk_sdk_repo_xml.sh \ |
| 142 | $(SDK_REPO_XML) $(SDK_REPO_XSD) $(SDK_REPO_XML_ARGS) |
| 143 | |
| 144 | $(call dist-for-goals, sdk_repo, $(SDK_REPO_XML)) |
| 145 | |
| 146 | else |
| 147 | |
| 148 | $(SDK_REPO_XML): ; |
| 149 | |
| 150 | endif |
| 151 | |
| 152 | # ----------------------------------------------------------------- |
| 153 | |
| 154 | sdk_repo: $(SDK_REPO_DEPS) $(SDK_REPO_XML) |
Raphael | 922ee89 | 2011-02-15 16:08:36 -0800 | [diff] [blame] | 155 | @echo "Packing of SDK repository done" |
| 156 | |