• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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
18name := $(TARGET_PRODUCT)
19ifeq ($(TARGET_BUILD_TYPE),debug)
20	name := $(name)_debug
21endif
22
23name := $(name)-flashable-$(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.
32ifndef VENDOR_BLOBS_LICENSE
33	@echo "with-license requires VENDOR_BLOBS_LICENSE to be set."
34	exit 1
35else
36	$(ZIP2ZIP) -i $(BUILT_TARGET_FILES_PACKAGE) -o $@ \
37		RADIO/bootloader.img:bootloader.img RADIO/radio.img:radio.img \
38		IMAGES/*.img:. OTA/android-info.txt:android-info.txt
39endif
40with_license_zip := $(PRODUCT_OUT)/$(name).sh
41$(with_license_zip): PRIVATE_NAME := $(name)
42$(with_license_zip): PRIVATE_INPUT_ZIP := $(license_image_input_zip)
43$(with_license_zip): PRIVATE_VENDOR_BLOBS_LICENSE := $(VENDOR_BLOBS_LICENSE)
44$(with_license_zip): $(license_image_input_zip) $(VENDOR_BLOBS_LICENSE)
45$(with_license_zip): $(HOST_OUT_EXECUTABLES)/generate-self-extracting-archive
46	# Args: <output> <input archive> <comment> <license file>
47	$(HOST_OUT_EXECUTABLES)/generate-self-extracting-archive $@ \
48		$(PRIVATE_INPUT_ZIP) $(PRIVATE_NAME) $(PRIVATE_VENDOR_BLOBS_LICENSE)
49with-license : $(with_license_zip)
50$(call dist-for-goals, with-license, $(with_license_zip))
51