|
| 1 | +# |
| 2 | +# Copyright (c) 2018, Google, Inc. All rights reserved |
| 3 | +# |
| 4 | +# Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | +# you may not use this file except in compliance with the License. |
| 6 | +# You may obtain a copy of the License at |
| 7 | +# |
| 8 | +# http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | +# |
| 10 | +# Unless required by applicable law or agreed to in writing, software |
| 11 | +# distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | +# See the License for the specific language governing permissions and |
| 14 | +# limitations under the License. |
| 15 | +# |
| 16 | + |
| 17 | +# |
| 18 | +# This makefile contains rules for building QEMU for running Trusty. |
| 19 | +# It is expected that it will be included by the project that uses QEMU |
| 20 | +# and the caller will configure the following variables: |
| 21 | +# |
| 22 | +# QEMU_ROOT - Root of qemu project |
| 23 | +# QEMU_BUILD_BASE - location that will be used to store temp files and |
| 24 | +# build results. |
| 25 | +# QEMU_ARCH - qemu arch to build |
| 26 | +# QEMU_TARGET - targets to build, use comma to separate targets |
| 27 | +# if multiple targets are specified. |
| 28 | +# |
| 29 | +# The following variable is returned to the caller: |
| 30 | +# QEMU_BIN - resulting qemu image |
| 31 | +# QEMU_BUILD_BASE - location that will be used to store temp files and |
| 32 | +# build results. |
| 33 | +# |
| 34 | +# |
| 35 | + |
| 36 | +QEMU_BIN:=$(QEMU_BUILD_BASE)/$(QEMU_ARCH)-softmmu/qemu-system-$(QEMU_ARCH) |
| 37 | +QEMU_MAKEFILE:=$(QEMU_BUILD_BASE)/Makefile |
| 38 | + |
| 39 | +# Set of features disabled by the AOSP emulator. We don't need these features |
| 40 | +# either, and we want minimal dependencies. |
| 41 | +QEMU_AOSP_DISABLES := \ |
| 42 | + --disable-curses \ |
| 43 | + --disable-docs \ |
| 44 | + --disable-glusterfs \ |
| 45 | + --disable-gtk \ |
| 46 | + --disable-spice \ |
| 47 | + --disable-opengl \ |
| 48 | + |
| 49 | +# Warnings which pollute the build output and which can make us miss |
| 50 | +# warnings in non-external code that we should be paying attention to. |
| 51 | +QEMU_EXTRA_CFLAGS := \ |
| 52 | + -Wno-address-of-packed-member \ |
| 53 | + -Wno-format-truncation \ |
| 54 | + -Wno-stringop-truncation \ |
| 55 | + -Wno-array-bounds \ |
| 56 | + |
| 57 | +# Newer capstone releases have the headers under include/capstone |
| 58 | +QEMU_EXTRA_CFLAGS += -I$(TRUSTY_TOP)/$(QEMU_ROOT)/capstone/include/capstone |
| 59 | + |
| 60 | +$(QEMU_MAKEFILE): QEMU_ROOT:=$(QEMU_ROOT) |
| 61 | +$(QEMU_MAKEFILE): QEMU_BUILD_BASE:=$(QEMU_BUILD_BASE) |
| 62 | +$(QEMU_MAKEFILE): QEMU_TARGET:=$(QEMU_TARGET) |
| 63 | +$(QEMU_MAKEFILE): QEMU_AOSP_DISABLES:=$(QEMU_AOSP_DISABLES) |
| 64 | +$(QEMU_MAKEFILE): QEMU_EXTRA_CFLAGS:=$(QEMU_EXTRA_CFLAGS) |
| 65 | +$(QEMU_MAKEFILE): |
| 66 | + mkdir -p $(QEMU_BUILD_BASE) |
| 67 | + #--with-git=true sets the "git" program to /bin/true - it essentially disables git |
| 68 | + #--disable-git-update may look like what we want, but it requests manual intervention, not disables git |
| 69 | + # TODO(b/148904400): Our prebuilt Clang can't build QEMU yet, and there is no |
| 70 | + # prebuilts GCC, i.e. currently we can only build QEMU with host toolchain. On |
| 71 | + # some hosts compiler will complain about stringop truncation. |
| 72 | + cd $(QEMU_BUILD_BASE) && $(abspath $(QEMU_ROOT)/configure) \ |
| 73 | + --target-list=$(QEMU_TARGET) --disable-werror \ |
| 74 | + --extra-cflags="$(QEMU_EXTRA_CFLAGS)" \ |
| 75 | + --disable-gcrypt $(QEMU_AOSP_DISABLES) \ |
| 76 | + --enable-slirp |
| 77 | + |
| 78 | +$(QEMU_BIN): QEMU_BUILD_BASE:=$(QEMU_BUILD_BASE) |
| 79 | +$(QEMU_BIN): $(QEMU_MAKEFILE) .PHONY |
| 80 | + $(MAKE) -C $(QEMU_BUILD_BASE) |
| 81 | + |
| 82 | +# Add QEMU_BIN to the list of project dependencies |
| 83 | +EXTRA_BUILDDEPS += $(QEMU_BIN) |
| 84 | + |
| 85 | +QEMU_ARCH:= |
| 86 | +QEMU_ROOT:= |
| 87 | +QEMU_TARGET:= |
| 88 | +QEMU_AOSP_DISABLES:= |
| 89 | +QEMU_EXTRA_CFLAGS:= |
0 commit comments