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