1 ifeq ($(TARGET_ARCH),arm) 2 LOCAL_PATH:= $(call my-dir) 3 4 # determine the location of platform-specific directories 5 # 6 CONFIG_DIRS := \ 7 $(LOCAL_PATH)/android/config \ 8 $(LOCAL_PATH)/android/config/$(HOST_PREBUILT_TAG) 9 10 CONFIG_INCLUDES := $(CONFIG_DIRS:%=-I%) 11 12 MY_CC := $(HOST_CC) 13 14 MY_OPTIM := -O2 -g -fno-PIC -falign-functions=0 -fomit-frame-pointer 15 ifeq ($(BUILD_DEBUG_EMULATOR),true) 16 MY_OPTIM := -O0 -g 17 endif 18 19 MY_CFLAGS := $(CONFIG_INCLUDES) $(MY_OPTIM) 20 21 # Overwrite configuration for debug builds. 22 # 23 ifeq ($(BUILD_DEBUG_EMULATOR),true) 24 MY_CFLAGS := $(CONFIG_INCLUDES) -O0 -g \ 25 -fno-PIC -falign-functions=0 26 endif 27 28 MY_CFLAGS += -DCONFIG_MEMCHECK 29 30 MY_LDLIBS := 31 32 # this is needed to build the emulator on 64-bit Linux systems 33 ifeq ($(HOST_OS)-$(HOST_ARCH),linux-x86) 34 MY_CFLAGS += -Wa,--32 35 endif 36 37 ifeq ($(HOST_OS),freebsd) 38 MY_CFLAGS += -Wa,--32 -I /usr/local/include 39 endif 40 41 ifeq ($(HOST_OS),windows) 42 MY_CFLAGS += -D_WIN32 -mno-cygwin 43 # we need Win32 features that are available since Windows 2000 Professional/Server (NT 5.0) 44 MY_CFLAGS += -DWINVER=0x501 45 endif 46 47 ifeq ($(HOST_ARCH),ppc) 48 MY_CFLAGS += -D__powerpc__ 49 endif 50 51 ifeq ($(HOST_OS),darwin) 52 MY_CFLAGS += -mdynamic-no-pic 53 54 # When building on Leopard or above, we need to use the 10.4 SDK 55 # or the generated binary will not run on Tiger. 56 DARWIN_VERSION := $(strip $(shell sw_vers -productVersion)) 57 ifneq ($(filter 10.1 10.2 10.3 10.1.% 10.2.% 10.3.%,$(DARWIN_VERSION)),) 58 $(error Building the Android emulator requires OS X 10.4 or above) 59 endif 60 ifeq ($(filter 10.4 10.4.%,$(DARWIN_VERSION)),) 61 # We are on Leopard or above 62 TIGER_SDK := /Developer/SDKs/MacOSX10.4u.sdk 63 ifeq ($(strip $(wildcard $(TIGER_SDK))),) 64 $(info Please install the 10.4 SDK on this machine at $(TIGER_SDK)) 65 $(error Aborting the build.) 66 endif 67 MY_CFLAGS += -isysroot $(TIGER_SDK) -mmacosx-version-min=10.4 -DMACOSX_DEPLOYMENT_TARGET=10.4 68 MY_LDLIBS += -isysroot $(TIGER_SDK) -Wl,-syslibroot,$(TIGER_SDK) -mmacosx-version-min=10.4 69 70 # Beginning with Snow Leopard, the default compiler is GCC 4.2 71 # which is incompatible with the 10.4 SDK, so we must 72 # specify the use of GCC 4.0. 73 ifeq ($(filter 10.5 10.5.%,$(DARWIN_VERSION)),) 74 # We are on Snow Leopard or above 75 MY_CC := gcc-4.0 76 endif 77 endif 78 endif 79 80 # BUILD_STANDALONE_EMULATOR is only defined when building with 81 # the android-rebuild.sh script. The script will also provide 82 # adequate values for HOST_CC 83 # 84 ifneq ($(BUILD_STANDALONE_EMULATOR),true) 85 86 ifneq ($(USE_CCACHE),) 87 MY_CC := prebuilt/$(HOST_PREBUILT_TAG)/ccache/ccache $(MY_CC) 88 endif 89 endif 90 91 92 ifneq ($(combo_target)$(TARGET_SIMULATOR),HOST_true) 93 ifneq ($(HOST_ARCH),x86_64) 94 MY_CFLAGS += -m32 95 MY_LDLIBS += -m32 96 endif 97 endif 98 99 include $(CLEAR_VARS) 100 101 ########################################################### 102 # Zlib configuration 103 # 104 ZLIB_DIR := distrib/zlib-1.2.3 105 include $(LOCAL_PATH)/$(ZLIB_DIR)/sources.make 106 107 ########################################################### 108 # Libpng configuration 109 # 110 LIBPNG_DIR := distrib/libpng-1.2.19 111 include $(LOCAL_PATH)/$(LIBPNG_DIR)/sources.make 112 113 ############################################################################### 114 # build the TCG code generator 115 # 116 include $(CLEAR_VARS) 117 118 LOCAL_NO_DEFAULT_COMPILER_FLAGS := true 119 LOCAL_CC := $(MY_CC) 120 LOCAL_CFLAGS := $(MY_CFLAGS) $(LOCAL_CFLAGS) 121 LOCAL_LDLIBS := $(MY_LDLIBS) 122 LOCAL_MODULE := emulator-tcg 123 124 TCG_TARGET := $(HOST_ARCH) 125 ifeq ($(TCG_TARGET),x86) 126 TCG_TARGET := i386 127 endif 128 129 TCG_CFLAGS := -I$(LOCAL_PATH)/tcg -I$(LOCAL_PATH)/tcg/$(TCG_TARGET) 130 131 LOCAL_CFLAGS += $(TCG_CFLAGS) \ 132 -I$(LOCAL_PATH)/target-arm \ 133 -I$(LOCAL_PATH)/fpu \ 134 135 LOCAL_SRC_FILES := \ 136 tcg/tcg.c \ 137 tcg/tcg-runtime.c \ 138 139 include $(BUILD_HOST_STATIC_LIBRARY) 140 141 ############################################################################## 142 # build the HW emulation support 143 # 144 include $(CLEAR_VARS) 145 146 LOCAL_NO_DEFAULT_COMPILER_FLAGS := true 147 LOCAL_CC := $(MY_CC) 148 LOCAL_MODULE := emulator-hw 149 150 HW_CFLAGS := -I$(LOCAL_PATH)/hw 151 152 LOCAL_CFLAGS := $(MY_CFLAGS) $(LOCAL_CFLAGS) 153 LOCAL_CFLAGS += -I$(LOCAL_PATH)/target-arm -I$(LOCAL_PATH)/fpu $(HW_CFLAGS) 154 LOCAL_CFLAGS += $(ZLIB_CFLAGS) -I$(LOCAL_PATH)/$(ZLIB_DIR) 155 156 HW_SOURCES := \ 157 android_arm.c \ 158 arm_pic.c \ 159 bt.c \ 160 bt-hci.c \ 161 bt-hid.c \ 162 bt-l2cap.c \ 163 bt-sdp.c \ 164 cdrom.c \ 165 dma.c \ 166 irq.c \ 167 goldfish_audio.c \ 168 goldfish_battery.c \ 169 goldfish_device.c \ 170 goldfish_events_device.c \ 171 goldfish_fb.c \ 172 goldfish_interrupt.c \ 173 goldfish_memlog.c \ 174 goldfish_mmc.c \ 175 goldfish_nand.c \ 176 goldfish_switch.c \ 177 goldfish_timer.c \ 178 goldfish_trace.c \ 179 goldfish_tty.c \ 180 msmouse.c \ 181 pci.c \ 182 qdev.c \ 183 scsi-disk.c \ 184 smc91c111.c \ 185 sysbus.c \ 186 usb-hid.c \ 187 usb-hub.c \ 188 usb-msd.c \ 189 usb-ohci.c \ 190 usb.c \ 191 watchdog.c \ 192 193 LOCAL_SRC_FILES += $(HW_SOURCES:%=hw/%) 194 195 include $(BUILD_HOST_STATIC_LIBRARY) 196 197 ############################################################################## 198 # build the ELF/DWARF stuff 199 # This library is used by emulator's memory checker to extract debug information 200 # from the symbol files when reporting memory allocation violations. In 201 # particular, this library is used to extract routine name and source file 202 # location for the code address where violation has been detected. 203 # 204 include $(CLEAR_VARS) 205 206 LOCAL_NO_DEFAULT_COMPILER_FLAGS := true 207 LOCAL_CC := $(MY_CC) 208 LOCAL_MODULE := emulator-elff 209 LOCAL_CPP_EXTENSION := .cc 210 211 ELFF_CFLAGS := -I$(LOCAL_PATH)/elff 212 213 LOCAL_CFLAGS := $(MY_CFLAGS) $(LOCAL_CFLAGS) 214 LOCAL_CFLAGS += -I$(LOCAL_PATH)/target-arm -I$(LOCAL_PATH)/fpu $(ELFF_CFLAGS) 215 LOCAL_CFLAGS += $(ZLIB_CFLAGS) -I$(LOCAL_PATH)/$(ZLIB_DIR) 216 217 ELFF_SOURCES := \ 218 dwarf_cu.cc \ 219 dwarf_die.cc \ 220 dwarf_utils.cc \ 221 elf_alloc.cc \ 222 elf_file.cc \ 223 elf_mapped_section.cc \ 224 elff_api.cc \ 225 226 LOCAL_SRC_FILES += $(ELFF_SOURCES:%=elff/%) 227 ELFF_LDLIBS := -lstdc++ 228 229 include $(BUILD_HOST_STATIC_LIBRARY) 230 231 ############################################################################## 232 # build the memory access checking support 233 # Memory access checker uses information collected by instrumented code in 234 # libc.so in order to keep track of memory blocks allocated from heap. Memory 235 # checker then uses this information to make sure that every access to allocated 236 # memory is within allocated block. This information also allows detecting 237 # memory leaks and attempts to free/realloc invalid pointers. 238 # 239 include $(CLEAR_VARS) 240 241 LOCAL_NO_DEFAULT_COMPILER_FLAGS := true 242 LOCAL_CC := $(MY_CC) 243 LOCAL_MODULE := emulator-memcheck 244 245 MCHK_CFLAGS := -I$(LOCAL_PATH)/memcheck -I$(LOCAL_PATH)/elff 246 247 LOCAL_CFLAGS := $(MY_CFLAGS) $(LOCAL_CFLAGS) 248 LOCAL_CFLAGS += -I$(LOCAL_PATH)/target-arm -I$(LOCAL_PATH)/fpu $(MCHK_CFLAGS) 249 LOCAL_CFLAGS += $(ZLIB_CFLAGS) -I$(LOCAL_PATH)/$(ZLIB_DIR) 250 251 MCHK_SOURCES := \ 252 memcheck.c \ 253 memcheck_proc_management.c \ 254 memcheck_malloc_map.c \ 255 memcheck_mmrange_map.c \ 256 memcheck_util.c \ 257 258 LOCAL_SRC_FILES += $(MCHK_SOURCES:%=memcheck/%) 259 260 include $(BUILD_HOST_STATIC_LIBRARY) 261 262 ############################################################################## 263 # build the ARM-specific emulation engine sources 264 # 265 include $(CLEAR_VARS) 266 267 LOCAL_NO_DEFAULT_COMPILER_FLAGS := true 268 LOCAL_CC := $(MY_CC) 269 LOCAL_MODULE := emulator-arm 270 LOCAL_LDLIBS := $(MY_LDLIBS) 271 LOCAL_CFLAGS := $(MY_CFLAGS) $(LOCAL_CFLAGS) 272 LOCAL_STATIC_LIBRARIES := emulator-hw 273 274 LOCAL_CFLAGS := -fno-PIC -fomit-frame-pointer -Wno-sign-compare 275 LOCAL_CFLAGS := $(MY_CFLAGS) $(LOCAL_CFLAGS) 276 277 LOCAL_CFLAGS += -I$(LOCAL_PATH) \ 278 -I$(LOCAL_PATH)/target-arm \ 279 -I$(LOCAL_PATH)/fpu \ 280 $(TCG_CFLAGS) \ 281 $(HW_CFLAGS) \ 282 283 ifeq ($(HOST_ARCH),ppc) 284 LOCAL_CFLAGS += -D__powerpc__ 285 endif 286 287 LOCAL_SRC_FILES += exec.c cpu-exec.c \ 288 target-arm/op_helper.c \ 289 target-arm/iwmmxt_helper.c \ 290 target-arm/neon_helper.c \ 291 target-arm/helper.c \ 292 target-arm/translate.c \ 293 target-arm/machine.c \ 294 translate-all.c \ 295 hw/armv7m.c \ 296 hw/armv7m_nvic.c \ 297 arm-semi.c \ 298 trace.c \ 299 varint.c \ 300 dcache.c \ 301 softmmu_outside_jit.c \ 302 303 LOCAL_SRC_FILES += fpu/softfloat.c 304 305 include $(BUILD_HOST_STATIC_LIBRARY) 306 307 ############################################################################## 308 # SDL-related definitions 309 # 310 311 SDL_CONFIG ?= prebuilt/$(HOST_PREBUILT_TAG)/sdl/bin/sdl-config 312 SDL_CFLAGS := $(shell $(SDL_CONFIG) --cflags) 313 314 # We need to filter out the _GNU_SOURCE variable because it breaks recent 315 # releases of Cygwin when using the -mno-cygwin option. Moreover, we don't 316 # need this macro at all to build the Android emulator. 317 SDL_CFLAGS := $(filter-out -D_GNU_SOURCE=1,$(SDL_CFLAGS)) 318 SDL_LDLIBS := $(filter-out %.a %.lib,$(shell $(SDL_CONFIG) --static-libs)) 319 320 321 ############################################################################## 322 # determine audio sources, build the prebuilt audio-library if needed 323 # 324 325 # determine AUDIO sources based on current configuration 326 # 327 AUDIO_SOURCES := audio.c noaudio.c wavaudio.c sdlaudio.c wavcapture.c mixeng.c 328 AUDIO_CFLAGS := -I$(LOCAL_PATH)/audio -DHAS_AUDIO 329 AUDIO_LDLIBS := 330 331 ifeq ($(HOST_OS),darwin) 332 CONFIG_COREAUDIO ?= yes 333 AUDIO_CFLAGS += -DHOST_BSD=1 334 endif 335 336 ifeq ($(HOST_OS),windows) 337 CONFIG_WINAUDIO ?= yes 338 endif 339 340 ifeq ($(HOST_OS),linux) 341 CONFIG_OSS ?= yes 342 CONFIG_ALSA ?= yes 343 CONFIG_ESD ?= yes 344 endif 345 346 ifeq ($(HOST_OS),freebsd) 347 CONFIG_OSS ?= yes 348 endif 349 350 ifeq ($(CONFIG_COREAUDIO),yes) 351 AUDIO_SOURCES += coreaudio.c 352 AUDIO_CFLAGS += -DCONFIG_COREAUDIO 353 AUDIO_LDLIBS += -Wl,-framework,CoreAudio 354 endif 355 356 ifeq ($(CONFIG_WINAUDIO),yes) 357 AUDIO_SOURCES += winaudio.c 358 AUDIO_CFLAGS += -DCONFIG_WINAUDIO 359 endif 360 361 ifeq ($(CONFIG_ALSA),yes) 362 AUDIO_SOURCES += alsaaudio.c audio_pt_int.c 363 AUDIO_CFLAGS += -DCONFIG_ALSA 364 endif 365 366 ifeq ($(CONFIG_ESD),yes) 367 AUDIO_SOURCES += esdaudio.c 368 AUDIO_CFLAGS += -DCONFIG_ESD 369 endif 370 371 ifeq ($(CONFIG_OSS),yes) 372 AUDIO_SOURCES += ossaudio.c 373 AUDIO_CFLAGS += -DCONFIG_OSS 374 endif 375 376 AUDIO_SOURCES := $(AUDIO_SOURCES:%=audio/%) 377 378 # determine whether we're going to use the prebuilt 379 # audio library (this is useful on Linux to avoid requiring 380 # all sound-related development packages to be installed on 381 # the build and developer machines). 382 # 383 # note that you can define BUILD_QEMU_AUDIO_LIB to true 384 # in your environment to force recompilation. 385 # 386 QEMU_AUDIO_LIB := 387 388 ifneq ($(BUILD_STANDALONE_EMULATOR),true) 389 QEMU_AUDIO_LIB := $(wildcard \ 390 prebuilt/$(HOST_PREBUILT_TAG)/emulator/libqemu-audio.a) 391 endif 392 393 ifeq ($(BUILD_QEMU_AUDIO_LIB),true) 394 include $(CLEAR_VARS) 395 LOCAL_NO_DEFAULT_COMPILER_FLAGS := true 396 LOCAL_CC := $(MY_CC) 397 LOCAL_MODULE := libqemu-audio 398 LOCAL_LDLIBS := $(MY_LDLIBS) 399 400 LOCAL_CFLAGS := -Wno-sign-compare \ 401 -fno-strict-aliasing -W -Wall -Wno-unused-parameter \ 402 -I$(LOCAL_PATH) \ 403 -I$(LOCAL_PATH)/target-arm \ 404 -I$(LOCAL_PATH)/fpu \ 405 406 # this is very important, otherwise the generated binaries may 407 # not link properly on our build servers 408 ifeq ($(HOST_OS),linux) 409 LOCAL_CFLAGS += -fno-stack-protector 410 endif 411 412 LOCAL_CFLAGS := $(MY_CFLAGS) $(LOCAL_CFLAGS) $(AUDIO_CFLAGS) 413 414 LOCAL_CFLAGS += $(SDL_CFLAGS) 415 416 LOCAL_SRC_FILES += $(AUDIO_SOURCES) 417 418 include $(BUILD_HOST_STATIC_LIBRARY) 419 QEMU_AUDIO_LIB := $(LOCAL_BUILT_MODULE) 420 421 endif # !QEMU_AUDIO_LIB 422 423 ############################################################################## 424 # now build the emulator itself 425 # 426 include $(CLEAR_VARS) 427 428 LOCAL_NO_DEFAULT_COMPILER_FLAGS := true 429 LOCAL_CC := $(MY_CC) 430 LOCAL_MODULE := emulator 431 LOCAL_STATIC_LIBRARIES := emulator-memcheck emulator-hw emulator-arm emulator-tcg 432 LOCAL_STATIC_LIBRARIES += emulator-elff 433 LOCAL_LDLIBS := $(MY_LDLIBS) 434 435 # don't remove the -fno-strict-aliasing, or you'll break things 436 # (e.g. slirp-android/network support) 437 # 438 LOCAL_CFLAGS := -fno-PIC -Wno-sign-compare \ 439 -fno-strict-aliasing -g -W -Wall -Wno-unused-parameter 440 441 LOCAL_CFLAGS := $(MY_CFLAGS) $(LOCAL_CFLAGS) 442 443 # add the build ID to the default macro definitions 444 LOCAL_CFLAGS += -DANDROID_BUILD_ID="$(strip $(BUILD_ID))-$(strip $(BUILD_NUMBER))" 445 446 # For non-standalone builds, extract the major version number from the Android SDK 447 # tools revision number. 448 ifneq ($(BUILD_STANDALONE_EMULATOR),true) 449 ANDROID_SDK_TOOLS_REVISION := $(shell awk -F= '/Pkg.Revision/ { print $$2; }' sdk/files/tools_source.properties) 450 endif 451 452 ANDROID_SDK_TOOLS_REVISION := $(strip $(ANDROID_SDK_TOOLS_REVISION)) 453 ifdef ANDROID_SDK_TOOLS_REVISION 454 LOCAL_CFLAGS += -DANDROID_SDK_TOOLS_REVISION=$(ANDROID_SDK_TOOLS_REVISION) 455 endif 456 457 # include the Zlib sources 458 # 459 LOCAL_SRC_FILES += $(ZLIB_SOURCES) 460 LOCAL_CFLAGS += $(ZLIB_CFLAGS) -I$(LOCAL_PATH)/$(ZLIB_DIR) 461 462 # include the Libpng sources 463 # 464 LOCAL_SRC_FILES += $(LIBPNG_SOURCES) 465 LOCAL_CFLAGS += $(LIBPNG_CFLAGS) -I$(LOCAL_PATH)/$(LIBPNG_DIR) 466 467 LOCAL_CFLAGS += -I$(LOCAL_PATH)/ \ 468 -I$(LOCAL_PATH)/target-arm \ 469 -I$(LOCAL_PATH)/fpu \ 470 $(TCG_CFLAGS) \ 471 $(HW_CFLAGS) \ 472 473 # Needed by the upstream code 474 LOCAL_CFLAGS += -DNEED_CPU_H 475 476 # include telephony stuff 477 # 478 TELEPHONY_SOURCES := android_modem.c modem_driver.c gsm.c sim_card.c sysdeps_qemu.c sms.c remote_call.c 479 LOCAL_SRC_FILES += $(TELEPHONY_SOURCES:%=telephony/%) 480 LOCAL_CFLAGS += -I$(LOCAL_PATH)/telephony 481 482 # include sound support source files. we first try to see if we have a prebuilt audio 483 # library. if not, we build things the "hard" way. 484 # 485 # note that to generate the prebuilt audio library, you should do the following: 486 # 487 # cd tools/qemu 488 # ./android-rebuild.sh 489 # distrib/update-audio.sh 490 # 491 ifeq ($(QEMU_AUDIO_LIB),) 492 LOCAL_SRC_FILES += $(AUDIO_SOURCES) 493 endif # !QEMU_AUDIO_LIB 494 495 LOCAL_CFLAGS += $(AUDIO_CFLAGS) 496 LOCAL_LDLIBS += $(AUDIO_LDLIBS) 497 498 # include slirp-android code, i.e. the user-level networking stuff 499 # 500 SLIRP_SOURCES := bootp.c cksum.c debug.c if.c ip_icmp.c ip_input.c ip_output.c \ 501 mbuf.c misc.c sbuf.c slirp.c socket.c tcp_input.c tcp_output.c \ 502 tcp_subr.c tcp_timer.c tftp.c udp.c 503 504 LOCAL_SRC_FILES += $(SLIRP_SOURCES:%=slirp-android/%) 505 LOCAL_CFLAGS += -I$(LOCAL_PATH)/slirp-android 506 507 # socket proxy support 508 # 509 PROXY_SOURCES := \ 510 proxy_common.c \ 511 proxy_http.c \ 512 proxy_http_connector.c \ 513 proxy_http_rewriter.c \ 514 515 LOCAL_SRC_FILES += $(PROXY_SOURCES:%=proxy/%) 516 LOCAL_CFLAGS += -I$(LOCAL_PATH)/proxy 517 518 # the linux-user sources, I doubt we really need these 519 # 520 #LINUX_SOURCES := main.c elfload.c mmap.c signal.c path.c syscall.c 521 #LOCAL_SRC_FILES += $(LINUX_SOURCES:%=linux-user/%) 522 523 # the skin support sources 524 # 525 SKIN_SOURCES := rect.c \ 526 region.c \ 527 image.c \ 528 trackball.c \ 529 keyboard.c \ 530 keyset.c \ 531 file.c \ 532 window.c \ 533 scaler.c \ 534 composer.c \ 535 surface.c \ 536 537 LOCAL_SRC_FILES += $(SKIN_SOURCES:%=android/skin/%) 538 #LOCAL_CFLAGS += -I$(LOCAL_PATH)/skin 539 540 ifeq ($(HOST_ARCH),x86) 541 # enable MMX code for our skin scaler 542 LOCAL_CFLAGS += -DUSE_MMX=1 -mmmx 543 endif 544 545 # include other sources 546 # 547 VL_SOURCES := vl-android.c osdep.c cutils.c \ 548 block.c readline.c monitor.c console.c loader.c sockets.c \ 549 aes.c d3des.c \ 550 block/qcow.c \ 551 block/qcow2.c \ 552 block/qcow2-refcount.c \ 553 block/qcow2-snapshot.c \ 554 block/qcow2-cluster.c \ 555 block/cloop.c \ 556 block/dmg.c \ 557 block/vvfat.c \ 558 buffered_file.c \ 559 cbuffer.c \ 560 gdbstub.c \ 561 vnc-android.c disas.c arm-dis.c \ 562 shaper.c charpipe.c loadpng.c \ 563 framebuffer.c \ 564 tcpdump.c \ 565 qemu-char-android.c \ 566 qemu-malloc.c \ 567 qemu-option.c \ 568 savevm.c \ 569 net-android.c \ 570 acl.c \ 571 aio-android.c \ 572 dma-helpers.c \ 573 qemu-sockets-android.c \ 574 keymaps.c \ 575 bt-host.c \ 576 bt-vhci.c \ 577 module.c \ 578 android/boot-properties.c \ 579 android/charmap.c \ 580 android/cmdline-option.c \ 581 android/config.c \ 582 android/console.c \ 583 android/gps.c \ 584 android/help.c \ 585 android/hw-control.c \ 586 android/hw-events.c \ 587 android/hw-kmsg.c \ 588 android/hw-lcd.c \ 589 android/hw-qemud.c \ 590 android/hw-sensors.c \ 591 android/keycode.c \ 592 android/main.c \ 593 android/resource.c \ 594 android/user-config.c \ 595 android/utils/bufprint.c \ 596 android/utils/debug.c \ 597 android/utils/dirscanner.c \ 598 android/utils/ini.c \ 599 android/utils/filelock.c \ 600 android/utils/misc.c \ 601 android/utils/path.c \ 602 android/utils/reflist.c \ 603 android/utils/stralloc.c \ 604 android/utils/system.c \ 605 android/utils/tempfile.c \ 606 android/utils/timezone.c \ 607 android/utils/mapfile.c \ 608 android/avd/hw-config.c \ 609 android/avd/info.c \ 610 611 VL_SOURCES += hw/arm_boot.c \ 612 hw/android_arm.c \ 613 614 ifeq ($(HOST_OS),windows) 615 VL_SOURCES += block/raw-win32.c \ 616 migration-dummy-android.c \ 617 iolooper-select.c 618 else 619 VL_SOURCES += block/raw-posix.c \ 620 migration.c \ 621 migration-exec.c \ 622 migration-tcp-android.c \ 623 iolooper-select.c 624 endif 625 626 ifeq ($(HOST_OS),linux) 627 VL_SOURCES += usb-linux.c \ 628 qemu-thread.c 629 else 630 VL_SOURCES += usb-dummy-android.c 631 endif 632 633 ifeq ($(HOST_ARCH),x86) 634 VL_SOURCES += i386-dis.c 635 endif 636 ifeq ($(HOST_ARCH),x86_64) 637 VL_SOURCES += i386-dis.c 638 endif 639 ifeq ($(HOST_ARCH),ppc) 640 VL_SOURCES += ppc-dis.c 641 endif 642 643 ifeq ($(HOST_OS),windows) 644 VL_SOURCES += tap-win32.c 645 LOCAL_LDLIBS += -mno-cygwin -mwindows -mconsole 646 endif 647 648 ifeq ($(HOST_OS),freebsd) 649 LOCAL_LDLIBS += -L/usr/local/lib -lpthread -lX11 -lutil 650 endif 651 652 LOCAL_SRC_FILES += $(VL_SOURCES) 653 654 ifeq ($(HOST_OS),linux) 655 LOCAL_LDLIBS += -lutil -lrt 656 endif 657 658 # add SDL-specific flags 659 # 660 LOCAL_CFLAGS += $(SDL_CFLAGS) 661 LOCAL_LDLIBS += $(SDL_LDLIBS) 662 # Circular dependencies between libSDL and libSDLmain; 663 # We repeat the libraries in the final link to work around it. 664 LOCAL_STATIC_LIBRARIES += libSDL libSDLmain 665 LOCAL_STATIC_LIBRARIES += libSDL libSDLmain 666 667 # add ELFF-specific flags 668 # 669 LOCAL_LDLIBS += $(ELFF_LDLIBS) 670 671 # on Windows, link the icon file as well into the executable 672 # unfortunately, our build system doesn't help us much, so we need 673 # to use some weird pathnames to make this work... 674 # 675 ifeq ($(HOST_OS),windows) 676 677 # Locate windres executable 678 WINDRES := windres 679 ifneq ($(USE_MINGW),) 680 # When building the Windows emulator under Linux, use the MinGW one 681 WINDRES := i586-mingw32msvc-windres 682 endif 683 684 INTERMEDIATE := $(call intermediates-dir-for,EXECUTABLES,$(LOCAL_MODULE),true) 685 ANDROID_ICON_OBJ := android_icon.o 686 ANDROID_ICON_PATH := $(LOCAL_PATH)/images 687 $(ANDROID_ICON_PATH)/$(ANDROID_ICON_OBJ): $(ANDROID_ICON_PATH)/android_icon.rc 688 $(WINDRES) $< -I $(ANDROID_ICON_PATH) -o $@ 689 690 # seems to be the only way to add an object file that was not generated from 691 # a C/C++/Java source file to our build system. and very unfortunately, 692 # $(TOPDIR)/$(LOCALPATH) will always be prepended to this value, which forces 693 # us to put the object file in the source directory... 694 # 695 LOCAL_PREBUILT_OBJ_FILES += images/$(ANDROID_ICON_OBJ) 696 endif 697 698 # qemu-options.h is generated from qemu-options.hx with the "hxtool" shell script 699 # 700 intermediates := $(call intermediates-dir-for,EXECUTABLES,$(LOCAL_MODULE),true) 701 702 QEMU_OPTIONS_H := $(intermediates)/qemu-options.h 703 $(QEMU_OPTIONS_H): PRIVATE_PATH := $(LOCAL_PATH) 704 $(QEMU_OPTIONS_H): PRIVATE_CUSTOM_TOOL = $(PRIVATE_PATH)/hxtool -h < $< > $@ 705 $(QEMU_OPTIONS_H): $(LOCAL_PATH)/qemu-options.hx $(LOCAL_PATH)/hxtool 706 $(transform-generated-source) 707 708 $(intermediates)/vl-android.o: $(QEMU_OPTIONS_H) 709 710 LOCAL_GENERATED_SOURCES += $(QEMU_OPTIONS_H) 711 712 # qemu-monitor.h is generated from qemu-monitor.hx with the "hxtool" shell script 713 # 714 intermediates := $(call intermediates-dir-for,EXECUTABLES,$(LOCAL_MODULE),true) 715 716 QEMU_MONITOR_H := $(intermediates)/qemu-monitor.h 717 $(QEMU_MONITOR_H): PRIVATE_PATH := $(LOCAL_PATH) 718 $(QEMU_MONITOR_H): PRIVATE_CUSTOM_TOOL = $(PRIVATE_PATH)/hxtool -h < $< > $@ 719 $(QEMU_MONITOR_H): $(LOCAL_PATH)/qemu-monitor.hx $(LOCAL_PATH)/hxtool 720 $(transform-generated-source) 721 722 $(intermediates)/vl-android.o: $(QEMU_MONITOR_H) 723 724 LOCAL_GENERATED_SOURCES += $(QEMU_MONITOR_H) 725 726 727 # gdbstub-xml.c contains C-compilable arrays corresponding to the content 728 # of $(LOCAL_PATH)/gdb-xml/, and is generated with the 'feature_to_c.sh' script. 729 # 730 ifeq ($(QEMU_TARGET_XML_SOURCES),) 731 QEMU_TARGET_XML_SOURCES := arm-core arm-neon arm-vfp arm-vfp3 732 QEMU_TARGET_XML_SOURCES := $(QEMU_TARGET_XML_SOURCES:%=$(LOCAL_PATH)/gdb-xml/%.xml) 733 endif 734 735 QEMU_GDBSTUB_XML_C := $(intermediates)/gdbstub-xml.c 736 $(QEMU_GDBSTUB_XML_C): PRIVATE_PATH := $(LOCAL_PATH) 737 $(QEMU_GDBSTUB_XML_C): PRIVATE_SOURCES := $(TARGET_XML_SOURCES) 738 $(QEMU_GDBSTUB_XML_C): PRIVATE_CUSTOM_TOOL = $(PRIVATE_PATH)/feature_to_c.sh $@ $(QEMU_TARGET_XML_SOURCES) 739 $(QEMU_GDBSTUB_XML_C): $(QEMU_TARGET_XML_SOURCES) $(LOCAL_PATH)/feature_to_c.sh 740 $(hide) rm -f $@ 741 $(transform-generated-source) 742 743 $(intermediates)/vl-android.o: $(QEMU_GDBSTUB_XML_C) 744 745 LOCAL_GENERATED_SOURCES += $(QEMU_GDBSTUB_XML_C) 746 747 # hw-config-defs.h is generated from android/avd/hardware-properties.ini 748 # 749 QEMU_HARDWARE_PROPERTIES_INI := $(LOCAL_PATH)/android/avd/hardware-properties.ini 750 QEMU_HW_CONFIG_DEFS_H := $(LOCAL_PATH)/android/avd/hw-config-defs.h 751 $(QEMU_HW_CONFIG_DEFS_H): PRIVATE_PATH := $(LOCAL_PATH) 752 $(QEMU_HW_CONFIG_DEFS_H): PRIVATE_SOURCES := $(QEMU_HARDWARE_PROPERTIES_INI) 753 $(QEMU_HW_CONFIG_DEFS_H): PRIVATE_CUSTOM_TOOL = $(PRIVATE_PATH)/android/tools/gen-hw-config.py $(QEMU_HARDWARE_PROPERTIES_INI) $@ 754 $(QEMU_HW_CONFIG_DEFS_H): $(QEMU_HARDWARE_PROPERTIES_INI) $(LOCAL_PATH)/android/tools/gen-hw-config.py 755 $(hide) rm -f $@ 756 $(transform-generated-source) 757 758 $(LOCAL_PATH)/android/avd/hw-config.h: $(QEMU_HW_CONFIG_DEFS_H) 759 760 LOCAL_GENERATED_SOURCES += $(QEMU_HW_CONFIG_DEFS_H) 761 762 # this is already done by the Android build system, but is done for the 763 # benefit of the stand-alone one. 764 # 765 ifeq ($(BUILD_STANDALONE_EMULATOR),true) 766 LOCAL_CFLAGS += -I$(intermediates) 767 endif 768 769 770 771 # other flags 772 LOCAL_CFLAGS += -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE 773 LOCAL_LDLIBS += -lm 774 775 ifeq ($(HOST_OS),windows) 776 LOCAL_LDLIBS += -lwinmm -lws2_32 -liphlpapi 777 else 778 LOCAL_LDLIBS += -lpthread 779 endif 780 781 LOCAL_LDLIBS += $(QEMU_AUDIO_LIB) 782 783 # Generate a completely static executable if needed. 784 # Note that this means no sound and graphics on Linux. 785 # 786 ifeq ($(CONFIG_STATIC_EXECUTABLE),true) 787 LOCAL_SRC_FILES += dynlink-static.c 788 LOCAL_LDLIBS += -static 789 endif 790 791 LOCAL_MODULE := emulator 792 793 include $(BUILD_HOST_EXECUTABLE) 794 795 endif # TARGET_ARCH == arm 796