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