forked from aosp-mirror/platform_external_qemu
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile.common.mk
213 lines (167 loc) · 7.51 KB
/
Makefile.common.mk
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
BUILD_TARGET_TAG := $(BUILD_TARGET_OS)-$(BUILD_TARGET_ARCH)
# Build libext4_utils and related modules/
include $(LOCAL_PATH)/distrib/zlib.mk
include $(LOCAL_PATH)/distrib/libcurl.mk
include $(LOCAL_PATH)/distrib/libuuid.mk
include $(LOCAL_PATH)/distrib/libxml2.mk
include $(LOCAL_PATH)/distrib/libsparse/sources.mk
include $(LOCAL_PATH)/distrib/libselinux/sources.mk
include $(LOCAL_PATH)/distrib/ext4_utils/sources.mk
include $(LOCAL_PATH)/distrib/libbreakpad.mk
include $(LOCAL_PATH)/distrib/Qt5.mk
include $(LOCAL_PATH)/distrib/jpeg-6b/libjpeg.mk
include $(LOCAL_PATH)/distrib/libpng.mk
include $(LOCAL_PATH)/distrib/mini-glib/sources.make
include $(LOCAL_PATH)/distrib/googletest/Android.mk
EMULATOR_VERSION_CFLAGS :=
ANDROID_SDK_TOOLS_REVISION := $(strip $(ANDROID_SDK_TOOLS_REVISION))
ifdef ANDROID_SDK_TOOLS_REVISION
EMULATOR_VERSION_CFLAGS += -DANDROID_SDK_TOOLS_REVISION=$(ANDROID_SDK_TOOLS_REVISION)
endif
ANDROID_SDK_TOOLS_BUILD_NUMBER := $(strip $(ANDROID_SDK_TOOLS_BUILD_NUMBER))
ifdef ANDROID_SDK_TOOLS_BUILD_NUMBER
EMULATOR_VERSION_CFLAGS += -DANDROID_SDK_TOOLS_BUILD_NUMBER=$(ANDROID_SDK_TOOLS_BUILD_NUMBER)
endif
EMULATOR_COMMON_CFLAGS := -Werror=implicit-function-declaration
# Include the emulator version definition from Makefile.common.mk
EMULATOR_COMMON_CFLAGS += $(EMULATOR_VERSION_CFLAGS)
ifeq (true,$(BUILD_DEBUG))
EMULATOR_COMMON_CFLAGS += -DENABLE_DLOG=1
else
EMULATOR_COMMON_CFLAGS += -DENABLE_DLOG=0
endif
EMULATOR_CRASHUPLOAD := $(strip $(EMULATOR_CRASHUPLOAD))
ifdef EMULATOR_CRASHUPLOAD
EMULATOR_COMMON_CFLAGS += -DCRASHUPLOAD=$(EMULATOR_CRASHUPLOAD)
endif
# Required to access config-host.h
EMULATOR_COMMON_INCLUDES := \
$(BUILD_OBJS_DIR)/build
EMUGL_SRCDIR := $(LOCAL_PATH)/distrib/android-emugl
EMUGL_INCLUDES := $(EMUGL_SRCDIR)/host/include
ifeq (true,$(BUILD_EMUGL_PRINTOUT))
EMUGL_USER_CFLAGS := -DOPENGL_DEBUG_PRINTOUT
else
EMUGL_USER_CFLAGS :=
endif
##############################################################################
##############################################################################
###
### gen-hw-config-defs: Generate hardware configuration definitions header
###
### The 'gen-hw-config.py' script is used to generate the hw-config-defs.h
### header from the an .ini file like android/avd/hardware-properties.ini
###
### Due to the way the Android build system works, we need to regenerate
### it for each module (the output will go into a module-specific directory).
###
### This defines a function that can be used inside a module definition
###
### $(call gen-hw-config-defs)
###
# First, define a rule to generate a dummy "emulator_hw_config_defs" module
# which purpose is simply to host the generated header in its output directory.
intermediates := $(call intermediates-dir-for,$(BUILD_TARGET_BITS),emulator_hw_config_defs)
QEMU_HARDWARE_PROPERTIES_INI := $(LOCAL_PATH)/android/avd/hardware-properties.ini
QEMU_HW_CONFIG_DEFS_H := $(intermediates)/android/avd/hw-config-defs.h
$(QEMU_HW_CONFIG_DEFS_H): PRIVATE_PATH := $(LOCAL_PATH)
$(QEMU_HW_CONFIG_DEFS_H): PRIVATE_CUSTOM_TOOL = $(PRIVATE_PATH)/android/tools/gen-hw-config.py $< $@
$(QEMU_HW_CONFIG_DEFS_H): $(QEMU_HARDWARE_PROPERTIES_INI) $(LOCAL_PATH)/android/tools/gen-hw-config.py
$(hide) rm -f $@
$(transform-generated-source)
QEMU_HW_CONFIG_DEFS_INCLUDES := $(intermediates)
# Second, define a function that needs to be called inside each module that contains
# a source file that includes the generated header file.
gen-hw-config-defs = \
$(eval LOCAL_GENERATED_SOURCES += $(QEMU_HW_CONFIG_DEFS_H))\
$(eval LOCAL_C_INCLUDES += $(QEMU_HW_CONFIG_DEFS_INCLUDES))
include $(LOCAL_PATH)/Makefile.android-emu.mk
include $(LOCAL_PATH)/Makefile.qemu1-common.mk
ifeq ($(BUILD_TARGET_OS),windows)
# on Windows, link the icon file as well into the executable
# unfortunately, our build system doesn't help us much, so we need
# to use some weird pathnames to make this work...
WINDRES_CPU_32 := i386
WINDRES_CPU_64 := x86-64
EMULATOR_ICON_OBJ := $(BUILD_OBJS_DIR)/build/emulator_icon$(BUILD_TARGET_BITS).o
$(EMULATOR_ICON_OBJ): PRIVATE_TARGET := $(WINDRES_CPU_$(BUILD_TARGET_BITS))
$(EMULATOR_ICON_OBJ): $(LOCAL_PATH)/images/emulator_icon.rc
@echo "Windres ($(PRIVATE_TARGET)): $@"
$(hide) $(BUILD_TARGET_WINDRES) --target=pe-$(PRIVATE_TARGET) $< -I $(LOCAL_PATH)/images -o $@
# Usage: $(eval $(call insert-windows-icon))
define insert-windows-icon
LOCAL_PREBUILT_OBJ_FILES += $(EMULATOR_ICON_OBJ)
endef
endif # BUILD_TARGET_OS == windows
# We want to build all variants of the emulator binaries. This makes
# it easier to catch target-specific regressions during emulator development.
EMULATOR_TARGET_ARCH := arm
include $(LOCAL_PATH)/Makefile.qemu1-target.mk
# Note: the same binary handles x86 and x86_64
EMULATOR_TARGET_ARCH := x86
include $(LOCAL_PATH)/Makefile.qemu1-target.mk
EMULATOR_TARGET_ARCH := mips
include $(LOCAL_PATH)/Makefile.qemu1-target.mk
##############################################################################
##############################################################################
###
### emulator: LAUNCHER FOR TARGET-SPECIFIC EMULATOR
###
# NOTE: Build as 32-bit or 64-bit executable, depending on the value of
# EMULATOR_PROGRAM_BITNESS.
ifeq ($(BUILD_TARGET_BITS),$(EMULATOR_PROGRAM_BITNESS))
$(call start-emulator-program, emulator)
LOCAL_SRC_FILES := \
android/main-emulator.cpp \
# Needed to compile the call to androidQtSetupEnv() in main-emulator.cpp
LOCAL_CFLAGS += -DCONFIG_QT
LOCAL_STATIC_LIBRARIES := $(ANDROID_EMU_STATIC_LIBRARIES)
# Ensure this is always built, even if 32-bit binaries are disabled.
LOCAL_IGNORE_BITNESS := true
ifeq ($(BUILD_TARGET_OS),windows)
$(eval $(call insert-windows-icon))
endif
# To avoid runtime linking issues on Linux and Windows, a custom copy of the
# C++ standard library is copied to $(BUILD_OBJS_DIR)/lib[64], a path that is added
# to the runtime library search path by the top-level 'emulator' launcher
# program before it spawns the emulation engine. However, 'emulator' cannot
# use these versions of the library, so statically link it against the
# executable instead.
$(call local-link-static-c++lib)
$(call end-emulator-program)
##############################################################################
###
### emulator-check: a standalone question answering service
###
$(call start-emulator-program, emulator-check)
LOCAL_SRC_FILES := \
android/emulator-check/main-emulator-check.cpp \
android/emulator-check/PlatformInfo.cpp \
LOCAL_STATIC_LIBRARIES := $(ANDROID_EMU_STATIC_LIBRARIES)
LOCAL_LDLIBS := $(ANDROID_EMU_LDLIBS)
LOCAL_IGNORE_BITNESS := true
ifeq ($(BUILD_TARGET_OS),windows)
$(eval $(call insert-windows-icon))
endif
ifeq ($(BUILD_TARGET_OS),linux)
# For PlatformInfo.cpp
LOCAL_LDLIBS += -lX11
endif
$(call local-link-static-c++lib)
$(call end-emulator-program)
endif # BUILD_TARGET_BITS == EMULATOR_PROGRAM_BITNESS
include $(LOCAL_PATH)/Makefile.crash-service.mk
##############################################################################
##############################################################################
###
### GPU emulation libraries
###
include $(EMUGL_SRCDIR)/Android.mk
##############################################################################
##############################################################################
###
### QEMU2
###
ifdef QEMU2_TOP_DIR
include $(QEMU2_TOP_DIR)/android-qemu2-glue/build/Makefile.qemu2.mk
endif