David 'Digit' Turner | aff94b8 | 2011-02-07 18:10:54 +0100 | [diff] [blame] | 1 | # This file is included several times to build target-specific |
| 2 | # modules for the Android emulator. It will be called several times |
Bhanu Chetlapalli | 741dc13 | 2012-05-08 17:16:03 -0700 | [diff] [blame] | 3 | # for arm, x86 and mips |
David 'Digit' Turner | aff94b8 | 2011-02-07 18:10:54 +0100 | [diff] [blame] | 4 | # |
| 5 | |
| 6 | ifndef EMULATOR_TARGET_ARCH |
| 7 | $(error EMULATOR_TARGET_ARCH is not defined!) |
| 8 | endif |
| 9 | |
| 10 | EMULATOR_TARGET_CPU := $(EMULATOR_TARGET_ARCH) |
| 11 | ifeq ($(EMULATOR_TARGET_CPU),x86) |
| 12 | EMULATOR_TARGET_CPU := i386 |
| 13 | endif |
| 14 | |
| 15 | ############################################################################## |
| 16 | ############################################################################## |
| 17 | ### |
| 18 | ### emulator-target-$CPU: target-specific emulation code. |
| 19 | ### |
| 20 | ### Used by both the core and standalone programs. |
| 21 | ### |
| 22 | |
| 23 | # Common compiler flags for all target-dependent libraries |
| 24 | EMULATOR_TARGET_CFLAGS := \ |
| 25 | -I$(LOCAL_PATH)/android/config/$(HOST_PREBUILT_TAG) \ |
| 26 | -I$(LOCAL_PATH)/android/config/target-$(EMULATOR_TARGET_ARCH) \ |
| 27 | -I$(LOCAL_PATH)/target-$(EMULATOR_TARGET_CPU) \ |
| 28 | -I$(LOCAL_PATH)/fpu \ |
Bhanu Chetlapalli | 741dc13 | 2012-05-08 17:16:03 -0700 | [diff] [blame] | 29 | -DNEED_CPU_H |
David 'Digit' Turner | aff94b8 | 2011-02-07 18:10:54 +0100 | [diff] [blame] | 30 | |
| 31 | TCG_TARGET := $(HOST_ARCH) |
David 'Digit' Turner | f1d9bf1 | 2011-05-11 18:19:41 +0200 | [diff] [blame] | 32 | ifeq ($(HOST_ARCH),x86) |
| 33 | TCG_TARGET := i386 |
| 34 | endif |
| 35 | ifeq ($(HOST_ARCH),x86_64) |
David 'Digit' Turner | aff94b8 | 2011-02-07 18:10:54 +0100 | [diff] [blame] | 36 | TCG_TARGET := i386 |
| 37 | endif |
| 38 | |
| 39 | EMULATOR_TARGET_CFLAGS += \ |
| 40 | -I$(LOCAL_PATH)/tcg \ |
| 41 | -I$(LOCAL_PATH)/tcg/$(TCG_TARGET) \ |
| 42 | -DTARGET_ARCH=\"$(EMULATOR_TARGET_ARCH)\" |
| 43 | |
| 44 | |
Andrew Hsieh | c7389bd | 2012-03-13 02:13:40 -0700 | [diff] [blame] | 45 | common_LOCAL_CFLAGS = |
| 46 | common_LOCAL_SRC_FILES = |
| 47 | |
David 'Digit' Turner | aff94b8 | 2011-02-07 18:10:54 +0100 | [diff] [blame] | 48 | |
| 49 | # The following is to ensure that "config.h" will map to a target-specific |
| 50 | # configuration file header. |
Andrew Hsieh | c7389bd | 2012-03-13 02:13:40 -0700 | [diff] [blame] | 51 | common_LOCAL_CFLAGS += $(EMULATOR_TARGET_CFLAGS) |
David 'Digit' Turner | aff94b8 | 2011-02-07 18:10:54 +0100 | [diff] [blame] | 52 | |
Andrew Hsieh | c7389bd | 2012-03-13 02:13:40 -0700 | [diff] [blame] | 53 | common_LOCAL_SRC_FILES += \ |
David 'Digit' Turner | aff94b8 | 2011-02-07 18:10:54 +0100 | [diff] [blame] | 54 | tcg/tcg.c \ |
| 55 | |
| 56 | ############################################################################## |
| 57 | # Emulated hardware devices. |
| 58 | # |
| 59 | |
| 60 | HW_SOURCES := \ |
| 61 | bt.c \ |
| 62 | bt-hci.c \ |
| 63 | bt-hid.c \ |
| 64 | bt-l2cap.c \ |
| 65 | bt-sdp.c \ |
| 66 | cdrom.c \ |
| 67 | dma.c \ |
| 68 | irq.c \ |
Jun Nakajima | 6f19836 | 2011-02-24 13:16:01 -0800 | [diff] [blame] | 69 | goldfish_audio.c \ |
David 'Digit' Turner | aff94b8 | 2011-02-07 18:10:54 +0100 | [diff] [blame] | 70 | goldfish_device.c \ |
| 71 | goldfish_events_device.c \ |
| 72 | goldfish_fb.c \ |
| 73 | goldfish_battery.c \ |
| 74 | goldfish_mmc.c \ |
| 75 | goldfish_memlog.c \ |
| 76 | goldfish_nand.c \ |
David 'Digit' Turner | 89217f5 | 2011-03-21 17:51:03 +0100 | [diff] [blame] | 77 | goldfish_pipe.c \ |
David 'Digit' Turner | aff94b8 | 2011-02-07 18:10:54 +0100 | [diff] [blame] | 78 | goldfish_tty.c \ |
Tom Knych | 08c7228 | 2013-01-02 18:05:24 -0800 | [diff] [blame] | 79 | goldfish_vmem.c \ |
David 'Digit' Turner | aff94b8 | 2011-02-07 18:10:54 +0100 | [diff] [blame] | 80 | msmouse.c \ |
| 81 | pci.c \ |
| 82 | qdev.c \ |
| 83 | scsi-disk.c \ |
| 84 | sysbus.c \ |
| 85 | usb-hid.c \ |
| 86 | usb-hub.c \ |
| 87 | usb-msd.c \ |
| 88 | usb-ohci.c \ |
| 89 | usb.c \ |
| 90 | watchdog.c |
| 91 | |
David 'Digit' Turner | 42fc449 | 2011-06-29 13:16:16 +0200 | [diff] [blame] | 92 | |
David 'Digit' Turner | aff94b8 | 2011-02-07 18:10:54 +0100 | [diff] [blame] | 93 | ifeq ($(EMULATOR_TARGET_ARCH),arm) |
| 94 | HW_SOURCES += android_arm.c \ |
| 95 | arm_pic.c \ |
David 'Digit' Turner | aff94b8 | 2011-02-07 18:10:54 +0100 | [diff] [blame] | 96 | goldfish_interrupt.c \ |
| 97 | goldfish_switch.c \ |
| 98 | goldfish_timer.c \ |
| 99 | goldfish_trace.c \ |
Bhanu Chetlapalli | 741dc13 | 2012-05-08 17:16:03 -0700 | [diff] [blame] | 100 | arm_boot.c |
David 'Digit' Turner | aff94b8 | 2011-02-07 18:10:54 +0100 | [diff] [blame] | 101 | |
| 102 | # The following sources must be compiled with the final executables |
| 103 | # because they contain device_init() or machine_init() statements. |
| 104 | HW_OBJ_SOURCES := hw/smc91c111.c |
| 105 | HW_OBJ_CFLAGS := $(EMULATOR_TARGET_CFLAGS) |
| 106 | |
David 'Digit' Turner | cc33b2d | 2013-12-15 00:09:42 +0100 | [diff] [blame] | 107 | common_LOCAL_SRC_FILES += disas/arm.c |
David 'Digit' Turner | aff94b8 | 2011-02-07 18:10:54 +0100 | [diff] [blame] | 108 | |
| 109 | # smc91c111.c requires <zlib.h> |
Andrew Hsieh | c7389bd | 2012-03-13 02:13:40 -0700 | [diff] [blame] | 110 | common_LOCAL_CFLAGS += $(ZLIB_CFLAGS) |
David 'Digit' Turner | aff94b8 | 2011-02-07 18:10:54 +0100 | [diff] [blame] | 111 | endif |
| 112 | |
David 'Digit' Turner | 764a3c9 | 2011-05-05 12:40:49 +0200 | [diff] [blame] | 113 | # required to ensure we properly initialize virtual audio hardware |
Andrew Hsieh | c7389bd | 2012-03-13 02:13:40 -0700 | [diff] [blame] | 114 | common_LOCAL_CFLAGS += -DHAS_AUDIO |
David 'Digit' Turner | 764a3c9 | 2011-05-05 12:40:49 +0200 | [diff] [blame] | 115 | |
David 'Digit' Turner | aff94b8 | 2011-02-07 18:10:54 +0100 | [diff] [blame] | 116 | ifeq ($(EMULATOR_TARGET_ARCH),x86) |
| 117 | HW_SOURCES += \ |
| 118 | apic.c \ |
| 119 | i8259.c \ |
| 120 | mc146818rtc.c \ |
| 121 | piix_pci.c \ |
| 122 | i8254.c \ |
| 123 | pckbd.c \ |
| 124 | ioapic.c \ |
| 125 | ps2.c \ |
| 126 | smbios.c \ |
| 127 | fw_cfg.c |
| 128 | |
| 129 | # The following sources must be compiled with the final executables |
| 130 | # because they contain device_init() or machine_init() statements. |
| 131 | HW_OBJ_SOURCES := \ |
| 132 | hw/ne2000.c \ |
| 133 | hw/pc.c |
| 134 | |
| 135 | HW_OBJ_CFLAGS := $(EMULATOR_TARGET_CFLAGS) |
| 136 | |
| 137 | endif |
| 138 | |
Bhanu Chetlapalli | 741dc13 | 2012-05-08 17:16:03 -0700 | [diff] [blame] | 139 | ifeq ($(EMULATOR_TARGET_ARCH),mips) |
| 140 | HW_SOURCES += \ |
| 141 | android_mips.c \ |
| 142 | mips_pic.c \ |
| 143 | goldfish_interrupt.c \ |
| 144 | goldfish_switch.c \ |
| 145 | goldfish_timer.c \ |
| 146 | goldfish_trace.c \ |
| 147 | mips_timer.c \ |
| 148 | mips_int.c |
| 149 | |
| 150 | # The following sources must be compiled with the final executables |
| 151 | # because they contain device_init() or machine_init() statements. |
| 152 | HW_OBJ_SOURCES := hw/smc91c111.c |
| 153 | HW_OBJ_CFLAGS := $(EMULATOR_TARGET_CFLAGS) |
| 154 | |
David 'Digit' Turner | cc33b2d | 2013-12-15 00:09:42 +0100 | [diff] [blame] | 155 | common_LOCAL_SRC_FILES += disas/mips.c |
Bhanu Chetlapalli | 741dc13 | 2012-05-08 17:16:03 -0700 | [diff] [blame] | 156 | |
| 157 | # smc91c111.c requires <zlib.h> |
| 158 | LOCAL_CFLAGS += $(ZLIB_CFLAGS) |
| 159 | ifeq ($(ARCH_HAS_BIGENDIAN),true) |
| 160 | LOCAL_CFLAGS += -DTARGET_WORDS_BIGENDIAN |
| 161 | endif |
| 162 | |
| 163 | endif |
Andrew Hsieh | c7389bd | 2012-03-13 02:13:40 -0700 | [diff] [blame] | 164 | common_LOCAL_SRC_FILES += $(HW_SOURCES:%=hw/%) |
David 'Digit' Turner | aff94b8 | 2011-02-07 18:10:54 +0100 | [diff] [blame] | 165 | |
Andrew Hsieh | c7389bd | 2012-03-13 02:13:40 -0700 | [diff] [blame] | 166 | common_LOCAL_SRC_FILES += \ |
David 'Digit' Turner | aff94b8 | 2011-02-07 18:10:54 +0100 | [diff] [blame] | 167 | cpu-exec.c \ |
David 'Digit' Turner | 317c9d5 | 2011-05-10 06:38:21 +0200 | [diff] [blame] | 168 | exec.c \ |
David 'Digit' Turner | aff94b8 | 2011-02-07 18:10:54 +0100 | [diff] [blame] | 169 | translate-all.c \ |
David 'Digit' Turner | d4e803c | 2013-12-14 23:45:50 +0100 | [diff] [blame] | 170 | android/trace.c \ |
David 'Digit' Turner | aff94b8 | 2011-02-07 18:10:54 +0100 | [diff] [blame] | 171 | varint.c \ |
Bhanu Chetlapalli | 741dc13 | 2012-05-08 17:16:03 -0700 | [diff] [blame] | 172 | softmmu_outside_jit.c |
David 'Digit' Turner | aff94b8 | 2011-02-07 18:10:54 +0100 | [diff] [blame] | 173 | |
| 174 | ############################################################################## |
| 175 | # CPU-specific emulation. |
| 176 | # |
Andrew Hsieh | c7389bd | 2012-03-13 02:13:40 -0700 | [diff] [blame] | 177 | common_LOCAL_CFLAGS += -fno-PIC -fomit-frame-pointer -Wno-sign-compare |
David 'Digit' Turner | aff94b8 | 2011-02-07 18:10:54 +0100 | [diff] [blame] | 178 | |
| 179 | ifeq ($(HOST_ARCH),ppc) |
Andrew Hsieh | c7389bd | 2012-03-13 02:13:40 -0700 | [diff] [blame] | 180 | common_LOCAL_CFLAGS += -D__powerpc__ |
David 'Digit' Turner | aff94b8 | 2011-02-07 18:10:54 +0100 | [diff] [blame] | 181 | endif |
| 182 | |
| 183 | ifeq ($(EMULATOR_TARGET_ARCH),arm) |
Andrew Hsieh | c7389bd | 2012-03-13 02:13:40 -0700 | [diff] [blame] | 184 | common_LOCAL_SRC_FILES += \ |
David 'Digit' Turner | 82a591c | 2013-12-17 09:10:58 +0100 | [diff] [blame^] | 185 | target-arm/arm-semi.c \ |
David 'Digit' Turner | aff94b8 | 2011-02-07 18:10:54 +0100 | [diff] [blame] | 186 | target-arm/op_helper.c \ |
| 187 | target-arm/iwmmxt_helper.c \ |
| 188 | target-arm/neon_helper.c \ |
| 189 | target-arm/helper.c \ |
David 'Digit' Turner | 288208c | 2011-05-11 19:37:35 +0200 | [diff] [blame] | 190 | target-arm/helper-android.c \ |
David 'Digit' Turner | aff94b8 | 2011-02-07 18:10:54 +0100 | [diff] [blame] | 191 | target-arm/translate.c \ |
| 192 | target-arm/machine.c \ |
| 193 | hw/armv7m.c \ |
David 'Digit' Turner | 82a591c | 2013-12-17 09:10:58 +0100 | [diff] [blame^] | 194 | hw/armv7m_nvic.c |
David 'Digit' Turner | aff94b8 | 2011-02-07 18:10:54 +0100 | [diff] [blame] | 195 | |
Andrew Hsieh | c7389bd | 2012-03-13 02:13:40 -0700 | [diff] [blame] | 196 | common_LOCAL_SRC_FILES += fpu/softfloat.c |
David 'Digit' Turner | aff94b8 | 2011-02-07 18:10:54 +0100 | [diff] [blame] | 197 | endif |
| 198 | |
| 199 | ifeq ($(EMULATOR_TARGET_ARCH), x86) |
Andrew Hsieh | c7389bd | 2012-03-13 02:13:40 -0700 | [diff] [blame] | 200 | common_LOCAL_SRC_FILES += \ |
David 'Digit' Turner | aff94b8 | 2011-02-07 18:10:54 +0100 | [diff] [blame] | 201 | target-i386/op_helper.c \ |
| 202 | target-i386/helper.c \ |
| 203 | target-i386/translate.c \ |
| 204 | target-i386/machine.c \ |
| 205 | |
Jun Nakajima | e4a3c78 | 2011-12-17 19:22:12 -0800 | [diff] [blame] | 206 | ifeq ($(HOST_OS),darwin) |
Andrew Hsieh | c7389bd | 2012-03-13 02:13:40 -0700 | [diff] [blame] | 207 | common_LOCAL_SRC_FILES += \ |
Jun Nakajima | e4a3c78 | 2011-12-17 19:22:12 -0800 | [diff] [blame] | 208 | target-i386/hax-all.c \ |
| 209 | target-i386/hax-darwin.c |
| 210 | endif |
| 211 | |
| 212 | ifeq ($(HOST_OS),windows) |
Andrew Hsieh | c7389bd | 2012-03-13 02:13:40 -0700 | [diff] [blame] | 213 | common_LOCAL_SRC_FILES += \ |
Jun Nakajima | e4a3c78 | 2011-12-17 19:22:12 -0800 | [diff] [blame] | 214 | target-i386/hax-all.c \ |
| 215 | target-i386/hax-windows.c |
| 216 | endif |
| 217 | |
Andrew Hsieh | c7389bd | 2012-03-13 02:13:40 -0700 | [diff] [blame] | 218 | common_LOCAL_SRC_FILES += fpu/softfloat-native.c |
David 'Digit' Turner | aff94b8 | 2011-02-07 18:10:54 +0100 | [diff] [blame] | 219 | endif |
| 220 | |
Bhanu Chetlapalli | 741dc13 | 2012-05-08 17:16:03 -0700 | [diff] [blame] | 221 | ifeq ($(EMULATOR_TARGET_ARCH), mips) |
| 222 | common_LOCAL_SRC_FILES += \ |
| 223 | target-mips/op_helper.c \ |
| 224 | target-mips/helper.c \ |
| 225 | target-mips/translate.c \ |
| 226 | target-mips/machine.c |
| 227 | |
| 228 | common_LOCAL_SRC_FILES += fpu/softfloat.c |
| 229 | endif |
| 230 | |
Jun Nakajima | 1321c76 | 2011-03-04 17:17:45 -0800 | [diff] [blame] | 231 | # compile KVM only if target is x86 on x86 Linux |
David 'Digit' Turner | 3659775 | 2011-05-20 01:18:01 +0200 | [diff] [blame] | 232 | QEMU_KVM_TAG := $(QEMU_HOST_TAG)-$(EMULATOR_TARGET_ARCH) |
| 233 | QEMU_DO_KVM := $(if $(filter linux-x86-x86 linux-x86_64-x86,$(QEMU_KVM_TAG)),true,false) |
| 234 | ifeq ($(QEMU_DO_KVM),true) |
Andrew Hsieh | c7389bd | 2012-03-13 02:13:40 -0700 | [diff] [blame] | 235 | common_LOCAL_SRC_FILES += \ |
David 'Digit' Turner | 3659775 | 2011-05-20 01:18:01 +0200 | [diff] [blame] | 236 | target-i386/kvm.c \ |
Jun Nakajima | bb0140b | 2011-05-27 18:24:21 -0700 | [diff] [blame] | 237 | target-i386/kvm-gs-restore.c \ |
David 'Digit' Turner | 3659775 | 2011-05-20 01:18:01 +0200 | [diff] [blame] | 238 | kvm-all.c \ |
| 239 | kvm-android.c |
Jun Nakajima | 1321c76 | 2011-03-04 17:17:45 -0800 | [diff] [blame] | 240 | endif |
| 241 | |
David 'Digit' Turner | aff94b8 | 2011-02-07 18:10:54 +0100 | [diff] [blame] | 242 | ############################################################################## |
| 243 | # Memory-access checking support. |
| 244 | # Memory access checker uses information collected by instrumented code in |
| 245 | # libc.so in order to keep track of memory blocks allocated from heap. Memory |
| 246 | # checker then uses this information to make sure that every access to allocated |
| 247 | # memory is within allocated block. This information also allows detecting |
| 248 | # memory leaks and attempts to free/realloc invalid pointers. |
| 249 | # |
Andrew Hsieh | c7389bd | 2012-03-13 02:13:40 -0700 | [diff] [blame] | 250 | common_LOCAL_CFLAGS += \ |
David 'Digit' Turner | aff94b8 | 2011-02-07 18:10:54 +0100 | [diff] [blame] | 251 | -I$(LOCAL_PATH)/memcheck \ |
| 252 | -I$(LOCAL_PATH)/elff |
| 253 | |
| 254 | MCHK_SOURCES := \ |
| 255 | memcheck.c \ |
| 256 | memcheck_proc_management.c \ |
| 257 | memcheck_malloc_map.c \ |
| 258 | memcheck_mmrange_map.c \ |
Bhanu Chetlapalli | 741dc13 | 2012-05-08 17:16:03 -0700 | [diff] [blame] | 259 | memcheck_util.c |
David 'Digit' Turner | aff94b8 | 2011-02-07 18:10:54 +0100 | [diff] [blame] | 260 | |
Andrew Hsieh | c7389bd | 2012-03-13 02:13:40 -0700 | [diff] [blame] | 261 | common_LOCAL_SRC_FILES += $(MCHK_SOURCES:%=memcheck/%) |
David 'Digit' Turner | aff94b8 | 2011-02-07 18:10:54 +0100 | [diff] [blame] | 262 | |
Andrew Hsieh | c7389bd | 2012-03-13 02:13:40 -0700 | [diff] [blame] | 263 | common_LOCAL_SRC_FILES += \ |
David 'Digit' Turner | ae3098a | 2011-05-11 16:01:57 +0200 | [diff] [blame] | 264 | cpus.c \ |
| 265 | arch_init.c |
| 266 | |
David 'Digit' Turner | 088edf8 | 2011-05-09 15:59:28 +0200 | [diff] [blame] | 267 | # What a mess, os-posix.c depends on the exact values of options |
| 268 | # which are target specific. |
| 269 | ifeq ($(HOST_OS),windows) |
David 'Digit' Turner | 1c31e3e | 2013-12-14 20:07:17 +0100 | [diff] [blame] | 270 | common_LOCAL_SRC_FILES += os-win32.c util/oslib-win32.c |
David 'Digit' Turner | 088edf8 | 2011-05-09 15:59:28 +0200 | [diff] [blame] | 271 | else |
David 'Digit' Turner | 1c31e3e | 2013-12-14 20:07:17 +0100 | [diff] [blame] | 272 | common_LOCAL_SRC_FILES += os-posix.c util/oslib-posix.c |
David 'Digit' Turner | 088edf8 | 2011-05-09 15:59:28 +0200 | [diff] [blame] | 273 | endif |
David 'Digit' Turner | aff94b8 | 2011-02-07 18:10:54 +0100 | [diff] [blame] | 274 | |
Andrew Hsieh | c7389bd | 2012-03-13 02:13:40 -0700 | [diff] [blame] | 275 | |
| 276 | ## one for 32-bit |
| 277 | $(call start-emulator-library, emulator-target-$(EMULATOR_TARGET_CPU)) |
| 278 | LOCAL_CFLAGS += $(common_LOCAL_CFLAGS) |
| 279 | LOCAL_SRC_FILES += $(common_LOCAL_SRC_FILES) |
| 280 | $(call gen-hw-config-defs) |
| 281 | $(call gen-hx-header,qemu-options.hx,qemu-options.def,os-posix.c os-win32.c) |
David 'Digit' Turner | aff94b8 | 2011-02-07 18:10:54 +0100 | [diff] [blame] | 282 | $(call end-emulator-library) |
| 283 | |
Andrew Hsieh | c7389bd | 2012-03-13 02:13:40 -0700 | [diff] [blame] | 284 | ## another for 64-bit, see note in file Makefile.common emulator64-common |
Andrew Hsieh | 83df59c | 2012-07-24 16:06:28 -0700 | [diff] [blame] | 285 | ifneq ($(filter linux darwin,$(HOST_OS)),) |
Andrew Hsieh | c7389bd | 2012-03-13 02:13:40 -0700 | [diff] [blame] | 286 | ifneq ($(BUILD_STANDALONE_EMULATOR),true) |
| 287 | $(call start-emulator-library, emulator64-target-$(EMULATOR_TARGET_CPU)) |
| 288 | LOCAL_CFLAGS += $(common_LOCAL_CFLAGS) -m64 |
| 289 | LOCAL_SRC_FILES += $(common_LOCAL_SRC_FILES) |
| 290 | $(call gen-hw-config-defs) |
| 291 | $(call gen-hx-header,qemu-options.hx,qemu-options.def,os-posix.c os-win32.c) |
| 292 | $(call end-emulator-library) |
| 293 | endif # BUILD_STANDALONE_EMULATOR == nil |
Andrew Hsieh | 83df59c | 2012-07-24 16:06:28 -0700 | [diff] [blame] | 294 | endif # HOST_OS == linux || darwin |
Andrew Hsieh | c7389bd | 2012-03-13 02:13:40 -0700 | [diff] [blame] | 295 | |
| 296 | |
| 297 | |
David 'Digit' Turner | aff94b8 | 2011-02-07 18:10:54 +0100 | [diff] [blame] | 298 | ############################################################################## |
| 299 | ############################################################################## |
| 300 | ### |
| 301 | ### qemu-android-$CPU: headless emulator core program |
| 302 | ### |
| 303 | ### |
| 304 | $(call start-emulator-program, qemu-android-$(EMULATOR_TARGET_ARCH)) |
| 305 | |
| 306 | LOCAL_CFLAGS += \ |
| 307 | $(EMULATOR_COMMON_CFLAGS) \ |
| 308 | $(ELFF_CFLAGS) \ |
| 309 | $(EMULATOR_LIBQEMU_CFLAGS) \ |
| 310 | $(EMULATOR_TARGET_CFLAGS) \ |
Bhanu Chetlapalli | 741dc13 | 2012-05-08 17:16:03 -0700 | [diff] [blame] | 311 | -DCONFIG_STANDALONE_CORE |
David 'Digit' Turner | aff94b8 | 2011-02-07 18:10:54 +0100 | [diff] [blame] | 312 | |
Jesse Hall | 183e927 | 2012-04-26 15:13:27 -0700 | [diff] [blame] | 313 | ifneq ($(QEMU_OPENGLES_INCLUDE),) |
| 314 | LOCAL_CFLAGS += -I$(QEMU_OPENGLES_INCLUDE) |
| 315 | endif |
David 'Digit' Turner | aff94b8 | 2011-02-07 18:10:54 +0100 | [diff] [blame] | 316 | |
Raphael Moll | 9e319a9 | 2012-11-28 13:48:25 -0800 | [diff] [blame] | 317 | LOCAL_CFLAGS += $(GCC_W_NO_MISSING_FIELD_INITIALIZERS) |
David 'Digit' Turner | aff94b8 | 2011-02-07 18:10:54 +0100 | [diff] [blame] | 318 | |
| 319 | LOCAL_STATIC_LIBRARIES := \ |
| 320 | emulator-libqemu \ |
| 321 | emulator-target-$(EMULATOR_TARGET_CPU) \ |
Lars Poeschel | 33da99a | 2012-08-22 09:42:42 +0200 | [diff] [blame] | 322 | emulator-libjpeg \ |
David 'Digit' Turner | aff94b8 | 2011-02-07 18:10:54 +0100 | [diff] [blame] | 323 | emulator-libelff \ |
Bhanu Chetlapalli | 741dc13 | 2012-05-08 17:16:03 -0700 | [diff] [blame] | 324 | emulator-common |
David 'Digit' Turner | aff94b8 | 2011-02-07 18:10:54 +0100 | [diff] [blame] | 325 | |
| 326 | LOCAL_LDLIBS += \ |
| 327 | $(EMULATOR_COMMON_LDLIBS) \ |
| 328 | $(EMULATOR_LIBQEMU_LDLIBS) \ |
Bhanu Chetlapalli | 741dc13 | 2012-05-08 17:16:03 -0700 | [diff] [blame] | 329 | $(ELFF_LDLIBS) |
David 'Digit' Turner | aff94b8 | 2011-02-07 18:10:54 +0100 | [diff] [blame] | 330 | |
| 331 | LOCAL_SRC_FILES := \ |
| 332 | audio/audio.c \ |
| 333 | disas.c \ |
| 334 | dma-helpers.c \ |
| 335 | gdbstub.c \ |
David 'Digit' Turner | aff94b8 | 2011-02-07 18:10:54 +0100 | [diff] [blame] | 336 | loader.c \ |
| 337 | monitor.c \ |
| 338 | qemu-timer.c \ |
David 'Digit' Turner | 317c9d5 | 2011-05-10 06:38:21 +0200 | [diff] [blame] | 339 | qemu-timer-common.c \ |
David 'Digit' Turner | aff94b8 | 2011-02-07 18:10:54 +0100 | [diff] [blame] | 340 | vl-android.c \ |
| 341 | android/console.c \ |
David 'Digit' Turner | cb88e79 | 2011-08-26 01:35:14 +0200 | [diff] [blame] | 342 | android/opengles.c \ |
David 'Digit' Turner | aff94b8 | 2011-02-07 18:10:54 +0100 | [diff] [blame] | 343 | android/display-core.c \ |
| 344 | android/protocol/attach-ui-proxy.c \ |
| 345 | android/protocol/fb-updates-proxy.c \ |
| 346 | android/protocol/user-events-impl.c \ |
| 347 | android/protocol/ui-commands-proxy.c \ |
| 348 | android/protocol/core-commands-impl.c \ |
David 'Digit' Turner | 852088c | 2013-12-14 23:04:12 +0100 | [diff] [blame] | 349 | android/protocol/core-commands-qemu.c \ |
David 'Digit' Turner | d4e803c | 2013-12-14 23:45:50 +0100 | [diff] [blame] | 350 | android/user-events-qemu.c \ |
David 'Digit' Turner | 852088c | 2013-12-14 23:04:12 +0100 | [diff] [blame] | 351 | ui/keymaps.c \ |
David 'Digit' Turner | aff94b8 | 2011-02-07 18:10:54 +0100 | [diff] [blame] | 352 | |
David 'Digit' Turner | 088edf8 | 2011-05-09 15:59:28 +0200 | [diff] [blame] | 353 | $(call gen-hx-header,qemu-monitor.hx,qemu-monitor.h,monitor.c) |
David 'Digit' Turner | 317c9d5 | 2011-05-10 06:38:21 +0200 | [diff] [blame] | 354 | $(call gen-hx-header,qemu-options.hx,qemu-options.def,vl-android.c qemu-options.h) |
David 'Digit' Turner | 42fc449 | 2011-06-29 13:16:16 +0200 | [diff] [blame] | 355 | $(call gen-hw-config-defs) |
David 'Digit' Turner | aff94b8 | 2011-02-07 18:10:54 +0100 | [diff] [blame] | 356 | |
| 357 | ifeq ($(HOST_OS),darwin) |
| 358 | FRAMEWORKS := OpenGL Cocoa QuickTime ApplicationServices Carbon IOKit |
| 359 | LOCAL_LDLIBS += $(FRAMEWORKS:%=-Wl,-framework,%) |
| 360 | endif |
| 361 | |
| 362 | # Generate a completely static executable if needed. |
| 363 | # Note that this means no sound and graphics on Linux. |
| 364 | # |
Andrew Hsieh | 632a0e1 | 2012-04-28 00:48:53 +0800 | [diff] [blame] | 365 | ifneq ($(strip $(CONFIG_STATIC_EXECUTABLE)$(BUILD_HOST_static)),) |
David 'Digit' Turner | 1634ff5 | 2013-12-14 23:31:41 +0100 | [diff] [blame] | 366 | LOCAL_SRC_FILES += android/dynlink-static.c |
David 'Digit' Turner | aff94b8 | 2011-02-07 18:10:54 +0100 | [diff] [blame] | 367 | LOCAL_LDLIBS += -static |
| 368 | endif |
| 369 | |
| 370 | # The following files cannot be in static libraries because they contain |
| 371 | # constructor functions that are otherwise stripped by the final linker |
| 372 | LOCAL_SRC_FILES += $(HW_OBJ_SOURCES) |
| 373 | LOCAL_CFLAGS += $(HW_OBJ_CFLAGS) |
| 374 | |
| 375 | LOCAL_SRC_FILES += $(BLOCK_SOURCES) |
| 376 | LOCAL_CFLAGS += $(BLOCK_CFLAGS) |
| 377 | |
David 'Digit' Turner | aff94b8 | 2011-02-07 18:10:54 +0100 | [diff] [blame] | 378 | $(call end-emulator-program) |
| 379 | |
| 380 | ############################################################################## |
| 381 | ############################################################################## |
| 382 | ### |
| 383 | ### emulator-$ARCH: Standalone emulator program |
| 384 | ### |
| 385 | ### |
| 386 | |
Andrew Hsieh | c7389bd | 2012-03-13 02:13:40 -0700 | [diff] [blame] | 387 | common_LOCAL_LDLIBS = |
| 388 | common_LOCAL_CFLAGS = |
| 389 | common_LOCAL_SRC_FILES = |
David 'Digit' Turner | aff94b8 | 2011-02-07 18:10:54 +0100 | [diff] [blame] | 390 | |
Andrew Hsieh | c7389bd | 2012-03-13 02:13:40 -0700 | [diff] [blame] | 391 | |
| 392 | common_LOCAL_STATIC_LIBRARIES := \ |
David 'Digit' Turner | aff94b8 | 2011-02-07 18:10:54 +0100 | [diff] [blame] | 393 | emulator-libui \ |
| 394 | emulator-libqemu \ |
| 395 | emulator-target-$(EMULATOR_TARGET_CPU) \ |
| 396 | emulator-libelff \ |
Bhanu Chetlapalli | 741dc13 | 2012-05-08 17:16:03 -0700 | [diff] [blame] | 397 | emulator-common |
David 'Digit' Turner | aff94b8 | 2011-02-07 18:10:54 +0100 | [diff] [blame] | 398 | |
Andrew Hsieh | c7389bd | 2012-03-13 02:13:40 -0700 | [diff] [blame] | 399 | common_LOCAL_LDLIBS += \ |
David 'Digit' Turner | aff94b8 | 2011-02-07 18:10:54 +0100 | [diff] [blame] | 400 | $(EMULATOR_COMMON_LDLIBS) \ |
| 401 | $(EMULATOR_LIBQEMU_LDLIBS) \ |
| 402 | $(EMULATOR_LIBUI_LDLIBS) \ |
Bhanu Chetlapalli | 741dc13 | 2012-05-08 17:16:03 -0700 | [diff] [blame] | 403 | $(ELFF_LDLIBS) |
David 'Digit' Turner | aff94b8 | 2011-02-07 18:10:54 +0100 | [diff] [blame] | 404 | |
Andrew Hsieh | c7389bd | 2012-03-13 02:13:40 -0700 | [diff] [blame] | 405 | common_LOCAL_CFLAGS += \ |
David 'Digit' Turner | aff94b8 | 2011-02-07 18:10:54 +0100 | [diff] [blame] | 406 | $(EMULATOR_TARGET_CFLAGS) \ |
| 407 | $(EMULATOR_COMMON_CFLAGS) \ |
| 408 | $(EMULATOR_LIBQEMU_CFLAGS) \ |
| 409 | $(EMULATOR_LIBUI_CFLAGS) |
| 410 | |
Andrew Hsieh | c7389bd | 2012-03-13 02:13:40 -0700 | [diff] [blame] | 411 | common_LOCAL_SRC_FILES := \ |
David 'Digit' Turner | aff94b8 | 2011-02-07 18:10:54 +0100 | [diff] [blame] | 412 | audio/audio.c \ |
| 413 | disas.c \ |
| 414 | dma-helpers.c \ |
| 415 | gdbstub.c \ |
David 'Digit' Turner | aff94b8 | 2011-02-07 18:10:54 +0100 | [diff] [blame] | 416 | loader.c \ |
| 417 | monitor.c \ |
| 418 | qemu-timer.c \ |
David 'Digit' Turner | 317c9d5 | 2011-05-10 06:38:21 +0200 | [diff] [blame] | 419 | qemu-timer-common.c \ |
David 'Digit' Turner | aff94b8 | 2011-02-07 18:10:54 +0100 | [diff] [blame] | 420 | vl-android.c \ |
| 421 | android/cmdline-option.c \ |
| 422 | android/console.c \ |
| 423 | android/display.c \ |
| 424 | android/display-core.c \ |
| 425 | android/help.c \ |
| 426 | android/main-common.c \ |
| 427 | android/main.c \ |
David 'Digit' Turner | cb88e79 | 2011-08-26 01:35:14 +0200 | [diff] [blame] | 428 | android/opengles.c \ |
David 'Digit' Turner | aff94b8 | 2011-02-07 18:10:54 +0100 | [diff] [blame] | 429 | android/protocol/core-commands-qemu.c \ |
| 430 | android/protocol/ui-commands-qemu.c \ |
David 'Digit' Turner | d4e803c | 2013-12-14 23:45:50 +0100 | [diff] [blame] | 431 | android/user-events-qemu.c \ |
David 'Digit' Turner | 852088c | 2013-12-14 23:04:12 +0100 | [diff] [blame] | 432 | ui/keymaps.c \ |
David 'Digit' Turner | aff94b8 | 2011-02-07 18:10:54 +0100 | [diff] [blame] | 433 | |
David 'Digit' Turner | aff94b8 | 2011-02-07 18:10:54 +0100 | [diff] [blame] | 434 | |
| 435 | # The following files cannot be in static libraries because they contain |
| 436 | # constructor functions that are otherwise stripped by the final linker |
Andrew Hsieh | c7389bd | 2012-03-13 02:13:40 -0700 | [diff] [blame] | 437 | common_LOCAL_SRC_FILES += $(HW_OBJ_SOURCES) |
| 438 | common_LOCAL_CFLAGS += $(HW_OBJ_CFLAGS) |
David 'Digit' Turner | aff94b8 | 2011-02-07 18:10:54 +0100 | [diff] [blame] | 439 | |
Andrew Hsieh | c7389bd | 2012-03-13 02:13:40 -0700 | [diff] [blame] | 440 | common_LOCAL_SRC_FILES += $(BLOCK_SOURCES) |
| 441 | common_LOCAL_CFLAGS += $(BLOCK_CFLAGS) |
David 'Digit' Turner | aff94b8 | 2011-02-07 18:10:54 +0100 | [diff] [blame] | 442 | |
Andrew Hsieh | c7389bd | 2012-03-13 02:13:40 -0700 | [diff] [blame] | 443 | common_LOCAL_SRC_FILES += $(SDLMAIN_SOURCES) |
David 'Digit' Turner | aff94b8 | 2011-02-07 18:10:54 +0100 | [diff] [blame] | 444 | |
| 445 | # Generate a completely static executable if needed. |
| 446 | # Note that this means no sound and graphics on Linux. |
| 447 | # |
Andrew Hsieh | 632a0e1 | 2012-04-28 00:48:53 +0800 | [diff] [blame] | 448 | ifneq ($(strip $(CONFIG_STATIC_EXECUTABLE)$(BUILD_HOST_static)),) |
David 'Digit' Turner | 1634ff5 | 2013-12-14 23:31:41 +0100 | [diff] [blame] | 449 | common_LOCAL_SRC_FILES += android/dynlink-static.c |
Andrew Hsieh | c7389bd | 2012-03-13 02:13:40 -0700 | [diff] [blame] | 450 | common_LOCAL_LDLIBS += -static |
David 'Digit' Turner | aff94b8 | 2011-02-07 18:10:54 +0100 | [diff] [blame] | 451 | endif |
| 452 | |
Andrew Hsieh | c7389bd | 2012-03-13 02:13:40 -0700 | [diff] [blame] | 453 | ## one for 32-bit |
| 454 | $(call start-emulator-program, emulator-$(EMULATOR_TARGET_ARCH)) |
| 455 | LOCAL_STATIC_LIBRARIES += \ |
| 456 | emulator-libui \ |
| 457 | emulator-libqemu \ |
| 458 | emulator-target-$(EMULATOR_TARGET_CPU) \ |
Lars Poeschel | 33da99a | 2012-08-22 09:42:42 +0200 | [diff] [blame] | 459 | emulator-libjpeg \ |
Andrew Hsieh | c7389bd | 2012-03-13 02:13:40 -0700 | [diff] [blame] | 460 | emulator-libelff \ |
| 461 | emulator-common \ |
| 462 | $(SDL_STATIC_LIBRARIES) |
| 463 | LOCAL_LDLIBS += $(common_LOCAL_LDLIBS) |
| 464 | LOCAL_CFLAGS += $(common_LOCAL_CFLAGS) |
| 465 | LOCAL_SRC_FILES += $(common_LOCAL_SRC_FILES) |
| 466 | $(call gen-hx-header,qemu-monitor.hx,qemu-monitor.h,monitor.c) |
| 467 | $(call gen-hx-header,qemu-options.hx,qemu-options.def,vl-android.c qemu-options.h) |
| 468 | $(call gen-hw-config-defs) |
Raphael Moll | cdbea23 | 2012-05-04 15:04:27 -0700 | [diff] [blame] | 469 | |
| 470 | ifeq ($(HOST_OS),windows) |
| 471 | $(eval $(call insert-windows-icon)) |
| 472 | endif |
| 473 | |
David 'Digit' Turner | aff94b8 | 2011-02-07 18:10:54 +0100 | [diff] [blame] | 474 | $(call end-emulator-program) |
Andrew Hsieh | c7389bd | 2012-03-13 02:13:40 -0700 | [diff] [blame] | 475 | |
| 476 | |
| 477 | ## another for 64-bit, see note in file Makefile.common emulator64-common |
Andrew Hsieh | 83df59c | 2012-07-24 16:06:28 -0700 | [diff] [blame] | 478 | ifneq ($(filter linux darwin,$(HOST_OS)),) |
Andrew Hsieh | c7389bd | 2012-03-13 02:13:40 -0700 | [diff] [blame] | 479 | ifneq ($(BUILD_STANDALONE_EMULATOR),true) |
| 480 | $(call start-emulator-program, emulator64-$(EMULATOR_TARGET_ARCH)) |
| 481 | LOCAL_STATIC_LIBRARIES += \ |
| 482 | emulator64-libui \ |
| 483 | emulator64-libqemu \ |
| 484 | emulator64-target-$(EMULATOR_TARGET_CPU) \ |
Lars Poeschel | 33da99a | 2012-08-22 09:42:42 +0200 | [diff] [blame] | 485 | emulator64-libjpeg \ |
Andrew Hsieh | c7389bd | 2012-03-13 02:13:40 -0700 | [diff] [blame] | 486 | emulator64-libelff \ |
| 487 | emulator64-common \ |
| 488 | $(SDL_STATIC_LIBRARIES_64) |
| 489 | LOCAL_LDLIBS += $(common_LOCAL_LDLIBS) -m64 |
| 490 | LOCAL_CFLAGS += $(common_LOCAL_CFLAGS) -m64 |
| 491 | LOCAL_SRC_FILES += $(common_LOCAL_SRC_FILES) |
| 492 | $(call gen-hx-header,qemu-monitor.hx,qemu-monitor.h,monitor.c) |
| 493 | $(call gen-hx-header,qemu-options.hx,qemu-options.def,vl-android.c qemu-options.h) |
| 494 | $(call gen-hw-config-defs) |
| 495 | $(call end-emulator-program) |
| 496 | endif # BUILD_STANDALONE_EMULATOR == nil |
Andrew Hsieh | 83df59c | 2012-07-24 16:06:28 -0700 | [diff] [blame] | 497 | endif # HOST_OS == linux || darwin |
Raphael Moll | cdbea23 | 2012-05-04 15:04:27 -0700 | [diff] [blame] | 498 | |