David 'Digit' Turner | aff94b8 | 2011-02-07 18:10:54 +0100 | [diff] [blame] | 1 | # When building this project, we actually generate several components which |
| 2 | # are the following: |
| 3 | # |
| 4 | # - the emulator-ui program (which is target-agnostic) |
| 5 | # - the target-specific qemu-android-$ARCH programs (headless emulation engines) |
| 6 | # - the "standalone" emulator programs (embed both UI and engine in a single |
| 7 | # binary and process), i.e. "emulator" for ARM and "emulator-x86" for x86. |
| 8 | # |
| 9 | # This file defines static host libraries that will be used by at least two |
| 10 | # of these components. |
| 11 | # |
| 12 | |
| 13 | ############################################################################## |
| 14 | ############################################################################## |
| 15 | ### |
David 'Digit' Turner | 42fc449 | 2011-06-29 13:16:16 +0200 | [diff] [blame] | 16 | ### gen-hw-config-defs: Generate hardware configuration definitions header |
| 17 | ### |
| 18 | ### The 'gen-hw-config.py' script is used to generate the hw-config-defs.h |
| 19 | ### header from the an .ini file like android/avd/hardware-properties.ini |
| 20 | ### |
| 21 | ### Due to the way the Android build system works, we need to regenerate |
| 22 | ### it for each module (the output will go into a module-specific directory). |
| 23 | ### |
| 24 | ### This defines a function that can be used inside a module definition |
| 25 | ### |
| 26 | ### $(call gen-hw-config-defs) |
| 27 | ### |
| 28 | |
| 29 | # First, define a rule to generate a dummy "emulator_hw_config_defs" module |
| 30 | # which purpose is simply to host the generated header in its output directory. |
| 31 | intermediates := $(call intermediates-dir-for,SHARED_LIBRARIES,emulator_hw_config_defs,true) |
| 32 | |
| 33 | QEMU_HARDWARE_PROPERTIES_INI := $(LOCAL_PATH)/android/avd/hardware-properties.ini |
| 34 | QEMU_HW_CONFIG_DEFS_H := $(intermediates)/android/avd/hw-config-defs.h |
| 35 | $(QEMU_HW_CONFIG_DEFS_H): PRIVATE_PATH := $(LOCAL_PATH) |
David 'Digit' Turner | 66241a6 | 2011-07-06 00:31:59 +0200 | [diff] [blame] | 36 | $(QEMU_HW_CONFIG_DEFS_H): PRIVATE_CUSTOM_TOOL = $(PRIVATE_PATH)/android/tools/gen-hw-config.py $< $@ |
David 'Digit' Turner | 42fc449 | 2011-06-29 13:16:16 +0200 | [diff] [blame] | 37 | $(QEMU_HW_CONFIG_DEFS_H): $(QEMU_HARDWARE_PROPERTIES_INI) $(LOCAL_PATH)/android/tools/gen-hw-config.py |
| 38 | $(hide) rm -f $@ |
| 39 | $(transform-generated-source) |
| 40 | |
| 41 | QEMU_HW_CONFIG_DEFS_INCLUDES := $(intermediates) |
| 42 | |
| 43 | # Second, define a function that needs to be called inside each module that contains |
| 44 | # a source file that includes the generated header file. |
| 45 | gen-hw-config-defs = \ |
| 46 | $(eval LOCAL_GENERATED_SOURCES += $(QEMU_HW_CONFIG_DEFS_H))\ |
| 47 | $(eval LOCAL_C_INCLUDES += $(QEMU_HW_CONFIG_DEFS_INCLUDES)) |
| 48 | |
| 49 | ############################################################################## |
| 50 | ############################################################################## |
| 51 | ### |
David 'Digit' Turner | aff94b8 | 2011-02-07 18:10:54 +0100 | [diff] [blame] | 52 | ### emulator-common: LIBRARY OF COMMON FUNCTIONS |
| 53 | ### |
| 54 | ### THESE ARE POTENTIALLY USED BY ALL COMPONENTS |
| 55 | ### |
| 56 | |
| 57 | $(call start-emulator-library, emulator-common) |
| 58 | |
| 59 | EMULATOR_COMMON_CFLAGS := |
| 60 | |
| 61 | # Needed by everything about the host |
| 62 | EMULATOR_COMMON_CFLAGS += \ |
| 63 | -I$(LOCAL_PATH)/android/config/$(QEMU_HOST_TAG) |
| 64 | |
| 65 | # add the build ID to the default macro definitions |
| 66 | ifeq ($(BUILD_STANDALONE_EMULATOR),) |
| 67 | EMULATOR_COMMON_CFLAGS += -DANDROID_BUILD_ID="$(strip $(BUILD_ID))-$(strip $(BUILD_NUMBER))" |
| 68 | endif |
| 69 | |
| 70 | # For non-standalone builds, extract the major version number from the Android SDK |
| 71 | # tools revision number. |
| 72 | ifneq ($(BUILD_STANDALONE_EMULATOR),true) |
| 73 | ANDROID_SDK_TOOLS_REVISION := $(shell awk -F= '/Pkg.Revision/ { print $$2; }' sdk/files/tools_source.properties) |
| 74 | endif |
| 75 | |
| 76 | ANDROID_SDK_TOOLS_REVISION := $(strip $(ANDROID_SDK_TOOLS_REVISION)) |
| 77 | ifdef ANDROID_SDK_TOOLS_REVISION |
| 78 | EMULATOR_COMMON_CFLAGS += -DANDROID_SDK_TOOLS_REVISION=$(ANDROID_SDK_TOOLS_REVISION) |
| 79 | endif |
| 80 | |
| 81 | # Enable large-file support (i.e. make off_t a 64-bit value) |
| 82 | ifeq ($(HOST_OS),linux) |
| 83 | EMULATOR_COMMON_CFLAGS += -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE |
| 84 | endif |
| 85 | |
| 86 | ########################################################### |
| 87 | # Zlib sources |
| 88 | # |
| 89 | ZLIB_DIR := distrib/zlib-1.2.3 |
| 90 | include $(LOCAL_PATH)/$(ZLIB_DIR)/sources.make |
| 91 | EMULATOR_COMMON_CFLAGS += -I$(LOCAL_PATH)/$(ZLIB_DIR) |
| 92 | |
| 93 | LOCAL_SRC_FILES += $(ZLIB_SOURCES) |
| 94 | |
| 95 | ########################################################### |
| 96 | # Android utility functions |
| 97 | # |
| 98 | LOCAL_SRC_FILES += \ |
| 99 | sockets.c \ |
| 100 | iolooper-select.c \ |
| 101 | android/async-console.c \ |
| 102 | android/async-utils.c \ |
| 103 | android/charmap.c \ |
| 104 | android/framebuffer.c \ |
| 105 | android/keycode-array.c \ |
| 106 | android/avd/hw-config.c \ |
| 107 | android/avd/info.c \ |
David 'Digit' Turner | 2d238fd | 2011-03-25 10:34:47 +0100 | [diff] [blame] | 108 | android/avd/util.c \ |
David 'Digit' Turner | aff94b8 | 2011-02-07 18:10:54 +0100 | [diff] [blame] | 109 | android/sync-utils.c \ |
| 110 | android/utils/assert.c \ |
| 111 | android/utils/bufprint.c \ |
| 112 | android/utils/debug.c \ |
David 'Digit' Turner | 816e53c | 2011-08-17 18:33:45 +0200 | [diff] [blame] | 113 | android/utils/dll.c \ |
David 'Digit' Turner | aff94b8 | 2011-02-07 18:10:54 +0100 | [diff] [blame] | 114 | android/utils/dirscanner.c \ |
| 115 | android/utils/filelock.c \ |
| 116 | android/utils/ini.c \ |
David 'Digit' Turner | bbb8104 | 2011-03-17 14:48:44 +0100 | [diff] [blame] | 117 | android/utils/intmap.c \ |
David 'Digit' Turner | 0a879bf | 2011-05-12 18:45:18 +0200 | [diff] [blame] | 118 | android/utils/lineinput.c \ |
David 'Digit' Turner | aff94b8 | 2011-02-07 18:10:54 +0100 | [diff] [blame] | 119 | android/utils/mapfile.c \ |
| 120 | android/utils/misc.c \ |
| 121 | android/utils/panic.c \ |
| 122 | android/utils/path.c \ |
| 123 | android/utils/reflist.c \ |
| 124 | android/utils/refset.c \ |
| 125 | android/utils/stralloc.c \ |
| 126 | android/utils/system.c \ |
| 127 | android/utils/tempfile.c \ |
| 128 | android/utils/vector.c \ |
| 129 | |
David 'Digit' Turner | 42fc449 | 2011-06-29 13:16:16 +0200 | [diff] [blame] | 130 | $(call gen-hw-config-defs) |
| 131 | |
David 'Digit' Turner | aff94b8 | 2011-02-07 18:10:54 +0100 | [diff] [blame] | 132 | LOCAL_CFLAGS += $(EMULATOR_COMMON_CFLAGS) |
| 133 | |
| 134 | $(call end-emulator-library) |
| 135 | |
| 136 | ############################################################################## |
| 137 | ############################################################################## |
| 138 | ### |
| 139 | ### emulator-libui: LIBRARY OF UI-RELATED FUNCTIONS |
| 140 | ### |
| 141 | ### THESE ARE USED BY 'emulator-ui' AND THE STANDALONE PROGRAMS |
| 142 | ### |
| 143 | |
| 144 | $(call start-emulator-library, emulator-libui) |
| 145 | |
| 146 | EMULATOR_LIBUI_CFLAGS := |
| 147 | |
| 148 | LOCAL_CFLAGS += $(EMULATOR_COMMON_CFLAGS) |
| 149 | |
| 150 | ########################################################### |
| 151 | # Libpng configuration |
| 152 | # |
| 153 | LIBPNG_DIR := distrib/libpng-1.2.19 |
| 154 | include $(LOCAL_PATH)/$(LIBPNG_DIR)/sources.make |
| 155 | |
| 156 | EMULATOR_LIBUI_CFLAGS += \ |
| 157 | $(LIBPNG_CFLAGS) \ |
| 158 | -I$(LOCAL_PATH)/$(LIBPNG_DIR) |
| 159 | |
| 160 | LOCAL_SRC_FILES += $(LIBPNG_SOURCES) loadpng.c |
| 161 | |
| 162 | ############################################################################## |
| 163 | # SDL-related definitions |
| 164 | # |
| 165 | |
| 166 | # Build SDL from sources except in certain cases where we use |
| 167 | # prebuilt libraries instead. |
| 168 | # |
| 169 | BUILD_SDL_FROM_SOURCES := true |
| 170 | |
| 171 | # On linux-x86, using the prebuilts avoid installing all the X11 |
| 172 | # development packages on our build servers. |
| 173 | # |
| 174 | ifeq ($(QEMU_HOST_TAG),linux-x86) |
| 175 | BUILD_SDL_FROM_SOURCES := false |
| 176 | endif |
| 177 | |
| 178 | # On darwin-x86, a bug in the Android build system prevents the compilation |
| 179 | # of Objective-C sources. Fixed recently in AOSP, but we still use the |
| 180 | # prebuilts for the benefit of older platform branches. |
| 181 | # |
| 182 | ifeq ($(QEMU_HOST_TAG),darwin-x86) |
| 183 | BUILD_SDL_FROM_SOURCES := false |
| 184 | endif |
| 185 | |
| 186 | # If we're building with android-configure.sh && make, always build from |
| 187 | # sources to catch regressions as soon as they happen. |
| 188 | # |
| 189 | ifeq ($(BUILD_STANDALONE_EMULATOR),true) |
| 190 | BUILD_SDL_FROM_SOURCES := true |
| 191 | endif |
| 192 | |
| 193 | # Except if we used android-configure.sh --sdl-config=<script> |
| 194 | # |
David 'Digit' Turner | a402668 | 2011-08-24 12:54:01 +0200 | [diff] [blame] | 195 | ifneq ($(QEMU_SDL_CONFIG),) |
David 'Digit' Turner | aff94b8 | 2011-02-07 18:10:54 +0100 | [diff] [blame] | 196 | BUILD_SDL_FROM_SOURCES := false |
David 'Digit' Turner | a402668 | 2011-08-24 12:54:01 +0200 | [diff] [blame] | 197 | SDL_CONFIG := $(QEMU_SDL_CONFIG) |
David 'Digit' Turner | aff94b8 | 2011-02-07 18:10:54 +0100 | [diff] [blame] | 198 | endif |
| 199 | |
| 200 | ifneq ($(BUILD_SDL_FROM_SOURCES),true) |
| 201 | |
| 202 | SDL_CONFIG ?= prebuilt/$(QEMU_HOST_TAG)/sdl/bin/sdl-config |
| 203 | SDL_CFLAGS := $(shell $(SDL_CONFIG) --cflags) |
| 204 | |
| 205 | # We need to filter out the _GNU_SOURCE variable because it breaks recent |
| 206 | # releases of Cygwin when using the -mno-cygwin option. Moreover, we don't |
| 207 | # need this macro at all to build the Android emulator. |
| 208 | SDL_CFLAGS := $(filter-out -D_GNU_SOURCE=1,$(SDL_CFLAGS)) |
| 209 | SDL_LDLIBS := $(filter-out %.a %.lib,$(shell $(SDL_CONFIG) --static-libs)) |
| 210 | |
| 211 | # Circular dependencies between libSDL and libSDLmain |
| 212 | # We repeat the libraries in the final link to work around it |
| 213 | SDL_STATIC_LIBRARIES := libSDL libSDLmain libSDL libSDLmain |
| 214 | |
| 215 | else # BUILD_SDL_FROM_SOURCES |
| 216 | |
| 217 | SDL_DIR := distrib/sdl-1.2.12 |
| 218 | include $(LOCAL_PATH)/$(SDL_DIR)/sources.make |
| 219 | LOCAL_SRC_FILES += $(SDL_SOURCES) |
| 220 | |
| 221 | EMULATOR_LIBUI_CFLAGS += \ |
| 222 | -I$(LOCAL_PATH)/$(SDL_DIR)/include |
| 223 | |
| 224 | SDL_STATIC_LIBRARIES := |
| 225 | |
| 226 | endif # BUILD_SDL_FROM_SOURCES |
| 227 | |
| 228 | EMULATOR_LIBUI_CFLAGS += $(SDL_CFLAGS) |
| 229 | EMULATOR_LIBUI_LDLIBS += $(SDL_LDLIBS) |
| 230 | |
| 231 | # The following is needed by SDL_LoadObject |
| 232 | ifneq ($(HOST_OS),windows) |
| 233 | EMULATOR_LIBUI_LDLIBS += -ldl |
| 234 | endif |
| 235 | |
| 236 | # the skin support sources |
| 237 | # |
| 238 | SKIN_SOURCES := rect.c \ |
| 239 | region.c \ |
| 240 | image.c \ |
| 241 | trackball.c \ |
| 242 | keyboard.c \ |
| 243 | keyset.c \ |
| 244 | file.c \ |
| 245 | window.c \ |
| 246 | scaler.c \ |
| 247 | composer.c \ |
| 248 | surface.c \ |
| 249 | |
| 250 | LOCAL_SRC_FILES += $(SKIN_SOURCES:%=android/skin/%) |
| 251 | |
| 252 | LOCAL_SRC_FILES += \ |
| 253 | android/user-config.c \ |
| 254 | android/resource.c \ |
| 255 | android/qemulator.c \ |
| 256 | android/keycode.c \ |
| 257 | |
David 'Digit' Turner | 42fc449 | 2011-06-29 13:16:16 +0200 | [diff] [blame] | 258 | $(call gen-hw-config-defs) |
| 259 | |
David 'Digit' Turner | aff94b8 | 2011-02-07 18:10:54 +0100 | [diff] [blame] | 260 | # enable MMX code for our skin scaler |
| 261 | ifeq ($(HOST_ARCH),x86) |
| 262 | LOCAL_CFLAGS += -DUSE_MMX=1 -mmmx |
| 263 | endif |
| 264 | |
| 265 | LOCAL_CFLAGS += $(EMULATOR_LIBUI_CFLAGS) |
| 266 | |
| 267 | $(call end-emulator-library) |
| 268 | |
| 269 | ############################################################################## |
| 270 | ############################################################################## |
| 271 | ### |
| 272 | ### emulator-libqemu: TARGET-INDEPENDENT QEMU FUNCTIONS |
| 273 | ### |
| 274 | ### THESE ARE USED BY EVERYTHING EXCEPT 'emulator-ui' |
| 275 | ### |
| 276 | |
| 277 | $(call start-emulator-library, emulator-libqemu) |
| 278 | |
| 279 | EMULATOR_LIBQEMU_CFLAGS := |
| 280 | |
| 281 | LOCAL_CFLAGS += $(EMULATOR_COMMON_CFLAGS) |
| 282 | |
| 283 | AUDIO_SOURCES := noaudio.c wavaudio.c wavcapture.c mixeng.c |
| 284 | AUDIO_CFLAGS := -I$(LOCAL_PATH)/audio -DHAS_AUDIO |
| 285 | AUDIO_LDLIBS := |
| 286 | |
| 287 | LOCAL_CFLAGS += -Wall -Wno-missing-field-initializers |
| 288 | |
| 289 | ifeq ($(HOST_OS),darwin) |
| 290 | CONFIG_COREAUDIO ?= yes |
| 291 | AUDIO_CFLAGS += -DHOST_BSD=1 |
| 292 | endif |
| 293 | |
| 294 | ifeq ($(HOST_OS),windows) |
| 295 | CONFIG_WINAUDIO ?= yes |
| 296 | endif |
| 297 | |
| 298 | ifeq ($(HOST_OS),linux) |
| 299 | CONFIG_OSS ?= yes |
| 300 | CONFIG_ALSA ?= yes |
| 301 | CONFIG_PULSEAUDIO ?= yes |
| 302 | CONFIG_ESD ?= yes |
| 303 | endif |
| 304 | |
| 305 | ifeq ($(HOST_OS),freebsd) |
| 306 | CONFIG_OSS ?= yes |
| 307 | endif |
| 308 | |
| 309 | ifeq ($(CONFIG_COREAUDIO),yes) |
| 310 | AUDIO_SOURCES += coreaudio.c |
| 311 | AUDIO_CFLAGS += -DCONFIG_COREAUDIO |
| 312 | AUDIO_LDLIBS += -Wl,-framework,CoreAudio |
| 313 | endif |
| 314 | |
| 315 | ifeq ($(CONFIG_WINAUDIO),yes) |
| 316 | AUDIO_SOURCES += winaudio.c |
| 317 | AUDIO_CFLAGS += -DCONFIG_WINAUDIO |
| 318 | endif |
| 319 | |
| 320 | ifeq ($(CONFIG_PULSEAUDIO),yes) |
| 321 | AUDIO_SOURCES += paaudio.c audio_pt_int.c |
| 322 | AUDIO_CFLAGS += -DCONFIG_PULSEAUDIO |
| 323 | endif |
| 324 | |
| 325 | ifeq ($(CONFIG_ALSA),yes) |
| 326 | AUDIO_SOURCES += alsaaudio.c audio_pt_int.c |
| 327 | AUDIO_CFLAGS += -DCONFIG_ALSA |
| 328 | endif |
| 329 | |
| 330 | ifeq ($(CONFIG_ESD),yes) |
| 331 | AUDIO_SOURCES += esdaudio.c |
| 332 | AUDIO_CFLAGS += -DCONFIG_ESD |
| 333 | endif |
| 334 | |
| 335 | ifeq ($(CONFIG_OSS),yes) |
| 336 | AUDIO_SOURCES += ossaudio.c |
| 337 | AUDIO_CFLAGS += -DCONFIG_OSS |
| 338 | endif |
| 339 | |
| 340 | AUDIO_SOURCES := $(call sort,$(AUDIO_SOURCES:%=audio/%)) |
| 341 | |
| 342 | LOCAL_CFLAGS += -Wno-sign-compare \ |
| 343 | -fno-strict-aliasing -W -Wall -Wno-unused-parameter \ |
| 344 | |
| 345 | # this is very important, otherwise the generated binaries may |
| 346 | # not link properly on our build servers |
| 347 | ifeq ($(HOST_OS),linux) |
| 348 | LOCAL_CFLAGS += -fno-stack-protector |
| 349 | endif |
| 350 | |
| 351 | LOCAL_SRC_FILES += $(AUDIO_SOURCES) |
| 352 | LOCAL_SRC_FILES += \ |
| 353 | android/audio-test.c |
| 354 | |
| 355 | # other flags |
| 356 | ifneq ($(HOST_OS),windows) |
| 357 | AUDIO_LDLIBS += -ldl |
| 358 | else |
| 359 | endif |
| 360 | |
| 361 | |
| 362 | EMULATOR_LIBQEMU_CFLAGS += $(AUDIO_CFLAGS) |
| 363 | EMULATOR_LIBQEMU_LDLIBS += $(AUDIO_LDLIBS) |
| 364 | |
| 365 | LOCAL_CFLAGS += -Wno-missing-field-initializers |
| 366 | |
| 367 | # migration sources |
| 368 | # |
| 369 | ifeq ($(HOST_OS),windows) |
| 370 | LOCAL_SRC_FILES += migration-dummy-android.c |
| 371 | else |
| 372 | LOCAL_SRC_FILES += migration.c \ |
| 373 | migration-exec.c \ |
| 374 | migration-tcp-android.c |
| 375 | endif |
| 376 | |
| 377 | # misc. sources |
| 378 | # |
| 379 | CORE_MISC_SOURCES = \ |
| 380 | acl.c \ |
| 381 | aes.c \ |
| 382 | aio-android.c \ |
| 383 | async.c \ |
| 384 | bt-host.c \ |
| 385 | bt-vhci.c \ |
| 386 | buffered_file.c \ |
| 387 | cbuffer.c \ |
| 388 | charpipe.c \ |
| 389 | console.c \ |
| 390 | cutils.c \ |
| 391 | d3des.c \ |
| 392 | input.c \ |
David 'Digit' Turner | 8354d2d | 2011-05-11 00:19:06 +0200 | [diff] [blame] | 393 | iohandler.c \ |
David 'Digit' Turner | aff94b8 | 2011-02-07 18:10:54 +0100 | [diff] [blame] | 394 | ioport.c \ |
| 395 | module.c \ |
| 396 | net-android.c \ |
| 397 | notify.c \ |
| 398 | osdep.c \ |
David 'Digit' Turner | aff94b8 | 2011-02-07 18:10:54 +0100 | [diff] [blame] | 399 | path.c \ |
David 'Digit' Turner | 3b2846a | 2011-05-11 01:34:40 +0200 | [diff] [blame] | 400 | qemu-char.c \ |
David 'Digit' Turner | aff94b8 | 2011-02-07 18:10:54 +0100 | [diff] [blame] | 401 | qemu-config.c \ |
| 402 | qemu-error.c \ |
| 403 | qemu-malloc.c \ |
| 404 | qemu-option.c \ |
| 405 | qemu-sockets-android.c \ |
| 406 | qerror.c \ |
| 407 | readline.c \ |
| 408 | savevm.c \ |
| 409 | shaper.c \ |
| 410 | tcpdump.c \ |
| 411 | vnc-android.c \ |
| 412 | android/boot-properties.c \ |
| 413 | android/config.c \ |
| 414 | android/core-init-utils.c \ |
| 415 | android/gps.c \ |
| 416 | android/hw-kmsg.c \ |
| 417 | android/hw-lcd.c \ |
| 418 | android/hw-events.c \ |
| 419 | android/hw-control.c \ |
| 420 | android/hw-sensors.c \ |
| 421 | android/hw-qemud.c \ |
David 'Digit' Turner | aff94b8 | 2011-02-07 18:10:54 +0100 | [diff] [blame] | 422 | android/looper-qemu.c \ |
David 'Digit' Turner | c0ac733 | 2011-05-02 15:05:35 +0200 | [diff] [blame] | 423 | android/hw-pipe-net.c \ |
David 'Digit' Turner | aff94b8 | 2011-02-07 18:10:54 +0100 | [diff] [blame] | 424 | android/qemu-setup.c \ |
| 425 | android/snapshot.c \ |
Vladimir Chtchetkine | db611d5 | 2011-11-01 17:35:07 -0700 | [diff] [blame] | 426 | android/android-device.c \ |
| 427 | android/sensors-port.c \ |
David 'Digit' Turner | aff94b8 | 2011-02-07 18:10:54 +0100 | [diff] [blame] | 428 | android/utils/timezone.c \ |
Vladimir Chtchetkine | c646f5e | 2011-09-03 15:17:13 -0700 | [diff] [blame] | 429 | android/camera/camera-format-converters.c \ |
Vladimir Chtchetkine | d86c724 | 2011-12-09 15:45:46 -0800 | [diff] [blame^] | 430 | android/camera/camera-service.c \ |
| 431 | android/adb-server.c \ |
| 432 | android/adb-qemud.c |
David 'Digit' Turner | aff94b8 | 2011-02-07 18:10:54 +0100 | [diff] [blame] | 433 | |
David 'Digit' Turner | 42fc449 | 2011-06-29 13:16:16 +0200 | [diff] [blame] | 434 | $(call gen-hw-config-defs) |
| 435 | |
David 'Digit' Turner | aff94b8 | 2011-02-07 18:10:54 +0100 | [diff] [blame] | 436 | ifeq ($(HOST_ARCH),x86) |
| 437 | CORE_MISC_SOURCES += i386-dis.c |
| 438 | endif |
| 439 | ifeq ($(HOST_ARCH),x86_64) |
| 440 | CORE_MISC_SOURCES += i386-dis.c |
| 441 | endif |
| 442 | ifeq ($(HOST_ARCH),ppc) |
| 443 | CORE_MISC_SOURCES += ppc-dis.c \ |
| 444 | cache-utils.c |
| 445 | endif |
| 446 | |
| 447 | ifeq ($(HOST_OS),linux) |
| 448 | CORE_MISC_SOURCES += usb-linux.c \ |
Vladimir Chtchetkine | 4ed09fd | 2011-08-18 09:42:40 -0700 | [diff] [blame] | 449 | qemu-thread.c \ |
| 450 | android/camera/camera-capture-linux.c |
David 'Digit' Turner | aff94b8 | 2011-02-07 18:10:54 +0100 | [diff] [blame] | 451 | else |
| 452 | CORE_MISC_SOURCES += usb-dummy-android.c |
| 453 | endif |
| 454 | |
| 455 | ifeq ($(HOST_OS),windows) |
Vladimir Chtchetkine | 4ed09fd | 2011-08-18 09:42:40 -0700 | [diff] [blame] | 456 | CORE_MISC_SOURCES += tap-win32.c \ |
| 457 | android/camera/camera-capture-windows.c |
| 458 | |
David 'Digit' Turner | aff94b8 | 2011-02-07 18:10:54 +0100 | [diff] [blame] | 459 | else |
| 460 | CORE_MISC_SOURCES += posix-aio-compat.c |
| 461 | endif |
| 462 | |
Vladimir Chtchetkine | b92b303 | 2011-09-12 15:29:32 -0700 | [diff] [blame] | 463 | ifeq ($(HOST_OS),darwin) |
Vladimir Chtchetkine | 955a997 | 2011-10-12 15:40:17 -0700 | [diff] [blame] | 464 | CORE_MISC_SOURCES += android/camera/camera-capture-mac.m |
Vladimir Chtchetkine | b92b303 | 2011-09-12 15:29:32 -0700 | [diff] [blame] | 465 | endif |
| 466 | |
David 'Digit' Turner | aff94b8 | 2011-02-07 18:10:54 +0100 | [diff] [blame] | 467 | LOCAL_SRC_FILES += $(CORE_MISC_SOURCES) |
| 468 | |
| 469 | # Required |
| 470 | LOCAL_CFLAGS += -D_XOPEN_SOURCE=600 -D_BSD_SOURCE=1 |
| 471 | |
| 472 | SLIRP_SOURCES := \ |
| 473 | bootp.c \ |
| 474 | cksum.c \ |
| 475 | debug.c \ |
| 476 | if.c \ |
| 477 | ip_icmp.c \ |
| 478 | ip_input.c \ |
| 479 | ip_output.c \ |
| 480 | mbuf.c \ |
| 481 | misc.c \ |
| 482 | sbuf.c \ |
| 483 | slirp.c \ |
| 484 | socket.c \ |
| 485 | tcp_input.c \ |
| 486 | tcp_output.c \ |
| 487 | tcp_subr.c \ |
| 488 | tcp_timer.c \ |
| 489 | tftp.c \ |
| 490 | udp.c |
| 491 | |
| 492 | LOCAL_SRC_FILES += $(SLIRP_SOURCES:%=slirp-android/%) |
| 493 | EMULATOR_LIBQEMU_CFLAGS += -I$(LOCAL_PATH)/slirp-android |
| 494 | |
| 495 | # socket proxy support |
| 496 | # |
| 497 | PROXY_SOURCES := \ |
| 498 | proxy_common.c \ |
| 499 | proxy_http.c \ |
| 500 | proxy_http_connector.c \ |
| 501 | proxy_http_rewriter.c \ |
| 502 | |
| 503 | LOCAL_SRC_FILES += $(PROXY_SOURCES:%=proxy/%) |
| 504 | EMULATOR_LIBQEMU_CFLAGS += -I$(LOCAL_PATH)/proxy |
| 505 | |
| 506 | # include telephony stuff |
| 507 | # |
| 508 | TELEPHONY_SOURCES := \ |
| 509 | android_modem.c \ |
| 510 | modem_driver.c \ |
| 511 | gsm.c \ |
| 512 | sim_card.c \ |
| 513 | sysdeps_qemu.c \ |
| 514 | sms.c \ |
| 515 | remote_call.c |
| 516 | |
| 517 | LOCAL_SRC_FILES += $(TELEPHONY_SOURCES:%=telephony/%) |
| 518 | EMULATOR_LIBQEMU_CFLAGS += -I$(LOCAL_PATH)/telephony |
| 519 | |
| 520 | # sources inherited from upstream, but not fully |
| 521 | # integrated into android emulator |
| 522 | # |
| 523 | LOCAL_SRC_FILES += \ |
| 524 | json-lexer.c \ |
| 525 | json-parser.c \ |
| 526 | json-streamer.c \ |
| 527 | qjson.c \ |
| 528 | qbool.c \ |
| 529 | qdict.c \ |
| 530 | qfloat.c \ |
| 531 | qint.c \ |
| 532 | qlist.c \ |
| 533 | qstring.c \ |
| 534 | |
David 'Digit' Turner | aff94b8 | 2011-02-07 18:10:54 +0100 | [diff] [blame] | 535 | # gdbstub-xml.c contains C-compilable arrays corresponding to the content |
| 536 | # of $(LOCAL_PATH)/gdb-xml/, and is generated with the 'feature_to_c.sh' script. |
| 537 | # |
| 538 | intermediates := $(call intermediates-dir-for,STATIC_LIBRARIES,$(LOCAL_MODULE),true) |
| 539 | |
| 540 | ifeq ($(QEMU_TARGET_XML_SOURCES),) |
| 541 | QEMU_TARGET_XML_SOURCES := arm-core arm-neon arm-vfp arm-vfp3 |
| 542 | QEMU_TARGET_XML_SOURCES := $(QEMU_TARGET_XML_SOURCES:%=$(LOCAL_PATH)/gdb-xml/%.xml) |
| 543 | endif |
| 544 | |
| 545 | QEMU_GDBSTUB_XML_C := $(intermediates)/gdbstub-xml.c |
| 546 | $(QEMU_GDBSTUB_XML_C): PRIVATE_PATH := $(LOCAL_PATH) |
| 547 | $(QEMU_GDBSTUB_XML_C): PRIVATE_SOURCES := $(TARGET_XML_SOURCES) |
| 548 | $(QEMU_GDBSTUB_XML_C): PRIVATE_CUSTOM_TOOL = $(PRIVATE_PATH)/feature_to_c.sh $@ $(QEMU_TARGET_XML_SOURCES) |
| 549 | $(QEMU_GDBSTUB_XML_C): $(QEMU_TARGET_XML_SOURCES) $(LOCAL_PATH)/feature_to_c.sh |
| 550 | $(hide) rm -f $@ |
| 551 | $(transform-generated-source) |
| 552 | |
| 553 | LOCAL_GENERATED_SOURCES += $(QEMU_GDBSTUB_XML_C) |
| 554 | |
| 555 | EMULATOR_LIBQEMU_CFLAGS += -I$(intermediates) |
| 556 | |
| 557 | LOCAL_CFLAGS += $(EMULATOR_LIBQEMU_CFLAGS) |
| 558 | |
| 559 | $(call end-emulator-library) |
| 560 | |
| 561 | # Block sources, we must compile them with each executable because they |
| 562 | # are only referenced by the rest of the code using constructor functions. |
| 563 | # If their object files are put in a static library, these are never compiled |
| 564 | # into the final linked executable that uses them. |
| 565 | # |
| 566 | # Normally, one would solve thus using LOCAL_WHOLE_STATIC_LIBRARIES, but |
| 567 | # the Darwin linker doesn't support -Wl,--whole-archive or equivalent :-( |
| 568 | # |
| 569 | BLOCK_SOURCES += \ |
| 570 | block.c \ |
| 571 | blockdev.c \ |
| 572 | block/qcow.c \ |
| 573 | block/qcow2.c \ |
| 574 | block/qcow2-refcount.c \ |
| 575 | block/qcow2-snapshot.c \ |
| 576 | block/qcow2-cluster.c \ |
| 577 | block/cloop.c \ |
| 578 | block/dmg.c \ |
| 579 | block/vvfat.c \ |
| 580 | block/raw.c |
| 581 | |
| 582 | ifeq ($(HOST_OS),windows) |
| 583 | BLOCK_SOURCES += block/raw-win32.c |
| 584 | else |
| 585 | BLOCK_SOURCES += block/raw-posix.c |
| 586 | endif |
| 587 | |
| 588 | BLOCK_CFLAGS += $(EMULATOR_COMMON_CFLAGS) |
| 589 | BLOCK_CFLAGS += -DCONFIG_BDRV_WHITELIST="" |
| 590 | |
| 591 | |
| 592 | ############################################################################## |
| 593 | ############################################################################## |
| 594 | ### |
| 595 | ### emulator-libelff: TARGET-INDEPENDENT ELF/DWARD PARSER |
| 596 | ### |
| 597 | ### THESE ARE USED BY EVERYTHING EXCEPT 'emulator-ui', BUT WE CANNOT PUT |
| 598 | ### THEM IN emulator-libqemu SINCE THE SOURCES ARE C++ |
| 599 | ### |
| 600 | |
| 601 | $(call start-emulator-library, emulator-libelff) |
| 602 | |
| 603 | LOCAL_CPP_EXTENSION := .cc |
| 604 | |
| 605 | ELFF_CFLAGS := -I$(LOCAL_PATH)/elff |
| 606 | ELFF_LDLIBS := -lstdc++ |
| 607 | |
| 608 | ELFF_SOURCES := \ |
| 609 | dwarf_cu.cc \ |
| 610 | dwarf_die.cc \ |
| 611 | dwarf_utils.cc \ |
| 612 | elf_alloc.cc \ |
| 613 | elf_file.cc \ |
| 614 | elf_mapped_section.cc \ |
| 615 | elff_api.cc \ |
| 616 | |
| 617 | LOCAL_SRC_FILES += $(ELFF_SOURCES:%=elff/%) |
| 618 | |
| 619 | LOCAL_CFLAGS += \ |
| 620 | -fno-exceptions \ |
| 621 | $(ELFF_CFLAGS) \ |
| 622 | |
| 623 | $(call end-emulator-library) |
| 624 | |
| 625 | |
| 626 | ############################################################################## |
| 627 | ############################################################################## |
| 628 | ### |
| 629 | ### gen-hx-header: Generate headers from .hx file with "hxtool" script. |
| 630 | ### |
| 631 | ### The 'hxtool' script is used to generate header files from an input |
| 632 | ### file with the .hx suffix. I.e. foo.hx --> foo.h |
| 633 | ### |
| 634 | ### Due to the way the Android build system works, we need to regenerate |
| 635 | ### it for each module (the output will go into a module-specific directory). |
| 636 | ### |
| 637 | ### This defines a function that can be used inside a module definition |
| 638 | ### |
David 'Digit' Turner | 088edf8 | 2011-05-09 15:59:28 +0200 | [diff] [blame] | 639 | ### $(call gen-hx-header,<input>,<output>,<source-files>) |
David 'Digit' Turner | aff94b8 | 2011-02-07 18:10:54 +0100 | [diff] [blame] | 640 | ### |
| 641 | ### Where: <input> is the input file, with a .hx suffix (e.g. foo.hx) |
David 'Digit' Turner | 088edf8 | 2011-05-09 15:59:28 +0200 | [diff] [blame] | 642 | ### <output> is the output file, with a .h or .def suffix |
David 'Digit' Turner | aff94b8 | 2011-02-07 18:10:54 +0100 | [diff] [blame] | 643 | ### <source-files> is a list of source files that include the header |
| 644 | ### |
| 645 | |
| 646 | |
| 647 | gen-hx-header = $(eval $(call gen-hx-header-ev,$1,$2,$3)) |
| 648 | |
| 649 | define gen-hx-header-ev |
David 'Digit' Turner | 42fc449 | 2011-06-29 13:16:16 +0200 | [diff] [blame] | 650 | intermediates := $$(call intermediates-dir-for,$$(LOCAL_MODULE_CLASS),$$(LOCAL_MODULE),true) |
David 'Digit' Turner | 317c9d5 | 2011-05-10 06:38:21 +0200 | [diff] [blame] | 651 | |
David 'Digit' Turner | 088edf8 | 2011-05-09 15:59:28 +0200 | [diff] [blame] | 652 | QEMU_HEADER_H := $$(intermediates)/$$2 |
David 'Digit' Turner | aff94b8 | 2011-02-07 18:10:54 +0100 | [diff] [blame] | 653 | $$(QEMU_HEADER_H): PRIVATE_PATH := $$(LOCAL_PATH) |
| 654 | $$(QEMU_HEADER_H): PRIVATE_CUSTOM_TOOL = $$(PRIVATE_PATH)/hxtool -h < $$< > $$@ |
| 655 | $$(QEMU_HEADER_H): $$(LOCAL_PATH)/$$1 $$(LOCAL_PATH)/hxtool |
| 656 | $$(transform-generated-source) |
| 657 | |
| 658 | LOCAL_GENERATED_SOURCES += $$(QEMU_HEADER_H) |
David 'Digit' Turner | 088edf8 | 2011-05-09 15:59:28 +0200 | [diff] [blame] | 659 | LOCAL_C_INCLUDES += $$(intermediates) |
David 'Digit' Turner | aff94b8 | 2011-02-07 18:10:54 +0100 | [diff] [blame] | 660 | endef |
| 661 | |