blob: 5ca974a1a02ac0380d6f5f3b96394812f135e1b0 [file] [log] [blame]
Ian Kasprzak9601e6e2019-11-08 18:40:39 -08001# Copyright (C) 2019 The Android Open Source Project
2#
3# Licensed under the Apache License, Version 2.0 (the "License");
4# you may not use this file except in compliance with the License.
5# You may obtain a copy of the License at
6#
7# http://www.apache.org/licenses/LICENSE-2.0
8#
9# Unless required by applicable law or agreed to in writing, software
10# distributed under the License is distributed on an "AS IS" BASIS,
11# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12# See the License for the specific language governing permissions and
13# limitations under the License.
14
15
16.PHONY: with-license
17
18name := $(TARGET_PRODUCT)
19ifeq ($(TARGET_BUILD_TYPE),debug)
20 name := $(name)_debug
21endif
22
Jeongik Cha05210f92023-04-27 11:05:22 +090023dist_name := $(name)-flashable-FILE_NAME_TAG_PLACEHOLDER-with-license
24name := $(name)-flashable-with-license
Ian Kasprzak9601e6e2019-11-08 18:40:39 -080025
26with_license_intermediates := \
27 $(call intermediates-dir-for,PACKAGING,with_license)
28
29# Create a with-license artifact target
30license_image_input_zip := $(with_license_intermediates)/$(name).zip
31$(license_image_input_zip) : $(BUILT_TARGET_FILES_PACKAGE) $(ZIP2ZIP)
32# DO NOT PROCEED without a license file.
Ian Kasprzak4305cf22019-11-12 18:38:16 -080033ifndef VENDOR_BLOBS_LICENSE
34 @echo "with-license requires VENDOR_BLOBS_LICENSE to be set."
Ian Kasprzak9601e6e2019-11-08 18:40:39 -080035 exit 1
36else
37 $(ZIP2ZIP) -i $(BUILT_TARGET_FILES_PACKAGE) -o $@ \
38 RADIO/bootloader.img:bootloader.img RADIO/radio.img:radio.img \
Ian Kasprzak8f9b3c12019-12-05 15:29:40 -080039 IMAGES/*.img:. OTA/android-info.txt:android-info.txt
Ian Kasprzak9601e6e2019-11-08 18:40:39 -080040endif
Bob Badour3a0f0c12022-04-05 10:43:45 -070041
42$(call declare-1p-container,$(license_image_input_zip),build)
43$(call declare-container-deps,$(license_image_input_zip),$(BUILT_TARGET_FILES_PACKAGE))
44
Ian Kasprzak9601e6e2019-11-08 18:40:39 -080045with_license_zip := $(PRODUCT_OUT)/$(name).sh
Jeongik Cha05210f92023-04-27 11:05:22 +090046dist_name := $(dist_name).sh
Ian Kasprzak9601e6e2019-11-08 18:40:39 -080047$(with_license_zip): PRIVATE_NAME := $(name)
48$(with_license_zip): PRIVATE_INPUT_ZIP := $(license_image_input_zip)
Ian Kasprzak4305cf22019-11-12 18:38:16 -080049$(with_license_zip): PRIVATE_VENDOR_BLOBS_LICENSE := $(VENDOR_BLOBS_LICENSE)
50$(with_license_zip): $(license_image_input_zip) $(VENDOR_BLOBS_LICENSE)
Ian Kasprzak9601e6e2019-11-08 18:40:39 -080051$(with_license_zip): $(HOST_OUT_EXECUTABLES)/generate-self-extracting-archive
52 # Args: <output> <input archive> <comment> <license file>
53 $(HOST_OUT_EXECUTABLES)/generate-self-extracting-archive $@ \
Ian Kasprzak4305cf22019-11-12 18:38:16 -080054 $(PRIVATE_INPUT_ZIP) $(PRIVATE_NAME) $(PRIVATE_VENDOR_BLOBS_LICENSE)
Ian Kasprzak9601e6e2019-11-08 18:40:39 -080055with-license : $(with_license_zip)
Jeongik Cha05210f92023-04-27 11:05:22 +090056$(call dist-for-goals, with-license, $(with_license_zip):$(dist_name))
Bob Badour3a0f0c12022-04-05 10:43:45 -070057
58$(call declare-1p-container,$(with_license_zip),)
59$(call declare-container-license-deps,$(with_license_zip),$(license_image_input_zip),$(with_license_zip):)
60