blob: 17f886ea9a3ae41c6cc2abb7a1f983e0abd5de6c [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' Turner6ddf8732014-06-12 10:29:23 +020091EMULATOR_COMMON_CFLAGS += -I$(ZLIB_INCLUDES)
David 'Digit' Turneraff94b82011-02-07 18:10:54 +010092
93###########################################################
David 'Digit' Turner1d1a2af2014-01-10 16:17:40 +010094# GLib sources
95#
David 'Digit' Turner99c07e72014-01-13 12:34:52 +010096GLIB_DIR := distrib/mini-glib
David 'Digit' Turner1d1a2af2014-01-10 16:17:40 +010097include $(LOCAL_PATH)/$(GLIB_DIR)/sources.make
98EMULATOR_COMMON_CFLAGS += -I$(GLIB_INCLUDE_DIR)
99
100common_LOCAL_SRC_FILES += $(GLIB_SOURCES)
101
102###########################################################
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100103# Android utility functions
104#
Andrew Hsiehc7389bd2012-03-13 02:13:40 -0700105common_LOCAL_SRC_FILES += \
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100106 android/async-console.c \
107 android/async-utils.c \
108 android/charmap.c \
109 android/framebuffer.c \
David 'Digit' Turnerd413fa52013-12-14 23:35:20 +0100110 android/iolooper-select.c \
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100111 android/keycode-array.c \
112 android/avd/hw-config.c \
113 android/avd/info.c \
David 'Digit' Turner2d238fd2011-03-25 10:34:47 +0100114 android/avd/util.c \
David 'Digit' Turnercc330d42013-12-14 23:26:42 +0100115 android/sockets.c \
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100116 android/sync-utils.c \
David 'Digit' Turnerd3f2c272014-02-19 22:39:08 +0100117 android/base/containers/PodVector.cpp \
118 android/base/containers/StringVector.cpp \
David 'Digit' Turner11823982014-02-11 23:48:52 +0100119 android/base/files/PathUtils.cpp \
David 'Digit' Turner7a41eef2014-02-07 15:56:41 +0100120 android/base/Log.cpp \
David 'Digit' Turnerd3f2c272014-02-19 22:39:08 +0100121 android/base/String.cpp \
David 'Digit' Turner97502fa2014-04-28 22:05:28 +0200122 android/base/StringFormat.cpp \
David 'Digit' Turneref457d22014-02-07 18:46:49 +0100123 android/base/StringView.cpp \
David 'Digit' Turner045bdbe2014-04-28 22:26:52 +0200124 android/emulation/CpuAccelerator.cpp \
David 'Digit' Turner890f4642014-02-24 11:53:03 +0100125 android/filesystems/ext4_utils.cpp \
David 'Digit' Turner83942732014-06-17 11:06:12 +0200126 android/filesystems/partition_types.cpp \
David 'Digit' Turnerc6e0cae2014-03-07 23:08:30 +0100127 android/kernel/kernel_utils.cpp \
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100128 android/utils/assert.c \
129 android/utils/bufprint.c \
130 android/utils/debug.c \
David 'Digit' Turner816e53c2011-08-17 18:33:45 +0200131 android/utils/dll.c \
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100132 android/utils/dirscanner.c \
David 'Digit' Turner52e99422014-02-03 17:11:18 +0100133 android/utils/eintr_wrapper.c \
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100134 android/utils/filelock.c \
David 'Digit' Turner5ea91482014-02-13 18:02:56 +0100135 android/utils/file_data.c \
David 'Digit' Turneree573752014-06-17 09:59:41 +0200136 android/utils/host_bitness.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
David 'Digit' Turnerdddfa642014-06-12 18:48:17 +0200155common_LOCAL_CFLAGS += -I$(LIBEXT4_UTILS_INCLUDES)
Andrew Hsiehc7389bd2012-03-13 02:13:40 -0700156
157## one for 32-bit
158$(call start-emulator-library, emulator-common)
159LOCAL_CFLAGS += $(common_LOCAL_CFLAGS)
160LOCAL_SRC_FILES += $(common_LOCAL_SRC_FILES)
David 'Digit' Turner42fc4492011-06-29 13:16:16 +0200161$(call gen-hw-config-defs)
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100162$(call end-emulator-library)
163
David 'Digit' Turner9669d492014-06-12 01:20:53 +0200164$(call start-emulator64-library, emulator64-common)
165LOCAL_CFLAGS += $(common_LOCAL_CFLAGS)
166LOCAL_SRC_FILES += $(common_LOCAL_SRC_FILES)
167$(call gen-hw-config-defs)
168$(call end-emulator-library)
Andrew Hsiehc7389bd2012-03-13 02:13:40 -0700169
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100170##############################################################################
171##############################################################################
172###
173### emulator-libui: LIBRARY OF UI-RELATED FUNCTIONS
174###
175### THESE ARE USED BY 'emulator-ui' AND THE STANDALONE PROGRAMS
176###
177
Andrew Hsiehc7389bd2012-03-13 02:13:40 -0700178common_LOCAL_CFLAGS =
179common_LOCAL_SRC_FILES =
Andrew Hsiehc7389bd2012-03-13 02:13:40 -0700180common_LOCAL_CFLAGS += $(EMULATOR_COMMON_CFLAGS)
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100181
182###########################################################
183# Libpng configuration
184#
David 'Digit' Turnerc7702eb2014-02-26 12:41:50 +0100185LIBPNG_DIR := distrib/libpng-1.2.46
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100186include $(LOCAL_PATH)/$(LIBPNG_DIR)/sources.make
187
188EMULATOR_LIBUI_CFLAGS += \
189 $(LIBPNG_CFLAGS) \
190 -I$(LOCAL_PATH)/$(LIBPNG_DIR)
191
David 'Digit' Turner1634ff52013-12-14 23:31:41 +0100192common_LOCAL_SRC_FILES += $(LIBPNG_SOURCES) android/loadpng.c
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100193
194##############################################################################
195# SDL-related definitions
196#
197
198# Build SDL from sources except in certain cases where we use
199# prebuilt libraries instead.
200#
201BUILD_SDL_FROM_SOURCES := true
202
203# On linux-x86, using the prebuilts avoid installing all the X11
David 'Digit' Turner425c53b2014-05-02 18:13:28 +0200204# development packages on our build servers. Note: When building 64-bit
205# host binaries, don't use 32-bit SDL prebuilts.
Ying Wang52e9ecf2014-04-23 18:24:30 -0700206ifeq ($(strip $(QEMU_HOST_TAG)$(HOST_IS_64_BIT)),linux-x86)
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100207 BUILD_SDL_FROM_SOURCES := false
208endif
209
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100210# If we're building with android-configure.sh && make, always build from
211# sources to catch regressions as soon as they happen.
212#
213ifeq ($(BUILD_STANDALONE_EMULATOR),true)
214 BUILD_SDL_FROM_SOURCES := true
215endif
216
217# Except if we used android-configure.sh --sdl-config=<script>
218#
David 'Digit' Turnera4026682011-08-24 12:54:01 +0200219ifneq ($(QEMU_SDL_CONFIG),)
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100220 BUILD_SDL_FROM_SOURCES := false
David 'Digit' Turnera4026682011-08-24 12:54:01 +0200221 SDL_CONFIG := $(QEMU_SDL_CONFIG)
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100222endif
223
224ifneq ($(BUILD_SDL_FROM_SOURCES),true)
225
Xavier Ducrohet20821322012-04-03 16:39:24 -0700226 SDL_CONFIG ?= prebuilts/tools/$(QEMU_HOST_TAG)/sdl/bin/sdl-config
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100227 SDL_CFLAGS := $(shell $(SDL_CONFIG) --cflags)
228
229 # We need to filter out the _GNU_SOURCE variable because it breaks recent
230 # releases of Cygwin when using the -mno-cygwin option. Moreover, we don't
231 # need this macro at all to build the Android emulator.
232 SDL_CFLAGS := $(filter-out -D_GNU_SOURCE=1,$(SDL_CFLAGS))
233 SDL_LDLIBS := $(filter-out %.a %.lib,$(shell $(SDL_CONFIG) --static-libs))
234
235 # Circular dependencies between libSDL and libSDLmain
236 # We repeat the libraries in the final link to work around it
237 SDL_STATIC_LIBRARIES := libSDL libSDLmain libSDL libSDLmain
Andrew Hsiehc7389bd2012-03-13 02:13:40 -0700238 SDL_STATIC_LIBRARIES_64 := lib64SDL lib64SDLmain lib64SDL lib64SDLmain
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100239
240else # BUILD_SDL_FROM_SOURCES
241
Jesse Hallc60b1142012-07-17 17:01:04 -0700242 SDL_DIR := distrib/sdl-1.2.15
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100243 include $(LOCAL_PATH)/$(SDL_DIR)/sources.make
David 'Digit' Turneraf061c52014-02-28 23:33:54 +0100244
245 SDL_STATIC_LIBRARIES := emulator_libSDL emulator_libSDLmain emulator_libSDL emulator_libSDLmain
246 SDL_STATIC_LIBRARIES_64 := emulator_lib64SDL emulator_lib64SDLmain emulator_lib64SDL emulator_lib64SDLmain
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100247
248 EMULATOR_LIBUI_CFLAGS += \
249 -I$(LOCAL_PATH)/$(SDL_DIR)/include
250
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100251endif # BUILD_SDL_FROM_SOURCES
252
253EMULATOR_LIBUI_CFLAGS += $(SDL_CFLAGS)
254EMULATOR_LIBUI_LDLIBS += $(SDL_LDLIBS)
255
256# The following is needed by SDL_LoadObject
257ifneq ($(HOST_OS),windows)
258 EMULATOR_LIBUI_LDLIBS += -ldl
259endif
260
261# the skin support sources
262#
263SKIN_SOURCES := rect.c \
264 region.c \
265 image.c \
266 trackball.c \
267 keyboard.c \
268 keyset.c \
269 file.c \
270 window.c \
271 scaler.c \
272 composer.c \
273 surface.c \
274
Andrew Hsiehc7389bd2012-03-13 02:13:40 -0700275common_LOCAL_SRC_FILES += $(SKIN_SOURCES:%=android/skin/%)
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100276
Andrew Hsiehc7389bd2012-03-13 02:13:40 -0700277common_LOCAL_SRC_FILES += \
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100278 android/user-config.c \
279 android/resource.c \
280 android/qemulator.c \
281 android/keycode.c \
282
283# enable MMX code for our skin scaler
284ifeq ($(HOST_ARCH),x86)
Andrew Hsiehc7389bd2012-03-13 02:13:40 -0700285common_LOCAL_CFLAGS += -DUSE_MMX=1 -mmmx
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100286endif
287
Andrew Hsiehc7389bd2012-03-13 02:13:40 -0700288common_LOCAL_CFLAGS += $(EMULATOR_LIBUI_CFLAGS)
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100289
Andrew Hsiehc7389bd2012-03-13 02:13:40 -0700290
291## one for 32-bit
292$(call start-emulator-library, emulator-libui)
293LOCAL_CFLAGS += $(common_LOCAL_CFLAGS)
294LOCAL_SRC_FILES += $(common_LOCAL_SRC_FILES)
295$(call gen-hw-config-defs)
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100296$(call end-emulator-library)
297
Andrew Hsiehc7389bd2012-03-13 02:13:40 -0700298
David 'Digit' Turner9669d492014-06-12 01:20:53 +0200299$(call start-emulator64-library, emulator64-libui)
300LOCAL_CFLAGS += $(common_LOCAL_CFLAGS)
301LOCAL_SRC_FILES += $(common_LOCAL_SRC_FILES)
302$(call gen-hw-config-defs)
303$(call end-emulator-library)
Andrew Hsiehc7389bd2012-03-13 02:13:40 -0700304
305
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100306##############################################################################
307##############################################################################
308###
309### emulator-libqemu: TARGET-INDEPENDENT QEMU FUNCTIONS
310###
311### THESE ARE USED BY EVERYTHING EXCEPT 'emulator-ui'
312###
313
Andrew Hsiehc7389bd2012-03-13 02:13:40 -0700314common_LOCAL_CFLAGS =
315common_LOCAL_SRC_FILES =
316
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100317
318EMULATOR_LIBQEMU_CFLAGS :=
319
Andrew Hsiehc7389bd2012-03-13 02:13:40 -0700320common_LOCAL_CFLAGS += $(EMULATOR_COMMON_CFLAGS)
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100321
322AUDIO_SOURCES := noaudio.c wavaudio.c wavcapture.c mixeng.c
323AUDIO_CFLAGS := -I$(LOCAL_PATH)/audio -DHAS_AUDIO
324AUDIO_LDLIBS :=
325
Raphael Moll9e319a92012-11-28 13:48:25 -0800326common_LOCAL_CFLAGS += -Wall $(GCC_W_NO_MISSING_FIELD_INITIALIZERS)
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100327
328ifeq ($(HOST_OS),darwin)
329 CONFIG_COREAUDIO ?= yes
330 AUDIO_CFLAGS += -DHOST_BSD=1
331endif
332
333ifeq ($(HOST_OS),windows)
334 CONFIG_WINAUDIO ?= yes
335endif
336
337ifeq ($(HOST_OS),linux)
338 CONFIG_OSS ?= yes
339 CONFIG_ALSA ?= yes
340 CONFIG_PULSEAUDIO ?= yes
341 CONFIG_ESD ?= yes
342endif
343
344ifeq ($(HOST_OS),freebsd)
345 CONFIG_OSS ?= yes
346endif
347
348ifeq ($(CONFIG_COREAUDIO),yes)
349 AUDIO_SOURCES += coreaudio.c
350 AUDIO_CFLAGS += -DCONFIG_COREAUDIO
351 AUDIO_LDLIBS += -Wl,-framework,CoreAudio
352endif
353
354ifeq ($(CONFIG_WINAUDIO),yes)
355 AUDIO_SOURCES += winaudio.c
356 AUDIO_CFLAGS += -DCONFIG_WINAUDIO
357endif
358
359ifeq ($(CONFIG_PULSEAUDIO),yes)
360 AUDIO_SOURCES += paaudio.c audio_pt_int.c
361 AUDIO_CFLAGS += -DCONFIG_PULSEAUDIO
362endif
363
364ifeq ($(CONFIG_ALSA),yes)
365 AUDIO_SOURCES += alsaaudio.c audio_pt_int.c
366 AUDIO_CFLAGS += -DCONFIG_ALSA
367endif
368
369ifeq ($(CONFIG_ESD),yes)
370 AUDIO_SOURCES += esdaudio.c
371 AUDIO_CFLAGS += -DCONFIG_ESD
372endif
373
374ifeq ($(CONFIG_OSS),yes)
375 AUDIO_SOURCES += ossaudio.c
376 AUDIO_CFLAGS += -DCONFIG_OSS
377endif
378
379AUDIO_SOURCES := $(call sort,$(AUDIO_SOURCES:%=audio/%))
380
Andrew Hsiehc7389bd2012-03-13 02:13:40 -0700381common_LOCAL_CFLAGS += -Wno-sign-compare \
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100382 -fno-strict-aliasing -W -Wall -Wno-unused-parameter \
383
384# this is very important, otherwise the generated binaries may
385# not link properly on our build servers
386ifeq ($(HOST_OS),linux)
Andrew Hsiehc7389bd2012-03-13 02:13:40 -0700387common_LOCAL_CFLAGS += -fno-stack-protector
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100388endif
389
Andrew Hsiehc7389bd2012-03-13 02:13:40 -0700390common_LOCAL_SRC_FILES += $(AUDIO_SOURCES)
391common_LOCAL_SRC_FILES += \
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100392 android/audio-test.c
393
394# other flags
395ifneq ($(HOST_OS),windows)
396 AUDIO_LDLIBS += -ldl
397else
398endif
399
400
401EMULATOR_LIBQEMU_CFLAGS += $(AUDIO_CFLAGS)
402EMULATOR_LIBQEMU_LDLIBS += $(AUDIO_LDLIBS)
403
Raphael Moll9e319a92012-11-28 13:48:25 -0800404common_LOCAL_CFLAGS += $(GCC_W_NO_MISSING_FIELD_INITIALIZERS)
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100405
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100406# misc. sources
407#
408CORE_MISC_SOURCES = \
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100409 aio-android.c \
410 async.c \
David 'Digit' Turner8354d2d2011-05-11 00:19:06 +0200411 iohandler.c \
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100412 ioport.c \
David 'Digit' Turnerdc7a2b62014-01-28 04:57:43 +0100413 migration-dummy-android.c \
David 'Digit' Turner3b2846a2011-05-11 01:34:40 +0200414 qemu-char.c \
David 'Digit' Turner67c35562014-01-16 18:24:09 +0100415 qemu-log.c \
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100416 savevm.c \
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100417 android/boot-properties.c \
David 'Digit' Turnere1e03df2013-12-15 00:42:21 +0100418 android/cbuffer.c \
419 android/charpipe.c \
David 'Digit' Turner73dd5fc2014-02-04 12:50:55 +0100420 android/config-file.c \
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100421 android/core-init-utils.c \
422 android/gps.c \
423 android/hw-kmsg.c \
424 android/hw-lcd.c \
425 android/hw-events.c \
426 android/hw-control.c \
427 android/hw-sensors.c \
428 android/hw-qemud.c \
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100429 android/looper-qemu.c \
David 'Digit' Turnerc0ac7332011-05-02 15:05:35 +0200430 android/hw-pipe-net.c \
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100431 android/qemu-setup.c \
David 'Digit' Turner6e2eb782013-12-15 00:54:21 +0100432 android/qemu-tcpdump.c \
David 'Digit' Turnercc330d42013-12-14 23:26:42 +0100433 android/shaper.c \
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100434 android/snapshot.c \
Vladimir Chtchetkine9d36fe72012-03-26 10:29:20 -0700435 android/async-socket-connector.c \
Vladimir Chtchetkinea7383ef2012-03-29 07:34:07 -0700436 android/async-socket.c \
Vladimir Chtchetkinec8aa2c52012-04-05 16:22:55 -0700437 android/sdk-controller-socket.c \
Vladimir Chtchetkinedb611d52011-11-01 17:35:07 -0700438 android/sensors-port.c \
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100439 android/utils/timezone.c \
Vladimir Chtchetkinec646f5e2011-09-03 15:17:13 -0700440 android/camera/camera-format-converters.c \
Vladimir Chtchetkined86c7242011-12-09 15:45:46 -0800441 android/camera/camera-service.c \
442 android/adb-server.c \
Vladimir Chtchetkinedb450d72012-01-12 13:37:40 -0800443 android/adb-qemud.c \
Vladimir Chtchetkine8dd31e82012-02-15 17:16:04 -0800444 android/snaphost-android.c \
445 android/multitouch-screen.c \
446 android/multitouch-port.c \
David 'Digit' Turner84569132013-12-13 17:34:07 +0100447 android/utils/jpeg-compress.c \
David 'Digit' Turnercc330d42013-12-14 23:26:42 +0100448 net/net-android.c \
David 'Digit' Turner1c31e3e2013-12-14 20:07:17 +0100449 qobject/qerror.c \
David 'Digit' Turner2e36f052014-01-16 16:22:47 +0100450 qom/container.c \
451 qom/object.c \
452 qom/qom-qobject.c \
David 'Digit' Turner1c31e3e2013-12-14 20:07:17 +0100453 ui/console.c \
454 ui/d3des.c \
David 'Digit' Turnerd7088e92013-12-17 09:25:19 +0100455 ui/input.c \
David 'Digit' Turner1c31e3e2013-12-14 20:07:17 +0100456 ui/vnc-android.c \
David 'Digit' Turner37dc41a2013-12-14 14:45:51 +0100457 util/aes.c \
David 'Digit' Turnere90d6652013-12-14 14:55:12 +0100458 util/cutils.c \
David 'Digit' Turner910aea92014-01-15 16:53:38 +0100459 util/error.c \
David 'Digit' Turner1befd342014-01-15 17:56:45 +0100460 util/hexdump.c \
461 util/iov.c \
David 'Digit' Turnere90d6652013-12-14 14:55:12 +0100462 util/module.c \
463 util/notify.c \
David 'Digit' Turner84569132013-12-13 17:34:07 +0100464 util/osdep.c \
David 'Digit' Turner1c31e3e2013-12-14 20:07:17 +0100465 util/path.c \
466 util/qemu-config.c \
467 util/qemu-error.c \
468 util/qemu-option.c \
469 util/qemu-sockets-android.c \
David 'Digit' Turner910aea92014-01-15 16:53:38 +0100470 util/unicode.c \
David 'Digit' Turnerc79de3c2014-01-23 04:17:24 +0100471 util/yield-android.c \
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100472
473ifeq ($(HOST_ARCH),x86)
David 'Digit' Turnercc33b2d2013-12-15 00:09:42 +0100474 CORE_MISC_SOURCES += disas/i386.c
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100475endif
476ifeq ($(HOST_ARCH),x86_64)
David 'Digit' Turnercc33b2d2013-12-15 00:09:42 +0100477 CORE_MISC_SOURCES += disas/i386.c
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100478endif
479ifeq ($(HOST_ARCH),ppc)
David 'Digit' Turnercc33b2d2013-12-15 00:09:42 +0100480 CORE_MISC_SOURCES += disas/ppc.c \
David 'Digit' Turner37dc41a2013-12-14 14:45:51 +0100481 util/cache-utils.c
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100482endif
483
484ifeq ($(HOST_OS),linux)
David 'Digit' Turner9f82bbb2014-04-14 16:57:38 +0200485 CORE_MISC_SOURCES += util/compatfd.c \
David 'Digit' Turner086e66e2014-02-04 22:24:36 +0100486 util/qemu-thread-posix.c \
Vladimir Chtchetkine4ed09fd2011-08-18 09:42:40 -0700487 android/camera/camera-capture-linux.c
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100488endif
489
490ifeq ($(HOST_OS),windows)
Vladimir Chtchetkine4ed09fd2011-08-18 09:42:40 -0700491 CORE_MISC_SOURCES += tap-win32.c \
David 'Digit' Turner086e66e2014-02-04 22:24:36 +0100492 android/camera/camera-capture-windows.c \
493 util/qemu-thread-win32.c
Vladimir Chtchetkine4ed09fd2011-08-18 09:42:40 -0700494
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100495else
496 CORE_MISC_SOURCES += posix-aio-compat.c
497endif
498
Vladimir Chtchetkineb92b3032011-09-12 15:29:32 -0700499ifeq ($(HOST_OS),darwin)
David 'Digit' Turner086e66e2014-02-04 22:24:36 +0100500 CORE_MISC_SOURCES += android/camera/camera-capture-mac.m \
David 'Digit' Turner76bc27e2014-02-12 20:48:04 +0100501 util/compatfd.c \
David 'Digit' Turner086e66e2014-02-04 22:24:36 +0100502 util/qemu-thread-posix.c
Vladimir Chtchetkineb92b3032011-09-12 15:29:32 -0700503endif
504
Andrew Hsiehc7389bd2012-03-13 02:13:40 -0700505common_LOCAL_SRC_FILES += $(CORE_MISC_SOURCES)
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100506
507# Required
Lars Poeschel33da99a2012-08-22 09:42:42 +0200508common_LOCAL_CFLAGS += -D_XOPEN_SOURCE=600 -D_BSD_SOURCE=1 -I$(LOCAL_PATH)/distrib/jpeg-6b
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100509
510SLIRP_SOURCES := \
511 bootp.c \
512 cksum.c \
513 debug.c \
514 if.c \
515 ip_icmp.c \
516 ip_input.c \
517 ip_output.c \
518 mbuf.c \
519 misc.c \
520 sbuf.c \
521 slirp.c \
522 socket.c \
523 tcp_input.c \
524 tcp_output.c \
525 tcp_subr.c \
526 tcp_timer.c \
527 tftp.c \
528 udp.c
529
Andrew Hsiehc7389bd2012-03-13 02:13:40 -0700530common_LOCAL_SRC_FILES += $(SLIRP_SOURCES:%=slirp-android/%)
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100531EMULATOR_LIBQEMU_CFLAGS += -I$(LOCAL_PATH)/slirp-android
532
533# socket proxy support
534#
535PROXY_SOURCES := \
536 proxy_common.c \
537 proxy_http.c \
538 proxy_http_connector.c \
539 proxy_http_rewriter.c \
540
Andrew Hsiehc7389bd2012-03-13 02:13:40 -0700541common_LOCAL_SRC_FILES += $(PROXY_SOURCES:%=proxy/%)
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100542EMULATOR_LIBQEMU_CFLAGS += -I$(LOCAL_PATH)/proxy
543
544# include telephony stuff
545#
546TELEPHONY_SOURCES := \
547 android_modem.c \
548 modem_driver.c \
549 gsm.c \
550 sim_card.c \
551 sysdeps_qemu.c \
552 sms.c \
553 remote_call.c
554
Andrew Hsiehc7389bd2012-03-13 02:13:40 -0700555common_LOCAL_SRC_FILES += $(TELEPHONY_SOURCES:%=telephony/%)
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100556EMULATOR_LIBQEMU_CFLAGS += -I$(LOCAL_PATH)/telephony
557
558# sources inherited from upstream, but not fully
559# integrated into android emulator
560#
Andrew Hsiehc7389bd2012-03-13 02:13:40 -0700561common_LOCAL_SRC_FILES += \
David 'Digit' Turner1c31e3e2013-12-14 20:07:17 +0100562 qobject/json-lexer.c \
563 qobject/json-parser.c \
564 qobject/json-streamer.c \
565 qobject/qjson.c \
566 qobject/qbool.c \
567 qobject/qdict.c \
568 qobject/qfloat.c \
569 qobject/qint.c \
570 qobject/qlist.c \
571 qobject/qstring.c \
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100572
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100573ifeq ($(QEMU_TARGET_XML_SOURCES),)
574 QEMU_TARGET_XML_SOURCES := arm-core arm-neon arm-vfp arm-vfp3
575 QEMU_TARGET_XML_SOURCES := $(QEMU_TARGET_XML_SOURCES:%=$(LOCAL_PATH)/gdb-xml/%.xml)
576endif
577
Andrew Hsiehc7389bd2012-03-13 02:13:40 -0700578common_LOCAL_CFLAGS += $(EMULATOR_LIBQEMU_CFLAGS)
579
580
581## one for 32-bit
582$(call start-emulator-library, emulator-libqemu)
583# gdbstub-xml.c contains C-compilable arrays corresponding to the content
584# of $(LOCAL_PATH)/gdb-xml/, and is generated with the 'feature_to_c.sh' script.
585#
586intermediates = $(call intermediates-dir-for,STATIC_LIBRARIES,$(LOCAL_MODULE),true)
587QEMU_GDBSTUB_XML_C = $(intermediates)/gdbstub-xml.c
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100588$(QEMU_GDBSTUB_XML_C): PRIVATE_PATH := $(LOCAL_PATH)
589$(QEMU_GDBSTUB_XML_C): PRIVATE_SOURCES := $(TARGET_XML_SOURCES)
590$(QEMU_GDBSTUB_XML_C): PRIVATE_CUSTOM_TOOL = $(PRIVATE_PATH)/feature_to_c.sh $@ $(QEMU_TARGET_XML_SOURCES)
591$(QEMU_GDBSTUB_XML_C): $(QEMU_TARGET_XML_SOURCES) $(LOCAL_PATH)/feature_to_c.sh
592 $(hide) rm -f $@
593 $(transform-generated-source)
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100594LOCAL_GENERATED_SOURCES += $(QEMU_GDBSTUB_XML_C)
Andrew Hsiehc7389bd2012-03-13 02:13:40 -0700595LOCAL_CFLAGS += $(common_LOCAL_CFLAGS) -I$(intermediates)
596LOCAL_SRC_FILES += $(common_LOCAL_SRC_FILES)
597$(call gen-hw-config-defs)
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100598$(call end-emulator-library)
599
Andrew Hsiehc7389bd2012-03-13 02:13:40 -0700600
601## another for 64-bit, see note in emulator64-common
David 'Digit' Turner9669d492014-06-12 01:20:53 +0200602$(call start-emulator64-library, emulator64-libqemu)
603# gdbstub-xml.c contains C-compilable arrays corresponding to the content
604# of $(LOCAL_PATH)/gdb-xml/, and is generated with the 'feature_to_c.sh' script.
605#
606intermediates = $(call intermediates-dir-for,STATIC_LIBRARIES,$(LOCAL_MODULE),true)
607QEMU_GDBSTUB_XML_C = $(intermediates)/gdbstub-xml.c
608$(QEMU_GDBSTUB_XML_C): PRIVATE_PATH := $(LOCAL_PATH)
609$(QEMU_GDBSTUB_XML_C): PRIVATE_SOURCES := $(TARGET_XML_SOURCES)
610$(QEMU_GDBSTUB_XML_C): PRIVATE_CUSTOM_TOOL = $(PRIVATE_PATH)/feature_to_c.sh $@ $(QEMU_TARGET_XML_SOURCES)
611$(QEMU_GDBSTUB_XML_C): $(QEMU_TARGET_XML_SOURCES) $(LOCAL_PATH)/feature_to_c.sh
Andrew Hsiehc7389bd2012-03-13 02:13:40 -0700612 $(hide) rm -f $@
613 $(transform-generated-source)
David 'Digit' Turner9669d492014-06-12 01:20:53 +0200614LOCAL_GENERATED_SOURCES += $(QEMU_GDBSTUB_XML_C)
615LOCAL_CFLAGS += $(common_LOCAL_CFLAGS) -I$(intermediates)
616LOCAL_SRC_FILES += $(common_LOCAL_SRC_FILES)
617$(call gen-hw-config-defs)
618$(call end-emulator-library)
Andrew Hsiehc7389bd2012-03-13 02:13:40 -0700619
620
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100621# Block sources, we must compile them with each executable because they
622# are only referenced by the rest of the code using constructor functions.
623# If their object files are put in a static library, these are never compiled
624# into the final linked executable that uses them.
625#
626# Normally, one would solve thus using LOCAL_WHOLE_STATIC_LIBRARIES, but
627# the Darwin linker doesn't support -Wl,--whole-archive or equivalent :-(
628#
629BLOCK_SOURCES += \
630 block.c \
631 blockdev.c \
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100632 block/qcow2.c \
633 block/qcow2-refcount.c \
634 block/qcow2-snapshot.c \
635 block/qcow2-cluster.c \
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100636 block/raw.c
637
638ifeq ($(HOST_OS),windows)
639 BLOCK_SOURCES += block/raw-win32.c
640else
641 BLOCK_SOURCES += block/raw-posix.c
642endif
643
644BLOCK_CFLAGS += $(EMULATOR_COMMON_CFLAGS)
David 'Digit' Turnercef730b2014-02-04 01:02:30 +0100645BLOCK_CFLAGS += -DCONFIG_BDRV_WHITELIST=\"\"
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100646
Lars Poeschel33da99a2012-08-22 09:42:42 +0200647##############################################################################
648##############################################################################
649###
650### emulator-libjpeg: TARGET-INDEPENDENT QEMU FUNCTIONS
651###
652### THESE ARE USED BY EVERYTHING EXCEPT 'emulator-ui'
653###
654
655common_LOCAL_CFLAGS =
656common_LOCAL_SRC_FILES =
657
658###########################################################
659# Jpeg configuration
660#
661LIBJPEG_DIR := distrib/jpeg-6b
662include $(LOCAL_PATH)/$(LIBJPEG_DIR)/sources.make
663
664common_LOCAL_SRC_FILES += $(LIBJPEG_SOURCES)
665
666common_LOCAL_CFLAGS += \
667 $(LIBJPEG_CFLAGS) \
668 -I$(LOCAL_PATH)/$(LIBJPEG_DIR)
669
670## one for 32-bit
671$(call start-emulator-library, emulator-libjpeg)
672LOCAL_CFLAGS += $(common_LOCAL_CFLAGS)
673LOCAL_SRC_FILES += $(common_LOCAL_SRC_FILES)
674$(call end-emulator-library)
675
676
677## another for 64-bit, see note in emulator64-common
David 'Digit' Turner9669d492014-06-12 01:20:53 +0200678$(call start-emulator64-library, emulator64-libjpeg)
679LOCAL_CFLAGS += $(common_LOCAL_CFLAGS)
680LOCAL_SRC_FILES += $(common_LOCAL_SRC_FILES)
681$(call end-emulator-library)
Lars Poeschel33da99a2012-08-22 09:42:42 +0200682
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100683
684##############################################################################
685##############################################################################
686###
David 'Digit' Turner8be0af82014-01-14 14:39:13 +0100687### emulator-libelff: TARGET-INDEPENDENT ELF/DWARF PARSER
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100688###
689### THESE ARE USED BY EVERYTHING EXCEPT 'emulator-ui', BUT WE CANNOT PUT
690### THEM IN emulator-libqemu SINCE THE SOURCES ARE C++
691###
692
Andrew Hsiehc7389bd2012-03-13 02:13:40 -0700693common_LOCAL_CFLAGS =
694common_LOCAL_SRC_FILES =
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100695
David 'Digit' Turnerf8f73752014-03-14 17:30:51 +0100696ELFF_CFLAGS := -I$(LOCAL_PATH)/distrib/elff
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100697ELFF_LDLIBS := -lstdc++
698
699ELFF_SOURCES := \
700 dwarf_cu.cc \
701 dwarf_die.cc \
702 dwarf_utils.cc \
703 elf_alloc.cc \
704 elf_file.cc \
705 elf_mapped_section.cc \
706 elff_api.cc \
707
David 'Digit' Turnerf8f73752014-03-14 17:30:51 +0100708common_LOCAL_SRC_FILES += $(ELFF_SOURCES:%=distrib/elff/elff/%)
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100709
Andrew Hsiehc7389bd2012-03-13 02:13:40 -0700710common_LOCAL_CFLAGS += \
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100711 -fno-exceptions \
712 $(ELFF_CFLAGS) \
713
Andrew Hsiehc7389bd2012-03-13 02:13:40 -0700714
715## one for 32-bit
716$(call start-emulator-library, emulator-libelff)
717LOCAL_CPP_EXTENSION := .cc
718LOCAL_CFLAGS += $(common_LOCAL_CFLAGS)
719LOCAL_SRC_FILES += $(common_LOCAL_SRC_FILES)
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100720$(call end-emulator-library)
721
722
David 'Digit' Turner9669d492014-06-12 01:20:53 +0200723$(call start-emulator64-library, emulator64-libelff)
724LOCAL_CPP_EXTENSION := .cc
725LOCAL_CFLAGS += $(common_LOCAL_CFLAGS)
726LOCAL_SRC_FILES += $(common_LOCAL_SRC_FILES)
727$(call end-emulator-library)
Andrew Hsiehc7389bd2012-03-13 02:13:40 -0700728
729
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100730##############################################################################
731##############################################################################
732###
733### gen-hx-header: Generate headers from .hx file with "hxtool" script.
734###
735### The 'hxtool' script is used to generate header files from an input
736### file with the .hx suffix. I.e. foo.hx --> foo.h
737###
738### Due to the way the Android build system works, we need to regenerate
739### it for each module (the output will go into a module-specific directory).
740###
741### This defines a function that can be used inside a module definition
742###
David 'Digit' Turner088edf82011-05-09 15:59:28 +0200743### $(call gen-hx-header,<input>,<output>,<source-files>)
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100744###
745### Where: <input> is the input file, with a .hx suffix (e.g. foo.hx)
David 'Digit' Turner088edf82011-05-09 15:59:28 +0200746### <output> is the output file, with a .h or .def suffix
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100747### <source-files> is a list of source files that include the header
748###
749
750
751gen-hx-header = $(eval $(call gen-hx-header-ev,$1,$2,$3))
752
753define gen-hx-header-ev
David 'Digit' Turner42fc4492011-06-29 13:16:16 +0200754intermediates := $$(call intermediates-dir-for,$$(LOCAL_MODULE_CLASS),$$(LOCAL_MODULE),true)
David 'Digit' Turner317c9d52011-05-10 06:38:21 +0200755
David 'Digit' Turner088edf82011-05-09 15:59:28 +0200756QEMU_HEADER_H := $$(intermediates)/$$2
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100757$$(QEMU_HEADER_H): PRIVATE_PATH := $$(LOCAL_PATH)
758$$(QEMU_HEADER_H): PRIVATE_CUSTOM_TOOL = $$(PRIVATE_PATH)/hxtool -h < $$< > $$@
759$$(QEMU_HEADER_H): $$(LOCAL_PATH)/$$1 $$(LOCAL_PATH)/hxtool
760 $$(transform-generated-source)
761
762LOCAL_GENERATED_SOURCES += $$(QEMU_HEADER_H)
David 'Digit' Turner088edf82011-05-09 15:59:28 +0200763LOCAL_C_INCLUDES += $$(intermediates)
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100764endef