Makefile.common revision 9f82bbb7f5463da5ad5b891fc9012ade60eaed0d
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### 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. 31intermediates := $(call intermediates-dir-for,SHARED_LIBRARIES,emulator_hw_config_defs,true) 32 33QEMU_HARDWARE_PROPERTIES_INI := $(LOCAL_PATH)/android/avd/hardware-properties.ini 34QEMU_HW_CONFIG_DEFS_H := $(intermediates)/android/avd/hw-config-defs.h 35$(QEMU_HW_CONFIG_DEFS_H): PRIVATE_PATH := $(LOCAL_PATH) 36$(QEMU_HW_CONFIG_DEFS_H): PRIVATE_CUSTOM_TOOL = $(PRIVATE_PATH)/android/tools/gen-hw-config.py $< $@ 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 41QEMU_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. 45gen-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### 52### emulator-common: LIBRARY OF COMMON FUNCTIONS 53### 54### THESE ARE POTENTIALLY USED BY ALL COMPONENTS 55### 56 57common_LOCAL_CFLAGS = 58common_LOCAL_SRC_FILES = 59 60EMULATOR_COMMON_CFLAGS := 61 62# Needed by everything about the host 63EMULATOR_COMMON_CFLAGS += \ 64 -I$(LOCAL_PATH)/android/config/$(QEMU_HOST_TAG) 65 66# add the build ID to the default macro definitions 67ifeq ($(BUILD_STANDALONE_EMULATOR),) 68EMULATOR_COMMON_CFLAGS += -DANDROID_BUILD_ID="$(strip $(BUILD_ID))-$(strip $(BUILD_NUMBER))" 69endif 70 71# For non-standalone builds, extract the major version number from the Android SDK 72# tools revision number. 73ifneq ($(BUILD_STANDALONE_EMULATOR),true) 74 ANDROID_SDK_TOOLS_REVISION := $(shell awk -F= '/Pkg.Revision/ { print $$2; }' sdk/files/tools_source.properties) 75endif 76 77ANDROID_SDK_TOOLS_REVISION := $(strip $(ANDROID_SDK_TOOLS_REVISION)) 78ifdef ANDROID_SDK_TOOLS_REVISION 79 EMULATOR_COMMON_CFLAGS += -DANDROID_SDK_TOOLS_REVISION=$(ANDROID_SDK_TOOLS_REVISION) 80endif 81 82# Enable large-file support (i.e. make off_t a 64-bit value) 83ifeq ($(HOST_OS),linux) 84EMULATOR_COMMON_CFLAGS += -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE 85endif 86 87 88########################################################### 89# Zlib sources 90# 91ZLIB_DIR := distrib/zlib-1.2.8 92include $(LOCAL_PATH)/$(ZLIB_DIR)/sources.make 93EMULATOR_COMMON_CFLAGS += -I$(LOCAL_PATH)/$(ZLIB_DIR) 94 95common_LOCAL_SRC_FILES += $(ZLIB_SOURCES) 96 97########################################################### 98# GLib sources 99# 100GLIB_DIR := distrib/mini-glib 101include $(LOCAL_PATH)/$(GLIB_DIR)/sources.make 102EMULATOR_COMMON_CFLAGS += -I$(GLIB_INCLUDE_DIR) 103 104common_LOCAL_SRC_FILES += $(GLIB_SOURCES) 105 106########################################################### 107# Android utility functions 108# 109common_LOCAL_SRC_FILES += \ 110 android/async-console.c \ 111 android/async-utils.c \ 112 android/charmap.c \ 113 android/framebuffer.c \ 114 android/iolooper-select.c \ 115 android/keycode-array.c \ 116 android/avd/hw-config.c \ 117 android/avd/info.c \ 118 android/avd/util.c \ 119 android/sockets.c \ 120 android/sync-utils.c \ 121 android/base/containers/PodVector.cpp \ 122 android/base/containers/StringVector.cpp \ 123 android/base/files/PathUtils.cpp \ 124 android/base/Log.cpp \ 125 android/base/String.cpp \ 126 android/base/StringView.cpp \ 127 android/filesystems/ext4_utils.cpp \ 128 android/kernel/kernel_utils.cpp \ 129 android/utils/assert.c \ 130 android/utils/bufprint.c \ 131 android/utils/debug.c \ 132 android/utils/dll.c \ 133 android/utils/dirscanner.c \ 134 android/utils/eintr_wrapper.c \ 135 android/utils/filelock.c \ 136 android/utils/file_data.c \ 137 android/utils/ini.c \ 138 android/utils/intmap.c \ 139 android/utils/lineinput.c \ 140 android/utils/mapfile.c \ 141 android/utils/misc.c \ 142 android/utils/panic.c \ 143 android/utils/path.c \ 144 android/utils/property_file.c \ 145 android/utils/reflist.c \ 146 android/utils/refset.c \ 147 android/utils/stralloc.c \ 148 android/utils/system.c \ 149 android/utils/tempfile.c \ 150 android/utils/vector.c \ 151 android/utils/win32_cmdline_quote.c \ 152 153common_LOCAL_CFLAGS += $(EMULATOR_COMMON_CFLAGS) 154 155 156## one for 32-bit 157$(call start-emulator-library, emulator-common) 158LOCAL_CFLAGS += $(common_LOCAL_CFLAGS) 159LOCAL_SRC_FILES += $(common_LOCAL_SRC_FILES) 160$(call gen-hw-config-defs) 161$(call end-emulator-library) 162 163ifdef EMULATOR_BUILD_64BITS 164 $(call start-emulator-library, emulator64-common) 165 LOCAL_CFLAGS += $(common_LOCAL_CFLAGS) -m64 166 LOCAL_SRC_FILES += $(common_LOCAL_SRC_FILES) 167 $(call gen-hw-config-defs) 168 $(call end-emulator-library) 169endif # EMULATOR_BUILD_64BITS 170 171############################################################################## 172############################################################################## 173### 174### emulator-libui: LIBRARY OF UI-RELATED FUNCTIONS 175### 176### THESE ARE USED BY 'emulator-ui' AND THE STANDALONE PROGRAMS 177### 178 179common_LOCAL_CFLAGS = 180common_LOCAL_SRC_FILES = 181common_LOCAL_CFLAGS += $(EMULATOR_COMMON_CFLAGS) 182 183########################################################### 184# Libpng configuration 185# 186LIBPNG_DIR := distrib/libpng-1.2.46 187include $(LOCAL_PATH)/$(LIBPNG_DIR)/sources.make 188 189EMULATOR_LIBUI_CFLAGS += \ 190 $(LIBPNG_CFLAGS) \ 191 -I$(LOCAL_PATH)/$(LIBPNG_DIR) 192 193common_LOCAL_SRC_FILES += $(LIBPNG_SOURCES) android/loadpng.c 194 195############################################################################## 196# SDL-related definitions 197# 198 199# Build SDL from sources except in certain cases where we use 200# prebuilt libraries instead. 201# 202BUILD_SDL_FROM_SOURCES := true 203 204# On linux-x86, using the prebuilts avoid installing all the X11 205# development packages on our build servers. 206# 207ifeq ($(QEMU_HOST_TAG),linux-x86) 208 BUILD_SDL_FROM_SOURCES := false 209endif 210 211# If we're building with android-configure.sh && make, always build from 212# sources to catch regressions as soon as they happen. 213# 214ifeq ($(BUILD_STANDALONE_EMULATOR),true) 215 BUILD_SDL_FROM_SOURCES := true 216endif 217 218# Except if we used android-configure.sh --sdl-config=<script> 219# 220ifneq ($(QEMU_SDL_CONFIG),) 221 BUILD_SDL_FROM_SOURCES := false 222 SDL_CONFIG := $(QEMU_SDL_CONFIG) 223endif 224 225ifneq ($(BUILD_SDL_FROM_SOURCES),true) 226 227 SDL_CONFIG ?= prebuilts/tools/$(QEMU_HOST_TAG)/sdl/bin/sdl-config 228 SDL_CFLAGS := $(shell $(SDL_CONFIG) --cflags) 229 230 # We need to filter out the _GNU_SOURCE variable because it breaks recent 231 # releases of Cygwin when using the -mno-cygwin option. Moreover, we don't 232 # need this macro at all to build the Android emulator. 233 SDL_CFLAGS := $(filter-out -D_GNU_SOURCE=1,$(SDL_CFLAGS)) 234 SDL_LDLIBS := $(filter-out %.a %.lib,$(shell $(SDL_CONFIG) --static-libs)) 235 236 # Circular dependencies between libSDL and libSDLmain 237 # We repeat the libraries in the final link to work around it 238 SDL_STATIC_LIBRARIES := libSDL libSDLmain libSDL libSDLmain 239 SDL_STATIC_LIBRARIES_64 := lib64SDL lib64SDLmain lib64SDL lib64SDLmain 240 241else # BUILD_SDL_FROM_SOURCES 242 243 SDL_DIR := distrib/sdl-1.2.15 244 include $(LOCAL_PATH)/$(SDL_DIR)/sources.make 245 246 SDL_STATIC_LIBRARIES := emulator_libSDL emulator_libSDLmain emulator_libSDL emulator_libSDLmain 247 SDL_STATIC_LIBRARIES_64 := emulator_lib64SDL emulator_lib64SDLmain emulator_lib64SDL emulator_lib64SDLmain 248 249 EMULATOR_LIBUI_CFLAGS += \ 250 -I$(LOCAL_PATH)/$(SDL_DIR)/include 251 252endif # BUILD_SDL_FROM_SOURCES 253 254EMULATOR_LIBUI_CFLAGS += $(SDL_CFLAGS) 255EMULATOR_LIBUI_LDLIBS += $(SDL_LDLIBS) 256 257# The following is needed by SDL_LoadObject 258ifneq ($(HOST_OS),windows) 259 EMULATOR_LIBUI_LDLIBS += -ldl 260endif 261 262# the skin support sources 263# 264SKIN_SOURCES := rect.c \ 265 region.c \ 266 image.c \ 267 trackball.c \ 268 keyboard.c \ 269 keyset.c \ 270 file.c \ 271 window.c \ 272 scaler.c \ 273 composer.c \ 274 surface.c \ 275 276common_LOCAL_SRC_FILES += $(SKIN_SOURCES:%=android/skin/%) 277 278common_LOCAL_SRC_FILES += \ 279 android/user-config.c \ 280 android/resource.c \ 281 android/qemulator.c \ 282 android/keycode.c \ 283 284# enable MMX code for our skin scaler 285ifeq ($(HOST_ARCH),x86) 286common_LOCAL_CFLAGS += -DUSE_MMX=1 -mmmx 287endif 288 289common_LOCAL_CFLAGS += $(EMULATOR_LIBUI_CFLAGS) 290 291 292## one for 32-bit 293$(call start-emulator-library, emulator-libui) 294LOCAL_CFLAGS += $(common_LOCAL_CFLAGS) 295LOCAL_SRC_FILES += $(common_LOCAL_SRC_FILES) 296$(call gen-hw-config-defs) 297$(call end-emulator-library) 298 299 300ifdef EMULATOR_BUILD_64BITS 301 $(call start-emulator-library, emulator64-libui) 302 LOCAL_CFLAGS += $(common_LOCAL_CFLAGS) -m64 303 LOCAL_SRC_FILES += $(common_LOCAL_SRC_FILES) 304 $(call gen-hw-config-defs) 305 $(call end-emulator-library) 306endif # HOST_OS == linux || darwin 307 308 309############################################################################## 310############################################################################## 311### 312### emulator-libqemu: TARGET-INDEPENDENT QEMU FUNCTIONS 313### 314### THESE ARE USED BY EVERYTHING EXCEPT 'emulator-ui' 315### 316 317common_LOCAL_CFLAGS = 318common_LOCAL_SRC_FILES = 319 320 321EMULATOR_LIBQEMU_CFLAGS := 322 323common_LOCAL_CFLAGS += $(EMULATOR_COMMON_CFLAGS) 324 325AUDIO_SOURCES := noaudio.c wavaudio.c wavcapture.c mixeng.c 326AUDIO_CFLAGS := -I$(LOCAL_PATH)/audio -DHAS_AUDIO 327AUDIO_LDLIBS := 328 329common_LOCAL_CFLAGS += -Wall $(GCC_W_NO_MISSING_FIELD_INITIALIZERS) 330 331ifeq ($(HOST_OS),darwin) 332 CONFIG_COREAUDIO ?= yes 333 AUDIO_CFLAGS += -DHOST_BSD=1 334endif 335 336ifeq ($(HOST_OS),windows) 337 CONFIG_WINAUDIO ?= yes 338endif 339 340ifeq ($(HOST_OS),linux) 341 CONFIG_OSS ?= yes 342 CONFIG_ALSA ?= yes 343 CONFIG_PULSEAUDIO ?= yes 344 CONFIG_ESD ?= yes 345endif 346 347ifeq ($(HOST_OS),freebsd) 348 CONFIG_OSS ?= yes 349endif 350 351ifeq ($(CONFIG_COREAUDIO),yes) 352 AUDIO_SOURCES += coreaudio.c 353 AUDIO_CFLAGS += -DCONFIG_COREAUDIO 354 AUDIO_LDLIBS += -Wl,-framework,CoreAudio 355endif 356 357ifeq ($(CONFIG_WINAUDIO),yes) 358 AUDIO_SOURCES += winaudio.c 359 AUDIO_CFLAGS += -DCONFIG_WINAUDIO 360endif 361 362ifeq ($(CONFIG_PULSEAUDIO),yes) 363 AUDIO_SOURCES += paaudio.c audio_pt_int.c 364 AUDIO_CFLAGS += -DCONFIG_PULSEAUDIO 365endif 366 367ifeq ($(CONFIG_ALSA),yes) 368 AUDIO_SOURCES += alsaaudio.c audio_pt_int.c 369 AUDIO_CFLAGS += -DCONFIG_ALSA 370endif 371 372ifeq ($(CONFIG_ESD),yes) 373 AUDIO_SOURCES += esdaudio.c 374 AUDIO_CFLAGS += -DCONFIG_ESD 375endif 376 377ifeq ($(CONFIG_OSS),yes) 378 AUDIO_SOURCES += ossaudio.c 379 AUDIO_CFLAGS += -DCONFIG_OSS 380endif 381 382AUDIO_SOURCES := $(call sort,$(AUDIO_SOURCES:%=audio/%)) 383 384common_LOCAL_CFLAGS += -Wno-sign-compare \ 385 -fno-strict-aliasing -W -Wall -Wno-unused-parameter \ 386 387# this is very important, otherwise the generated binaries may 388# not link properly on our build servers 389ifeq ($(HOST_OS),linux) 390common_LOCAL_CFLAGS += -fno-stack-protector 391endif 392 393common_LOCAL_SRC_FILES += $(AUDIO_SOURCES) 394common_LOCAL_SRC_FILES += \ 395 android/audio-test.c 396 397# other flags 398ifneq ($(HOST_OS),windows) 399 AUDIO_LDLIBS += -ldl 400else 401endif 402 403 404EMULATOR_LIBQEMU_CFLAGS += $(AUDIO_CFLAGS) 405EMULATOR_LIBQEMU_LDLIBS += $(AUDIO_LDLIBS) 406 407common_LOCAL_CFLAGS += $(GCC_W_NO_MISSING_FIELD_INITIALIZERS) 408 409# misc. sources 410# 411CORE_MISC_SOURCES = \ 412 aio-android.c \ 413 async.c \ 414 iohandler.c \ 415 ioport.c \ 416 migration-dummy-android.c \ 417 qemu-char.c \ 418 qemu-log.c \ 419 savevm.c \ 420 android/boot-properties.c \ 421 android/cbuffer.c \ 422 android/charpipe.c \ 423 android/config-file.c \ 424 android/core-init-utils.c \ 425 android/gps.c \ 426 android/hw-kmsg.c \ 427 android/hw-lcd.c \ 428 android/hw-events.c \ 429 android/hw-control.c \ 430 android/hw-sensors.c \ 431 android/hw-qemud.c \ 432 android/looper-qemu.c \ 433 android/hw-pipe-net.c \ 434 android/qemu-setup.c \ 435 android/qemu-tcpdump.c \ 436 android/shaper.c \ 437 android/snapshot.c \ 438 android/async-socket-connector.c \ 439 android/async-socket.c \ 440 android/sdk-controller-socket.c \ 441 android/sensors-port.c \ 442 android/utils/timezone.c \ 443 android/camera/camera-format-converters.c \ 444 android/camera/camera-service.c \ 445 android/adb-server.c \ 446 android/adb-qemud.c \ 447 android/snaphost-android.c \ 448 android/multitouch-screen.c \ 449 android/multitouch-port.c \ 450 android/utils/jpeg-compress.c \ 451 net/net-android.c \ 452 qobject/qerror.c \ 453 qom/container.c \ 454 qom/object.c \ 455 qom/qom-qobject.c \ 456 ui/console.c \ 457 ui/d3des.c \ 458 ui/input.c \ 459 ui/vnc-android.c \ 460 util/aes.c \ 461 util/cutils.c \ 462 util/error.c \ 463 util/hexdump.c \ 464 util/iov.c \ 465 util/module.c \ 466 util/notify.c \ 467 util/osdep.c \ 468 util/path.c \ 469 util/qemu-config.c \ 470 util/qemu-error.c \ 471 util/qemu-option.c \ 472 util/qemu-sockets-android.c \ 473 util/unicode.c \ 474 util/yield-android.c \ 475 476ifeq ($(HOST_ARCH),x86) 477 CORE_MISC_SOURCES += disas/i386.c 478endif 479ifeq ($(HOST_ARCH),x86_64) 480 CORE_MISC_SOURCES += disas/i386.c 481endif 482ifeq ($(HOST_ARCH),ppc) 483 CORE_MISC_SOURCES += disas/ppc.c \ 484 util/cache-utils.c 485endif 486 487ifeq ($(HOST_OS),linux) 488 CORE_MISC_SOURCES += util/compatfd.c \ 489 util/qemu-thread-posix.c \ 490 android/camera/camera-capture-linux.c 491endif 492 493ifeq ($(HOST_OS),windows) 494 CORE_MISC_SOURCES += tap-win32.c \ 495 android/camera/camera-capture-windows.c \ 496 util/qemu-thread-win32.c 497 498else 499 CORE_MISC_SOURCES += posix-aio-compat.c 500endif 501 502ifeq ($(HOST_OS),darwin) 503 CORE_MISC_SOURCES += android/camera/camera-capture-mac.m \ 504 util/compatfd.c \ 505 util/qemu-thread-posix.c 506endif 507 508common_LOCAL_SRC_FILES += $(CORE_MISC_SOURCES) 509 510# Required 511common_LOCAL_CFLAGS += -D_XOPEN_SOURCE=600 -D_BSD_SOURCE=1 -I$(LOCAL_PATH)/distrib/jpeg-6b 512 513SLIRP_SOURCES := \ 514 bootp.c \ 515 cksum.c \ 516 debug.c \ 517 if.c \ 518 ip_icmp.c \ 519 ip_input.c \ 520 ip_output.c \ 521 mbuf.c \ 522 misc.c \ 523 sbuf.c \ 524 slirp.c \ 525 socket.c \ 526 tcp_input.c \ 527 tcp_output.c \ 528 tcp_subr.c \ 529 tcp_timer.c \ 530 tftp.c \ 531 udp.c 532 533common_LOCAL_SRC_FILES += $(SLIRP_SOURCES:%=slirp-android/%) 534EMULATOR_LIBQEMU_CFLAGS += -I$(LOCAL_PATH)/slirp-android 535 536# socket proxy support 537# 538PROXY_SOURCES := \ 539 proxy_common.c \ 540 proxy_http.c \ 541 proxy_http_connector.c \ 542 proxy_http_rewriter.c \ 543 544common_LOCAL_SRC_FILES += $(PROXY_SOURCES:%=proxy/%) 545EMULATOR_LIBQEMU_CFLAGS += -I$(LOCAL_PATH)/proxy 546 547# include telephony stuff 548# 549TELEPHONY_SOURCES := \ 550 android_modem.c \ 551 modem_driver.c \ 552 gsm.c \ 553 sim_card.c \ 554 sysdeps_qemu.c \ 555 sms.c \ 556 remote_call.c 557 558common_LOCAL_SRC_FILES += $(TELEPHONY_SOURCES:%=telephony/%) 559EMULATOR_LIBQEMU_CFLAGS += -I$(LOCAL_PATH)/telephony 560 561# sources inherited from upstream, but not fully 562# integrated into android emulator 563# 564common_LOCAL_SRC_FILES += \ 565 qobject/json-lexer.c \ 566 qobject/json-parser.c \ 567 qobject/json-streamer.c \ 568 qobject/qjson.c \ 569 qobject/qbool.c \ 570 qobject/qdict.c \ 571 qobject/qfloat.c \ 572 qobject/qint.c \ 573 qobject/qlist.c \ 574 qobject/qstring.c \ 575 576ifeq ($(QEMU_TARGET_XML_SOURCES),) 577 QEMU_TARGET_XML_SOURCES := arm-core arm-neon arm-vfp arm-vfp3 578 QEMU_TARGET_XML_SOURCES := $(QEMU_TARGET_XML_SOURCES:%=$(LOCAL_PATH)/gdb-xml/%.xml) 579endif 580 581common_LOCAL_CFLAGS += $(EMULATOR_LIBQEMU_CFLAGS) 582 583 584## one for 32-bit 585$(call start-emulator-library, emulator-libqemu) 586# gdbstub-xml.c contains C-compilable arrays corresponding to the content 587# of $(LOCAL_PATH)/gdb-xml/, and is generated with the 'feature_to_c.sh' script. 588# 589intermediates = $(call intermediates-dir-for,STATIC_LIBRARIES,$(LOCAL_MODULE),true) 590QEMU_GDBSTUB_XML_C = $(intermediates)/gdbstub-xml.c 591$(QEMU_GDBSTUB_XML_C): PRIVATE_PATH := $(LOCAL_PATH) 592$(QEMU_GDBSTUB_XML_C): PRIVATE_SOURCES := $(TARGET_XML_SOURCES) 593$(QEMU_GDBSTUB_XML_C): PRIVATE_CUSTOM_TOOL = $(PRIVATE_PATH)/feature_to_c.sh $@ $(QEMU_TARGET_XML_SOURCES) 594$(QEMU_GDBSTUB_XML_C): $(QEMU_TARGET_XML_SOURCES) $(LOCAL_PATH)/feature_to_c.sh 595 $(hide) rm -f $@ 596 $(transform-generated-source) 597LOCAL_GENERATED_SOURCES += $(QEMU_GDBSTUB_XML_C) 598LOCAL_CFLAGS += $(common_LOCAL_CFLAGS) -I$(intermediates) 599LOCAL_SRC_FILES += $(common_LOCAL_SRC_FILES) 600$(call gen-hw-config-defs) 601$(call end-emulator-library) 602 603 604## another for 64-bit, see note in emulator64-common 605ifdef EMULATOR_BUILD_64BITS 606 $(call start-emulator-library, emulator64-libqemu) 607 # gdbstub-xml.c contains C-compilable arrays corresponding to the content 608 # of $(LOCAL_PATH)/gdb-xml/, and is generated with the 'feature_to_c.sh' script. 609 # 610 intermediates = $(call intermediates-dir-for,STATIC_LIBRARIES,$(LOCAL_MODULE),true) 611 QEMU_GDBSTUB_XML_C = $(intermediates)/gdbstub-xml.c 612 $(QEMU_GDBSTUB_XML_C): PRIVATE_PATH := $(LOCAL_PATH) 613 $(QEMU_GDBSTUB_XML_C): PRIVATE_SOURCES := $(TARGET_XML_SOURCES) 614 $(QEMU_GDBSTUB_XML_C): PRIVATE_CUSTOM_TOOL = $(PRIVATE_PATH)/feature_to_c.sh $@ $(QEMU_TARGET_XML_SOURCES) 615 $(QEMU_GDBSTUB_XML_C): $(QEMU_TARGET_XML_SOURCES) $(LOCAL_PATH)/feature_to_c.sh 616 $(hide) rm -f $@ 617 $(transform-generated-source) 618 LOCAL_GENERATED_SOURCES += $(QEMU_GDBSTUB_XML_C) 619 LOCAL_CFLAGS += $(common_LOCAL_CFLAGS) -I$(intermediates) -m64 620 LOCAL_SRC_FILES += $(common_LOCAL_SRC_FILES) 621 $(call gen-hw-config-defs) 622 $(call end-emulator-library) 623endif # EMULATOR_BUILD_64BITS 624 625 626# Block sources, we must compile them with each executable because they 627# are only referenced by the rest of the code using constructor functions. 628# If their object files are put in a static library, these are never compiled 629# into the final linked executable that uses them. 630# 631# Normally, one would solve thus using LOCAL_WHOLE_STATIC_LIBRARIES, but 632# the Darwin linker doesn't support -Wl,--whole-archive or equivalent :-( 633# 634BLOCK_SOURCES += \ 635 block.c \ 636 blockdev.c \ 637 block/qcow.c \ 638 block/qcow2.c \ 639 block/qcow2-refcount.c \ 640 block/qcow2-snapshot.c \ 641 block/qcow2-cluster.c \ 642 block/raw.c 643 644ifeq ($(HOST_OS),windows) 645 BLOCK_SOURCES += block/raw-win32.c 646else 647 BLOCK_SOURCES += block/raw-posix.c 648endif 649 650BLOCK_CFLAGS += $(EMULATOR_COMMON_CFLAGS) 651BLOCK_CFLAGS += -DCONFIG_BDRV_WHITELIST=\"\" 652 653############################################################################## 654############################################################################## 655### 656### emulator-libjpeg: TARGET-INDEPENDENT QEMU FUNCTIONS 657### 658### THESE ARE USED BY EVERYTHING EXCEPT 'emulator-ui' 659### 660 661common_LOCAL_CFLAGS = 662common_LOCAL_SRC_FILES = 663 664########################################################### 665# Jpeg configuration 666# 667LIBJPEG_DIR := distrib/jpeg-6b 668include $(LOCAL_PATH)/$(LIBJPEG_DIR)/sources.make 669 670common_LOCAL_SRC_FILES += $(LIBJPEG_SOURCES) 671 672common_LOCAL_CFLAGS += \ 673 $(LIBJPEG_CFLAGS) \ 674 -I$(LOCAL_PATH)/$(LIBJPEG_DIR) 675 676## one for 32-bit 677$(call start-emulator-library, emulator-libjpeg) 678LOCAL_CFLAGS += $(common_LOCAL_CFLAGS) 679LOCAL_SRC_FILES += $(common_LOCAL_SRC_FILES) 680$(call end-emulator-library) 681 682 683## another for 64-bit, see note in emulator64-common 684ifdef EMULATOR_BUILD_64BITS 685 $(call start-emulator-library, emulator64-libjpeg) 686 LOCAL_CFLAGS += $(common_LOCAL_CFLAGS) -m64 687 LOCAL_SRC_FILES += $(common_LOCAL_SRC_FILES) 688 $(call end-emulator-library) 689endif # EMULATOR_BUILD_64BITS 690 691 692############################################################################## 693############################################################################## 694### 695### emulator-libelff: TARGET-INDEPENDENT ELF/DWARF PARSER 696### 697### THESE ARE USED BY EVERYTHING EXCEPT 'emulator-ui', BUT WE CANNOT PUT 698### THEM IN emulator-libqemu SINCE THE SOURCES ARE C++ 699### 700 701common_LOCAL_CFLAGS = 702common_LOCAL_SRC_FILES = 703 704ELFF_CFLAGS := -I$(LOCAL_PATH)/distrib/elff 705ELFF_LDLIBS := -lstdc++ 706 707ELFF_SOURCES := \ 708 dwarf_cu.cc \ 709 dwarf_die.cc \ 710 dwarf_utils.cc \ 711 elf_alloc.cc \ 712 elf_file.cc \ 713 elf_mapped_section.cc \ 714 elff_api.cc \ 715 716common_LOCAL_SRC_FILES += $(ELFF_SOURCES:%=distrib/elff/elff/%) 717 718common_LOCAL_CFLAGS += \ 719 -fno-exceptions \ 720 $(ELFF_CFLAGS) \ 721 722 723## one for 32-bit 724$(call start-emulator-library, emulator-libelff) 725LOCAL_CPP_EXTENSION := .cc 726LOCAL_CFLAGS += $(common_LOCAL_CFLAGS) 727LOCAL_SRC_FILES += $(common_LOCAL_SRC_FILES) 728$(call end-emulator-library) 729 730 731ifdef EMULATOR_BUILD_64BITS 732 $(call start-emulator-library, emulator64-libelff) 733 LOCAL_CPP_EXTENSION := .cc 734 LOCAL_CFLAGS += $(common_LOCAL_CFLAGS) -m64 735 LOCAL_SRC_FILES += $(common_LOCAL_SRC_FILES) 736 $(call end-emulator-library) 737endif # EMULATOR_BUILD_64BITS 738 739 740############################################################################## 741############################################################################## 742### 743### gen-hx-header: Generate headers from .hx file with "hxtool" script. 744### 745### The 'hxtool' script is used to generate header files from an input 746### file with the .hx suffix. I.e. foo.hx --> foo.h 747### 748### Due to the way the Android build system works, we need to regenerate 749### it for each module (the output will go into a module-specific directory). 750### 751### This defines a function that can be used inside a module definition 752### 753### $(call gen-hx-header,<input>,<output>,<source-files>) 754### 755### Where: <input> is the input file, with a .hx suffix (e.g. foo.hx) 756### <output> is the output file, with a .h or .def suffix 757### <source-files> is a list of source files that include the header 758### 759 760 761gen-hx-header = $(eval $(call gen-hx-header-ev,$1,$2,$3)) 762 763define gen-hx-header-ev 764intermediates := $$(call intermediates-dir-for,$$(LOCAL_MODULE_CLASS),$$(LOCAL_MODULE),true) 765 766QEMU_HEADER_H := $$(intermediates)/$$2 767$$(QEMU_HEADER_H): PRIVATE_PATH := $$(LOCAL_PATH) 768$$(QEMU_HEADER_H): PRIVATE_CUSTOM_TOOL = $$(PRIVATE_PATH)/hxtool -h < $$< > $$@ 769$$(QEMU_HEADER_H): $$(LOCAL_PATH)/$$1 $$(LOCAL_PATH)/hxtool 770 $$(transform-generated-source) 771 772LOCAL_GENERATED_SOURCES += $$(QEMU_HEADER_H) 773LOCAL_C_INCLUDES += $$(intermediates) 774endef 775 776