blob: daa68971baf4a8d3c2fbe6bf018c64ef7eebc98e [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
23name := $(name)-img-$(FILE_NAME_TAG)-with-license
24
25with_license_intermediates := \
26 $(call intermediates-dir-for,PACKAGING,with_license)
27
28# Create a with-license artifact target
29license_image_input_zip := $(with_license_intermediates)/$(name).zip
30$(license_image_input_zip) : $(BUILT_TARGET_FILES_PACKAGE) $(ZIP2ZIP)
31# DO NOT PROCEED without a license file.
Ian Kasprzak4305cf22019-11-12 18:38:16 -080032ifndef VENDOR_BLOBS_LICENSE
33 @echo "with-license requires VENDOR_BLOBS_LICENSE to be set."
Ian Kasprzak9601e6e2019-11-08 18:40:39 -080034 exit 1
35else
36 $(ZIP2ZIP) -i $(BUILT_TARGET_FILES_PACKAGE) -o $@ \
37 RADIO/bootloader.img:bootloader.img RADIO/radio.img:radio.img \
38 IMAGES/system.img:system.img IMAGES/vendor.img:vendor.img \
39 IMAGES/boot.img:boot.img OTA/android-info.txt:android-info.txt
40endif
41with_license_zip := $(PRODUCT_OUT)/$(name).sh
42$(with_license_zip): PRIVATE_NAME := $(name)
43$(with_license_zip): PRIVATE_INPUT_ZIP := $(license_image_input_zip)
Ian Kasprzak4305cf22019-11-12 18:38:16 -080044$(with_license_zip): PRIVATE_VENDOR_BLOBS_LICENSE := $(VENDOR_BLOBS_LICENSE)
45$(with_license_zip): $(license_image_input_zip) $(VENDOR_BLOBS_LICENSE)
Ian Kasprzak9601e6e2019-11-08 18:40:39 -080046$(with_license_zip): $(HOST_OUT_EXECUTABLES)/generate-self-extracting-archive
47 # Args: <output> <input archive> <comment> <license file>
48 $(HOST_OUT_EXECUTABLES)/generate-self-extracting-archive $@ \
Ian Kasprzak4305cf22019-11-12 18:38:16 -080049 $(PRIVATE_INPUT_ZIP) $(PRIVATE_NAME) $(PRIVATE_VENDOR_BLOBS_LICENSE)
Ian Kasprzak9601e6e2019-11-08 18:40:39 -080050with-license : $(with_license_zip)
51$(call dist-for-goals, with-license, $(with_license_zip))