# When building this project, we actually generate several components which # are the following: # # - the emulator-ui program (which is target-agnostic) # - the target-specific qemu-android-$ARCH programs (headless emulation engines) # - the "standalone" emulator programs (embed both UI and engine in a single # binary and process), i.e. "emulator" for ARM and "emulator-x86" for x86. # # This file defines static host libraries that will be used by at least two # of these components. # ############################################################################## ############################################################################## ### ### gen-hw-config-defs: Generate hardware configuration definitions header ### ### The 'gen-hw-config.py' script is used to generate the hw-config-defs.h ### header from the an .ini file like android/avd/hardware-properties.ini ### ### Due to the way the Android build system works, we need to regenerate ### it for each module (the output will go into a module-specific directory). ### ### This defines a function that can be used inside a module definition ### ### $(call gen-hw-config-defs) ### # First, define a rule to generate a dummy "emulator_hw_config_defs" module # which purpose is simply to host the generated header in its output directory. intermediates := $(call intermediates-dir-for,SHARED_LIBRARIES,emulator_hw_config_defs,true) QEMU_HARDWARE_PROPERTIES_INI := $(LOCAL_PATH)/android/avd/hardware-properties.ini QEMU_HW_CONFIG_DEFS_H := $(intermediates)/android/avd/hw-config-defs.h $(QEMU_HW_CONFIG_DEFS_H): PRIVATE_PATH := $(LOCAL_PATH) $(QEMU_HW_CONFIG_DEFS_H): PRIVATE_CUSTOM_TOOL = $(PRIVATE_PATH)/android/tools/gen-hw-config.py $< $@ $(QEMU_HW_CONFIG_DEFS_H): $(QEMU_HARDWARE_PROPERTIES_INI) $(LOCAL_PATH)/android/tools/gen-hw-config.py $(hide) rm -f $@ $(transform-generated-source) QEMU_HW_CONFIG_DEFS_INCLUDES := $(intermediates) # Second, define a function that needs to be called inside each module that contains # a source file that includes the generated header file. gen-hw-config-defs = \ $(eval LOCAL_GENERATED_SOURCES += $(QEMU_HW_CONFIG_DEFS_H))\ $(eval LOCAL_C_INCLUDES += $(QEMU_HW_CONFIG_DEFS_INCLUDES)) ############################################################################## ############################################################################## ### ### emulator-common: LIBRARY OF COMMON FUNCTIONS ### ### THESE ARE POTENTIALLY USED BY ALL COMPONENTS ### common_LOCAL_CFLAGS = common_LOCAL_SRC_FILES = EMULATOR_COMMON_CFLAGS := # Needed by everything about the host EMULATOR_COMMON_CFLAGS += \ -I$(LOCAL_PATH)/android/config/$(QEMU_HOST_TAG) # add the build ID to the default macro definitions ifeq ($(BUILD_STANDALONE_EMULATOR),) EMULATOR_COMMON_CFLAGS += -DANDROID_BUILD_ID="$(strip $(BUILD_ID))-$(strip $(BUILD_NUMBER))" endif # For non-standalone builds, extract the major version number from the Android SDK # tools revision number. ifneq ($(BUILD_STANDALONE_EMULATOR),true) ANDROID_SDK_TOOLS_REVISION := $(shell awk -F= '/Pkg.Revision/ { print $$2; }' sdk/files/tools_source.properties) endif ANDROID_SDK_TOOLS_REVISION := $(strip $(ANDROID_SDK_TOOLS_REVISION)) ifdef ANDROID_SDK_TOOLS_REVISION EMULATOR_COMMON_CFLAGS += -DANDROID_SDK_TOOLS_REVISION=$(ANDROID_SDK_TOOLS_REVISION) endif # Enable large-file support (i.e. make off_t a 64-bit value) ifeq ($(HOST_OS),linux) EMULATOR_COMMON_CFLAGS += -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE endif ########################################################### # Zlib sources # ZLIB_DIR := distrib/zlib-1.2.3 include $(LOCAL_PATH)/$(ZLIB_DIR)/sources.make EMULATOR_COMMON_CFLAGS += -I$(LOCAL_PATH)/$(ZLIB_DIR) common_LOCAL_SRC_FILES += $(ZLIB_SOURCES) ########################################################### # Android utility functions # common_LOCAL_SRC_FILES += \ sockets.c \ iolooper-select.c \ android/async-console.c \ android/async-utils.c \ android/charmap.c \ android/framebuffer.c \ android/keycode-array.c \ android/avd/hw-config.c \ android/avd/info.c \ android/avd/util.c \ android/sync-utils.c \ android/utils/assert.c \ android/utils/bufprint.c \ android/utils/debug.c \ android/utils/dll.c \ android/utils/dirscanner.c \ android/utils/filelock.c \ android/utils/ini.c \ android/utils/intmap.c \ android/utils/lineinput.c \ android/utils/mapfile.c \ android/utils/misc.c \ android/utils/panic.c \ android/utils/path.c \ android/utils/reflist.c \ android/utils/refset.c \ android/utils/stralloc.c \ android/utils/system.c \ android/utils/tempfile.c \ android/utils/vector.c \ common_LOCAL_CFLAGS += $(EMULATOR_COMMON_CFLAGS) ## one for 32-bit $(call start-emulator-library, emulator-common) LOCAL_CFLAGS += $(common_LOCAL_CFLAGS) LOCAL_SRC_FILES += $(common_LOCAL_SRC_FILES) $(call gen-hw-config-defs) $(call end-emulator-library) ## another for 64-bit # NOTE: only linux and darwin in non-standalone mode is supported, because # 1) For Windows: amd64-mingw32msvc-gcc doesn't work, see http://b/issue?id=5949152. # 2) Standalone has --try-64 ifneq ($(filter linux darwin,$(HOST_OS)),) ifneq ($(BUILD_STANDALONE_EMULATOR),true) $(call start-emulator-library, emulator64-common) LOCAL_CFLAGS += $(common_LOCAL_CFLAGS) -m64 LOCAL_SRC_FILES += $(common_LOCAL_SRC_FILES) $(call gen-hw-config-defs) $(call end-emulator-library) endif # BUILD_STANDALONE_EMULATOR == nil endif # HOST_OS == linux || darwin ############################################################################## ############################################################################## ### ### emulator-libui: LIBRARY OF UI-RELATED FUNCTIONS ### ### THESE ARE USED BY 'emulator-ui' AND THE STANDALONE PROGRAMS ### common_LOCAL_CFLAGS = common_LOCAL_SRC_FILES = ifneq ($(QEMU_OPENGLES_INCLUDE),) EMULATOR_LIBUI_CFLAGS := -I$(QEMU_OPENGLES_INCLUDE) endif common_LOCAL_CFLAGS += $(EMULATOR_COMMON_CFLAGS) ########################################################### # Libpng configuration # LIBPNG_DIR := distrib/libpng-1.2.19 include $(LOCAL_PATH)/$(LIBPNG_DIR)/sources.make EMULATOR_LIBUI_CFLAGS += \ $(LIBPNG_CFLAGS) \ -I$(LOCAL_PATH)/$(LIBPNG_DIR) common_LOCAL_SRC_FILES += $(LIBPNG_SOURCES) loadpng.c ############################################################################## # SDL-related definitions # # Build SDL from sources except in certain cases where we use # prebuilt libraries instead. # BUILD_SDL_FROM_SOURCES := true # On linux-x86, using the prebuilts avoid installing all the X11 # development packages on our build servers. # ifeq ($(QEMU_HOST_TAG),linux-x86) BUILD_SDL_FROM_SOURCES := false endif # If we're building with android-configure.sh && make, always build from # sources to catch regressions as soon as they happen. # ifeq ($(BUILD_STANDALONE_EMULATOR),true) BUILD_SDL_FROM_SOURCES := true endif # Except if we used android-configure.sh --sdl-config=