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 |
| 3 | # (e.g. once for the arm target, and once for the x86 target). |
| 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 \ |
| 29 | -DNEED_CPU_H \ |
| 30 | |
| 31 | TCG_TARGET := $(HOST_ARCH) |
| 32 | ifeq ($(TCG_TARGET),x86) |
| 33 | TCG_TARGET := i386 |
| 34 | endif |
| 35 | |
| 36 | EMULATOR_TARGET_CFLAGS += \ |
| 37 | -I$(LOCAL_PATH)/tcg \ |
| 38 | -I$(LOCAL_PATH)/tcg/$(TCG_TARGET) \ |
| 39 | -DTARGET_ARCH=\"$(EMULATOR_TARGET_ARCH)\" |
| 40 | |
| 41 | |
| 42 | $(call start-emulator-library, emulator-target-$(EMULATOR_TARGET_CPU)) |
| 43 | |
| 44 | # The following is to ensure that "config.h" will map to a target-specific |
| 45 | # configuration file header. |
| 46 | LOCAL_CFLAGS += $(EMULATOR_TARGET_CFLAGS) |
| 47 | |
| 48 | LOCAL_SRC_FILES += \ |
| 49 | tcg/tcg.c \ |
| 50 | |
| 51 | ############################################################################## |
| 52 | # Emulated hardware devices. |
| 53 | # |
| 54 | |
| 55 | HW_SOURCES := \ |
| 56 | bt.c \ |
| 57 | bt-hci.c \ |
| 58 | bt-hid.c \ |
| 59 | bt-l2cap.c \ |
| 60 | bt-sdp.c \ |
| 61 | cdrom.c \ |
| 62 | dma.c \ |
| 63 | irq.c \ |
Jun Nakajima | 6f19836 | 2011-02-24 13:16:01 -0800 | [diff] [blame] | 64 | goldfish_audio.c \ |
David 'Digit' Turner | aff94b8 | 2011-02-07 18:10:54 +0100 | [diff] [blame] | 65 | goldfish_device.c \ |
| 66 | goldfish_events_device.c \ |
| 67 | goldfish_fb.c \ |
| 68 | goldfish_battery.c \ |
| 69 | goldfish_mmc.c \ |
| 70 | goldfish_memlog.c \ |
| 71 | goldfish_nand.c \ |
David 'Digit' Turner | 89217f5 | 2011-03-21 17:51:03 +0100 | [diff] [blame] | 72 | goldfish_pipe.c \ |
David 'Digit' Turner | aff94b8 | 2011-02-07 18:10:54 +0100 | [diff] [blame] | 73 | goldfish_tty.c \ |
| 74 | msmouse.c \ |
| 75 | pci.c \ |
| 76 | qdev.c \ |
| 77 | scsi-disk.c \ |
| 78 | sysbus.c \ |
| 79 | usb-hid.c \ |
| 80 | usb-hub.c \ |
| 81 | usb-msd.c \ |
| 82 | usb-ohci.c \ |
| 83 | usb.c \ |
| 84 | watchdog.c |
| 85 | |
| 86 | ifeq ($(EMULATOR_TARGET_ARCH),arm) |
| 87 | HW_SOURCES += android_arm.c \ |
| 88 | arm_pic.c \ |
David 'Digit' Turner | aff94b8 | 2011-02-07 18:10:54 +0100 | [diff] [blame] | 89 | goldfish_interrupt.c \ |
| 90 | goldfish_switch.c \ |
| 91 | goldfish_timer.c \ |
| 92 | goldfish_trace.c \ |
| 93 | arm_boot.c \ |
| 94 | |
| 95 | # The following sources must be compiled with the final executables |
| 96 | # because they contain device_init() or machine_init() statements. |
| 97 | HW_OBJ_SOURCES := hw/smc91c111.c |
| 98 | HW_OBJ_CFLAGS := $(EMULATOR_TARGET_CFLAGS) |
| 99 | |
| 100 | LOCAL_SRC_FILES += arm-dis.c |
| 101 | |
| 102 | # smc91c111.c requires <zlib.h> |
| 103 | LOCAL_CFLAGS += $(ZLIB_CFLAGS) |
| 104 | endif |
| 105 | |
| 106 | ifeq ($(EMULATOR_TARGET_ARCH),x86) |
| 107 | HW_SOURCES += \ |
| 108 | apic.c \ |
| 109 | i8259.c \ |
| 110 | mc146818rtc.c \ |
| 111 | piix_pci.c \ |
| 112 | i8254.c \ |
| 113 | pckbd.c \ |
| 114 | ioapic.c \ |
| 115 | ps2.c \ |
| 116 | smbios.c \ |
| 117 | fw_cfg.c |
| 118 | |
| 119 | # The following sources must be compiled with the final executables |
| 120 | # because they contain device_init() or machine_init() statements. |
| 121 | HW_OBJ_SOURCES := \ |
| 122 | hw/ne2000.c \ |
| 123 | hw/pc.c |
| 124 | |
| 125 | HW_OBJ_CFLAGS := $(EMULATOR_TARGET_CFLAGS) |
| 126 | |
| 127 | endif |
| 128 | |
| 129 | LOCAL_SRC_FILES += $(HW_SOURCES:%=hw/%) |
| 130 | |
| 131 | LOCAL_SRC_FILES += \ |
| 132 | exec.c \ |
| 133 | cpu-exec.c \ |
| 134 | translate-all.c \ |
| 135 | trace.c \ |
| 136 | varint.c \ |
| 137 | dcache.c \ |
| 138 | softmmu_outside_jit.c \ |
| 139 | |
| 140 | ############################################################################## |
| 141 | # CPU-specific emulation. |
| 142 | # |
| 143 | LOCAL_CFLAGS += -fno-PIC -fomit-frame-pointer -Wno-sign-compare |
| 144 | |
| 145 | ifeq ($(HOST_ARCH),ppc) |
| 146 | LOCAL_CFLAGS += -D__powerpc__ |
| 147 | endif |
| 148 | |
| 149 | ifeq ($(EMULATOR_TARGET_ARCH),arm) |
| 150 | LOCAL_SRC_FILES += \ |
| 151 | target-arm/op_helper.c \ |
| 152 | target-arm/iwmmxt_helper.c \ |
| 153 | target-arm/neon_helper.c \ |
| 154 | target-arm/helper.c \ |
| 155 | target-arm/translate.c \ |
| 156 | target-arm/machine.c \ |
| 157 | hw/armv7m.c \ |
| 158 | hw/armv7m_nvic.c \ |
| 159 | arm-semi.c \ |
| 160 | |
| 161 | LOCAL_SRC_FILES += fpu/softfloat.c |
| 162 | endif |
| 163 | |
| 164 | ifeq ($(EMULATOR_TARGET_ARCH), x86) |
| 165 | LOCAL_SRC_FILES += \ |
| 166 | target-i386/op_helper.c \ |
| 167 | target-i386/helper.c \ |
| 168 | target-i386/translate.c \ |
| 169 | target-i386/machine.c \ |
| 170 | |
| 171 | LOCAL_SRC_FILES += fpu/softfloat-native.c |
| 172 | endif |
| 173 | |
Jun Nakajima | 1321c76 | 2011-03-04 17:17:45 -0800 | [diff] [blame] | 174 | # compile KVM only if target is x86 on x86 Linux |
| 175 | ifeq ($(QEMU_HOST_TAG)-$(EMULATOR_TARGET_ARCH),linux-x86-x86) |
| 176 | # the following is to include linux/kvm.h |
| 177 | LOCAL_CFLAGS += -I /usr/include |
| 178 | LOCAL_SRC_FILES += \ |
| 179 | target-i386/kvm.c \ |
| 180 | kvm-all.c |
| 181 | endif |
| 182 | |
David 'Digit' Turner | aff94b8 | 2011-02-07 18:10:54 +0100 | [diff] [blame] | 183 | ############################################################################## |
| 184 | # Memory-access checking support. |
| 185 | # Memory access checker uses information collected by instrumented code in |
| 186 | # libc.so in order to keep track of memory blocks allocated from heap. Memory |
| 187 | # checker then uses this information to make sure that every access to allocated |
| 188 | # memory is within allocated block. This information also allows detecting |
| 189 | # memory leaks and attempts to free/realloc invalid pointers. |
| 190 | # |
| 191 | LOCAL_CFLAGS += \ |
| 192 | -I$(LOCAL_PATH)/memcheck \ |
| 193 | -I$(LOCAL_PATH)/elff |
| 194 | |
| 195 | MCHK_SOURCES := \ |
| 196 | memcheck.c \ |
| 197 | memcheck_proc_management.c \ |
| 198 | memcheck_malloc_map.c \ |
| 199 | memcheck_mmrange_map.c \ |
| 200 | memcheck_util.c \ |
| 201 | |
| 202 | LOCAL_SRC_FILES += $(MCHK_SOURCES:%=memcheck/%) |
| 203 | |
| 204 | |
| 205 | $(call end-emulator-library) |
| 206 | |
| 207 | ############################################################################## |
| 208 | ############################################################################## |
| 209 | ### |
| 210 | ### qemu-android-$CPU: headless emulator core program |
| 211 | ### |
| 212 | ### |
| 213 | $(call start-emulator-program, qemu-android-$(EMULATOR_TARGET_ARCH)) |
| 214 | |
| 215 | LOCAL_CFLAGS += \ |
| 216 | $(EMULATOR_COMMON_CFLAGS) \ |
| 217 | $(ELFF_CFLAGS) \ |
| 218 | $(EMULATOR_LIBQEMU_CFLAGS) \ |
| 219 | $(EMULATOR_TARGET_CFLAGS) \ |
| 220 | -DCONFIG_STANDALONE_CORE \ |
| 221 | |
| 222 | LOCAL_CFLAGS += -Wno-missing-field-initializers |
| 223 | |
| 224 | |
| 225 | LOCAL_STATIC_LIBRARIES := \ |
| 226 | emulator-libqemu \ |
| 227 | emulator-target-$(EMULATOR_TARGET_CPU) \ |
| 228 | emulator-libelff \ |
| 229 | emulator-common \ |
| 230 | |
| 231 | |
| 232 | LOCAL_LDLIBS += \ |
| 233 | $(EMULATOR_COMMON_LDLIBS) \ |
| 234 | $(EMULATOR_LIBQEMU_LDLIBS) \ |
| 235 | $(ELFF_LDLIBS) \ |
| 236 | |
| 237 | LOCAL_SRC_FILES := \ |
| 238 | audio/audio.c \ |
| 239 | disas.c \ |
| 240 | dma-helpers.c \ |
| 241 | gdbstub.c \ |
| 242 | keymaps.c \ |
| 243 | loader.c \ |
| 244 | monitor.c \ |
| 245 | qemu-timer.c \ |
| 246 | user-events-qemu.c \ |
| 247 | vl-android.c \ |
| 248 | android/console.c \ |
| 249 | android/display-core.c \ |
| 250 | android/protocol/attach-ui-proxy.c \ |
| 251 | android/protocol/fb-updates-proxy.c \ |
| 252 | android/protocol/user-events-impl.c \ |
| 253 | android/protocol/ui-commands-proxy.c \ |
| 254 | android/protocol/core-commands-impl.c \ |
| 255 | android/protocol/core-commands-qemu.c \ |
| 256 | |
| 257 | $(call gen-hx-header,qemu-monitor.hx,monitor.c) |
| 258 | $(call gen-hx-header,qemu-options.hx,vl-android.c) |
| 259 | |
| 260 | ifeq ($(HOST_OS),darwin) |
| 261 | FRAMEWORKS := OpenGL Cocoa QuickTime ApplicationServices Carbon IOKit |
| 262 | LOCAL_LDLIBS += $(FRAMEWORKS:%=-Wl,-framework,%) |
| 263 | endif |
| 264 | |
| 265 | # Generate a completely static executable if needed. |
| 266 | # Note that this means no sound and graphics on Linux. |
| 267 | # |
| 268 | ifeq ($(CONFIG_STATIC_EXECUTABLE),true) |
| 269 | LOCAL_SRC_FILES += dynlink-static.c |
| 270 | LOCAL_LDLIBS += -static |
| 271 | endif |
| 272 | |
| 273 | # The following files cannot be in static libraries because they contain |
| 274 | # constructor functions that are otherwise stripped by the final linker |
| 275 | LOCAL_SRC_FILES += $(HW_OBJ_SOURCES) |
| 276 | LOCAL_CFLAGS += $(HW_OBJ_CFLAGS) |
| 277 | |
| 278 | LOCAL_SRC_FILES += $(BLOCK_SOURCES) |
| 279 | LOCAL_CFLAGS += $(BLOCK_CFLAGS) |
| 280 | |
| 281 | LOCAL_MODULE_TAGS := debug |
| 282 | |
| 283 | $(call end-emulator-program) |
| 284 | |
| 285 | ############################################################################## |
| 286 | ############################################################################## |
| 287 | ### |
| 288 | ### emulator-$ARCH: Standalone emulator program |
| 289 | ### |
| 290 | ### |
| 291 | |
David 'Digit' Turner | aff94b8 | 2011-02-07 18:10:54 +0100 | [diff] [blame] | 292 | $(call start-emulator-program, emulator-$(EMULATOR_TARGET_ARCH)) |
David 'Digit' Turner | aff94b8 | 2011-02-07 18:10:54 +0100 | [diff] [blame] | 293 | |
| 294 | LOCAL_STATIC_LIBRARIES := \ |
| 295 | emulator-libui \ |
| 296 | emulator-libqemu \ |
| 297 | emulator-target-$(EMULATOR_TARGET_CPU) \ |
| 298 | emulator-libelff \ |
| 299 | emulator-common \ |
| 300 | |
| 301 | LOCAL_LDLIBS += \ |
| 302 | $(EMULATOR_COMMON_LDLIBS) \ |
| 303 | $(EMULATOR_LIBQEMU_LDLIBS) \ |
| 304 | $(EMULATOR_LIBUI_LDLIBS) \ |
| 305 | $(ELFF_LDLIBS) \ |
| 306 | |
| 307 | LOCAL_CFLAGS += \ |
| 308 | $(EMULATOR_TARGET_CFLAGS) \ |
| 309 | $(EMULATOR_COMMON_CFLAGS) \ |
| 310 | $(EMULATOR_LIBQEMU_CFLAGS) \ |
| 311 | $(EMULATOR_LIBUI_CFLAGS) |
| 312 | |
| 313 | LOCAL_SRC_FILES := \ |
| 314 | audio/audio.c \ |
| 315 | disas.c \ |
| 316 | dma-helpers.c \ |
| 317 | gdbstub.c \ |
| 318 | keymaps.c \ |
| 319 | loader.c \ |
| 320 | monitor.c \ |
| 321 | qemu-timer.c \ |
| 322 | user-events-qemu.c \ |
| 323 | vl-android.c \ |
| 324 | android/cmdline-option.c \ |
| 325 | android/console.c \ |
| 326 | android/display.c \ |
| 327 | android/display-core.c \ |
| 328 | android/help.c \ |
| 329 | android/main-common.c \ |
| 330 | android/main.c \ |
| 331 | android/protocol/core-commands-qemu.c \ |
| 332 | android/protocol/ui-commands-qemu.c \ |
| 333 | android/ |
| 334 | |
| 335 | $(call gen-hx-header,qemu-monitor.hx,monitor.c) |
| 336 | $(call gen-hx-header,qemu-options.hx,vl-android.c) |
| 337 | |
| 338 | # The following files cannot be in static libraries because they contain |
| 339 | # constructor functions that are otherwise stripped by the final linker |
| 340 | LOCAL_SRC_FILES += $(HW_OBJ_SOURCES) |
| 341 | LOCAL_CFLAGS += $(HW_OBJ_CFLAGS) |
| 342 | |
| 343 | LOCAL_SRC_FILES += $(BLOCK_SOURCES) |
| 344 | LOCAL_CFLAGS += $(BLOCK_CFLAGS) |
| 345 | |
| 346 | LOCAL_SRC_FILES += $(SDLMAIN_SOURCES) |
| 347 | |
| 348 | # Generate a completely static executable if needed. |
| 349 | # Note that this means no sound and graphics on Linux. |
| 350 | # |
| 351 | ifeq ($(CONFIG_STATIC_EXECUTABLE),true) |
| 352 | LOCAL_SRC_FILES += dynlink-static.c |
| 353 | LOCAL_LDLIBS += -static |
| 354 | endif |
| 355 | |
| 356 | LOCAL_STATIC_LIBRARIES += $(SDL_STATIC_LIBRARIES) |
| 357 | |
| 358 | $(call end-emulator-program) |