1# Copyright (C) 2020 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# Package binary build of Trusty, QEMU, AOSP, and scripts for standalone use 17 18# Inputs: 19# QEMU_PACKAGE_FILES: files and folders to include in the package archive 20# These files/folders must be valid make targets, as they will be included 21# as pre-requisites to the package zip. 22# QEMU_PACKAGE_EXTRA_FILES: additional files and folders to include in the 23# package archive, which are not make targets. These files must be created 24# by a target in QEMU_PACKAGE_FILES. 25 26QEMU_PACKAGE_ZIP := $(BUILDDIR)/trusty_qemu_package.zip 27QEMU_PACKAGE_LICENSE := $(BUILDDIR)/LICENSE 28 29QEMU_PACKAGE_LICENSE_FILES := \ 30 $(call FIND_EXTERNAL,qemu/LICENSE) \ 31 $(call FIND_EXTERNAL,qemu/COPYING) \ 32 $(call FIND_EXTERNAL,linux/COPYING) \ 33 $(call FIND_EXTERNAL,linux/LICENSES/preferred/GPL-2.0) \ 34 $(call FIND_EXTERNAL,linux/LICENSES/exceptions/Linux-syscall-note) \ 35 $(call FIND_EXTERNAL,arm-trusted-firmware/docs/license.rst) \ 36 37# TODO: Unify with SDK license construction when it lands 38$(QEMU_PACKAGE_LICENSE): LOCAL_DIR := $(GET_LOCAL_DIR) 39$(QEMU_PACKAGE_LICENSE): $(QEMU_PACKAGE_LICENSE_FILES) 40 @$(MKDIR) 41 @echo Generating QEMU package license 42 $(NOECHO)rm -f $@.tmp 43 $(NOECHO)cat $(LOCAL_DIR)/../LICENSE >> $@.tmp; 44 $(NOECHO)for license in $^; do \ 45 printf "\n-------------------------------------------------------------------\n" >> $@.tmp;\ 46 printf "Copied from $$license\n\n\n" >> $@.tmp;\ 47 cat "$$license" >> $@.tmp;\ 48 done 49 $(call TESTANDREPLACEFILE,$@.tmp,$@) 50 51QEMU_PACKAGE_FILES += $(QEMU_PACKAGE_LICENSE) 52 53$(QEMU_PACKAGE_ZIP): BUILDDIR := $(BUILDDIR) 54$(QEMU_PACKAGE_ZIP): QEMU_PACKAGE_EXTRA_FILES := $(QEMU_PACKAGE_EXTRA_FILES) 55$(QEMU_PACKAGE_ZIP): $(QEMU_PACKAGE_FILES) 56 @$(MKDIR) 57 @echo Creating QEMU archive package 58 $(NOECHO)rm -f $@ 59 $(NOECHO)(cd $(BUILDDIR) && zip -q -u -r $@ $(subst $(BUILDDIR)/,,$^)) 60 $(NOECHO)(cd $(BUILDDIR) && zip -q -u -r $@ $(subst $(BUILDDIR)/,,$(QEMU_PACKAGE_EXTRA_FILES))) 61 62EXTRA_BUILDDEPS += $(QEMU_PACKAGE_ZIP) 63 64QEMU_PACKAGE_CONFIG := 65QEMU_PACKAGE_FILES := 66QEMU_PACKAGE_EXTRA_FILES := 67QEMU_PACKAGE_LICENSE := 68QEMU_PACKAGE_LICENSE_FILES := 69QEMU_PACKAGE_ZIP := 70