Ian Kasprzak | 9601e6e | 2019-11-08 18:40:39 -0800 | [diff] [blame] | 1 | # 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 | |
| 18 | name := $(TARGET_PRODUCT) |
| 19 | ifeq ($(TARGET_BUILD_TYPE),debug) |
| 20 | name := $(name)_debug |
| 21 | endif |
| 22 | |
Jeongik Cha | 05210f9 | 2023-04-27 11:05:22 +0900 | [diff] [blame] | 23 | dist_name := $(name)-flashable-FILE_NAME_TAG_PLACEHOLDER-with-license |
| 24 | name := $(name)-flashable-with-license |
Ian Kasprzak | 9601e6e | 2019-11-08 18:40:39 -0800 | [diff] [blame] | 25 | |
| 26 | with_license_intermediates := \ |
| 27 | $(call intermediates-dir-for,PACKAGING,with_license) |
| 28 | |
| 29 | # Create a with-license artifact target |
| 30 | license_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 Kasprzak | 4305cf2 | 2019-11-12 18:38:16 -0800 | [diff] [blame] | 33 | ifndef VENDOR_BLOBS_LICENSE |
| 34 | @echo "with-license requires VENDOR_BLOBS_LICENSE to be set." |
Ian Kasprzak | 9601e6e | 2019-11-08 18:40:39 -0800 | [diff] [blame] | 35 | exit 1 |
| 36 | else |
| 37 | $(ZIP2ZIP) -i $(BUILT_TARGET_FILES_PACKAGE) -o $@ \ |
| 38 | RADIO/bootloader.img:bootloader.img RADIO/radio.img:radio.img \ |
Ian Kasprzak | 8f9b3c1 | 2019-12-05 15:29:40 -0800 | [diff] [blame] | 39 | IMAGES/*.img:. OTA/android-info.txt:android-info.txt |
Ian Kasprzak | 9601e6e | 2019-11-08 18:40:39 -0800 | [diff] [blame] | 40 | endif |
Bob Badour | 3a0f0c1 | 2022-04-05 10:43:45 -0700 | [diff] [blame] | 41 | |
| 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 Kasprzak | 9601e6e | 2019-11-08 18:40:39 -0800 | [diff] [blame] | 45 | with_license_zip := $(PRODUCT_OUT)/$(name).sh |
Jeongik Cha | 05210f9 | 2023-04-27 11:05:22 +0900 | [diff] [blame] | 46 | dist_name := $(dist_name).sh |
Ian Kasprzak | 9601e6e | 2019-11-08 18:40:39 -0800 | [diff] [blame] | 47 | $(with_license_zip): PRIVATE_NAME := $(name) |
| 48 | $(with_license_zip): PRIVATE_INPUT_ZIP := $(license_image_input_zip) |
Ian Kasprzak | 4305cf2 | 2019-11-12 18:38:16 -0800 | [diff] [blame] | 49 | $(with_license_zip): PRIVATE_VENDOR_BLOBS_LICENSE := $(VENDOR_BLOBS_LICENSE) |
| 50 | $(with_license_zip): $(license_image_input_zip) $(VENDOR_BLOBS_LICENSE) |
Ian Kasprzak | 9601e6e | 2019-11-08 18:40:39 -0800 | [diff] [blame] | 51 | $(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 Kasprzak | 4305cf2 | 2019-11-12 18:38:16 -0800 | [diff] [blame] | 54 | $(PRIVATE_INPUT_ZIP) $(PRIVATE_NAME) $(PRIVATE_VENDOR_BLOBS_LICENSE) |
Ian Kasprzak | 9601e6e | 2019-11-08 18:40:39 -0800 | [diff] [blame] | 55 | with-license : $(with_license_zip) |
Jeongik Cha | 05210f9 | 2023-04-27 11:05:22 +0900 | [diff] [blame] | 56 | $(call dist-for-goals, with-license, $(with_license_zip):$(dist_name)) |
Bob Badour | 3a0f0c1 | 2022-04-05 10:43:45 -0700 | [diff] [blame] | 57 | |
| 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 | |