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