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