blob: 5e4daf936ed8449838c42a21ef6a1d31501ec0fa [file] [log] [blame]
David 'Digit' Turneraff94b82011-02-07 18:10:54 +01001# 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' Turner42fc4492011-06-29 13:16:16 +020016### 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)
David 'Digit' Turner66241a62011-07-06 00:31:59 +020036$(QEMU_HW_CONFIG_DEFS_H): PRIVATE_CUSTOM_TOOL = $(PRIVATE_PATH)/android/tools/gen-hw-config.py $< $@
David 'Digit' Turner42fc4492011-06-29 13:16:16 +020037$(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###
David 'Digit' Turneraff94b82011-02-07 18:10:54 +010052### emulator-common: LIBRARY OF COMMON FUNCTIONS
53###
54### THESE ARE POTENTIALLY USED BY ALL COMPONENTS
55###
56
Andrew Hsiehc7389bd2012-03-13 02:13:40 -070057common_LOCAL_CFLAGS =
58common_LOCAL_SRC_FILES =
David 'Digit' Turneraff94b82011-02-07 18:10:54 +010059
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
Raphael Moll9e319a92012-11-28 13:48:25 -080087
David 'Digit' Turneraff94b82011-02-07 18:10:54 +010088###########################################################
89# Zlib sources
90#
David 'Digit' Turner17b20e62014-02-26 12:38:23 +010091ZLIB_DIR := distrib/zlib-1.2.8
David 'Digit' Turneraff94b82011-02-07 18:10:54 +010092include $(LOCAL_PATH)/$(ZLIB_DIR)/sources.make
93EMULATOR_COMMON_CFLAGS += -I$(LOCAL_PATH)/$(ZLIB_DIR)
94
Andrew Hsiehc7389bd2012-03-13 02:13:40 -070095common_LOCAL_SRC_FILES += $(ZLIB_SOURCES)
David 'Digit' Turneraff94b82011-02-07 18:10:54 +010096
97###########################################################
David 'Digit' Turner1d1a2af2014-01-10 16:17:40 +010098# GLib sources
99#
David 'Digit' Turner99c07e72014-01-13 12:34:52 +0100100GLIB_DIR := distrib/mini-glib
David 'Digit' Turner1d1a2af2014-01-10 16:17:40 +0100101include $(LOCAL_PATH)/$(GLIB_DIR)/sources.make
102EMULATOR_COMMON_CFLAGS += -I$(GLIB_INCLUDE_DIR)
103
104common_LOCAL_SRC_FILES += $(GLIB_SOURCES)
105
106###########################################################
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100107# Android utility functions
108#
Andrew Hsiehc7389bd2012-03-13 02:13:40 -0700109common_LOCAL_SRC_FILES += \
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100110 android/async-console.c \
111 android/async-utils.c \
112 android/charmap.c \
113 android/framebuffer.c \
David 'Digit' Turnerd413fa52013-12-14 23:35:20 +0100114 android/iolooper-select.c \
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100115 android/keycode-array.c \
116 android/avd/hw-config.c \
117 android/avd/info.c \
David 'Digit' Turner2d238fd2011-03-25 10:34:47 +0100118 android/avd/util.c \
David 'Digit' Turnercc330d42013-12-14 23:26:42 +0100119 android/sockets.c \
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100120 android/sync-utils.c \
David 'Digit' Turnerd3f2c272014-02-19 22:39:08 +0100121 android/base/containers/PodVector.cpp \
122 android/base/containers/StringVector.cpp \
David 'Digit' Turner11823982014-02-11 23:48:52 +0100123 android/base/files/PathUtils.cpp \
David 'Digit' Turner7a41eef2014-02-07 15:56:41 +0100124 android/base/Log.cpp \
David 'Digit' Turnerd3f2c272014-02-19 22:39:08 +0100125 android/base/String.cpp \
David 'Digit' Turneref457d22014-02-07 18:46:49 +0100126 android/base/StringView.cpp \
David 'Digit' Turner890f4642014-02-24 11:53:03 +0100127 android/filesystems/ext4_utils.cpp \
David 'Digit' Turnerc6e0cae2014-03-07 23:08:30 +0100128 android/kernel/kernel_utils.cpp \
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100129 android/utils/assert.c \
130 android/utils/bufprint.c \
131 android/utils/debug.c \
David 'Digit' Turner816e53c2011-08-17 18:33:45 +0200132 android/utils/dll.c \
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100133 android/utils/dirscanner.c \
David 'Digit' Turner52e99422014-02-03 17:11:18 +0100134 android/utils/eintr_wrapper.c \
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100135 android/utils/filelock.c \
David 'Digit' Turner5ea91482014-02-13 18:02:56 +0100136 android/utils/file_data.c \
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100137 android/utils/ini.c \
David 'Digit' Turnerbbb81042011-03-17 14:48:44 +0100138 android/utils/intmap.c \
David 'Digit' Turner0a879bf2011-05-12 18:45:18 +0200139 android/utils/lineinput.c \
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100140 android/utils/mapfile.c \
141 android/utils/misc.c \
142 android/utils/panic.c \
143 android/utils/path.c \
David 'Digit' Turner5ea91482014-02-13 18:02:56 +0100144 android/utils/property_file.c \
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100145 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 \
David 'Digit' Turner60d0a152014-01-22 01:09:57 +0100151 android/utils/win32_cmdline_quote.c \
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100152
Andrew Hsiehc7389bd2012-03-13 02:13:40 -0700153common_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)
David 'Digit' Turner42fc4492011-06-29 13:16:16 +0200160$(call gen-hw-config-defs)
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100161$(call end-emulator-library)
162
David 'Digit' Turneraf061c52014-02-28 23:33:54 +0100163ifdef EMULATOR_BUILD_64BITS
David 'Digit' Turner8be0af82014-01-14 14:39:13 +0100164 $(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)
David 'Digit' Turneraf061c52014-02-28 23:33:54 +0100169endif # EMULATOR_BUILD_64BITS
Andrew Hsiehc7389bd2012-03-13 02:13:40 -0700170
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100171##############################################################################
172##############################################################################
173###
174### emulator-libui: LIBRARY OF UI-RELATED FUNCTIONS
175###
176### THESE ARE USED BY 'emulator-ui' AND THE STANDALONE PROGRAMS
177###
178
Andrew Hsiehc7389bd2012-03-13 02:13:40 -0700179common_LOCAL_CFLAGS =
180common_LOCAL_SRC_FILES =
Andrew Hsiehc7389bd2012-03-13 02:13:40 -0700181common_LOCAL_CFLAGS += $(EMULATOR_COMMON_CFLAGS)
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100182
183###########################################################
184# Libpng configuration
185#
David 'Digit' Turnerc7702eb2014-02-26 12:41:50 +0100186LIBPNG_DIR := distrib/libpng-1.2.46
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100187include $(LOCAL_PATH)/$(LIBPNG_DIR)/sources.make
188
189EMULATOR_LIBUI_CFLAGS += \
190 $(LIBPNG_CFLAGS) \
191 -I$(LOCAL_PATH)/$(LIBPNG_DIR)
192
David 'Digit' Turner1634ff52013-12-14 23:31:41 +0100193common_LOCAL_SRC_FILES += $(LIBPNG_SOURCES) android/loadpng.c
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100194
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
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100211# 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#
David 'Digit' Turnera4026682011-08-24 12:54:01 +0200220ifneq ($(QEMU_SDL_CONFIG),)
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100221 BUILD_SDL_FROM_SOURCES := false
David 'Digit' Turnera4026682011-08-24 12:54:01 +0200222 SDL_CONFIG := $(QEMU_SDL_CONFIG)
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100223endif
224
225ifneq ($(BUILD_SDL_FROM_SOURCES),true)
226
Xavier Ducrohet20821322012-04-03 16:39:24 -0700227 SDL_CONFIG ?= prebuilts/tools/$(QEMU_HOST_TAG)/sdl/bin/sdl-config
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100228 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
Andrew Hsiehc7389bd2012-03-13 02:13:40 -0700239 SDL_STATIC_LIBRARIES_64 := lib64SDL lib64SDLmain lib64SDL lib64SDLmain
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100240
241else # BUILD_SDL_FROM_SOURCES
242
Jesse Hallc60b1142012-07-17 17:01:04 -0700243 SDL_DIR := distrib/sdl-1.2.15
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100244 include $(LOCAL_PATH)/$(SDL_DIR)/sources.make
David 'Digit' Turneraf061c52014-02-28 23:33:54 +0100245
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
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100248
249 EMULATOR_LIBUI_CFLAGS += \
250 -I$(LOCAL_PATH)/$(SDL_DIR)/include
251
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100252endif # 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
Andrew Hsiehc7389bd2012-03-13 02:13:40 -0700276common_LOCAL_SRC_FILES += $(SKIN_SOURCES:%=android/skin/%)
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100277
Andrew Hsiehc7389bd2012-03-13 02:13:40 -0700278common_LOCAL_SRC_FILES += \
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100279 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)
Andrew Hsiehc7389bd2012-03-13 02:13:40 -0700286common_LOCAL_CFLAGS += -DUSE_MMX=1 -mmmx
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100287endif
288
Andrew Hsiehc7389bd2012-03-13 02:13:40 -0700289common_LOCAL_CFLAGS += $(EMULATOR_LIBUI_CFLAGS)
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100290
Andrew Hsiehc7389bd2012-03-13 02:13:40 -0700291
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)
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100297$(call end-emulator-library)
298
Andrew Hsiehc7389bd2012-03-13 02:13:40 -0700299
David 'Digit' Turneraf061c52014-02-28 23:33:54 +0100300ifdef EMULATOR_BUILD_64BITS
David 'Digit' Turner8be0af82014-01-14 14:39:13 +0100301 $(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)
Andrew Hsieh83df59c2012-07-24 16:06:28 -0700306endif # HOST_OS == linux || darwin
Andrew Hsiehc7389bd2012-03-13 02:13:40 -0700307
308
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100309##############################################################################
310##############################################################################
311###
312### emulator-libqemu: TARGET-INDEPENDENT QEMU FUNCTIONS
313###
314### THESE ARE USED BY EVERYTHING EXCEPT 'emulator-ui'
315###
316
Andrew Hsiehc7389bd2012-03-13 02:13:40 -0700317common_LOCAL_CFLAGS =
318common_LOCAL_SRC_FILES =
319
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100320
321EMULATOR_LIBQEMU_CFLAGS :=
322
Andrew Hsiehc7389bd2012-03-13 02:13:40 -0700323common_LOCAL_CFLAGS += $(EMULATOR_COMMON_CFLAGS)
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100324
325AUDIO_SOURCES := noaudio.c wavaudio.c wavcapture.c mixeng.c
326AUDIO_CFLAGS := -I$(LOCAL_PATH)/audio -DHAS_AUDIO
327AUDIO_LDLIBS :=
328
Raphael Moll9e319a92012-11-28 13:48:25 -0800329common_LOCAL_CFLAGS += -Wall $(GCC_W_NO_MISSING_FIELD_INITIALIZERS)
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100330
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
Andrew Hsiehc7389bd2012-03-13 02:13:40 -0700384common_LOCAL_CFLAGS += -Wno-sign-compare \
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100385 -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)
Andrew Hsiehc7389bd2012-03-13 02:13:40 -0700390common_LOCAL_CFLAGS += -fno-stack-protector
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100391endif
392
Andrew Hsiehc7389bd2012-03-13 02:13:40 -0700393common_LOCAL_SRC_FILES += $(AUDIO_SOURCES)
394common_LOCAL_SRC_FILES += \
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100395 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
Raphael Moll9e319a92012-11-28 13:48:25 -0800407common_LOCAL_CFLAGS += $(GCC_W_NO_MISSING_FIELD_INITIALIZERS)
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100408
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100409# misc. sources
410#
411CORE_MISC_SOURCES = \
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100412 aio-android.c \
413 async.c \
414 bt-host.c \
415 bt-vhci.c \
David 'Digit' Turner8354d2d2011-05-11 00:19:06 +0200416 iohandler.c \
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100417 ioport.c \
David 'Digit' Turnerdc7a2b62014-01-28 04:57:43 +0100418 migration-dummy-android.c \
David 'Digit' Turner3b2846a2011-05-11 01:34:40 +0200419 qemu-char.c \
David 'Digit' Turner67c35562014-01-16 18:24:09 +0100420 qemu-log.c \
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100421 savevm.c \
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100422 android/boot-properties.c \
David 'Digit' Turnere1e03df2013-12-15 00:42:21 +0100423 android/cbuffer.c \
424 android/charpipe.c \
David 'Digit' Turner73dd5fc2014-02-04 12:50:55 +0100425 android/config-file.c \
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100426 android/core-init-utils.c \
427 android/gps.c \
428 android/hw-kmsg.c \
429 android/hw-lcd.c \
430 android/hw-events.c \
431 android/hw-control.c \
432 android/hw-sensors.c \
433 android/hw-qemud.c \
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100434 android/looper-qemu.c \
David 'Digit' Turnerc0ac7332011-05-02 15:05:35 +0200435 android/hw-pipe-net.c \
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100436 android/qemu-setup.c \
David 'Digit' Turner6e2eb782013-12-15 00:54:21 +0100437 android/qemu-tcpdump.c \
David 'Digit' Turnercc330d42013-12-14 23:26:42 +0100438 android/shaper.c \
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100439 android/snapshot.c \
Vladimir Chtchetkine9d36fe72012-03-26 10:29:20 -0700440 android/async-socket-connector.c \
Vladimir Chtchetkinea7383ef2012-03-29 07:34:07 -0700441 android/async-socket.c \
Vladimir Chtchetkinec8aa2c52012-04-05 16:22:55 -0700442 android/sdk-controller-socket.c \
Vladimir Chtchetkinedb611d52011-11-01 17:35:07 -0700443 android/sensors-port.c \
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100444 android/utils/timezone.c \
Vladimir Chtchetkinec646f5e2011-09-03 15:17:13 -0700445 android/camera/camera-format-converters.c \
Vladimir Chtchetkined86c7242011-12-09 15:45:46 -0800446 android/camera/camera-service.c \
447 android/adb-server.c \
Vladimir Chtchetkinedb450d72012-01-12 13:37:40 -0800448 android/adb-qemud.c \
Vladimir Chtchetkine8dd31e82012-02-15 17:16:04 -0800449 android/snaphost-android.c \
450 android/multitouch-screen.c \
451 android/multitouch-port.c \
David 'Digit' Turner84569132013-12-13 17:34:07 +0100452 android/utils/jpeg-compress.c \
David 'Digit' Turnercc330d42013-12-14 23:26:42 +0100453 net/net-android.c \
David 'Digit' Turner1c31e3e2013-12-14 20:07:17 +0100454 qobject/qerror.c \
David 'Digit' Turner2e36f052014-01-16 16:22:47 +0100455 qom/container.c \
456 qom/object.c \
457 qom/qom-qobject.c \
David 'Digit' Turner1c31e3e2013-12-14 20:07:17 +0100458 ui/console.c \
459 ui/d3des.c \
David 'Digit' Turnerd7088e92013-12-17 09:25:19 +0100460 ui/input.c \
David 'Digit' Turner1c31e3e2013-12-14 20:07:17 +0100461 ui/vnc-android.c \
David 'Digit' Turner37dc41a2013-12-14 14:45:51 +0100462 util/aes.c \
David 'Digit' Turnere90d6652013-12-14 14:55:12 +0100463 util/cutils.c \
David 'Digit' Turner910aea92014-01-15 16:53:38 +0100464 util/error.c \
David 'Digit' Turner1befd342014-01-15 17:56:45 +0100465 util/hexdump.c \
466 util/iov.c \
David 'Digit' Turnere90d6652013-12-14 14:55:12 +0100467 util/module.c \
468 util/notify.c \
David 'Digit' Turner84569132013-12-13 17:34:07 +0100469 util/osdep.c \
David 'Digit' Turner1c31e3e2013-12-14 20:07:17 +0100470 util/path.c \
471 util/qemu-config.c \
472 util/qemu-error.c \
473 util/qemu-option.c \
474 util/qemu-sockets-android.c \
David 'Digit' Turner910aea92014-01-15 16:53:38 +0100475 util/unicode.c \
David 'Digit' Turnerc79de3c2014-01-23 04:17:24 +0100476 util/yield-android.c \
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100477
478ifeq ($(HOST_ARCH),x86)
David 'Digit' Turnercc33b2d2013-12-15 00:09:42 +0100479 CORE_MISC_SOURCES += disas/i386.c
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100480endif
481ifeq ($(HOST_ARCH),x86_64)
David 'Digit' Turnercc33b2d2013-12-15 00:09:42 +0100482 CORE_MISC_SOURCES += disas/i386.c
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100483endif
484ifeq ($(HOST_ARCH),ppc)
David 'Digit' Turnercc33b2d2013-12-15 00:09:42 +0100485 CORE_MISC_SOURCES += disas/ppc.c \
David 'Digit' Turner37dc41a2013-12-14 14:45:51 +0100486 util/cache-utils.c
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100487endif
488
489ifeq ($(HOST_OS),linux)
David 'Digit' Turnerd471c922013-12-17 09:52:48 +0100490 CORE_MISC_SOURCES += hw/usb/usb-linux.c \
David 'Digit' Turner76bc27e2014-02-12 20:48:04 +0100491 util/compatfd.c \
David 'Digit' Turner086e66e2014-02-04 22:24:36 +0100492 util/qemu-thread-posix.c \
Vladimir Chtchetkine4ed09fd2011-08-18 09:42:40 -0700493 android/camera/camera-capture-linux.c
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100494else
David 'Digit' Turnerd471c922013-12-17 09:52:48 +0100495 CORE_MISC_SOURCES += hw/usb/usb-dummy-android.c
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100496endif
497
498ifeq ($(HOST_OS),windows)
Vladimir Chtchetkine4ed09fd2011-08-18 09:42:40 -0700499 CORE_MISC_SOURCES += tap-win32.c \
David 'Digit' Turner086e66e2014-02-04 22:24:36 +0100500 android/camera/camera-capture-windows.c \
501 util/qemu-thread-win32.c
Vladimir Chtchetkine4ed09fd2011-08-18 09:42:40 -0700502
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100503else
504 CORE_MISC_SOURCES += posix-aio-compat.c
505endif
506
Vladimir Chtchetkineb92b3032011-09-12 15:29:32 -0700507ifeq ($(HOST_OS),darwin)
David 'Digit' Turner086e66e2014-02-04 22:24:36 +0100508 CORE_MISC_SOURCES += android/camera/camera-capture-mac.m \
David 'Digit' Turner76bc27e2014-02-12 20:48:04 +0100509 util/compatfd.c \
David 'Digit' Turner086e66e2014-02-04 22:24:36 +0100510 util/qemu-thread-posix.c
Vladimir Chtchetkineb92b3032011-09-12 15:29:32 -0700511endif
512
Andrew Hsiehc7389bd2012-03-13 02:13:40 -0700513common_LOCAL_SRC_FILES += $(CORE_MISC_SOURCES)
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100514
515# Required
Lars Poeschel33da99a2012-08-22 09:42:42 +0200516common_LOCAL_CFLAGS += -D_XOPEN_SOURCE=600 -D_BSD_SOURCE=1 -I$(LOCAL_PATH)/distrib/jpeg-6b
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100517
518SLIRP_SOURCES := \
519 bootp.c \
520 cksum.c \
521 debug.c \
522 if.c \
523 ip_icmp.c \
524 ip_input.c \
525 ip_output.c \
526 mbuf.c \
527 misc.c \
528 sbuf.c \
529 slirp.c \
530 socket.c \
531 tcp_input.c \
532 tcp_output.c \
533 tcp_subr.c \
534 tcp_timer.c \
535 tftp.c \
536 udp.c
537
Andrew Hsiehc7389bd2012-03-13 02:13:40 -0700538common_LOCAL_SRC_FILES += $(SLIRP_SOURCES:%=slirp-android/%)
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100539EMULATOR_LIBQEMU_CFLAGS += -I$(LOCAL_PATH)/slirp-android
540
541# socket proxy support
542#
543PROXY_SOURCES := \
544 proxy_common.c \
545 proxy_http.c \
546 proxy_http_connector.c \
547 proxy_http_rewriter.c \
548
Andrew Hsiehc7389bd2012-03-13 02:13:40 -0700549common_LOCAL_SRC_FILES += $(PROXY_SOURCES:%=proxy/%)
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100550EMULATOR_LIBQEMU_CFLAGS += -I$(LOCAL_PATH)/proxy
551
552# include telephony stuff
553#
554TELEPHONY_SOURCES := \
555 android_modem.c \
556 modem_driver.c \
557 gsm.c \
558 sim_card.c \
559 sysdeps_qemu.c \
560 sms.c \
561 remote_call.c
562
Andrew Hsiehc7389bd2012-03-13 02:13:40 -0700563common_LOCAL_SRC_FILES += $(TELEPHONY_SOURCES:%=telephony/%)
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100564EMULATOR_LIBQEMU_CFLAGS += -I$(LOCAL_PATH)/telephony
565
566# sources inherited from upstream, but not fully
567# integrated into android emulator
568#
Andrew Hsiehc7389bd2012-03-13 02:13:40 -0700569common_LOCAL_SRC_FILES += \
David 'Digit' Turner1c31e3e2013-12-14 20:07:17 +0100570 qobject/json-lexer.c \
571 qobject/json-parser.c \
572 qobject/json-streamer.c \
573 qobject/qjson.c \
574 qobject/qbool.c \
575 qobject/qdict.c \
576 qobject/qfloat.c \
577 qobject/qint.c \
578 qobject/qlist.c \
579 qobject/qstring.c \
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100580
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100581ifeq ($(QEMU_TARGET_XML_SOURCES),)
582 QEMU_TARGET_XML_SOURCES := arm-core arm-neon arm-vfp arm-vfp3
583 QEMU_TARGET_XML_SOURCES := $(QEMU_TARGET_XML_SOURCES:%=$(LOCAL_PATH)/gdb-xml/%.xml)
584endif
585
Andrew Hsiehc7389bd2012-03-13 02:13:40 -0700586common_LOCAL_CFLAGS += $(EMULATOR_LIBQEMU_CFLAGS)
587
588
589## one for 32-bit
590$(call start-emulator-library, emulator-libqemu)
591# gdbstub-xml.c contains C-compilable arrays corresponding to the content
592# of $(LOCAL_PATH)/gdb-xml/, and is generated with the 'feature_to_c.sh' script.
593#
594intermediates = $(call intermediates-dir-for,STATIC_LIBRARIES,$(LOCAL_MODULE),true)
595QEMU_GDBSTUB_XML_C = $(intermediates)/gdbstub-xml.c
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100596$(QEMU_GDBSTUB_XML_C): PRIVATE_PATH := $(LOCAL_PATH)
597$(QEMU_GDBSTUB_XML_C): PRIVATE_SOURCES := $(TARGET_XML_SOURCES)
598$(QEMU_GDBSTUB_XML_C): PRIVATE_CUSTOM_TOOL = $(PRIVATE_PATH)/feature_to_c.sh $@ $(QEMU_TARGET_XML_SOURCES)
599$(QEMU_GDBSTUB_XML_C): $(QEMU_TARGET_XML_SOURCES) $(LOCAL_PATH)/feature_to_c.sh
600 $(hide) rm -f $@
601 $(transform-generated-source)
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100602LOCAL_GENERATED_SOURCES += $(QEMU_GDBSTUB_XML_C)
Andrew Hsiehc7389bd2012-03-13 02:13:40 -0700603LOCAL_CFLAGS += $(common_LOCAL_CFLAGS) -I$(intermediates)
604LOCAL_SRC_FILES += $(common_LOCAL_SRC_FILES)
605$(call gen-hw-config-defs)
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100606$(call end-emulator-library)
607
Andrew Hsiehc7389bd2012-03-13 02:13:40 -0700608
609## another for 64-bit, see note in emulator64-common
David 'Digit' Turneraf061c52014-02-28 23:33:54 +0100610ifdef EMULATOR_BUILD_64BITS
David 'Digit' Turner8be0af82014-01-14 14:39:13 +0100611 $(call start-emulator-library, emulator64-libqemu)
612 # gdbstub-xml.c contains C-compilable arrays corresponding to the content
613 # of $(LOCAL_PATH)/gdb-xml/, and is generated with the 'feature_to_c.sh' script.
614 #
615 intermediates = $(call intermediates-dir-for,STATIC_LIBRARIES,$(LOCAL_MODULE),true)
616 QEMU_GDBSTUB_XML_C = $(intermediates)/gdbstub-xml.c
617 $(QEMU_GDBSTUB_XML_C): PRIVATE_PATH := $(LOCAL_PATH)
618 $(QEMU_GDBSTUB_XML_C): PRIVATE_SOURCES := $(TARGET_XML_SOURCES)
619 $(QEMU_GDBSTUB_XML_C): PRIVATE_CUSTOM_TOOL = $(PRIVATE_PATH)/feature_to_c.sh $@ $(QEMU_TARGET_XML_SOURCES)
620 $(QEMU_GDBSTUB_XML_C): $(QEMU_TARGET_XML_SOURCES) $(LOCAL_PATH)/feature_to_c.sh
Andrew Hsiehc7389bd2012-03-13 02:13:40 -0700621 $(hide) rm -f $@
622 $(transform-generated-source)
David 'Digit' Turner8be0af82014-01-14 14:39:13 +0100623 LOCAL_GENERATED_SOURCES += $(QEMU_GDBSTUB_XML_C)
624 LOCAL_CFLAGS += $(common_LOCAL_CFLAGS) -I$(intermediates) -m64
625 LOCAL_SRC_FILES += $(common_LOCAL_SRC_FILES)
626 $(call gen-hw-config-defs)
627 $(call end-emulator-library)
David 'Digit' Turneraf061c52014-02-28 23:33:54 +0100628endif # EMULATOR_BUILD_64BITS
Andrew Hsiehc7389bd2012-03-13 02:13:40 -0700629
630
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100631# Block sources, we must compile them with each executable because they
632# are only referenced by the rest of the code using constructor functions.
633# If their object files are put in a static library, these are never compiled
634# into the final linked executable that uses them.
635#
636# Normally, one would solve thus using LOCAL_WHOLE_STATIC_LIBRARIES, but
637# the Darwin linker doesn't support -Wl,--whole-archive or equivalent :-(
638#
639BLOCK_SOURCES += \
640 block.c \
641 blockdev.c \
642 block/qcow.c \
643 block/qcow2.c \
644 block/qcow2-refcount.c \
645 block/qcow2-snapshot.c \
646 block/qcow2-cluster.c \
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100647 block/raw.c
648
649ifeq ($(HOST_OS),windows)
650 BLOCK_SOURCES += block/raw-win32.c
651else
652 BLOCK_SOURCES += block/raw-posix.c
653endif
654
655BLOCK_CFLAGS += $(EMULATOR_COMMON_CFLAGS)
David 'Digit' Turnercef730b2014-02-04 01:02:30 +0100656BLOCK_CFLAGS += -DCONFIG_BDRV_WHITELIST=\"\"
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100657
Lars Poeschel33da99a2012-08-22 09:42:42 +0200658##############################################################################
659##############################################################################
660###
661### emulator-libjpeg: TARGET-INDEPENDENT QEMU FUNCTIONS
662###
663### THESE ARE USED BY EVERYTHING EXCEPT 'emulator-ui'
664###
665
666common_LOCAL_CFLAGS =
667common_LOCAL_SRC_FILES =
668
669###########################################################
670# Jpeg configuration
671#
672LIBJPEG_DIR := distrib/jpeg-6b
673include $(LOCAL_PATH)/$(LIBJPEG_DIR)/sources.make
674
675common_LOCAL_SRC_FILES += $(LIBJPEG_SOURCES)
676
677common_LOCAL_CFLAGS += \
678 $(LIBJPEG_CFLAGS) \
679 -I$(LOCAL_PATH)/$(LIBJPEG_DIR)
680
681## one for 32-bit
682$(call start-emulator-library, emulator-libjpeg)
683LOCAL_CFLAGS += $(common_LOCAL_CFLAGS)
684LOCAL_SRC_FILES += $(common_LOCAL_SRC_FILES)
685$(call end-emulator-library)
686
687
688## another for 64-bit, see note in emulator64-common
David 'Digit' Turneraf061c52014-02-28 23:33:54 +0100689ifdef EMULATOR_BUILD_64BITS
David 'Digit' Turner8be0af82014-01-14 14:39:13 +0100690 $(call start-emulator-library, emulator64-libjpeg)
691 LOCAL_CFLAGS += $(common_LOCAL_CFLAGS) -m64
692 LOCAL_SRC_FILES += $(common_LOCAL_SRC_FILES)
693 $(call end-emulator-library)
David 'Digit' Turneraf061c52014-02-28 23:33:54 +0100694endif # EMULATOR_BUILD_64BITS
Lars Poeschel33da99a2012-08-22 09:42:42 +0200695
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100696
697##############################################################################
698##############################################################################
699###
David 'Digit' Turner8be0af82014-01-14 14:39:13 +0100700### emulator-libelff: TARGET-INDEPENDENT ELF/DWARF PARSER
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100701###
702### THESE ARE USED BY EVERYTHING EXCEPT 'emulator-ui', BUT WE CANNOT PUT
703### THEM IN emulator-libqemu SINCE THE SOURCES ARE C++
704###
705
Andrew Hsiehc7389bd2012-03-13 02:13:40 -0700706common_LOCAL_CFLAGS =
707common_LOCAL_SRC_FILES =
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100708
709ELFF_CFLAGS := -I$(LOCAL_PATH)/elff
710ELFF_LDLIBS := -lstdc++
711
712ELFF_SOURCES := \
713 dwarf_cu.cc \
714 dwarf_die.cc \
715 dwarf_utils.cc \
716 elf_alloc.cc \
717 elf_file.cc \
718 elf_mapped_section.cc \
719 elff_api.cc \
720
Andrew Hsiehc7389bd2012-03-13 02:13:40 -0700721common_LOCAL_SRC_FILES += $(ELFF_SOURCES:%=elff/%)
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100722
Andrew Hsiehc7389bd2012-03-13 02:13:40 -0700723common_LOCAL_CFLAGS += \
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100724 -fno-exceptions \
725 $(ELFF_CFLAGS) \
726
Andrew Hsiehc7389bd2012-03-13 02:13:40 -0700727
728## one for 32-bit
729$(call start-emulator-library, emulator-libelff)
730LOCAL_CPP_EXTENSION := .cc
731LOCAL_CFLAGS += $(common_LOCAL_CFLAGS)
732LOCAL_SRC_FILES += $(common_LOCAL_SRC_FILES)
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100733$(call end-emulator-library)
734
735
David 'Digit' Turneraf061c52014-02-28 23:33:54 +0100736ifdef EMULATOR_BUILD_64BITS
David 'Digit' Turner8be0af82014-01-14 14:39:13 +0100737 $(call start-emulator-library, emulator64-libelff)
738 LOCAL_CPP_EXTENSION := .cc
739 LOCAL_CFLAGS += $(common_LOCAL_CFLAGS) -m64
740 LOCAL_SRC_FILES += $(common_LOCAL_SRC_FILES)
741 $(call end-emulator-library)
David 'Digit' Turneraf061c52014-02-28 23:33:54 +0100742endif # EMULATOR_BUILD_64BITS
Andrew Hsiehc7389bd2012-03-13 02:13:40 -0700743
744
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100745##############################################################################
746##############################################################################
747###
748### gen-hx-header: Generate headers from .hx file with "hxtool" script.
749###
750### The 'hxtool' script is used to generate header files from an input
751### file with the .hx suffix. I.e. foo.hx --> foo.h
752###
753### Due to the way the Android build system works, we need to regenerate
754### it for each module (the output will go into a module-specific directory).
755###
756### This defines a function that can be used inside a module definition
757###
David 'Digit' Turner088edf82011-05-09 15:59:28 +0200758### $(call gen-hx-header,<input>,<output>,<source-files>)
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100759###
760### Where: <input> is the input file, with a .hx suffix (e.g. foo.hx)
David 'Digit' Turner088edf82011-05-09 15:59:28 +0200761### <output> is the output file, with a .h or .def suffix
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100762### <source-files> is a list of source files that include the header
763###
764
765
766gen-hx-header = $(eval $(call gen-hx-header-ev,$1,$2,$3))
767
768define gen-hx-header-ev
David 'Digit' Turner42fc4492011-06-29 13:16:16 +0200769intermediates := $$(call intermediates-dir-for,$$(LOCAL_MODULE_CLASS),$$(LOCAL_MODULE),true)
David 'Digit' Turner317c9d52011-05-10 06:38:21 +0200770
David 'Digit' Turner088edf82011-05-09 15:59:28 +0200771QEMU_HEADER_H := $$(intermediates)/$$2
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100772$$(QEMU_HEADER_H): PRIVATE_PATH := $$(LOCAL_PATH)
773$$(QEMU_HEADER_H): PRIVATE_CUSTOM_TOOL = $$(PRIVATE_PATH)/hxtool -h < $$< > $$@
774$$(QEMU_HEADER_H): $$(LOCAL_PATH)/$$1 $$(LOCAL_PATH)/hxtool
775 $$(transform-generated-source)
776
777LOCAL_GENERATED_SOURCES += $$(QEMU_HEADER_H)
David 'Digit' Turner088edf82011-05-09 15:59:28 +0200778LOCAL_C_INCLUDES += $$(intermediates)
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100779endef
780