The Android Open Source Project | 8b23a6c | 2009-03-03 19:30:32 -0800 | [diff] [blame] | 1 | ifeq ($(TARGET_ARCH),arm) |
| 2 | LOCAL_PATH:= $(call my-dir) |
| 3 | |
David 'Digit' Turner | 34d1651 | 2010-05-18 17:02:33 -0700 | [diff] [blame] | 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 | |
The Android Open Source Project | 8b23a6c | 2009-03-03 19:30:32 -0800 | [diff] [blame] | 10 | # determine the location of platform-specific directories |
| 11 | # |
| 12 | CONFIG_DIRS := \ |
| 13 | $(LOCAL_PATH)/android/config \ |
David 'Digit' Turner | 34d1651 | 2010-05-18 17:02:33 -0700 | [diff] [blame] | 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 |
The Android Open Source Project | 8b23a6c | 2009-03-03 19:30:32 -0800 | [diff] [blame] | 19 | |
| 20 | CONFIG_INCLUDES := $(CONFIG_DIRS:%=-I%) |
| 21 | |
Kenny Root | 095cd0f | 2009-09-19 18:32:44 -0500 | [diff] [blame] | 22 | MY_CC := $(HOST_CC) |
| 23 | |
David 'Digit' Turner | 5d8f37a | 2009-09-14 14:32:27 -0700 | [diff] [blame] | 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 | |
David 'Digit' Turner | 9a0f1fb | 2010-02-25 14:22:29 -0800 | [diff] [blame] | 29 | MY_CFLAGS := $(CONFIG_INCLUDES) $(MY_OPTIM) |
The Android Open Source Project | 8b23a6c | 2009-03-03 19:30:32 -0800 | [diff] [blame] | 30 | |
David 'Digit' Turner | 466f548 | 2009-07-30 15:50:19 +0200 | [diff] [blame] | 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 | |
David 'Digit' Turner | 9a0f1fb | 2010-02-25 14:22:29 -0800 | [diff] [blame] | 38 | MY_CFLAGS += -DCONFIG_MEMCHECK |
| 39 | |
David 'Digit' Turner | b95f892 | 2009-08-21 23:10:16 -0700 | [diff] [blame] | 40 | MY_LDLIBS := |
The Android Open Source Project | 8b23a6c | 2009-03-03 19:30:32 -0800 | [diff] [blame] | 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) |
David 'Digit' Turner | 2910f18 | 2010-05-10 18:48:35 -0700 | [diff] [blame] | 62 | MY_CFLAGS += -mdynamic-no-pic |
David Turner | bba461c | 2009-06-03 10:48:15 -0700 | [diff] [blame] | 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)) |
Jeff Hamilton | d0d9734 | 2010-05-27 11:41:41 -0500 | [diff] [blame] | 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) |
David Turner | bba461c | 2009-06-03 10:48:15 -0700 | [diff] [blame] | 69 | endif |
Jeff Hamilton | d0d9734 | 2010-05-27 11:41:41 -0500 | [diff] [blame] | 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)) |
David Turner | bba461c | 2009-06-03 10:48:15 -0700 | [diff] [blame] | 75 | $(error Aborting the build.) |
| 76 | endif |
Jeff Hamilton | d0d9734 | 2010-05-27 11:41:41 -0500 | [diff] [blame] | 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 |
David Turner | bba461c | 2009-06-03 10:48:15 -0700 | [diff] [blame] | 79 | endif |
The Android Open Source Project | 8b23a6c | 2009-03-03 19:30:32 -0800 | [diff] [blame] | 80 | endif |
The Android Open Source Project | 8b23a6c | 2009-03-03 19:30:32 -0800 | [diff] [blame] | 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) |
David 'Digit' Turner | b95f892 | 2009-08-21 23:10:16 -0700 | [diff] [blame] | 96 | MY_CFLAGS += -m32 |
| 97 | MY_LDLIBS += -m32 |
The Android Open Source Project | 8b23a6c | 2009-03-03 19:30:32 -0800 | [diff] [blame] | 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) |
David 'Digit' Turner | b95f892 | 2009-08-21 23:10:16 -0700 | [diff] [blame] | 123 | LOCAL_LDLIBS := $(MY_LDLIBS) |
The Android Open Source Project | 8b23a6c | 2009-03-03 19:30:32 -0800 | [diff] [blame] | 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 | |
David Turner | 6a9ef17 | 2010-09-09 22:54:36 +0200 | [diff] [blame] | 133 | LOCAL_CFLAGS += $(TCG_CFLAGS) -DNEED_CPU_H \ |
The Android Open Source Project | 8b23a6c | 2009-03-03 19:30:32 -0800 | [diff] [blame] | 134 | -I$(LOCAL_PATH)/target-arm \ |
| 135 | -I$(LOCAL_PATH)/fpu \ |
| 136 | |
| 137 | LOCAL_SRC_FILES := \ |
| 138 | tcg/tcg.c \ |
The Android Open Source Project | 8b23a6c | 2009-03-03 19:30:32 -0800 | [diff] [blame] | 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) |
Jeff Hamilton | d0d9734 | 2010-05-27 11:41:41 -0500 | [diff] [blame] | 149 | LOCAL_LDLIBS := $(MY_LDLIBS) |
The Android Open Source Project | 8b23a6c | 2009-03-03 19:30:32 -0800 | [diff] [blame] | 150 | LOCAL_MODULE := emulator-hw |
| 151 | |
| 152 | HW_CFLAGS := -I$(LOCAL_PATH)/hw |
| 153 | |
David Turner | 6a9ef17 | 2010-09-09 22:54:36 +0200 | [diff] [blame] | 154 | LOCAL_CFLAGS := $(MY_CFLAGS) $(LOCAL_CFLAGS) -DNEED_CPU_H |
The Android Open Source Project | 8b23a6c | 2009-03-03 19:30:32 -0800 | [diff] [blame] | 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 \ |
David 'Digit' Turner | 5d8f37a | 2009-09-14 14:32:27 -0700 | [diff] [blame] | 161 | bt.c \ |
| 162 | bt-hci.c \ |
| 163 | bt-hid.c \ |
| 164 | bt-l2cap.c \ |
| 165 | bt-sdp.c \ |
The Android Open Source Project | 8b23a6c | 2009-03-03 19:30:32 -0800 | [diff] [blame] | 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 \ |
David 'Digit' Turner | 5d8f37a | 2009-09-14 14:32:27 -0700 | [diff] [blame] | 182 | msmouse.c \ |
The Android Open Source Project | 8b23a6c | 2009-03-03 19:30:32 -0800 | [diff] [blame] | 183 | pci.c \ |
David 'Digit' Turner | 5d8f37a | 2009-09-14 14:32:27 -0700 | [diff] [blame] | 184 | qdev.c \ |
The Android Open Source Project | 8b23a6c | 2009-03-03 19:30:32 -0800 | [diff] [blame] | 185 | scsi-disk.c \ |
| 186 | smc91c111.c \ |
David 'Digit' Turner | 5d8f37a | 2009-09-14 14:32:27 -0700 | [diff] [blame] | 187 | sysbus.c \ |
The Android Open Source Project | 8b23a6c | 2009-03-03 19:30:32 -0800 | [diff] [blame] | 188 | usb-hid.c \ |
| 189 | usb-hub.c \ |
| 190 | usb-msd.c \ |
| 191 | usb-ohci.c \ |
| 192 | usb.c \ |
David 'Digit' Turner | 5d8f37a | 2009-09-14 14:32:27 -0700 | [diff] [blame] | 193 | watchdog.c \ |
The Android Open Source Project | 8b23a6c | 2009-03-03 19:30:32 -0800 | [diff] [blame] | 194 | |
| 195 | LOCAL_SRC_FILES += $(HW_SOURCES:%=hw/%) |
| 196 | |
| 197 | include $(BUILD_HOST_STATIC_LIBRARY) |
| 198 | |
| 199 | ############################################################################## |
Vladimir Chtchetkine | 5389aa1 | 2010-02-16 10:38:35 -0800 | [diff] [blame] | 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) |
Jeff Hamilton | d0d9734 | 2010-05-27 11:41:41 -0500 | [diff] [blame] | 210 | LOCAL_LDLIBS := $(MY_LDLIBS) |
Vladimir Chtchetkine | 5389aa1 | 2010-02-16 10:38:35 -0800 | [diff] [blame] | 211 | LOCAL_MODULE := emulator-elff |
| 212 | LOCAL_CPP_EXTENSION := .cc |
| 213 | |
| 214 | ELFF_CFLAGS := -I$(LOCAL_PATH)/elff |
| 215 | |
David 'Digit' Turner | 3d66dc7 | 2010-01-27 18:18:41 -0800 | [diff] [blame] | 216 | LOCAL_CFLAGS := $(MY_CFLAGS) $(LOCAL_CFLAGS) -fno-exceptions |
Vladimir Chtchetkine | 5389aa1 | 2010-02-16 10:38:35 -0800 | [diff] [blame] | 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) |
Jeff Hamilton | d0d9734 | 2010-05-27 11:41:41 -0500 | [diff] [blame] | 246 | LOCAL_LDLIBS := $(MY_LDLIBS) |
Vladimir Chtchetkine | 5389aa1 | 2010-02-16 10:38:35 -0800 | [diff] [blame] | 247 | LOCAL_MODULE := emulator-memcheck |
| 248 | |
| 249 | MCHK_CFLAGS := -I$(LOCAL_PATH)/memcheck -I$(LOCAL_PATH)/elff |
| 250 | |
David Turner | 6a9ef17 | 2010-09-09 22:54:36 +0200 | [diff] [blame] | 251 | LOCAL_CFLAGS := $(MY_CFLAGS) $(LOCAL_CFLAGS) -DNEED_CPU_H |
Vladimir Chtchetkine | 5389aa1 | 2010-02-16 10:38:35 -0800 | [diff] [blame] | 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 | ############################################################################## |
The Android Open Source Project | 8b23a6c | 2009-03-03 19:30:32 -0800 | [diff] [blame] | 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 |
David 'Digit' Turner | b95f892 | 2009-08-21 23:10:16 -0700 | [diff] [blame] | 274 | LOCAL_LDLIBS := $(MY_LDLIBS) |
The Android Open Source Project | 8b23a6c | 2009-03-03 19:30:32 -0800 | [diff] [blame] | 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) \ |
David Turner | 6a9ef17 | 2010-09-09 22:54:36 +0200 | [diff] [blame] | 286 | -DNEED_CPU_H \ |
The Android Open Source Project | 8b23a6c | 2009-03-03 19:30:32 -0800 | [diff] [blame] | 287 | |
| 288 | ifeq ($(HOST_ARCH),ppc) |
| 289 | LOCAL_CFLAGS += -D__powerpc__ |
| 290 | endif |
| 291 | |
| 292 | LOCAL_SRC_FILES += exec.c cpu-exec.c \ |
| 293 | target-arm/op_helper.c \ |
| 294 | target-arm/iwmmxt_helper.c \ |
| 295 | target-arm/neon_helper.c \ |
| 296 | target-arm/helper.c \ |
| 297 | target-arm/translate.c \ |
| 298 | target-arm/machine.c \ |
| 299 | translate-all.c \ |
| 300 | hw/armv7m.c \ |
| 301 | hw/armv7m_nvic.c \ |
| 302 | arm-semi.c \ |
| 303 | trace.c \ |
| 304 | varint.c \ |
| 305 | dcache.c \ |
Vladimir Chtchetkine | 5389aa1 | 2010-02-16 10:38:35 -0800 | [diff] [blame] | 306 | softmmu_outside_jit.c \ |
The Android Open Source Project | 8b23a6c | 2009-03-03 19:30:32 -0800 | [diff] [blame] | 307 | |
| 308 | LOCAL_SRC_FILES += fpu/softfloat.c |
| 309 | |
| 310 | include $(BUILD_HOST_STATIC_LIBRARY) |
| 311 | |
| 312 | ############################################################################## |
| 313 | # SDL-related definitions |
| 314 | # |
| 315 | |
David 'Digit' Turner | 34d1651 | 2010-05-18 17:02:33 -0700 | [diff] [blame] | 316 | # Build SDL from sources except on linux-x86, to avoid installing all |
| 317 | # the X11 development packages on our build servers. |
| 318 | # |
| 319 | BUILD_SDL_FROM_SOURCES := true |
| 320 | ifeq ($(QEMU_HOST_TAG),linux-x86) |
| 321 | BUILD_SDL_FROM_SOURCES := false |
| 322 | endif |
David 'Digit' Turner | b74c48f | 2010-05-20 15:17:32 -0700 | [diff] [blame] | 323 | ifeq ($(QEMU_HOST_TAG),darwin-x86) |
| 324 | BUILD_SDL_FROM_SOURCES := false |
| 325 | endif |
David 'Digit' Turner | 34f2974 | 2010-05-25 18:16:10 -0700 | [diff] [blame] | 326 | ifeq ($(BUILD_STANDALONE_EMULATOR),true) |
| 327 | BUILD_SDL_FROM_SOURCES := true |
| 328 | endif |
| 329 | |
David 'Digit' Turner | 34d1651 | 2010-05-18 17:02:33 -0700 | [diff] [blame] | 330 | ifneq ($(SDL_CONFIG),) |
| 331 | BUILD_SDL_FROM_SOURCES := false |
| 332 | endif |
| 333 | |
| 334 | ifneq ($(BUILD_SDL_FROM_SOURCES),true) |
| 335 | |
| 336 | SDL_CONFIG ?= prebuilt/$(QEMU_HOST_TAG)/sdl/bin/sdl-config |
The Android Open Source Project | 8b23a6c | 2009-03-03 19:30:32 -0800 | [diff] [blame] | 337 | SDL_CFLAGS := $(shell $(SDL_CONFIG) --cflags) |
| 338 | |
| 339 | # We need to filter out the _GNU_SOURCE variable because it breaks recent |
| 340 | # releases of Cygwin when using the -mno-cygwin option. Moreover, we don't |
| 341 | # need this macro at all to build the Android emulator. |
| 342 | SDL_CFLAGS := $(filter-out -D_GNU_SOURCE=1,$(SDL_CFLAGS)) |
| 343 | SDL_LDLIBS := $(filter-out %.a %.lib,$(shell $(SDL_CONFIG) --static-libs)) |
| 344 | |
David 'Digit' Turner | 34d1651 | 2010-05-18 17:02:33 -0700 | [diff] [blame] | 345 | # Circular dependencies between libSDL and libSDLmain; |
| 346 | # We repeat the libraries in the final link to work around it. |
| 347 | SDL_STATIC_LIBRARIES := libSDL libSDLmain libSDL libSDLmain |
| 348 | |
| 349 | else # !BUILD_STANDALONE_EMULATOR |
| 350 | |
| 351 | SDL_DIR := distrib/sdl-1.2.12 |
| 352 | include $(LOCAL_PATH)/$(SDL_DIR)/sources.make |
| 353 | |
| 354 | endif # !BUILD_STANDALONE_EMULATOR |
The Android Open Source Project | 8b23a6c | 2009-03-03 19:30:32 -0800 | [diff] [blame] | 355 | |
| 356 | ############################################################################## |
| 357 | # determine audio sources, build the prebuilt audio-library if needed |
| 358 | # |
| 359 | |
| 360 | # determine AUDIO sources based on current configuration |
| 361 | # |
Vladimir Chtchetkine | eeac013 | 2010-05-03 10:46:28 -0700 | [diff] [blame] | 362 | AUDIO_SOURCES := audio.c noaudio.c wavaudio.c wavcapture.c mixeng.c |
The Android Open Source Project | 8b23a6c | 2009-03-03 19:30:32 -0800 | [diff] [blame] | 363 | AUDIO_CFLAGS := -I$(LOCAL_PATH)/audio -DHAS_AUDIO |
| 364 | AUDIO_LDLIBS := |
| 365 | |
| 366 | ifeq ($(HOST_OS),darwin) |
| 367 | CONFIG_COREAUDIO ?= yes |
David 'Digit' Turner | 5d8f37a | 2009-09-14 14:32:27 -0700 | [diff] [blame] | 368 | AUDIO_CFLAGS += -DHOST_BSD=1 |
The Android Open Source Project | 8b23a6c | 2009-03-03 19:30:32 -0800 | [diff] [blame] | 369 | endif |
| 370 | |
| 371 | ifeq ($(HOST_OS),windows) |
| 372 | CONFIG_WINAUDIO ?= yes |
| 373 | endif |
| 374 | |
| 375 | ifeq ($(HOST_OS),linux) |
| 376 | CONFIG_OSS ?= yes |
| 377 | CONFIG_ALSA ?= yes |
David 'Digit' Turner | 415a4b1 | 2010-07-28 12:20:14 -0700 | [diff] [blame] | 378 | CONFIG_PULSEAUDIO ?= yes |
The Android Open Source Project | 8b23a6c | 2009-03-03 19:30:32 -0800 | [diff] [blame] | 379 | CONFIG_ESD ?= yes |
| 380 | endif |
| 381 | |
| 382 | ifeq ($(HOST_OS),freebsd) |
| 383 | CONFIG_OSS ?= yes |
| 384 | endif |
| 385 | |
| 386 | ifeq ($(CONFIG_COREAUDIO),yes) |
| 387 | AUDIO_SOURCES += coreaudio.c |
| 388 | AUDIO_CFLAGS += -DCONFIG_COREAUDIO |
| 389 | AUDIO_LDLIBS += -Wl,-framework,CoreAudio |
| 390 | endif |
| 391 | |
| 392 | ifeq ($(CONFIG_WINAUDIO),yes) |
| 393 | AUDIO_SOURCES += winaudio.c |
| 394 | AUDIO_CFLAGS += -DCONFIG_WINAUDIO |
| 395 | endif |
| 396 | |
David 'Digit' Turner | 415a4b1 | 2010-07-28 12:20:14 -0700 | [diff] [blame] | 397 | ifeq ($(CONFIG_PULSEAUDIO),yes) |
| 398 | AUDIO_SOURCES += paaudio.c audio_pt_int.c |
| 399 | AUDIO_CFLAGS += -DCONFIG_PULSEAUDIO |
| 400 | endif |
| 401 | |
The Android Open Source Project | 8b23a6c | 2009-03-03 19:30:32 -0800 | [diff] [blame] | 402 | ifeq ($(CONFIG_ALSA),yes) |
| 403 | AUDIO_SOURCES += alsaaudio.c audio_pt_int.c |
| 404 | AUDIO_CFLAGS += -DCONFIG_ALSA |
| 405 | endif |
| 406 | |
| 407 | ifeq ($(CONFIG_ESD),yes) |
| 408 | AUDIO_SOURCES += esdaudio.c |
| 409 | AUDIO_CFLAGS += -DCONFIG_ESD |
| 410 | endif |
| 411 | |
| 412 | ifeq ($(CONFIG_OSS),yes) |
| 413 | AUDIO_SOURCES += ossaudio.c |
| 414 | AUDIO_CFLAGS += -DCONFIG_OSS |
| 415 | endif |
| 416 | |
David 'Digit' Turner | 415a4b1 | 2010-07-28 12:20:14 -0700 | [diff] [blame] | 417 | AUDIO_SOURCES := $(call sort,$(AUDIO_SOURCES:%=audio/%)) |
The Android Open Source Project | 8b23a6c | 2009-03-03 19:30:32 -0800 | [diff] [blame] | 418 | |
| 419 | # determine whether we're going to use the prebuilt |
| 420 | # audio library (this is useful on Linux to avoid requiring |
| 421 | # all sound-related development packages to be installed on |
| 422 | # the build and developer machines). |
| 423 | # |
| 424 | # note that you can define BUILD_QEMU_AUDIO_LIB to true |
| 425 | # in your environment to force recompilation. |
| 426 | # |
| 427 | QEMU_AUDIO_LIB := |
| 428 | |
| 429 | ifneq ($(BUILD_STANDALONE_EMULATOR),true) |
| 430 | QEMU_AUDIO_LIB := $(wildcard \ |
David 'Digit' Turner | 34d1651 | 2010-05-18 17:02:33 -0700 | [diff] [blame] | 431 | prebuilt/$(QEMU_HOST_TAG)/emulator/libqemu-audio.a) |
The Android Open Source Project | 8b23a6c | 2009-03-03 19:30:32 -0800 | [diff] [blame] | 432 | endif |
| 433 | |
| 434 | ifeq ($(BUILD_QEMU_AUDIO_LIB),true) |
| 435 | include $(CLEAR_VARS) |
| 436 | LOCAL_NO_DEFAULT_COMPILER_FLAGS := true |
| 437 | LOCAL_CC := $(MY_CC) |
| 438 | LOCAL_MODULE := libqemu-audio |
David 'Digit' Turner | b95f892 | 2009-08-21 23:10:16 -0700 | [diff] [blame] | 439 | LOCAL_LDLIBS := $(MY_LDLIBS) |
The Android Open Source Project | 8b23a6c | 2009-03-03 19:30:32 -0800 | [diff] [blame] | 440 | |
| 441 | LOCAL_CFLAGS := -Wno-sign-compare \ |
| 442 | -fno-strict-aliasing -W -Wall -Wno-unused-parameter \ |
| 443 | -I$(LOCAL_PATH) \ |
| 444 | -I$(LOCAL_PATH)/target-arm \ |
| 445 | -I$(LOCAL_PATH)/fpu \ |
| 446 | |
David 'Digit' Turner | 46be487 | 2009-06-04 16:07:01 +0200 | [diff] [blame] | 447 | # this is very important, otherwise the generated binaries may |
| 448 | # not link properly on our build servers |
| 449 | ifeq ($(HOST_OS),linux) |
| 450 | LOCAL_CFLAGS += -fno-stack-protector |
| 451 | endif |
| 452 | |
The Android Open Source Project | 8b23a6c | 2009-03-03 19:30:32 -0800 | [diff] [blame] | 453 | LOCAL_CFLAGS := $(MY_CFLAGS) $(LOCAL_CFLAGS) $(AUDIO_CFLAGS) |
| 454 | |
| 455 | LOCAL_CFLAGS += $(SDL_CFLAGS) |
| 456 | |
| 457 | LOCAL_SRC_FILES += $(AUDIO_SOURCES) |
| 458 | |
| 459 | include $(BUILD_HOST_STATIC_LIBRARY) |
| 460 | QEMU_AUDIO_LIB := $(LOCAL_BUILT_MODULE) |
| 461 | |
| 462 | endif # !QEMU_AUDIO_LIB |
| 463 | |
| 464 | ############################################################################## |
Vladimir Chtchetkine | a05284d | 2010-06-10 10:45:55 -0700 | [diff] [blame] | 465 | # Build emulator core library. |
| 466 | # This library contains "pure" emulation code separated from the intricacies |
| 467 | # of the UI. |
| 468 | # |
| 469 | include $(CLEAR_VARS) |
| 470 | |
| 471 | LOCAL_NO_DEFAULT_COMPILER_FLAGS := true |
| 472 | LOCAL_CC := $(MY_CC) |
| 473 | LOCAL_LDLIBS := $(MY_LDLIBS) |
| 474 | LOCAL_MODULE := emulator-core |
| 475 | |
| 476 | # don't remove the -fno-strict-aliasing, or you'll break things |
| 477 | # (e.g. slirp-android/network support) |
| 478 | # |
Vladimir Chtchetkine | 526a991 | 2010-06-10 11:15:27 -0700 | [diff] [blame] | 479 | EMULATOR_CORE_CFLAGS := -fno-PIC -Wno-sign-compare \ |
Vladimir Chtchetkine | a05284d | 2010-06-10 10:45:55 -0700 | [diff] [blame] | 480 | -fno-strict-aliasing -g -W -Wall -Wno-unused-parameter |
| 481 | |
Vladimir Chtchetkine | 526a991 | 2010-06-10 11:15:27 -0700 | [diff] [blame] | 482 | # Needed by the upstream code |
| 483 | EMULATOR_CORE_CFLAGS += -DNEED_CPU_H |
Vladimir Chtchetkine | a05284d | 2010-06-10 10:45:55 -0700 | [diff] [blame] | 484 | |
| 485 | # Common includes for the emulator |
Vladimir Chtchetkine | 526a991 | 2010-06-10 11:15:27 -0700 | [diff] [blame] | 486 | EMULATOR_CORE_CFLAGS += -I$(LOCAL_PATH)/ \ |
| 487 | -I$(LOCAL_PATH)/target-arm \ |
| 488 | -I$(LOCAL_PATH)/fpu \ |
| 489 | $(TCG_CFLAGS) \ |
| 490 | $(HW_CFLAGS) \ |
Vladimir Chtchetkine | a05284d | 2010-06-10 10:45:55 -0700 | [diff] [blame] | 491 | |
| 492 | # include slirp-android code, i.e. the user-level networking stuff |
| 493 | # |
| 494 | SLIRP_SOURCES := bootp.c cksum.c debug.c if.c ip_icmp.c ip_input.c ip_output.c \ |
| 495 | mbuf.c misc.c sbuf.c slirp.c socket.c tcp_input.c tcp_output.c \ |
| 496 | tcp_subr.c tcp_timer.c tftp.c udp.c |
| 497 | |
| 498 | LOCAL_SRC_FILES += $(SLIRP_SOURCES:%=slirp-android/%) |
Vladimir Chtchetkine | 526a991 | 2010-06-10 11:15:27 -0700 | [diff] [blame] | 499 | EMULATOR_CORE_CFLAGS += -I$(LOCAL_PATH)/slirp-android |
Vladimir Chtchetkine | a05284d | 2010-06-10 10:45:55 -0700 | [diff] [blame] | 500 | |
| 501 | # socket proxy support |
| 502 | # |
| 503 | PROXY_SOURCES := \ |
| 504 | proxy_common.c \ |
| 505 | proxy_http.c \ |
| 506 | proxy_http_connector.c \ |
| 507 | proxy_http_rewriter.c \ |
| 508 | |
| 509 | LOCAL_SRC_FILES += $(PROXY_SOURCES:%=proxy/%) |
Vladimir Chtchetkine | 526a991 | 2010-06-10 11:15:27 -0700 | [diff] [blame] | 510 | EMULATOR_CORE_CFLAGS += -I$(LOCAL_PATH)/proxy |
Vladimir Chtchetkine | a05284d | 2010-06-10 10:45:55 -0700 | [diff] [blame] | 511 | |
| 512 | # include telephony stuff |
| 513 | # |
| 514 | TELEPHONY_SOURCES := android_modem.c modem_driver.c gsm.c sim_card.c sysdeps_qemu.c sms.c remote_call.c |
| 515 | LOCAL_SRC_FILES += $(TELEPHONY_SOURCES:%=telephony/%) |
Vladimir Chtchetkine | 526a991 | 2010-06-10 11:15:27 -0700 | [diff] [blame] | 516 | EMULATOR_CORE_CFLAGS += -I$(LOCAL_PATH)/telephony |
| 517 | |
Vladimir Chtchetkine | d81e6d1 | 2010-06-15 16:46:32 -0700 | [diff] [blame] | 518 | # include android related stuff |
| 519 | # |
| 520 | ANDROID_SOURCES := qemu-setup.c |
| 521 | LOCAL_SRC_FILES += $(ANDROID_SOURCES:%=android/%) |
| 522 | |
Vladimir Chtchetkine | 526a991 | 2010-06-10 11:15:27 -0700 | [diff] [blame] | 523 | LOCAL_CFLAGS := $(MY_CFLAGS) $(LOCAL_CFLAGS) $(EMULATOR_CORE_CFLAGS) |
Vladimir Chtchetkine | a05284d | 2010-06-10 10:45:55 -0700 | [diff] [blame] | 524 | |
| 525 | include $(BUILD_HOST_STATIC_LIBRARY) |
| 526 | |
| 527 | ############################################################################## |
| 528 | # Build emulator UI library. |
| 529 | # This library contains some emulator related UI components. |
| 530 | # |
| 531 | include $(CLEAR_VARS) |
| 532 | |
| 533 | LOCAL_NO_DEFAULT_COMPILER_FLAGS := true |
| 534 | LOCAL_CC := $(MY_CC) |
| 535 | LOCAL_LDLIBS := $(MY_LDLIBS) |
| 536 | LOCAL_MODULE := emulator-ui |
| 537 | |
Vladimir Chtchetkine | 526a991 | 2010-06-10 11:15:27 -0700 | [diff] [blame] | 538 | EMULATOR_UI_CFLAGS := |
Vladimir Chtchetkine | a05284d | 2010-06-10 10:45:55 -0700 | [diff] [blame] | 539 | |
| 540 | # include the SDL sources |
| 541 | # |
David 'Digit' Turner | ca85ee2 | 2010-06-10 15:14:55 -0700 | [diff] [blame] | 542 | |
| 543 | # IMPORTANT: Normally, we should add SDLMAIN_SOURCES here, however this breaks |
| 544 | # the Linux mingw32 build. Apparently, the i586-mingw32-ld wants the |
| 545 | # implementation of _WinMain@16 to be in an object file on the final |
| 546 | # link command used to generate the executable, and will not search |
| 547 | # in the static libraries that are used to build it. |
| 548 | # |
| 549 | LOCAL_SRC_FILES += $(SDL_SOURCES) #$(SDLMAIN_SOURCES) |
Vladimir Chtchetkine | 526a991 | 2010-06-10 11:15:27 -0700 | [diff] [blame] | 550 | EMULATOR_UI_CFLAGS += $(SDL_CFLAGS) -I$(LOCAL_PATH)/$(SDL_DIR)/include |
Vladimir Chtchetkine | a05284d | 2010-06-10 10:45:55 -0700 | [diff] [blame] | 551 | |
| 552 | # the skin support sources |
| 553 | # |
| 554 | SKIN_SOURCES := rect.c \ |
| 555 | region.c \ |
| 556 | image.c \ |
| 557 | trackball.c \ |
| 558 | keyboard.c \ |
| 559 | keyset.c \ |
| 560 | file.c \ |
| 561 | window.c \ |
| 562 | scaler.c \ |
| 563 | composer.c \ |
| 564 | surface.c \ |
| 565 | |
| 566 | LOCAL_SRC_FILES += $(SKIN_SOURCES:%=android/skin/%) |
Vladimir Chtchetkine | 526a991 | 2010-06-10 11:15:27 -0700 | [diff] [blame] | 567 | EMULATOR_UI_CFLAGS += -I$(LOCAL_PATH)/skin |
| 568 | |
| 569 | LOCAL_CFLAGS := $(MY_CFLAGS) $(LOCAL_CFLAGS) $(EMULATOR_CORE_CFLAGS) $(EMULATOR_UI_CFLAGS) |
Vladimir Chtchetkine | a05284d | 2010-06-10 10:45:55 -0700 | [diff] [blame] | 570 | |
| 571 | include $(BUILD_HOST_STATIC_LIBRARY) |
| 572 | |
Vladimir Chtchetkine | ceb0fd0 | 2010-06-22 10:07:00 -0700 | [diff] [blame] | 573 | ############################################################################## |
Vladimir Chtchetkine | ba1f57f | 2010-07-27 14:14:15 -0700 | [diff] [blame] | 574 | # Common CFLAGS for UI and Core builds |
| 575 | |
| 576 | # add the build ID to the default macro definitions |
| 577 | UI_AND_CORE_CFLAGS = -DANDROID_BUILD_ID="$(strip $(BUILD_ID))-$(strip $(BUILD_NUMBER))" |
| 578 | |
| 579 | # For non-standalone builds, extract the major version number from the Android SDK |
| 580 | # tools revision number. |
| 581 | ifneq ($(BUILD_STANDALONE_EMULATOR),true) |
| 582 | ANDROID_SDK_TOOLS_REVISION := $(shell awk -F= '/Pkg.Revision/ { print $$2; }' sdk/files/tools_source.properties) |
| 583 | endif |
| 584 | |
| 585 | ANDROID_SDK_TOOLS_REVISION := $(strip $(ANDROID_SDK_TOOLS_REVISION)) |
| 586 | ifdef ANDROID_SDK_TOOLS_REVISION |
| 587 | UI_AND_CORE_CFLAGS += -DANDROID_SDK_TOOLS_REVISION=$(ANDROID_SDK_TOOLS_REVISION) |
| 588 | endif |
| 589 | |
| 590 | UI_AND_CORE_CFLAGS += -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE |
| 591 | |
| 592 | ############################################################################## |
Vladimir Chtchetkine | ceb0fd0 | 2010-06-22 10:07:00 -0700 | [diff] [blame] | 593 | # lists of source files used to build the emulator core |
| 594 | # |
| 595 | |
| 596 | # block sources |
| 597 | # |
| 598 | CORE_BLOCK_SOURCES = block.c \ |
| 599 | block/qcow.c \ |
| 600 | block/qcow2.c \ |
| 601 | block/qcow2-refcount.c \ |
| 602 | block/qcow2-snapshot.c \ |
| 603 | block/qcow2-cluster.c \ |
| 604 | block/cloop.c \ |
| 605 | block/dmg.c \ |
| 606 | block/vvfat.c |
| 607 | ifeq ($(HOST_OS),windows) |
| 608 | CORE_BLOCK_SOURCES += block/raw-win32.c |
| 609 | else |
| 610 | CORE_BLOCK_SOURCES += block/raw-posix.c |
| 611 | endif |
| 612 | |
| 613 | # hw sources |
| 614 | # |
| 615 | CORE_HW_SOURCES = hw/arm_boot.c \ |
| 616 | hw/android_arm.c |
| 617 | |
| 618 | # migration sources |
| 619 | # |
| 620 | CORE_MIGRATION_SOURCES = iolooper-select.c |
| 621 | ifeq ($(HOST_OS),windows) |
| 622 | CORE_MIGRATION_SOURCES += migration-dummy-android.c |
| 623 | else |
| 624 | CORE_MIGRATION_SOURCES += migration.c \ |
| 625 | migration-exec.c \ |
| 626 | migration-tcp-android.c |
| 627 | endif |
| 628 | |
| 629 | # misc. sources |
| 630 | # |
Vladimir Chtchetkine | eb83825 | 2010-07-15 12:27:56 -0700 | [diff] [blame] | 631 | CORE_MISC_SOURCES = vl-android.c \ |
| 632 | console.c \ |
Vladimir Chtchetkine | a678138 | 2010-07-09 09:19:37 -0700 | [diff] [blame] | 633 | loader.c \ |
| 634 | monitor.c \ |
| 635 | readline.c \ |
| 636 | qemu-char-android.c \ |
David Turner | edd3396 | 2010-09-10 00:17:41 +0200 | [diff] [blame^] | 637 | qemu-error.c \ |
| 638 | qerror.c \ |
Vladimir Chtchetkine | a678138 | 2010-07-09 09:19:37 -0700 | [diff] [blame] | 639 | disas.c \ |
| 640 | arm-dis.c \ |
Vladimir Chtchetkine | 7258f6b | 2010-07-14 10:04:01 -0700 | [diff] [blame] | 641 | aes.c \ |
| 642 | d3des.c \ |
| 643 | vnc-android.c \ |
| 644 | acl.c \ |
| 645 | buffered_file.c \ |
| 646 | cbuffer.c \ |
| 647 | gdbstub.c \ |
| 648 | ioport.c \ |
| 649 | shaper.c \ |
| 650 | charpipe.c \ |
| 651 | tcpdump.c \ |
Vladimir Chtchetkine | 7258f6b | 2010-07-14 10:04:01 -0700 | [diff] [blame] | 652 | qemu-option.c \ |
| 653 | savevm.c \ |
| 654 | net-android.c \ |
| 655 | aio-android.c \ |
| 656 | dma-helpers.c \ |
| 657 | qemu-sockets-android.c \ |
| 658 | bt-host.c \ |
| 659 | bt-vhci.c \ |
| 660 | module.c \ |
David Turner | 6a9ef17 | 2010-09-09 22:54:36 +0200 | [diff] [blame] | 661 | qemu-timer.c \ |
Vladimir Chtchetkine | a678138 | 2010-07-09 09:19:37 -0700 | [diff] [blame] | 662 | android/boot-properties.c \ |
David 'Digit' Turner | 055ae42 | 2010-07-27 11:34:16 -0700 | [diff] [blame] | 663 | android/display.c \ |
Vladimir Chtchetkine | 13682a0 | 2010-06-23 16:39:44 -0700 | [diff] [blame] | 664 | android/hw-kmsg.c \ |
Vladimir Chtchetkine | a21ac69 | 2010-06-28 10:47:18 -0700 | [diff] [blame] | 665 | android/hw-lcd.c \ |
Vladimir Chtchetkine | 4057561 | 2010-07-08 10:25:06 -0700 | [diff] [blame] | 666 | android/gps.c \ |
| 667 | android/hw-events.c \ |
| 668 | android/hw-control.c \ |
Vladimir Chtchetkine | 7258f6b | 2010-07-14 10:04:01 -0700 | [diff] [blame] | 669 | android/console.c \ |
Vladimir Chtchetkine | ba1f57f | 2010-07-27 14:14:15 -0700 | [diff] [blame] | 670 | android/hw-sensors.c \ |
Vladimir Chtchetkine | cefa744 | 2010-09-01 09:17:11 -0700 | [diff] [blame] | 671 | android/hw-qemud.c \ |
Vladimir Chtchetkine | 13682a0 | 2010-06-23 16:39:44 -0700 | [diff] [blame] | 672 | |
Vladimir Chtchetkine | ceb0fd0 | 2010-06-22 10:07:00 -0700 | [diff] [blame] | 673 | ifeq ($(HOST_ARCH),x86) |
| 674 | CORE_MISC_SOURCES += i386-dis.c |
| 675 | endif |
| 676 | ifeq ($(HOST_ARCH),x86_64) |
| 677 | CORE_MISC_SOURCES += i386-dis.c |
| 678 | endif |
| 679 | ifeq ($(HOST_ARCH),ppc) |
| 680 | CORE_MISC_SOURCES += ppc-dis.c |
| 681 | endif |
| 682 | |
| 683 | ifeq ($(HOST_OS),linux) |
| 684 | CORE_MISC_SOURCES += usb-linux.c \ |
| 685 | qemu-thread.c |
| 686 | else |
| 687 | CORE_MISC_SOURCES += usb-dummy-android.c |
| 688 | endif |
| 689 | |
| 690 | ifeq ($(HOST_OS),windows) |
| 691 | CORE_MISC_SOURCES += tap-win32.c |
| 692 | endif |
| 693 | |
Vladimir Chtchetkine | 7258f6b | 2010-07-14 10:04:01 -0700 | [diff] [blame] | 694 | # sources inherited from upstream, but not fully |
| 695 | # integrated into android emulator |
| 696 | # |
| 697 | CORE_UPSTREAM_SOURCES = json-lexer.c \ |
| 698 | json-parser.c \ |
| 699 | json-streamer.c \ |
| 700 | qjson.c \ |
| 701 | qbool.c \ |
| 702 | qdict.c \ |
| 703 | qfloat.c \ |
| 704 | qint.c \ |
| 705 | qlist.c \ |
| 706 | qstring.c \ |
| 707 | |
| 708 | |
Vladimir Chtchetkine | ceb0fd0 | 2010-06-22 10:07:00 -0700 | [diff] [blame] | 709 | CORE_SOURCES = $(CORE_BLOCK_SOURCES) $(CORE_HW_SOURCES) |
| 710 | CORE_SOURCES += $(CORE_MIGRATION_SOURCES) $(CORE_MISC_SOURCES) |
Vladimir Chtchetkine | 7258f6b | 2010-07-14 10:04:01 -0700 | [diff] [blame] | 711 | CORE_SOURCES += $(CORE_UPSTREAM_SOURCES) |
Vladimir Chtchetkine | a05284d | 2010-06-10 10:45:55 -0700 | [diff] [blame] | 712 | |
| 713 | ############################################################################## |
Vladimir Chtchetkine | 13682a0 | 2010-06-23 16:39:44 -0700 | [diff] [blame] | 714 | # lists of source files used to build the emulator UI |
| 715 | # |
| 716 | |
Vladimir Chtchetkine | 7258f6b | 2010-07-14 10:04:01 -0700 | [diff] [blame] | 717 | UI_SOURCES = loadpng.c \ |
Vladimir Chtchetkine | 7258f6b | 2010-07-14 10:04:01 -0700 | [diff] [blame] | 718 | android/user-config.c \ |
Vladimir Chtchetkine | 13682a0 | 2010-06-23 16:39:44 -0700 | [diff] [blame] | 719 | android/resource.c \ |
Vladimir Chtchetkine | 13682a0 | 2010-06-23 16:39:44 -0700 | [diff] [blame] | 720 | android/qemulator.c \ |
| 721 | android/keycode.c \ |
Vladimir Chtchetkine | 4057561 | 2010-07-08 10:25:06 -0700 | [diff] [blame] | 722 | android/help.c \ |
Vladimir Chtchetkine | 13682a0 | 2010-06-23 16:39:44 -0700 | [diff] [blame] | 723 | |
| 724 | ############################################################################## |
Vladimir Chtchetkine | 71bb14f | 2010-07-07 15:57:00 -0700 | [diff] [blame] | 725 | # lists of source files used by both, emulator UI and emulator core |
| 726 | # |
| 727 | |
Vladimir Chtchetkine | a678138 | 2010-07-09 09:19:37 -0700 | [diff] [blame] | 728 | UI_AND_CORE_SOURCES = osdep.c \ |
| 729 | cutils.c \ |
| 730 | sockets.c \ |
Vladimir Chtchetkine | eb83825 | 2010-07-15 12:27:56 -0700 | [diff] [blame] | 731 | keymaps.c \ |
Vladimir Chtchetkine | b5365f3 | 2010-08-09 13:33:57 -0700 | [diff] [blame] | 732 | qemu-malloc.c \ |
Vladimir Chtchetkine | a678138 | 2010-07-09 09:19:37 -0700 | [diff] [blame] | 733 | android/keycode-array.c \ |
Vladimir Chtchetkine | 71bb14f | 2010-07-07 15:57:00 -0700 | [diff] [blame] | 734 | android/charmap.c \ |
Vladimir Chtchetkine | a678138 | 2010-07-09 09:19:37 -0700 | [diff] [blame] | 735 | android/utils/bufprint.c \ |
| 736 | android/utils/debug.c \ |
| 737 | android/utils/path.c \ |
| 738 | android/utils/dirscanner.c \ |
| 739 | android/utils/filelock.c \ |
| 740 | android/utils/misc.c \ |
| 741 | android/utils/reflist.c \ |
| 742 | android/utils/stralloc.c \ |
| 743 | android/utils/system.c \ |
| 744 | android/utils/tempfile.c \ |
| 745 | android/utils/timezone.c \ |
| 746 | android/utils/mapfile.c \ |
Vladimir Chtchetkine | 074d1f9 | 2010-08-06 09:29:50 -0700 | [diff] [blame] | 747 | android/avd/hw-config.c \ |
| 748 | android/avd/info.c \ |
| 749 | android/utils/ini.c \ |
Vladimir Chtchetkine | 71bb14f | 2010-07-07 15:57:00 -0700 | [diff] [blame] | 750 | |
Vladimir Chtchetkine | ba1f57f | 2010-07-27 14:14:15 -0700 | [diff] [blame] | 751 | # include the Zlib sources |
| 752 | # |
| 753 | UI_AND_CORE_SOURCES += $(ZLIB_SOURCES) |
| 754 | UI_AND_CORE_CFLAGS += $(ZLIB_CFLAGS) -I$(LOCAL_PATH)/$(ZLIB_DIR) |
| 755 | |
| 756 | # include the Libpng sources |
| 757 | # |
| 758 | UI_AND_CORE_SOURCES += $(LIBPNG_SOURCES) |
| 759 | UI_AND_CORE_CFLAGS += $(LIBPNG_CFLAGS) -I$(LOCAL_PATH)/$(LIBPNG_DIR) |
| 760 | |
Vladimir Chtchetkine | 2fa5173 | 2010-07-16 11:19:48 -0700 | [diff] [blame] | 761 | # temp files used to collect UI->Core exchange protocol. |
| 762 | UI_AND_CORE_SOURCES += android/ui-core-protocol.c android/core-ui-protocol.c |
| 763 | |
Vladimir Chtchetkine | ba1f57f | 2010-07-27 14:14:15 -0700 | [diff] [blame] | 764 | # The common libraries |
| 765 | # |
| 766 | QEMU_SYSTEM_LDLIBS := -lm |
| 767 | ifeq ($(HOST_OS),windows) |
| 768 | QEMU_SYSTEM_LDLIBS += -mno-cygwin -mwindows -mconsole |
| 769 | endif |
| 770 | |
| 771 | ifeq ($(HOST_OS),freebsd) |
| 772 | QEMU_SYSTEM_LDLIBS += -L/usr/local/lib -lpthread -lX11 -lutil |
| 773 | endif |
| 774 | |
| 775 | ifeq ($(HOST_OS),linux) |
| 776 | QEMU_SYSTEM_LDLIBS += -lutil -lrt |
| 777 | endif |
| 778 | |
| 779 | ifeq ($(HOST_OS),windows) |
| 780 | QEMU_SYSTEM_LDLIBS += -lwinmm -lws2_32 -liphlpapi |
| 781 | else |
| 782 | QEMU_SYSTEM_LDLIBS += -lpthread |
| 783 | endif |
| 784 | |
David 'Digit' Turner | 393c0f1 | 2010-07-28 12:20:56 -0700 | [diff] [blame] | 785 | ifeq ($(HOST_OS),darwin) |
| 786 | QEMU_SYSTEM_LDLIBS += -Wl,-framework,Cocoa |
| 787 | endif |
Vladimir Chtchetkine | ba1f57f | 2010-07-27 14:14:15 -0700 | [diff] [blame] | 788 | |
| 789 | |
Vladimir Chtchetkine | 71bb14f | 2010-07-07 15:57:00 -0700 | [diff] [blame] | 790 | ############################################################################## |
The Android Open Source Project | 8b23a6c | 2009-03-03 19:30:32 -0800 | [diff] [blame] | 791 | # now build the emulator itself |
| 792 | # |
| 793 | include $(CLEAR_VARS) |
| 794 | |
Vladimir Chtchetkine | 2fa5173 | 2010-07-16 11:19:48 -0700 | [diff] [blame] | 795 | LOCAL_GENERATED_SOURCES := |
The Android Open Source Project | 8b23a6c | 2009-03-03 19:30:32 -0800 | [diff] [blame] | 796 | LOCAL_NO_DEFAULT_COMPILER_FLAGS := true |
| 797 | LOCAL_CC := $(MY_CC) |
| 798 | LOCAL_MODULE := emulator |
Vladimir Chtchetkine | 5389aa1 | 2010-02-16 10:38:35 -0800 | [diff] [blame] | 799 | LOCAL_STATIC_LIBRARIES := emulator-memcheck emulator-hw emulator-arm emulator-tcg |
| 800 | LOCAL_STATIC_LIBRARIES += emulator-elff |
Vladimir Chtchetkine | a05284d | 2010-06-10 10:45:55 -0700 | [diff] [blame] | 801 | LOCAL_STATIC_LIBRARIES += emulator-core emulator-ui |
David 'Digit' Turner | b95f892 | 2009-08-21 23:10:16 -0700 | [diff] [blame] | 802 | LOCAL_LDLIBS := $(MY_LDLIBS) |
The Android Open Source Project | 8b23a6c | 2009-03-03 19:30:32 -0800 | [diff] [blame] | 803 | |
Vladimir Chtchetkine | 526a991 | 2010-06-10 11:15:27 -0700 | [diff] [blame] | 804 | LOCAL_CFLAGS := $(MY_CFLAGS) $(LOCAL_CFLAGS) $(EMULATOR_CORE_CFLAGS) $(EMULATOR_UI_CFLAGS) |
The Android Open Source Project | 8b23a6c | 2009-03-03 19:30:32 -0800 | [diff] [blame] | 805 | |
| 806 | # add the build ID to the default macro definitions |
Vladimir Chtchetkine | ba1f57f | 2010-07-27 14:14:15 -0700 | [diff] [blame] | 807 | LOCAL_CFLAGS += $(UI_AND_CORE_CFLAGS) |
The Android Open Source Project | 8b23a6c | 2009-03-03 19:30:32 -0800 | [diff] [blame] | 808 | |
The Android Open Source Project | 8b23a6c | 2009-03-03 19:30:32 -0800 | [diff] [blame] | 809 | # include sound support source files. we first try to see if we have a prebuilt audio |
| 810 | # library. if not, we build things the "hard" way. |
| 811 | # |
| 812 | # note that to generate the prebuilt audio library, you should do the following: |
| 813 | # |
| 814 | # cd tools/qemu |
| 815 | # ./android-rebuild.sh |
| 816 | # distrib/update-audio.sh |
| 817 | # |
| 818 | ifeq ($(QEMU_AUDIO_LIB),) |
| 819 | LOCAL_SRC_FILES += $(AUDIO_SOURCES) |
| 820 | endif # !QEMU_AUDIO_LIB |
| 821 | |
| 822 | LOCAL_CFLAGS += $(AUDIO_CFLAGS) |
| 823 | LOCAL_LDLIBS += $(AUDIO_LDLIBS) |
| 824 | |
The Android Open Source Project | 8b23a6c | 2009-03-03 19:30:32 -0800 | [diff] [blame] | 825 | # the linux-user sources, I doubt we really need these |
| 826 | # |
| 827 | #LINUX_SOURCES := main.c elfload.c mmap.c signal.c path.c syscall.c |
| 828 | #LOCAL_SRC_FILES += $(LINUX_SOURCES:%=linux-user/%) |
| 829 | |
The Android Open Source Project | 8b23a6c | 2009-03-03 19:30:32 -0800 | [diff] [blame] | 830 | ifeq ($(HOST_ARCH),x86) |
| 831 | # enable MMX code for our skin scaler |
| 832 | LOCAL_CFLAGS += -DUSE_MMX=1 -mmmx |
| 833 | endif |
| 834 | |
| 835 | # include other sources |
| 836 | # |
Vladimir Chtchetkine | eb83825 | 2010-07-15 12:27:56 -0700 | [diff] [blame] | 837 | VL_SOURCES := framebuffer.c \ |
David 'Digit' Turner | 34f2974 | 2010-05-25 18:16:10 -0700 | [diff] [blame] | 838 | user-events-qemu.c \ |
The Android Open Source Project | 8b23a6c | 2009-03-03 19:30:32 -0800 | [diff] [blame] | 839 | android/cmdline-option.c \ |
| 840 | android/config.c \ |
The Android Open Source Project | 8b23a6c | 2009-03-03 19:30:32 -0800 | [diff] [blame] | 841 | android/main.c \ |
The Android Open Source Project | 8b23a6c | 2009-03-03 19:30:32 -0800 | [diff] [blame] | 842 | |
Vladimir Chtchetkine | ba1f57f | 2010-07-27 14:14:15 -0700 | [diff] [blame] | 843 | # Add common system libraries |
| 844 | # |
| 845 | LOCAL_LDLIBS += $(QEMU_SYSTEM_LDLIBS) |
Alexey Tarasov | 43fbac1 | 2009-06-15 14:28:15 +1100 | [diff] [blame] | 846 | |
Vladimir Chtchetkine | 71bb14f | 2010-07-07 15:57:00 -0700 | [diff] [blame] | 847 | LOCAL_SRC_FILES += $(VL_SOURCES) $(CORE_SOURCES) $(UI_SOURCES) $(UI_AND_CORE_SOURCES) |
The Android Open Source Project | 8b23a6c | 2009-03-03 19:30:32 -0800 | [diff] [blame] | 848 | |
The Android Open Source Project | 8b23a6c | 2009-03-03 19:30:32 -0800 | [diff] [blame] | 849 | # add SDL-specific flags |
| 850 | # |
| 851 | LOCAL_CFLAGS += $(SDL_CFLAGS) |
| 852 | LOCAL_LDLIBS += $(SDL_LDLIBS) |
David 'Digit' Turner | 34d1651 | 2010-05-18 17:02:33 -0700 | [diff] [blame] | 853 | LOCAL_STATIC_LIBRARIES += $(SDL_STATIC_LIBRARIES) |
The Android Open Source Project | 8b23a6c | 2009-03-03 19:30:32 -0800 | [diff] [blame] | 854 | |
Vladimir Chtchetkine | 5389aa1 | 2010-02-16 10:38:35 -0800 | [diff] [blame] | 855 | # add ELFF-specific flags |
| 856 | # |
| 857 | LOCAL_LDLIBS += $(ELFF_LDLIBS) |
| 858 | |
The Android Open Source Project | 8b23a6c | 2009-03-03 19:30:32 -0800 | [diff] [blame] | 859 | # on Windows, link the icon file as well into the executable |
| 860 | # unfortunately, our build system doesn't help us much, so we need |
| 861 | # to use some weird pathnames to make this work... |
| 862 | # |
| 863 | ifeq ($(HOST_OS),windows) |
Raphael | aea1b87 | 2010-04-14 12:16:28 -0700 | [diff] [blame] | 864 | |
| 865 | # Locate windres executable |
| 866 | WINDRES := windres |
| 867 | ifneq ($(USE_MINGW),) |
| 868 | # When building the Windows emulator under Linux, use the MinGW one |
| 869 | WINDRES := i586-mingw32msvc-windres |
| 870 | endif |
| 871 | |
The Android Open Source Project | 8b23a6c | 2009-03-03 19:30:32 -0800 | [diff] [blame] | 872 | INTERMEDIATE := $(call intermediates-dir-for,EXECUTABLES,$(LOCAL_MODULE),true) |
| 873 | ANDROID_ICON_OBJ := android_icon.o |
| 874 | ANDROID_ICON_PATH := $(LOCAL_PATH)/images |
| 875 | $(ANDROID_ICON_PATH)/$(ANDROID_ICON_OBJ): $(ANDROID_ICON_PATH)/android_icon.rc |
Raphael | aea1b87 | 2010-04-14 12:16:28 -0700 | [diff] [blame] | 876 | $(WINDRES) $< -I $(ANDROID_ICON_PATH) -o $@ |
The Android Open Source Project | 8b23a6c | 2009-03-03 19:30:32 -0800 | [diff] [blame] | 877 | |
| 878 | # seems to be the only way to add an object file that was not generated from |
| 879 | # a C/C++/Java source file to our build system. and very unfortunately, |
| 880 | # $(TOPDIR)/$(LOCALPATH) will always be prepended to this value, which forces |
| 881 | # us to put the object file in the source directory... |
| 882 | # |
| 883 | LOCAL_PREBUILT_OBJ_FILES += images/$(ANDROID_ICON_OBJ) |
| 884 | endif |
| 885 | |
David 'Digit' Turner | 5d8f37a | 2009-09-14 14:32:27 -0700 | [diff] [blame] | 886 | # qemu-options.h is generated from qemu-options.hx with the "hxtool" shell script |
| 887 | # |
| 888 | intermediates := $(call intermediates-dir-for,EXECUTABLES,$(LOCAL_MODULE),true) |
| 889 | |
| 890 | QEMU_OPTIONS_H := $(intermediates)/qemu-options.h |
| 891 | $(QEMU_OPTIONS_H): PRIVATE_PATH := $(LOCAL_PATH) |
| 892 | $(QEMU_OPTIONS_H): PRIVATE_CUSTOM_TOOL = $(PRIVATE_PATH)/hxtool -h < $< > $@ |
| 893 | $(QEMU_OPTIONS_H): $(LOCAL_PATH)/qemu-options.hx $(LOCAL_PATH)/hxtool |
| 894 | $(transform-generated-source) |
| 895 | |
| 896 | $(intermediates)/vl-android.o: $(QEMU_OPTIONS_H) |
| 897 | |
| 898 | LOCAL_GENERATED_SOURCES += $(QEMU_OPTIONS_H) |
| 899 | |
| 900 | # qemu-monitor.h is generated from qemu-monitor.hx with the "hxtool" shell script |
| 901 | # |
| 902 | intermediates := $(call intermediates-dir-for,EXECUTABLES,$(LOCAL_MODULE),true) |
| 903 | |
| 904 | QEMU_MONITOR_H := $(intermediates)/qemu-monitor.h |
| 905 | $(QEMU_MONITOR_H): PRIVATE_PATH := $(LOCAL_PATH) |
| 906 | $(QEMU_MONITOR_H): PRIVATE_CUSTOM_TOOL = $(PRIVATE_PATH)/hxtool -h < $< > $@ |
| 907 | $(QEMU_MONITOR_H): $(LOCAL_PATH)/qemu-monitor.hx $(LOCAL_PATH)/hxtool |
| 908 | $(transform-generated-source) |
| 909 | |
| 910 | $(intermediates)/vl-android.o: $(QEMU_MONITOR_H) |
| 911 | |
| 912 | LOCAL_GENERATED_SOURCES += $(QEMU_MONITOR_H) |
| 913 | |
| 914 | |
| 915 | # gdbstub-xml.c contains C-compilable arrays corresponding to the content |
| 916 | # of $(LOCAL_PATH)/gdb-xml/, and is generated with the 'feature_to_c.sh' script. |
| 917 | # |
| 918 | ifeq ($(QEMU_TARGET_XML_SOURCES),) |
| 919 | QEMU_TARGET_XML_SOURCES := arm-core arm-neon arm-vfp arm-vfp3 |
| 920 | QEMU_TARGET_XML_SOURCES := $(QEMU_TARGET_XML_SOURCES:%=$(LOCAL_PATH)/gdb-xml/%.xml) |
| 921 | endif |
| 922 | |
| 923 | QEMU_GDBSTUB_XML_C := $(intermediates)/gdbstub-xml.c |
| 924 | $(QEMU_GDBSTUB_XML_C): PRIVATE_PATH := $(LOCAL_PATH) |
| 925 | $(QEMU_GDBSTUB_XML_C): PRIVATE_SOURCES := $(TARGET_XML_SOURCES) |
| 926 | $(QEMU_GDBSTUB_XML_C): PRIVATE_CUSTOM_TOOL = $(PRIVATE_PATH)/feature_to_c.sh $@ $(QEMU_TARGET_XML_SOURCES) |
| 927 | $(QEMU_GDBSTUB_XML_C): $(QEMU_TARGET_XML_SOURCES) $(LOCAL_PATH)/feature_to_c.sh |
| 928 | $(hide) rm -f $@ |
| 929 | $(transform-generated-source) |
| 930 | |
| 931 | $(intermediates)/vl-android.o: $(QEMU_GDBSTUB_XML_C) |
| 932 | |
| 933 | LOCAL_GENERATED_SOURCES += $(QEMU_GDBSTUB_XML_C) |
| 934 | |
David 'Digit' Turner | 065242d | 2009-10-07 13:43:33 -0700 | [diff] [blame] | 935 | # hw-config-defs.h is generated from android/avd/hardware-properties.ini |
| 936 | # |
David 'Digit' Turner | 2ec4559 | 2009-10-07 14:48:19 -0700 | [diff] [blame] | 937 | QEMU_HARDWARE_PROPERTIES_INI := $(LOCAL_PATH)/android/avd/hardware-properties.ini |
David 'Digit' Turner | 065242d | 2009-10-07 13:43:33 -0700 | [diff] [blame] | 938 | QEMU_HW_CONFIG_DEFS_H := $(LOCAL_PATH)/android/avd/hw-config-defs.h |
| 939 | $(QEMU_HW_CONFIG_DEFS_H): PRIVATE_PATH := $(LOCAL_PATH) |
David 'Digit' Turner | 2ec4559 | 2009-10-07 14:48:19 -0700 | [diff] [blame] | 940 | $(QEMU_HW_CONFIG_DEFS_H): PRIVATE_SOURCES := $(QEMU_HARDWARE_PROPERTIES_INI) |
| 941 | $(QEMU_HW_CONFIG_DEFS_H): PRIVATE_CUSTOM_TOOL = $(PRIVATE_PATH)/android/tools/gen-hw-config.py $(QEMU_HARDWARE_PROPERTIES_INI) $@ |
| 942 | $(QEMU_HW_CONFIG_DEFS_H): $(QEMU_HARDWARE_PROPERTIES_INI) $(LOCAL_PATH)/android/tools/gen-hw-config.py |
David 'Digit' Turner | 065242d | 2009-10-07 13:43:33 -0700 | [diff] [blame] | 943 | $(hide) rm -f $@ |
| 944 | $(transform-generated-source) |
| 945 | |
| 946 | $(LOCAL_PATH)/android/avd/hw-config.h: $(QEMU_HW_CONFIG_DEFS_H) |
| 947 | |
| 948 | LOCAL_GENERATED_SOURCES += $(QEMU_HW_CONFIG_DEFS_H) |
David 'Digit' Turner | 5d8f37a | 2009-09-14 14:32:27 -0700 | [diff] [blame] | 949 | |
| 950 | # this is already done by the Android build system, but is done for the |
| 951 | # benefit of the stand-alone one. |
| 952 | # |
| 953 | ifeq ($(BUILD_STANDALONE_EMULATOR),true) |
| 954 | LOCAL_CFLAGS += -I$(intermediates) |
| 955 | endif |
| 956 | |
The Android Open Source Project | 8b23a6c | 2009-03-03 19:30:32 -0800 | [diff] [blame] | 957 | LOCAL_LDLIBS += $(QEMU_AUDIO_LIB) |
| 958 | |
David 'Digit' Turner | ab873b7 | 2010-03-08 18:33:50 -0800 | [diff] [blame] | 959 | # Generate a completely static executable if needed. |
| 960 | # Note that this means no sound and graphics on Linux. |
| 961 | # |
| 962 | ifeq ($(CONFIG_STATIC_EXECUTABLE),true) |
| 963 | LOCAL_SRC_FILES += dynlink-static.c |
| 964 | LOCAL_LDLIBS += -static |
| 965 | endif |
| 966 | |
The Android Open Source Project | 8b23a6c | 2009-03-03 19:30:32 -0800 | [diff] [blame] | 967 | LOCAL_MODULE := emulator |
| 968 | |
David 'Digit' Turner | ca85ee2 | 2010-06-10 15:14:55 -0700 | [diff] [blame] | 969 | # See comment about SDLMAIN_SOURCES in the 'emulator-ui' module declarations. |
| 970 | LOCAL_SRC_FILES += $(SDLMAIN_SOURCES) |
| 971 | |
The Android Open Source Project | 8b23a6c | 2009-03-03 19:30:32 -0800 | [diff] [blame] | 972 | include $(BUILD_HOST_EXECUTABLE) |
| 973 | |
Vladimir Chtchetkine | ba1f57f | 2010-07-27 14:14:15 -0700 | [diff] [blame] | 974 | ############################################################################## |
| 975 | # Build standalone emulator core. |
| 976 | # |
| 977 | include $(CLEAR_VARS) |
| 978 | |
Vladimir Chtchetkine | 3f16680 | 2010-08-26 08:25:06 -0700 | [diff] [blame] | 979 | LOCAL_GENERATED_SOURCES := |
Vladimir Chtchetkine | ba1f57f | 2010-07-27 14:14:15 -0700 | [diff] [blame] | 980 | LOCAL_NO_DEFAULT_COMPILER_FLAGS := true |
| 981 | LOCAL_CC := $(MY_CC) |
| 982 | LOCAL_MODULE := qemu-android |
| 983 | LOCAL_STATIC_LIBRARIES := emulator-memcheck emulator-hw emulator-arm emulator-tcg |
| 984 | LOCAL_STATIC_LIBRARIES += emulator-elff |
| 985 | LOCAL_STATIC_LIBRARIES += emulator-core |
| 986 | LOCAL_LDLIBS := $(MY_LDLIBS) |
| 987 | |
| 988 | LOCAL_CFLAGS := $(MY_CFLAGS) $(LOCAL_CFLAGS) $(EMULATOR_CORE_CFLAGS) |
| 989 | LOCAL_CFLAGS += $(UI_AND_CORE_CFLAGS) -DCONFIG_STANDALONE_CORE |
| 990 | |
| 991 | # include sound support source files. we first try to see if we have a prebuilt audio |
| 992 | # library. if not, we build things the "hard" way. |
| 993 | # |
| 994 | # note that to generate the prebuilt audio library, you should do the following: |
| 995 | # |
| 996 | # cd tools/qemu |
| 997 | # ./android-rebuild.sh |
| 998 | # distrib/update-audio.sh |
| 999 | # |
| 1000 | ifeq ($(QEMU_AUDIO_LIB),) |
| 1001 | LOCAL_SRC_FILES += $(AUDIO_SOURCES) |
| 1002 | endif # !QEMU_AUDIO_LIB |
| 1003 | |
| 1004 | LOCAL_CFLAGS += $(AUDIO_CFLAGS) |
| 1005 | LOCAL_LDLIBS += $(AUDIO_LDLIBS) |
| 1006 | |
| 1007 | # the linux-user sources, I doubt we really need these |
| 1008 | # |
| 1009 | #LINUX_SOURCES := main.c elfload.c mmap.c signal.c path.c syscall.c |
| 1010 | #LOCAL_SRC_FILES += $(LINUX_SOURCES:%=linux-user/%) |
| 1011 | |
| 1012 | # include other sources |
| 1013 | # |
| 1014 | VL_SOURCES := framebuffer.c \ |
| 1015 | user-events-qemu.c \ |
| 1016 | |
| 1017 | # Add common system libraries |
| 1018 | # |
| 1019 | LOCAL_LDLIBS += $(QEMU_SYSTEM_LDLIBS) |
| 1020 | |
| 1021 | LOCAL_SRC_FILES += $(VL_SOURCES) $(CORE_SOURCES) $(UI_AND_CORE_SOURCES) |
| 1022 | |
| 1023 | # add ELFF-specific flags |
| 1024 | # |
| 1025 | LOCAL_LDLIBS += $(ELFF_LDLIBS) |
| 1026 | |
| 1027 | # on Windows, link the icon file as well into the executable |
| 1028 | # unfortunately, our build system doesn't help us much, so we need |
| 1029 | # to use some weird pathnames to make this work... |
| 1030 | # |
| 1031 | ifeq ($(HOST_OS),windows) |
| 1032 | |
| 1033 | # Locate windres executable |
| 1034 | WINDRES := windres |
| 1035 | ifneq ($(USE_MINGW),) |
| 1036 | # When building the Windows emulator under Linux, use the MinGW one |
| 1037 | WINDRES := i586-mingw32msvc-windres |
| 1038 | endif |
| 1039 | |
| 1040 | INTERMEDIATE := $(call intermediates-dir-for,EXECUTABLES,$(LOCAL_MODULE),true) |
| 1041 | ANDROID_ICON_OBJ := android_icon.o |
| 1042 | ANDROID_ICON_PATH := $(LOCAL_PATH)/images |
| 1043 | $(ANDROID_ICON_PATH)/$(ANDROID_ICON_OBJ): $(ANDROID_ICON_PATH)/android_icon.rc |
| 1044 | $(WINDRES) $< -I $(ANDROID_ICON_PATH) -o $@ |
| 1045 | |
| 1046 | # seems to be the only way to add an object file that was not generated from |
| 1047 | # a C/C++/Java source file to our build system. and very unfortunately, |
| 1048 | # $(TOPDIR)/$(LOCALPATH) will always be prepended to this value, which forces |
| 1049 | # us to put the object file in the source directory... |
| 1050 | # |
| 1051 | LOCAL_PREBUILT_OBJ_FILES += images/$(ANDROID_ICON_OBJ) |
| 1052 | endif |
| 1053 | |
Vladimir Chtchetkine | 3f16680 | 2010-08-26 08:25:06 -0700 | [diff] [blame] | 1054 | # qemu-options.h is generated from qemu-options.hx with the "hxtool" shell script |
| 1055 | # |
| 1056 | intermediates := $(call intermediates-dir-for,EXECUTABLES,$(LOCAL_MODULE),true) |
| 1057 | |
| 1058 | QEMU_OPTIONS_H := $(intermediates)/qemu-options.h |
| 1059 | $(QEMU_OPTIONS_H): PRIVATE_PATH := $(LOCAL_PATH) |
| 1060 | $(QEMU_OPTIONS_H): PRIVATE_CUSTOM_TOOL = $(PRIVATE_PATH)/hxtool -h < $< > $@ |
| 1061 | $(QEMU_OPTIONS_H): $(LOCAL_PATH)/qemu-options.hx $(LOCAL_PATH)/hxtool |
| 1062 | $(transform-generated-source) |
| 1063 | |
| 1064 | $(intermediates)/vl-android.o: $(QEMU_OPTIONS_H) |
| 1065 | |
| 1066 | LOCAL_GENERATED_SOURCES += $(QEMU_OPTIONS_H) |
| 1067 | |
| 1068 | # qemu-monitor.h is generated from qemu-monitor.hx with the "hxtool" shell script |
| 1069 | # |
| 1070 | intermediates := $(call intermediates-dir-for,EXECUTABLES,$(LOCAL_MODULE),true) |
| 1071 | |
| 1072 | QEMU_MONITOR_H := $(intermediates)/qemu-monitor.h |
| 1073 | $(QEMU_MONITOR_H): PRIVATE_PATH := $(LOCAL_PATH) |
| 1074 | $(QEMU_MONITOR_H): PRIVATE_CUSTOM_TOOL = $(PRIVATE_PATH)/hxtool -h < $< > $@ |
| 1075 | $(QEMU_MONITOR_H): $(LOCAL_PATH)/qemu-monitor.hx $(LOCAL_PATH)/hxtool |
| 1076 | $(transform-generated-source) |
| 1077 | |
| 1078 | $(intermediates)/vl-android.o: $(QEMU_MONITOR_H) |
| 1079 | |
| 1080 | LOCAL_GENERATED_SOURCES += $(QEMU_MONITOR_H) |
| 1081 | |
| 1082 | |
| 1083 | # gdbstub-xml.c contains C-compilable arrays corresponding to the content |
| 1084 | # of $(LOCAL_PATH)/gdb-xml/, and is generated with the 'feature_to_c.sh' script. |
| 1085 | # |
| 1086 | ifeq ($(QEMU_TARGET_XML_SOURCES),) |
| 1087 | QEMU_TARGET_XML_SOURCES := arm-core arm-neon arm-vfp arm-vfp3 |
| 1088 | QEMU_TARGET_XML_SOURCES := $(QEMU_TARGET_XML_SOURCES:%=$(LOCAL_PATH)/gdb-xml/%.xml) |
| 1089 | endif |
| 1090 | |
| 1091 | QEMU_GDBSTUB_XML_C := $(intermediates)/gdbstub-xml.c |
| 1092 | $(QEMU_GDBSTUB_XML_C): PRIVATE_PATH := $(LOCAL_PATH) |
| 1093 | $(QEMU_GDBSTUB_XML_C): PRIVATE_SOURCES := $(TARGET_XML_SOURCES) |
| 1094 | $(QEMU_GDBSTUB_XML_C): PRIVATE_CUSTOM_TOOL = $(PRIVATE_PATH)/feature_to_c.sh $@ $(QEMU_TARGET_XML_SOURCES) |
| 1095 | $(QEMU_GDBSTUB_XML_C): $(QEMU_TARGET_XML_SOURCES) $(LOCAL_PATH)/feature_to_c.sh |
| 1096 | $(hide) rm -f $@ |
| 1097 | $(transform-generated-source) |
| 1098 | |
| 1099 | $(intermediates)/vl-android.o: $(QEMU_GDBSTUB_XML_C) |
| 1100 | |
| 1101 | LOCAL_GENERATED_SOURCES += $(QEMU_GDBSTUB_XML_C) |
| 1102 | |
| 1103 | # hw-config-defs.h is generated from android/avd/hardware-properties.ini |
| 1104 | # |
| 1105 | QEMU_HARDWARE_PROPERTIES_INI := $(LOCAL_PATH)/android/avd/hardware-properties.ini |
| 1106 | QEMU_HW_CONFIG_DEFS_H := $(LOCAL_PATH)/android/avd/hw-config-defs.h |
| 1107 | $(QEMU_HW_CONFIG_DEFS_H): PRIVATE_PATH := $(LOCAL_PATH) |
| 1108 | $(QEMU_HW_CONFIG_DEFS_H): PRIVATE_SOURCES := $(QEMU_HARDWARE_PROPERTIES_INI) |
| 1109 | $(QEMU_HW_CONFIG_DEFS_H): PRIVATE_CUSTOM_TOOL = $(PRIVATE_PATH)/android/tools/gen-hw-config.py $(QEMU_HARDWARE_PROPERTIES_INI) $@ |
| 1110 | $(QEMU_HW_CONFIG_DEFS_H): $(QEMU_HARDWARE_PROPERTIES_INI) $(LOCAL_PATH)/android/tools/gen-hw-config.py |
| 1111 | $(hide) rm -f $@ |
| 1112 | $(transform-generated-source) |
| 1113 | |
| 1114 | $(LOCAL_PATH)/android/avd/hw-config.h: $(QEMU_HW_CONFIG_DEFS_H) |
| 1115 | |
| 1116 | LOCAL_GENERATED_SOURCES += $(QEMU_HW_CONFIG_DEFS_H) |
| 1117 | |
Vladimir Chtchetkine | ba1f57f | 2010-07-27 14:14:15 -0700 | [diff] [blame] | 1118 | # this is already done by the Android build system, but is done for the |
| 1119 | # benefit of the stand-alone one. |
| 1120 | # |
| 1121 | ifeq ($(BUILD_STANDALONE_EMULATOR),true) |
| 1122 | LOCAL_CFLAGS += -I$(intermediates) |
| 1123 | endif |
| 1124 | |
| 1125 | # other flags |
| 1126 | ifneq ($(HOST_OS),windows) |
| 1127 | LOCAL_LDLIBS += -ldl |
| 1128 | endif |
| 1129 | |
| 1130 | LOCAL_LDLIBS += $(QEMU_AUDIO_LIB) |
| 1131 | |
David 'Digit' Turner | 415a4b1 | 2010-07-28 12:20:14 -0700 | [diff] [blame] | 1132 | ifeq ($(HOST_OS),darwin) |
| 1133 | FRAMEWORKS := OpenGL Cocoa QuickTime ApplicationServices Carbon IOKit |
| 1134 | LOCAL_LDLIBS += $(FRAMEWORKS:%=-Wl,-framework,%) |
| 1135 | endif |
| 1136 | |
Vladimir Chtchetkine | ba1f57f | 2010-07-27 14:14:15 -0700 | [diff] [blame] | 1137 | # Generate a completely static executable if needed. |
| 1138 | # Note that this means no sound and graphics on Linux. |
| 1139 | # |
| 1140 | ifeq ($(CONFIG_STATIC_EXECUTABLE),true) |
| 1141 | LOCAL_SRC_FILES += dynlink-static.c |
| 1142 | LOCAL_LDLIBS += -static |
| 1143 | endif |
| 1144 | |
| 1145 | LOCAL_MODULE := qemu-android |
| 1146 | |
| 1147 | include $(BUILD_HOST_EXECUTABLE) |
| 1148 | |
The Android Open Source Project | 8b23a6c | 2009-03-03 19:30:32 -0800 | [diff] [blame] | 1149 | endif # TARGET_ARCH == arm |