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 | 1d1a2af | 2014-01-10 16:17:40 +0100 | [diff] [blame] | 48 | common_LOCAL_CFLAGS += -I$(GLIB_INCLUDE_DIR) |
David 'Digit' Turner | aff94b8 | 2011-02-07 18:10:54 +0100 | [diff] [blame] | 49 | |
| 50 | # The following is to ensure that "config.h" will map to a target-specific |
| 51 | # configuration file header. |
Andrew Hsieh | c7389bd | 2012-03-13 02:13:40 -0700 | [diff] [blame] | 52 | common_LOCAL_CFLAGS += $(EMULATOR_TARGET_CFLAGS) |
David 'Digit' Turner | aff94b8 | 2011-02-07 18:10:54 +0100 | [diff] [blame] | 53 | |
Andrew Hsieh | c7389bd | 2012-03-13 02:13:40 -0700 | [diff] [blame] | 54 | common_LOCAL_SRC_FILES += \ |
David 'Digit' Turner | aff94b8 | 2011-02-07 18:10:54 +0100 | [diff] [blame] | 55 | tcg/tcg.c \ |
Octavian Purdila | 9f9deaf | 2013-11-08 19:00:56 +0200 | [diff] [blame] | 56 | tcg-runtime.c \ |
David 'Digit' Turner | dc78122 | 2014-03-07 16:53:45 +0100 | [diff] [blame] | 57 | util/host-utils.c \ |
David 'Digit' Turner | aff94b8 | 2011-02-07 18:10:54 +0100 | [diff] [blame] | 58 | |
| 59 | ############################################################################## |
| 60 | # Emulated hardware devices. |
| 61 | # |
| 62 | |
| 63 | HW_SOURCES := \ |
David 'Digit' Turner | 4b6bb76 | 2013-12-17 10:26:45 +0100 | [diff] [blame] | 64 | bt/core.c \ |
| 65 | bt/hci.c \ |
| 66 | bt/hid.c \ |
| 67 | bt/l2cap.c \ |
| 68 | bt/sdp.c \ |
David 'Digit' Turner | 4023ec8 | 2013-12-17 11:35:40 +0100 | [diff] [blame] | 69 | block/cdrom.c \ |
David 'Digit' Turner | 2ec695a | 2013-12-17 10:03:39 +0100 | [diff] [blame] | 70 | core/irq.c \ |
David 'Digit' Turner | 1074542 | 2013-12-17 10:05:40 +0100 | [diff] [blame] | 71 | core/qdev.c \ |
David 'Digit' Turner | 291300f | 2013-12-17 10:06:47 +0100 | [diff] [blame] | 72 | core/sysbus.c \ |
David 'Digit' Turner | f7c8d82 | 2013-12-17 14:02:11 +0100 | [diff] [blame] | 73 | core/dma.c \ |
David 'Digit' Turner | f066542 | 2013-12-17 10:47:09 +0100 | [diff] [blame] | 74 | android/goldfish/audio.c \ |
| 75 | android/goldfish/device.c \ |
| 76 | android/goldfish/events_device.c \ |
| 77 | android/goldfish/fb.c \ |
| 78 | android/goldfish/battery.c \ |
| 79 | android/goldfish/mmc.c \ |
| 80 | android/goldfish/memlog.c \ |
| 81 | android/goldfish/nand.c \ |
| 82 | android/goldfish/pipe.c \ |
| 83 | android/goldfish/tty.c \ |
| 84 | android/goldfish/vmem.c \ |
David 'Digit' Turner | 7977bd6 | 2013-12-17 11:17:24 +0100 | [diff] [blame] | 85 | pci/pci.c \ |
David 'Digit' Turner | be5c971 | 2013-12-17 13:56:10 +0100 | [diff] [blame] | 86 | scsi/scsi-disk.c \ |
David 'Digit' Turner | 704463f | 2013-12-17 11:33:57 +0100 | [diff] [blame] | 87 | usb/dev-hid.c \ |
| 88 | usb/dev-hub.c \ |
| 89 | usb/dev-storage.c \ |
| 90 | usb/hcd-ohci.c \ |
| 91 | usb/core.c \ |
David 'Digit' Turner | e2f7405 | 2013-12-17 11:29:40 +0100 | [diff] [blame] | 92 | watchdog/watchdog.c |
David 'Digit' Turner | aff94b8 | 2011-02-07 18:10:54 +0100 | [diff] [blame] | 93 | |
David 'Digit' Turner | 42fc449 | 2011-06-29 13:16:16 +0200 | [diff] [blame] | 94 | |
David 'Digit' Turner | aff94b8 | 2011-02-07 18:10:54 +0100 | [diff] [blame] | 95 | ifeq ($(EMULATOR_TARGET_ARCH),arm) |
David 'Digit' Turner | d129876 | 2013-12-17 10:22:24 +0100 | [diff] [blame] | 96 | HW_SOURCES += \ |
David 'Digit' Turner | ea06669 | 2013-12-17 14:03:28 +0100 | [diff] [blame] | 97 | android/android_arm.c \ |
David 'Digit' Turner | d129876 | 2013-12-17 10:22:24 +0100 | [diff] [blame] | 98 | arm/pic.c \ |
| 99 | arm/boot.c \ |
David 'Digit' Turner | f066542 | 2013-12-17 10:47:09 +0100 | [diff] [blame] | 100 | android/goldfish/interrupt.c \ |
| 101 | android/goldfish/switch.c \ |
| 102 | android/goldfish/timer.c \ |
| 103 | android/goldfish/trace.c \ |
David 'Digit' Turner | aff94b8 | 2011-02-07 18:10:54 +0100 | [diff] [blame] | 104 | |
| 105 | # The following sources must be compiled with the final executables |
| 106 | # because they contain device_init() or machine_init() statements. |
David 'Digit' Turner | ebf1de0 | 2013-12-17 13:57:47 +0100 | [diff] [blame] | 107 | HW_OBJ_SOURCES := hw/net/smc91c111.c |
David 'Digit' Turner | aff94b8 | 2011-02-07 18:10:54 +0100 | [diff] [blame] | 108 | HW_OBJ_CFLAGS := $(EMULATOR_TARGET_CFLAGS) |
| 109 | |
David 'Digit' Turner | cc33b2d | 2013-12-15 00:09:42 +0100 | [diff] [blame] | 110 | common_LOCAL_SRC_FILES += disas/arm.c |
David 'Digit' Turner | aff94b8 | 2011-02-07 18:10:54 +0100 | [diff] [blame] | 111 | |
| 112 | # smc91c111.c requires <zlib.h> |
Andrew Hsieh | c7389bd | 2012-03-13 02:13:40 -0700 | [diff] [blame] | 113 | common_LOCAL_CFLAGS += $(ZLIB_CFLAGS) |
David 'Digit' Turner | aff94b8 | 2011-02-07 18:10:54 +0100 | [diff] [blame] | 114 | endif |
| 115 | |
David 'Digit' Turner | 764a3c9 | 2011-05-05 12:40:49 +0200 | [diff] [blame] | 116 | # required to ensure we properly initialize virtual audio hardware |
Andrew Hsieh | c7389bd | 2012-03-13 02:13:40 -0700 | [diff] [blame] | 117 | common_LOCAL_CFLAGS += -DHAS_AUDIO |
David 'Digit' Turner | 764a3c9 | 2011-05-05 12:40:49 +0200 | [diff] [blame] | 118 | |
David 'Digit' Turner | aff94b8 | 2011-02-07 18:10:54 +0100 | [diff] [blame] | 119 | ifeq ($(EMULATOR_TARGET_ARCH),x86) |
| 120 | HW_SOURCES += \ |
David 'Digit' Turner | 3fbb656 | 2013-12-17 10:08:21 +0100 | [diff] [blame] | 121 | intc/apic.c \ |
David 'Digit' Turner | 9133525 | 2013-12-17 13:52:01 +0100 | [diff] [blame] | 122 | intc/i8259.c \ |
David 'Digit' Turner | 6d7b529 | 2013-12-17 13:53:17 +0100 | [diff] [blame] | 123 | timer/mc146818rtc.c \ |
David 'Digit' Turner | bfa4dab | 2013-12-17 11:19:22 +0100 | [diff] [blame] | 124 | pci-host/piix.c \ |
David 'Digit' Turner | 6459c4a | 2013-12-17 10:31:05 +0100 | [diff] [blame] | 125 | timer/i8254.c \ |
David 'Digit' Turner | 7b76926 | 2013-12-17 13:54:37 +0100 | [diff] [blame] | 126 | input/pckbd.c \ |
David 'Digit' Turner | 1079fa7 | 2013-12-17 13:55:27 +0100 | [diff] [blame] | 127 | intc/ioapic.c \ |
David 'Digit' Turner | 4ecc3dd | 2013-12-17 11:16:00 +0100 | [diff] [blame] | 128 | input/ps2.c \ |
David 'Digit' Turner | 343e928 | 2013-12-17 13:56:48 +0100 | [diff] [blame] | 129 | i386/smbios.c \ |
David 'Digit' Turner | a367a10 | 2013-12-17 11:36:33 +0100 | [diff] [blame] | 130 | nvram/fw_cfg.c |
David 'Digit' Turner | aff94b8 | 2011-02-07 18:10:54 +0100 | [diff] [blame] | 131 | |
| 132 | # The following sources must be compiled with the final executables |
| 133 | # because they contain device_init() or machine_init() statements. |
| 134 | HW_OBJ_SOURCES := \ |
David 'Digit' Turner | 0840598 | 2013-12-17 11:35:00 +0100 | [diff] [blame] | 135 | hw/net/ne2000.c \ |
David 'Digit' Turner | bb22854 | 2013-12-17 13:53:59 +0100 | [diff] [blame] | 136 | hw/i386/pc.c |
David 'Digit' Turner | aff94b8 | 2011-02-07 18:10:54 +0100 | [diff] [blame] | 137 | |
| 138 | HW_OBJ_CFLAGS := $(EMULATOR_TARGET_CFLAGS) |
| 139 | |
| 140 | endif |
| 141 | |
Bhanu Chetlapalli | 741dc13 | 2012-05-08 17:16:03 -0700 | [diff] [blame] | 142 | ifeq ($(EMULATOR_TARGET_ARCH),mips) |
| 143 | HW_SOURCES += \ |
David 'Digit' Turner | ea06669 | 2013-12-17 14:03:28 +0100 | [diff] [blame] | 144 | android/android_mips.c \ |
David 'Digit' Turner | af0fc43 | 2013-12-17 14:00:52 +0100 | [diff] [blame] | 145 | mips/mips_pic.c \ |
David 'Digit' Turner | f066542 | 2013-12-17 10:47:09 +0100 | [diff] [blame] | 146 | android/goldfish/interrupt.c \ |
| 147 | android/goldfish/switch.c \ |
| 148 | android/goldfish/timer.c \ |
| 149 | android/goldfish/trace.c \ |
David 'Digit' Turner | af0fc43 | 2013-12-17 14:00:52 +0100 | [diff] [blame] | 150 | mips/cputimer.c \ |
| 151 | mips/mips_int.c |
Bhanu Chetlapalli | 741dc13 | 2012-05-08 17:16:03 -0700 | [diff] [blame] | 152 | |
| 153 | # The following sources must be compiled with the final executables |
| 154 | # because they contain device_init() or machine_init() statements. |
David 'Digit' Turner | ebf1de0 | 2013-12-17 13:57:47 +0100 | [diff] [blame] | 155 | HW_OBJ_SOURCES := hw/net/smc91c111.c |
Bhanu Chetlapalli | 741dc13 | 2012-05-08 17:16:03 -0700 | [diff] [blame] | 156 | HW_OBJ_CFLAGS := $(EMULATOR_TARGET_CFLAGS) |
| 157 | |
David 'Digit' Turner | cc33b2d | 2013-12-15 00:09:42 +0100 | [diff] [blame] | 158 | common_LOCAL_SRC_FILES += disas/mips.c |
Bhanu Chetlapalli | 741dc13 | 2012-05-08 17:16:03 -0700 | [diff] [blame] | 159 | |
| 160 | # smc91c111.c requires <zlib.h> |
| 161 | LOCAL_CFLAGS += $(ZLIB_CFLAGS) |
| 162 | ifeq ($(ARCH_HAS_BIGENDIAN),true) |
| 163 | LOCAL_CFLAGS += -DTARGET_WORDS_BIGENDIAN |
| 164 | endif |
| 165 | |
| 166 | endif |
Andrew Hsieh | c7389bd | 2012-03-13 02:13:40 -0700 | [diff] [blame] | 167 | common_LOCAL_SRC_FILES += $(HW_SOURCES:%=hw/%) |
David 'Digit' Turner | aff94b8 | 2011-02-07 18:10:54 +0100 | [diff] [blame] | 168 | |
Andrew Hsieh | c7389bd | 2012-03-13 02:13:40 -0700 | [diff] [blame] | 169 | common_LOCAL_SRC_FILES += \ |
David 'Digit' Turner | 2a0488a | 2013-12-17 11:22:12 +0100 | [diff] [blame] | 170 | backends/msmouse.c \ |
David 'Digit' Turner | aff94b8 | 2011-02-07 18:10:54 +0100 | [diff] [blame] | 171 | cpu-exec.c \ |
David 'Digit' Turner | 3dc53fc | 2014-01-17 01:23:40 +0100 | [diff] [blame] | 172 | cputlb.c \ |
David 'Digit' Turner | 317c9d5 | 2011-05-10 06:38:21 +0200 | [diff] [blame] | 173 | exec.c \ |
David 'Digit' Turner | f9077a8 | 2014-02-10 23:10:47 +0100 | [diff] [blame] | 174 | main-loop.c \ |
David 'Digit' Turner | fdec1f1 | 2014-03-21 11:49:03 +0100 | [diff] [blame] | 175 | memory-android.c \ |
David 'Digit' Turner | aa1180c | 2014-01-28 06:08:00 +0100 | [diff] [blame] | 176 | monitor-android.c \ |
David 'Digit' Turner | aff94b8 | 2011-02-07 18:10:54 +0100 | [diff] [blame] | 177 | translate-all.c \ |
David 'Digit' Turner | 13209b9 | 2013-12-17 09:54:09 +0100 | [diff] [blame] | 178 | android/varint.c \ |
David 'Digit' Turner | aff94b8 | 2011-02-07 18:10:54 +0100 | [diff] [blame] | 179 | |
| 180 | ############################################################################## |
| 181 | # CPU-specific emulation. |
| 182 | # |
Andrew Hsieh | c7389bd | 2012-03-13 02:13:40 -0700 | [diff] [blame] | 183 | common_LOCAL_CFLAGS += -fno-PIC -fomit-frame-pointer -Wno-sign-compare |
David 'Digit' Turner | aff94b8 | 2011-02-07 18:10:54 +0100 | [diff] [blame] | 184 | |
| 185 | ifeq ($(HOST_ARCH),ppc) |
Andrew Hsieh | c7389bd | 2012-03-13 02:13:40 -0700 | [diff] [blame] | 186 | common_LOCAL_CFLAGS += -D__powerpc__ |
David 'Digit' Turner | aff94b8 | 2011-02-07 18:10:54 +0100 | [diff] [blame] | 187 | endif |
| 188 | |
| 189 | ifeq ($(EMULATOR_TARGET_ARCH),arm) |
Andrew Hsieh | c7389bd | 2012-03-13 02:13:40 -0700 | [diff] [blame] | 190 | common_LOCAL_SRC_FILES += \ |
David 'Digit' Turner | 82a591c | 2013-12-17 09:10:58 +0100 | [diff] [blame] | 191 | target-arm/arm-semi.c \ |
David 'Digit' Turner | aff94b8 | 2011-02-07 18:10:54 +0100 | [diff] [blame] | 192 | target-arm/op_helper.c \ |
| 193 | target-arm/iwmmxt_helper.c \ |
| 194 | target-arm/neon_helper.c \ |
| 195 | target-arm/helper.c \ |
David 'Digit' Turner | 288208c | 2011-05-11 19:37:35 +0200 | [diff] [blame] | 196 | target-arm/helper-android.c \ |
David 'Digit' Turner | aff94b8 | 2011-02-07 18:10:54 +0100 | [diff] [blame] | 197 | target-arm/translate.c \ |
| 198 | target-arm/machine.c \ |
David 'Digit' Turner | cd0c34b | 2013-12-17 10:19:44 +0100 | [diff] [blame] | 199 | hw/arm/armv7m.c \ |
| 200 | hw/arm/armv7m_nvic.c |
David 'Digit' Turner | e228840 | 2014-01-09 18:35:14 +0100 | [diff] [blame] | 201 | endif # EMULATOR_TARGET_ARCH == arm |
David 'Digit' Turner | aff94b8 | 2011-02-07 18:10:54 +0100 | [diff] [blame] | 202 | |
| 203 | ifeq ($(EMULATOR_TARGET_ARCH), x86) |
Andrew Hsieh | c7389bd | 2012-03-13 02:13:40 -0700 | [diff] [blame] | 204 | common_LOCAL_SRC_FILES += \ |
David 'Digit' Turner | ebb1b24 | 2014-04-07 14:47:57 +0200 | [diff] [blame^] | 205 | target-i386/cc_helper.c \ |
David 'Digit' Turner | aff94b8 | 2011-02-07 18:10:54 +0100 | [diff] [blame] | 206 | target-i386/op_helper.c \ |
| 207 | target-i386/helper.c \ |
| 208 | target-i386/translate.c \ |
| 209 | target-i386/machine.c \ |
| 210 | |
Jun Nakajima | e4a3c78 | 2011-12-17 19:22:12 -0800 | [diff] [blame] | 211 | ifeq ($(HOST_OS),darwin) |
Andrew Hsieh | c7389bd | 2012-03-13 02:13:40 -0700 | [diff] [blame] | 212 | common_LOCAL_SRC_FILES += \ |
Jun Nakajima | e4a3c78 | 2011-12-17 19:22:12 -0800 | [diff] [blame] | 213 | target-i386/hax-all.c \ |
| 214 | target-i386/hax-darwin.c |
| 215 | endif |
| 216 | |
| 217 | ifeq ($(HOST_OS),windows) |
Andrew Hsieh | c7389bd | 2012-03-13 02:13:40 -0700 | [diff] [blame] | 218 | common_LOCAL_SRC_FILES += \ |
Jun Nakajima | e4a3c78 | 2011-12-17 19:22:12 -0800 | [diff] [blame] | 219 | target-i386/hax-all.c \ |
| 220 | target-i386/hax-windows.c |
| 221 | endif |
David 'Digit' Turner | e228840 | 2014-01-09 18:35:14 +0100 | [diff] [blame] | 222 | endif # EMULATOR_TARGET_ARCH == x86 |
David 'Digit' Turner | aff94b8 | 2011-02-07 18:10:54 +0100 | [diff] [blame] | 223 | |
Bhanu Chetlapalli | 741dc13 | 2012-05-08 17:16:03 -0700 | [diff] [blame] | 224 | ifeq ($(EMULATOR_TARGET_ARCH), mips) |
| 225 | common_LOCAL_SRC_FILES += \ |
| 226 | target-mips/op_helper.c \ |
| 227 | target-mips/helper.c \ |
| 228 | target-mips/translate.c \ |
| 229 | target-mips/machine.c |
David 'Digit' Turner | e228840 | 2014-01-09 18:35:14 +0100 | [diff] [blame] | 230 | endif # EMULATOR_TARGET_ARCH == mips |
Bhanu Chetlapalli | 741dc13 | 2012-05-08 17:16:03 -0700 | [diff] [blame] | 231 | |
| 232 | common_LOCAL_SRC_FILES += fpu/softfloat.c |
Bhanu Chetlapalli | 741dc13 | 2012-05-08 17:16:03 -0700 | [diff] [blame] | 233 | |
Jun Nakajima | 1321c76 | 2011-03-04 17:17:45 -0800 | [diff] [blame] | 234 | # compile KVM only if target is x86 on x86 Linux |
David 'Digit' Turner | 3659775 | 2011-05-20 01:18:01 +0200 | [diff] [blame] | 235 | QEMU_KVM_TAG := $(QEMU_HOST_TAG)-$(EMULATOR_TARGET_ARCH) |
| 236 | QEMU_DO_KVM := $(if $(filter linux-x86-x86 linux-x86_64-x86,$(QEMU_KVM_TAG)),true,false) |
| 237 | ifeq ($(QEMU_DO_KVM),true) |
Andrew Hsieh | c7389bd | 2012-03-13 02:13:40 -0700 | [diff] [blame] | 238 | common_LOCAL_SRC_FILES += \ |
David 'Digit' Turner | 3659775 | 2011-05-20 01:18:01 +0200 | [diff] [blame] | 239 | target-i386/kvm.c \ |
Jun Nakajima | bb0140b | 2011-05-27 18:24:21 -0700 | [diff] [blame] | 240 | target-i386/kvm-gs-restore.c \ |
David 'Digit' Turner | 3659775 | 2011-05-20 01:18:01 +0200 | [diff] [blame] | 241 | kvm-all.c \ |
| 242 | kvm-android.c |
Jun Nakajima | 1321c76 | 2011-03-04 17:17:45 -0800 | [diff] [blame] | 243 | endif |
| 244 | |
David 'Digit' Turner | aff94b8 | 2011-02-07 18:10:54 +0100 | [diff] [blame] | 245 | ############################################################################## |
| 246 | # Memory-access checking support. |
| 247 | # Memory access checker uses information collected by instrumented code in |
| 248 | # libc.so in order to keep track of memory blocks allocated from heap. Memory |
| 249 | # checker then uses this information to make sure that every access to allocated |
| 250 | # memory is within allocated block. This information also allows detecting |
| 251 | # memory leaks and attempts to free/realloc invalid pointers. |
| 252 | # |
David 'Digit' Turner | f8f7375 | 2014-03-14 17:30:51 +0100 | [diff] [blame] | 253 | common_LOCAL_CFLAGS += $(ELFF_CFLAGS) |
David 'Digit' Turner | aff94b8 | 2011-02-07 18:10:54 +0100 | [diff] [blame] | 254 | |
| 255 | MCHK_SOURCES := \ |
| 256 | memcheck.c \ |
| 257 | memcheck_proc_management.c \ |
| 258 | memcheck_malloc_map.c \ |
| 259 | memcheck_mmrange_map.c \ |
Bhanu Chetlapalli | 741dc13 | 2012-05-08 17:16:03 -0700 | [diff] [blame] | 260 | memcheck_util.c |
David 'Digit' Turner | aff94b8 | 2011-02-07 18:10:54 +0100 | [diff] [blame] | 261 | |
David 'Digit' Turner | 96e493a | 2014-03-14 17:17:26 +0100 | [diff] [blame] | 262 | common_LOCAL_SRC_FILES += $(MCHK_SOURCES:%=android/qemu/memcheck/%) |
David 'Digit' Turner | aff94b8 | 2011-02-07 18:10:54 +0100 | [diff] [blame] | 263 | |
Andrew Hsieh | c7389bd | 2012-03-13 02:13:40 -0700 | [diff] [blame] | 264 | common_LOCAL_SRC_FILES += \ |
David 'Digit' Turner | ae3098a | 2011-05-11 16:01:57 +0200 | [diff] [blame] | 265 | cpus.c \ |
| 266 | arch_init.c |
| 267 | |
David 'Digit' Turner | 088edf8 | 2011-05-09 15:59:28 +0200 | [diff] [blame] | 268 | # What a mess, os-posix.c depends on the exact values of options |
| 269 | # which are target specific. |
| 270 | ifeq ($(HOST_OS),windows) |
David 'Digit' Turner | 1c31e3e | 2013-12-14 20:07:17 +0100 | [diff] [blame] | 271 | common_LOCAL_SRC_FILES += os-win32.c util/oslib-win32.c |
David 'Digit' Turner | 088edf8 | 2011-05-09 15:59:28 +0200 | [diff] [blame] | 272 | else |
David 'Digit' Turner | 1c31e3e | 2013-12-14 20:07:17 +0100 | [diff] [blame] | 273 | common_LOCAL_SRC_FILES += os-posix.c util/oslib-posix.c |
David 'Digit' Turner | 088edf8 | 2011-05-09 15:59:28 +0200 | [diff] [blame] | 274 | endif |
David 'Digit' Turner | aff94b8 | 2011-02-07 18:10:54 +0100 | [diff] [blame] | 275 | |
Andrew Hsieh | c7389bd | 2012-03-13 02:13:40 -0700 | [diff] [blame] | 276 | |
| 277 | ## one for 32-bit |
| 278 | $(call start-emulator-library, emulator-target-$(EMULATOR_TARGET_CPU)) |
| 279 | LOCAL_CFLAGS += $(common_LOCAL_CFLAGS) |
| 280 | LOCAL_SRC_FILES += $(common_LOCAL_SRC_FILES) |
| 281 | $(call gen-hw-config-defs) |
| 282 | $(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] | 283 | $(call end-emulator-library) |
| 284 | |
David 'Digit' Turner | af061c5 | 2014-02-28 23:33:54 +0100 | [diff] [blame] | 285 | ifdef EMULATOR_BUILD_64BITS |
David 'Digit' Turner | f6f5007 | 2014-01-14 14:39:13 +0100 | [diff] [blame] | 286 | $(call start-emulator-library, emulator64-target-$(EMULATOR_TARGET_CPU)) |
| 287 | LOCAL_CFLAGS += $(common_LOCAL_CFLAGS) -m64 |
| 288 | LOCAL_SRC_FILES += $(common_LOCAL_SRC_FILES) |
| 289 | $(call gen-hw-config-defs) |
| 290 | $(call gen-hx-header,qemu-options.hx,qemu-options.def,os-posix.c os-win32.c) |
| 291 | $(call end-emulator-library) |
David 'Digit' Turner | af061c5 | 2014-02-28 23:33:54 +0100 | [diff] [blame] | 292 | endif # EMULATOR_BUILD_64BITS |
Andrew Hsieh | c7389bd | 2012-03-13 02:13:40 -0700 | [diff] [blame] | 293 | |
David 'Digit' Turner | aff94b8 | 2011-02-07 18:10:54 +0100 | [diff] [blame] | 294 | ############################################################################## |
| 295 | ############################################################################## |
| 296 | ### |
| 297 | ### emulator-$ARCH: Standalone emulator program |
| 298 | ### |
| 299 | ### |
| 300 | |
Andrew Hsieh | c7389bd | 2012-03-13 02:13:40 -0700 | [diff] [blame] | 301 | common_LOCAL_LDLIBS = |
| 302 | common_LOCAL_CFLAGS = |
| 303 | common_LOCAL_SRC_FILES = |
David 'Digit' Turner | aff94b8 | 2011-02-07 18:10:54 +0100 | [diff] [blame] | 304 | |
Andrew Hsieh | c7389bd | 2012-03-13 02:13:40 -0700 | [diff] [blame] | 305 | |
| 306 | common_LOCAL_STATIC_LIBRARIES := \ |
David 'Digit' Turner | aff94b8 | 2011-02-07 18:10:54 +0100 | [diff] [blame] | 307 | emulator-libui \ |
| 308 | emulator-libqemu \ |
| 309 | emulator-target-$(EMULATOR_TARGET_CPU) \ |
| 310 | emulator-libelff \ |
Bhanu Chetlapalli | 741dc13 | 2012-05-08 17:16:03 -0700 | [diff] [blame] | 311 | emulator-common |
David 'Digit' Turner | aff94b8 | 2011-02-07 18:10:54 +0100 | [diff] [blame] | 312 | |
Andrew Hsieh | c7389bd | 2012-03-13 02:13:40 -0700 | [diff] [blame] | 313 | common_LOCAL_LDLIBS += \ |
David 'Digit' Turner | aff94b8 | 2011-02-07 18:10:54 +0100 | [diff] [blame] | 314 | $(EMULATOR_COMMON_LDLIBS) \ |
| 315 | $(EMULATOR_LIBQEMU_LDLIBS) \ |
| 316 | $(EMULATOR_LIBUI_LDLIBS) \ |
Bhanu Chetlapalli | 741dc13 | 2012-05-08 17:16:03 -0700 | [diff] [blame] | 317 | $(ELFF_LDLIBS) |
David 'Digit' Turner | aff94b8 | 2011-02-07 18:10:54 +0100 | [diff] [blame] | 318 | |
Andrew Hsieh | c7389bd | 2012-03-13 02:13:40 -0700 | [diff] [blame] | 319 | common_LOCAL_CFLAGS += \ |
David 'Digit' Turner | aff94b8 | 2011-02-07 18:10:54 +0100 | [diff] [blame] | 320 | $(EMULATOR_TARGET_CFLAGS) \ |
| 321 | $(EMULATOR_COMMON_CFLAGS) \ |
| 322 | $(EMULATOR_LIBQEMU_CFLAGS) \ |
| 323 | $(EMULATOR_LIBUI_CFLAGS) |
| 324 | |
Andrew Hsieh | c7389bd | 2012-03-13 02:13:40 -0700 | [diff] [blame] | 325 | common_LOCAL_SRC_FILES := \ |
David 'Digit' Turner | aff94b8 | 2011-02-07 18:10:54 +0100 | [diff] [blame] | 326 | audio/audio.c \ |
| 327 | disas.c \ |
| 328 | dma-helpers.c \ |
| 329 | gdbstub.c \ |
David 'Digit' Turner | aff94b8 | 2011-02-07 18:10:54 +0100 | [diff] [blame] | 330 | qemu-timer.c \ |
David 'Digit' Turner | f9077a8 | 2014-02-10 23:10:47 +0100 | [diff] [blame] | 331 | log-rotate-android.c \ |
David 'Digit' Turner | aff94b8 | 2011-02-07 18:10:54 +0100 | [diff] [blame] | 332 | vl-android.c \ |
| 333 | android/cmdline-option.c \ |
| 334 | android/console.c \ |
| 335 | android/display.c \ |
| 336 | android/display-core.c \ |
| 337 | android/help.c \ |
| 338 | android/main-common.c \ |
| 339 | android/main.c \ |
David 'Digit' Turner | cb88e79 | 2011-08-26 01:35:14 +0200 | [diff] [blame] | 340 | android/opengles.c \ |
David 'Digit' Turner | aff94b8 | 2011-02-07 18:10:54 +0100 | [diff] [blame] | 341 | android/protocol/core-commands-qemu.c \ |
| 342 | android/protocol/ui-commands-qemu.c \ |
David 'Digit' Turner | d4e803c | 2013-12-14 23:45:50 +0100 | [diff] [blame] | 343 | android/user-events-qemu.c \ |
David 'Digit' Turner | 70a9820 | 2013-12-17 09:30:04 +0100 | [diff] [blame] | 344 | hw/core/loader.c \ |
David 'Digit' Turner | 852088c | 2013-12-14 23:04:12 +0100 | [diff] [blame] | 345 | ui/keymaps.c \ |
David 'Digit' Turner | a18ede0 | 2014-02-06 14:30:48 +0100 | [diff] [blame] | 346 | util/qemu-timer-common.c \ |
David 'Digit' Turner | 1befd34 | 2014-01-15 17:56:45 +0100 | [diff] [blame] | 347 | util/iov.c \ |
David 'Digit' Turner | aff94b8 | 2011-02-07 18:10:54 +0100 | [diff] [blame] | 348 | |
David 'Digit' Turner | aff94b8 | 2011-02-07 18:10:54 +0100 | [diff] [blame] | 349 | # The following files cannot be in static libraries because they contain |
| 350 | # constructor functions that are otherwise stripped by the final linker |
Andrew Hsieh | c7389bd | 2012-03-13 02:13:40 -0700 | [diff] [blame] | 351 | common_LOCAL_SRC_FILES += $(HW_OBJ_SOURCES) |
| 352 | common_LOCAL_CFLAGS += $(HW_OBJ_CFLAGS) |
David 'Digit' Turner | aff94b8 | 2011-02-07 18:10:54 +0100 | [diff] [blame] | 353 | |
Andrew Hsieh | c7389bd | 2012-03-13 02:13:40 -0700 | [diff] [blame] | 354 | common_LOCAL_SRC_FILES += $(BLOCK_SOURCES) |
| 355 | common_LOCAL_CFLAGS += $(BLOCK_CFLAGS) |
David 'Digit' Turner | aff94b8 | 2011-02-07 18:10:54 +0100 | [diff] [blame] | 356 | |
David 'Digit' Turner | aff94b8 | 2011-02-07 18:10:54 +0100 | [diff] [blame] | 357 | # Generate a completely static executable if needed. |
| 358 | # Note that this means no sound and graphics on Linux. |
| 359 | # |
Andrew Hsieh | 632a0e1 | 2012-04-28 00:48:53 +0800 | [diff] [blame] | 360 | ifneq ($(strip $(CONFIG_STATIC_EXECUTABLE)$(BUILD_HOST_static)),) |
David 'Digit' Turner | 1634ff5 | 2013-12-14 23:31:41 +0100 | [diff] [blame] | 361 | common_LOCAL_SRC_FILES += android/dynlink-static.c |
Andrew Hsieh | c7389bd | 2012-03-13 02:13:40 -0700 | [diff] [blame] | 362 | common_LOCAL_LDLIBS += -static |
David 'Digit' Turner | aff94b8 | 2011-02-07 18:10:54 +0100 | [diff] [blame] | 363 | endif |
| 364 | |
Andrew Hsieh | c7389bd | 2012-03-13 02:13:40 -0700 | [diff] [blame] | 365 | ## one for 32-bit |
| 366 | $(call start-emulator-program, emulator-$(EMULATOR_TARGET_ARCH)) |
| 367 | LOCAL_STATIC_LIBRARIES += \ |
| 368 | emulator-libui \ |
| 369 | emulator-libqemu \ |
| 370 | emulator-target-$(EMULATOR_TARGET_CPU) \ |
Lars Poeschel | 33da99a | 2012-08-22 09:42:42 +0200 | [diff] [blame] | 371 | emulator-libjpeg \ |
Andrew Hsieh | c7389bd | 2012-03-13 02:13:40 -0700 | [diff] [blame] | 372 | emulator-libelff \ |
| 373 | emulator-common \ |
| 374 | $(SDL_STATIC_LIBRARIES) |
| 375 | LOCAL_LDLIBS += $(common_LOCAL_LDLIBS) |
David 'Digit' Turner | af061c5 | 2014-02-28 23:33:54 +0100 | [diff] [blame] | 376 | LOCAL_LDFLAGS += $(common_LOCAL_LDFLAGS) |
Andrew Hsieh | c7389bd | 2012-03-13 02:13:40 -0700 | [diff] [blame] | 377 | LOCAL_CFLAGS += $(common_LOCAL_CFLAGS) |
| 378 | LOCAL_SRC_FILES += $(common_LOCAL_SRC_FILES) |
Andrew Hsieh | c7389bd | 2012-03-13 02:13:40 -0700 | [diff] [blame] | 379 | $(call gen-hx-header,qemu-options.hx,qemu-options.def,vl-android.c qemu-options.h) |
| 380 | $(call gen-hw-config-defs) |
Raphael Moll | cdbea23 | 2012-05-04 15:04:27 -0700 | [diff] [blame] | 381 | |
| 382 | ifeq ($(HOST_OS),windows) |
David 'Digit' Turner | af061c5 | 2014-02-28 23:33:54 +0100 | [diff] [blame] | 383 | $(eval $(call insert-windows-icon)) |
| 384 | ifneq ($(BUILD_STANDALONE_EMULATOR),) |
| 385 | # Special exception for Windows: -lmingw32 must appear before libSDLmain |
| 386 | # on the link command-line, because it depends on _WinMain@16 which is |
| 387 | # exported by the latter. |
| 388 | LOCAL_LDFLAGS += -lmingw32 |
| 389 | else |
| 390 | # The previous trick doesn't work with the platform build system because |
| 391 | # it places all linker flags _after_ the actually libraries, so instead |
| 392 | # recompiler SDLmain from source so its object file is listed in the link |
| 393 | # command, forcing the linker to use it. |
| 394 | LOCAL_SRC_FILES += $(SDLMAIN_SOURCES:%=$(SDL_DIR)/%) |
| 395 | endif |
Raphael Moll | cdbea23 | 2012-05-04 15:04:27 -0700 | [diff] [blame] | 396 | endif |
| 397 | |
David 'Digit' Turner | aff94b8 | 2011-02-07 18:10:54 +0100 | [diff] [blame] | 398 | $(call end-emulator-program) |
Andrew Hsieh | c7389bd | 2012-03-13 02:13:40 -0700 | [diff] [blame] | 399 | |
| 400 | |
David 'Digit' Turner | af061c5 | 2014-02-28 23:33:54 +0100 | [diff] [blame] | 401 | ifdef EMULATOR_BUILD_64BITS |
David 'Digit' Turner | f6f5007 | 2014-01-14 14:39:13 +0100 | [diff] [blame] | 402 | $(call start-emulator-program, emulator64-$(EMULATOR_TARGET_ARCH)) |
| 403 | LOCAL_STATIC_LIBRARIES += \ |
| 404 | emulator64-libui \ |
| 405 | emulator64-libqemu \ |
| 406 | emulator64-target-$(EMULATOR_TARGET_CPU) \ |
| 407 | emulator64-libjpeg \ |
| 408 | emulator64-libelff \ |
| 409 | emulator64-common \ |
| 410 | $(SDL_STATIC_LIBRARIES_64) |
| 411 | LOCAL_LDLIBS += $(common_LOCAL_LDLIBS) -m64 |
| 412 | LOCAL_CFLAGS += $(common_LOCAL_CFLAGS) -m64 |
| 413 | LOCAL_SRC_FILES += $(common_LOCAL_SRC_FILES) |
David 'Digit' Turner | f6f5007 | 2014-01-14 14:39:13 +0100 | [diff] [blame] | 414 | $(call gen-hx-header,qemu-options.hx,qemu-options.def,vl-android.c qemu-options.h) |
| 415 | $(call gen-hw-config-defs) |
| 416 | $(call end-emulator-program) |
David 'Digit' Turner | af061c5 | 2014-02-28 23:33:54 +0100 | [diff] [blame] | 417 | endif # EMULATOR_BUILD_64BITS |
Raphael Moll | cdbea23 | 2012-05-04 15:04:27 -0700 | [diff] [blame] | 418 | |