blob: c6072d9211548ef74109c69278af9b22a618f17c [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' 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' Turneraff94b82011-02-07 18:10:54 +0100136 android/utils/ini.c \
David 'Digit' Turnerbbb81042011-03-17 14:48:44 +0100137 android/utils/intmap.c \
David 'Digit' Turner0a879bf2011-05-12 18:45:18 +0200138 android/utils/lineinput.c \
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100139 android/utils/mapfile.c \
140 android/utils/misc.c \
141 android/utils/panic.c \
142 android/utils/path.c \
David 'Digit' Turner5ea91482014-02-13 18:02:56 +0100143 android/utils/property_file.c \
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100144 android/utils/reflist.c \
145 android/utils/refset.c \
146 android/utils/stralloc.c \
147 android/utils/system.c \
148 android/utils/tempfile.c \
149 android/utils/vector.c \
David 'Digit' Turner60d0a152014-01-22 01:09:57 +0100150 android/utils/win32_cmdline_quote.c \
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100151
Andrew Hsiehc7389bd2012-03-13 02:13:40 -0700152common_LOCAL_CFLAGS += $(EMULATOR_COMMON_CFLAGS)
153
154
155## one for 32-bit
156$(call start-emulator-library, emulator-common)
157LOCAL_CFLAGS += $(common_LOCAL_CFLAGS)
158LOCAL_SRC_FILES += $(common_LOCAL_SRC_FILES)
David 'Digit' Turner42fc4492011-06-29 13:16:16 +0200159$(call gen-hw-config-defs)
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100160$(call end-emulator-library)
161
Andrew Hsiehc7389bd2012-03-13 02:13:40 -0700162## another for 64-bit
David 'Digit' Turner8be0af82014-01-14 14:39:13 +0100163# NOTE: only linux and darwin is supported, because for Windows,
164# amd64-mingw32msvc-gcc doesn't work, see http://b/issue?id=5949152.
Andrew Hsieh83df59c2012-07-24 16:06:28 -0700165ifneq ($(filter linux darwin,$(HOST_OS)),)
David 'Digit' Turner8be0af82014-01-14 14:39:13 +0100166 $(call start-emulator-library, emulator64-common)
167 LOCAL_CFLAGS += $(common_LOCAL_CFLAGS) -m64
168 LOCAL_SRC_FILES += $(common_LOCAL_SRC_FILES)
169 $(call gen-hw-config-defs)
170 $(call end-emulator-library)
Andrew Hsieh83df59c2012-07-24 16:06:28 -0700171endif # HOST_OS == linux || darwin
Andrew Hsiehc7389bd2012-03-13 02:13:40 -0700172
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100173##############################################################################
174##############################################################################
175###
176### emulator-libui: LIBRARY OF UI-RELATED FUNCTIONS
177###
178### THESE ARE USED BY 'emulator-ui' AND THE STANDALONE PROGRAMS
179###
180
Andrew Hsiehc7389bd2012-03-13 02:13:40 -0700181common_LOCAL_CFLAGS =
182common_LOCAL_SRC_FILES =
Andrew Hsiehc7389bd2012-03-13 02:13:40 -0700183common_LOCAL_CFLAGS += $(EMULATOR_COMMON_CFLAGS)
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100184
185###########################################################
186# Libpng configuration
187#
188LIBPNG_DIR := distrib/libpng-1.2.19
189include $(LOCAL_PATH)/$(LIBPNG_DIR)/sources.make
190
191EMULATOR_LIBUI_CFLAGS += \
192 $(LIBPNG_CFLAGS) \
193 -I$(LOCAL_PATH)/$(LIBPNG_DIR)
194
David 'Digit' Turner1634ff52013-12-14 23:31:41 +0100195common_LOCAL_SRC_FILES += $(LIBPNG_SOURCES) android/loadpng.c
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100196
197##############################################################################
198# SDL-related definitions
199#
200
201# Build SDL from sources except in certain cases where we use
202# prebuilt libraries instead.
203#
204BUILD_SDL_FROM_SOURCES := true
205
206# On linux-x86, using the prebuilts avoid installing all the X11
207# development packages on our build servers.
208#
209ifeq ($(QEMU_HOST_TAG),linux-x86)
210 BUILD_SDL_FROM_SOURCES := false
211endif
212
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100213# If we're building with android-configure.sh && make, always build from
214# sources to catch regressions as soon as they happen.
215#
216ifeq ($(BUILD_STANDALONE_EMULATOR),true)
217 BUILD_SDL_FROM_SOURCES := true
218endif
219
220# Except if we used android-configure.sh --sdl-config=<script>
221#
David 'Digit' Turnera4026682011-08-24 12:54:01 +0200222ifneq ($(QEMU_SDL_CONFIG),)
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100223 BUILD_SDL_FROM_SOURCES := false
David 'Digit' Turnera4026682011-08-24 12:54:01 +0200224 SDL_CONFIG := $(QEMU_SDL_CONFIG)
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100225endif
226
227ifneq ($(BUILD_SDL_FROM_SOURCES),true)
228
Xavier Ducrohet20821322012-04-03 16:39:24 -0700229 SDL_CONFIG ?= prebuilts/tools/$(QEMU_HOST_TAG)/sdl/bin/sdl-config
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100230 SDL_CFLAGS := $(shell $(SDL_CONFIG) --cflags)
231
232 # We need to filter out the _GNU_SOURCE variable because it breaks recent
233 # releases of Cygwin when using the -mno-cygwin option. Moreover, we don't
234 # need this macro at all to build the Android emulator.
235 SDL_CFLAGS := $(filter-out -D_GNU_SOURCE=1,$(SDL_CFLAGS))
236 SDL_LDLIBS := $(filter-out %.a %.lib,$(shell $(SDL_CONFIG) --static-libs))
237
238 # Circular dependencies between libSDL and libSDLmain
239 # We repeat the libraries in the final link to work around it
240 SDL_STATIC_LIBRARIES := libSDL libSDLmain libSDL libSDLmain
Andrew Hsiehc7389bd2012-03-13 02:13:40 -0700241 SDL_STATIC_LIBRARIES_64 := lib64SDL lib64SDLmain lib64SDL lib64SDLmain
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100242
243else # BUILD_SDL_FROM_SOURCES
244
Jesse Hallc60b1142012-07-17 17:01:04 -0700245 SDL_DIR := distrib/sdl-1.2.15
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100246 include $(LOCAL_PATH)/$(SDL_DIR)/sources.make
Andrew Hsiehc7389bd2012-03-13 02:13:40 -0700247 common_LOCAL_SRC_FILES += $(SDL_SOURCES)
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100248
249 EMULATOR_LIBUI_CFLAGS += \
250 -I$(LOCAL_PATH)/$(SDL_DIR)/include
251
252 SDL_STATIC_LIBRARIES :=
253
254endif # BUILD_SDL_FROM_SOURCES
255
256EMULATOR_LIBUI_CFLAGS += $(SDL_CFLAGS)
257EMULATOR_LIBUI_LDLIBS += $(SDL_LDLIBS)
258
259# The following is needed by SDL_LoadObject
260ifneq ($(HOST_OS),windows)
261 EMULATOR_LIBUI_LDLIBS += -ldl
262endif
263
264# the skin support sources
265#
266SKIN_SOURCES := rect.c \
267 region.c \
268 image.c \
269 trackball.c \
270 keyboard.c \
271 keyset.c \
272 file.c \
273 window.c \
274 scaler.c \
275 composer.c \
276 surface.c \
277
Andrew Hsiehc7389bd2012-03-13 02:13:40 -0700278common_LOCAL_SRC_FILES += $(SKIN_SOURCES:%=android/skin/%)
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100279
Andrew Hsiehc7389bd2012-03-13 02:13:40 -0700280common_LOCAL_SRC_FILES += \
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100281 android/user-config.c \
282 android/resource.c \
283 android/qemulator.c \
284 android/keycode.c \
285
286# enable MMX code for our skin scaler
287ifeq ($(HOST_ARCH),x86)
Andrew Hsiehc7389bd2012-03-13 02:13:40 -0700288common_LOCAL_CFLAGS += -DUSE_MMX=1 -mmmx
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100289endif
290
Andrew Hsiehc7389bd2012-03-13 02:13:40 -0700291common_LOCAL_CFLAGS += $(EMULATOR_LIBUI_CFLAGS)
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100292
Andrew Hsiehc7389bd2012-03-13 02:13:40 -0700293
294## one for 32-bit
295$(call start-emulator-library, emulator-libui)
296LOCAL_CFLAGS += $(common_LOCAL_CFLAGS)
297LOCAL_SRC_FILES += $(common_LOCAL_SRC_FILES)
298$(call gen-hw-config-defs)
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100299$(call end-emulator-library)
300
Andrew Hsiehc7389bd2012-03-13 02:13:40 -0700301
302## another for 64-bit, see note in emulator64-common
Andrew Hsieh83df59c2012-07-24 16:06:28 -0700303ifneq ($(filter linux darwin,$(HOST_OS)),)
David 'Digit' Turner8be0af82014-01-14 14:39:13 +0100304 $(call start-emulator-library, emulator64-libui)
305 LOCAL_CFLAGS += $(common_LOCAL_CFLAGS) -m64
306 LOCAL_SRC_FILES += $(common_LOCAL_SRC_FILES)
307 $(call gen-hw-config-defs)
308 $(call end-emulator-library)
Andrew Hsieh83df59c2012-07-24 16:06:28 -0700309endif # HOST_OS == linux || darwin
Andrew Hsiehc7389bd2012-03-13 02:13:40 -0700310
311
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100312##############################################################################
313##############################################################################
314###
315### emulator-libqemu: TARGET-INDEPENDENT QEMU FUNCTIONS
316###
317### THESE ARE USED BY EVERYTHING EXCEPT 'emulator-ui'
318###
319
Andrew Hsiehc7389bd2012-03-13 02:13:40 -0700320common_LOCAL_CFLAGS =
321common_LOCAL_SRC_FILES =
322
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100323
324EMULATOR_LIBQEMU_CFLAGS :=
325
Andrew Hsiehc7389bd2012-03-13 02:13:40 -0700326common_LOCAL_CFLAGS += $(EMULATOR_COMMON_CFLAGS)
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100327
328AUDIO_SOURCES := noaudio.c wavaudio.c wavcapture.c mixeng.c
329AUDIO_CFLAGS := -I$(LOCAL_PATH)/audio -DHAS_AUDIO
330AUDIO_LDLIBS :=
331
Raphael Moll9e319a92012-11-28 13:48:25 -0800332common_LOCAL_CFLAGS += -Wall $(GCC_W_NO_MISSING_FIELD_INITIALIZERS)
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100333
334ifeq ($(HOST_OS),darwin)
335 CONFIG_COREAUDIO ?= yes
336 AUDIO_CFLAGS += -DHOST_BSD=1
337endif
338
339ifeq ($(HOST_OS),windows)
340 CONFIG_WINAUDIO ?= yes
341endif
342
343ifeq ($(HOST_OS),linux)
344 CONFIG_OSS ?= yes
345 CONFIG_ALSA ?= yes
346 CONFIG_PULSEAUDIO ?= yes
347 CONFIG_ESD ?= yes
348endif
349
350ifeq ($(HOST_OS),freebsd)
351 CONFIG_OSS ?= yes
352endif
353
354ifeq ($(CONFIG_COREAUDIO),yes)
355 AUDIO_SOURCES += coreaudio.c
356 AUDIO_CFLAGS += -DCONFIG_COREAUDIO
357 AUDIO_LDLIBS += -Wl,-framework,CoreAudio
358endif
359
360ifeq ($(CONFIG_WINAUDIO),yes)
361 AUDIO_SOURCES += winaudio.c
362 AUDIO_CFLAGS += -DCONFIG_WINAUDIO
363endif
364
365ifeq ($(CONFIG_PULSEAUDIO),yes)
366 AUDIO_SOURCES += paaudio.c audio_pt_int.c
367 AUDIO_CFLAGS += -DCONFIG_PULSEAUDIO
368endif
369
370ifeq ($(CONFIG_ALSA),yes)
371 AUDIO_SOURCES += alsaaudio.c audio_pt_int.c
372 AUDIO_CFLAGS += -DCONFIG_ALSA
373endif
374
375ifeq ($(CONFIG_ESD),yes)
376 AUDIO_SOURCES += esdaudio.c
377 AUDIO_CFLAGS += -DCONFIG_ESD
378endif
379
380ifeq ($(CONFIG_OSS),yes)
381 AUDIO_SOURCES += ossaudio.c
382 AUDIO_CFLAGS += -DCONFIG_OSS
383endif
384
385AUDIO_SOURCES := $(call sort,$(AUDIO_SOURCES:%=audio/%))
386
Andrew Hsiehc7389bd2012-03-13 02:13:40 -0700387common_LOCAL_CFLAGS += -Wno-sign-compare \
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100388 -fno-strict-aliasing -W -Wall -Wno-unused-parameter \
389
390# this is very important, otherwise the generated binaries may
391# not link properly on our build servers
392ifeq ($(HOST_OS),linux)
Andrew Hsiehc7389bd2012-03-13 02:13:40 -0700393common_LOCAL_CFLAGS += -fno-stack-protector
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100394endif
395
Andrew Hsiehc7389bd2012-03-13 02:13:40 -0700396common_LOCAL_SRC_FILES += $(AUDIO_SOURCES)
397common_LOCAL_SRC_FILES += \
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100398 android/audio-test.c
399
400# other flags
401ifneq ($(HOST_OS),windows)
402 AUDIO_LDLIBS += -ldl
403else
404endif
405
406
407EMULATOR_LIBQEMU_CFLAGS += $(AUDIO_CFLAGS)
408EMULATOR_LIBQEMU_LDLIBS += $(AUDIO_LDLIBS)
409
Raphael Moll9e319a92012-11-28 13:48:25 -0800410common_LOCAL_CFLAGS += $(GCC_W_NO_MISSING_FIELD_INITIALIZERS)
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100411
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100412# misc. sources
413#
414CORE_MISC_SOURCES = \
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100415 aio-android.c \
416 async.c \
417 bt-host.c \
418 bt-vhci.c \
David 'Digit' Turner8354d2d2011-05-11 00:19:06 +0200419 iohandler.c \
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100420 ioport.c \
David 'Digit' Turnerdc7a2b62014-01-28 04:57:43 +0100421 migration-dummy-android.c \
David 'Digit' Turner3b2846a2011-05-11 01:34:40 +0200422 qemu-char.c \
David 'Digit' Turner67c35562014-01-16 18:24:09 +0100423 qemu-log.c \
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100424 savevm.c \
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100425 android/boot-properties.c \
David 'Digit' Turnere1e03df2013-12-15 00:42:21 +0100426 android/cbuffer.c \
427 android/charpipe.c \
David 'Digit' Turner73dd5fc2014-02-04 12:50:55 +0100428 android/config-file.c \
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100429 android/core-init-utils.c \
430 android/gps.c \
431 android/hw-kmsg.c \
432 android/hw-lcd.c \
433 android/hw-events.c \
434 android/hw-control.c \
435 android/hw-sensors.c \
436 android/hw-qemud.c \
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100437 android/looper-qemu.c \
David 'Digit' Turnerc0ac7332011-05-02 15:05:35 +0200438 android/hw-pipe-net.c \
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100439 android/qemu-setup.c \
David 'Digit' Turner6e2eb782013-12-15 00:54:21 +0100440 android/qemu-tcpdump.c \
David 'Digit' Turnercc330d42013-12-14 23:26:42 +0100441 android/shaper.c \
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100442 android/snapshot.c \
Vladimir Chtchetkine9d36fe72012-03-26 10:29:20 -0700443 android/async-socket-connector.c \
Vladimir Chtchetkinea7383ef2012-03-29 07:34:07 -0700444 android/async-socket.c \
Vladimir Chtchetkinec8aa2c52012-04-05 16:22:55 -0700445 android/sdk-controller-socket.c \
Vladimir Chtchetkinedb611d52011-11-01 17:35:07 -0700446 android/sensors-port.c \
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100447 android/utils/timezone.c \
Vladimir Chtchetkinec646f5e2011-09-03 15:17:13 -0700448 android/camera/camera-format-converters.c \
Vladimir Chtchetkined86c7242011-12-09 15:45:46 -0800449 android/camera/camera-service.c \
450 android/adb-server.c \
Vladimir Chtchetkinedb450d72012-01-12 13:37:40 -0800451 android/adb-qemud.c \
Vladimir Chtchetkine8dd31e82012-02-15 17:16:04 -0800452 android/snaphost-android.c \
453 android/multitouch-screen.c \
454 android/multitouch-port.c \
David 'Digit' Turner84569132013-12-13 17:34:07 +0100455 android/utils/jpeg-compress.c \
David 'Digit' Turnercc330d42013-12-14 23:26:42 +0100456 net/net-android.c \
David 'Digit' Turner1c31e3e2013-12-14 20:07:17 +0100457 qobject/qerror.c \
David 'Digit' Turner2e36f052014-01-16 16:22:47 +0100458 qom/container.c \
459 qom/object.c \
460 qom/qom-qobject.c \
David 'Digit' Turner1c31e3e2013-12-14 20:07:17 +0100461 ui/console.c \
462 ui/d3des.c \
David 'Digit' Turnerd7088e92013-12-17 09:25:19 +0100463 ui/input.c \
David 'Digit' Turner1c31e3e2013-12-14 20:07:17 +0100464 ui/vnc-android.c \
David 'Digit' Turner37dc41a2013-12-14 14:45:51 +0100465 util/aes.c \
David 'Digit' Turnere90d6652013-12-14 14:55:12 +0100466 util/cutils.c \
David 'Digit' Turner910aea92014-01-15 16:53:38 +0100467 util/error.c \
David 'Digit' Turner1befd342014-01-15 17:56:45 +0100468 util/hexdump.c \
469 util/iov.c \
David 'Digit' Turnere90d6652013-12-14 14:55:12 +0100470 util/module.c \
471 util/notify.c \
David 'Digit' Turner84569132013-12-13 17:34:07 +0100472 util/osdep.c \
David 'Digit' Turner1c31e3e2013-12-14 20:07:17 +0100473 util/path.c \
474 util/qemu-config.c \
475 util/qemu-error.c \
476 util/qemu-option.c \
477 util/qemu-sockets-android.c \
David 'Digit' Turner910aea92014-01-15 16:53:38 +0100478 util/unicode.c \
David 'Digit' Turnerc79de3c2014-01-23 04:17:24 +0100479 util/yield-android.c \
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100480
481ifeq ($(HOST_ARCH),x86)
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),x86_64)
David 'Digit' Turnercc33b2d2013-12-15 00:09:42 +0100485 CORE_MISC_SOURCES += disas/i386.c
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100486endif
487ifeq ($(HOST_ARCH),ppc)
David 'Digit' Turnercc33b2d2013-12-15 00:09:42 +0100488 CORE_MISC_SOURCES += disas/ppc.c \
David 'Digit' Turner37dc41a2013-12-14 14:45:51 +0100489 util/cache-utils.c
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100490endif
491
492ifeq ($(HOST_OS),linux)
David 'Digit' Turnerd471c922013-12-17 09:52:48 +0100493 CORE_MISC_SOURCES += hw/usb/usb-linux.c \
David 'Digit' Turner76bc27e2014-02-12 20:48:04 +0100494 util/compatfd.c \
David 'Digit' Turner086e66e2014-02-04 22:24:36 +0100495 util/qemu-thread-posix.c \
Vladimir Chtchetkine4ed09fd2011-08-18 09:42:40 -0700496 android/camera/camera-capture-linux.c
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100497else
David 'Digit' Turnerd471c922013-12-17 09:52:48 +0100498 CORE_MISC_SOURCES += hw/usb/usb-dummy-android.c
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100499endif
500
501ifeq ($(HOST_OS),windows)
Vladimir Chtchetkine4ed09fd2011-08-18 09:42:40 -0700502 CORE_MISC_SOURCES += tap-win32.c \
David 'Digit' Turner086e66e2014-02-04 22:24:36 +0100503 android/camera/camera-capture-windows.c \
504 util/qemu-thread-win32.c
Vladimir Chtchetkine4ed09fd2011-08-18 09:42:40 -0700505
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100506else
507 CORE_MISC_SOURCES += posix-aio-compat.c
508endif
509
Vladimir Chtchetkineb92b3032011-09-12 15:29:32 -0700510ifeq ($(HOST_OS),darwin)
David 'Digit' Turner086e66e2014-02-04 22:24:36 +0100511 CORE_MISC_SOURCES += android/camera/camera-capture-mac.m \
David 'Digit' Turner76bc27e2014-02-12 20:48:04 +0100512 util/compatfd.c \
David 'Digit' Turner086e66e2014-02-04 22:24:36 +0100513 util/qemu-thread-posix.c
Vladimir Chtchetkineb92b3032011-09-12 15:29:32 -0700514endif
515
Andrew Hsiehc7389bd2012-03-13 02:13:40 -0700516common_LOCAL_SRC_FILES += $(CORE_MISC_SOURCES)
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100517
518# Required
Lars Poeschel33da99a2012-08-22 09:42:42 +0200519common_LOCAL_CFLAGS += -D_XOPEN_SOURCE=600 -D_BSD_SOURCE=1 -I$(LOCAL_PATH)/distrib/jpeg-6b
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100520
521SLIRP_SOURCES := \
522 bootp.c \
523 cksum.c \
524 debug.c \
525 if.c \
526 ip_icmp.c \
527 ip_input.c \
528 ip_output.c \
529 mbuf.c \
530 misc.c \
531 sbuf.c \
532 slirp.c \
533 socket.c \
534 tcp_input.c \
535 tcp_output.c \
536 tcp_subr.c \
537 tcp_timer.c \
538 tftp.c \
539 udp.c
540
Andrew Hsiehc7389bd2012-03-13 02:13:40 -0700541common_LOCAL_SRC_FILES += $(SLIRP_SOURCES:%=slirp-android/%)
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100542EMULATOR_LIBQEMU_CFLAGS += -I$(LOCAL_PATH)/slirp-android
543
544# socket proxy support
545#
546PROXY_SOURCES := \
547 proxy_common.c \
548 proxy_http.c \
549 proxy_http_connector.c \
550 proxy_http_rewriter.c \
551
Andrew Hsiehc7389bd2012-03-13 02:13:40 -0700552common_LOCAL_SRC_FILES += $(PROXY_SOURCES:%=proxy/%)
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100553EMULATOR_LIBQEMU_CFLAGS += -I$(LOCAL_PATH)/proxy
554
555# include telephony stuff
556#
557TELEPHONY_SOURCES := \
558 android_modem.c \
559 modem_driver.c \
560 gsm.c \
561 sim_card.c \
562 sysdeps_qemu.c \
563 sms.c \
564 remote_call.c
565
Andrew Hsiehc7389bd2012-03-13 02:13:40 -0700566common_LOCAL_SRC_FILES += $(TELEPHONY_SOURCES:%=telephony/%)
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100567EMULATOR_LIBQEMU_CFLAGS += -I$(LOCAL_PATH)/telephony
568
569# sources inherited from upstream, but not fully
570# integrated into android emulator
571#
Andrew Hsiehc7389bd2012-03-13 02:13:40 -0700572common_LOCAL_SRC_FILES += \
David 'Digit' Turner1c31e3e2013-12-14 20:07:17 +0100573 qobject/json-lexer.c \
574 qobject/json-parser.c \
575 qobject/json-streamer.c \
576 qobject/qjson.c \
577 qobject/qbool.c \
578 qobject/qdict.c \
579 qobject/qfloat.c \
580 qobject/qint.c \
581 qobject/qlist.c \
582 qobject/qstring.c \
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100583
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100584ifeq ($(QEMU_TARGET_XML_SOURCES),)
585 QEMU_TARGET_XML_SOURCES := arm-core arm-neon arm-vfp arm-vfp3
586 QEMU_TARGET_XML_SOURCES := $(QEMU_TARGET_XML_SOURCES:%=$(LOCAL_PATH)/gdb-xml/%.xml)
587endif
588
Andrew Hsiehc7389bd2012-03-13 02:13:40 -0700589common_LOCAL_CFLAGS += $(EMULATOR_LIBQEMU_CFLAGS)
590
591
592## one for 32-bit
593$(call start-emulator-library, emulator-libqemu)
594# gdbstub-xml.c contains C-compilable arrays corresponding to the content
595# of $(LOCAL_PATH)/gdb-xml/, and is generated with the 'feature_to_c.sh' script.
596#
597intermediates = $(call intermediates-dir-for,STATIC_LIBRARIES,$(LOCAL_MODULE),true)
598QEMU_GDBSTUB_XML_C = $(intermediates)/gdbstub-xml.c
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100599$(QEMU_GDBSTUB_XML_C): PRIVATE_PATH := $(LOCAL_PATH)
600$(QEMU_GDBSTUB_XML_C): PRIVATE_SOURCES := $(TARGET_XML_SOURCES)
601$(QEMU_GDBSTUB_XML_C): PRIVATE_CUSTOM_TOOL = $(PRIVATE_PATH)/feature_to_c.sh $@ $(QEMU_TARGET_XML_SOURCES)
602$(QEMU_GDBSTUB_XML_C): $(QEMU_TARGET_XML_SOURCES) $(LOCAL_PATH)/feature_to_c.sh
603 $(hide) rm -f $@
604 $(transform-generated-source)
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100605LOCAL_GENERATED_SOURCES += $(QEMU_GDBSTUB_XML_C)
Andrew Hsiehc7389bd2012-03-13 02:13:40 -0700606LOCAL_CFLAGS += $(common_LOCAL_CFLAGS) -I$(intermediates)
607LOCAL_SRC_FILES += $(common_LOCAL_SRC_FILES)
608$(call gen-hw-config-defs)
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100609$(call end-emulator-library)
610
Andrew Hsiehc7389bd2012-03-13 02:13:40 -0700611
612## another for 64-bit, see note in emulator64-common
Andrew Hsieh83df59c2012-07-24 16:06:28 -0700613ifneq ($(filter linux darwin,$(HOST_OS)),)
David 'Digit' Turner8be0af82014-01-14 14:39:13 +0100614 $(call start-emulator-library, emulator64-libqemu)
615 # gdbstub-xml.c contains C-compilable arrays corresponding to the content
616 # of $(LOCAL_PATH)/gdb-xml/, and is generated with the 'feature_to_c.sh' script.
617 #
618 intermediates = $(call intermediates-dir-for,STATIC_LIBRARIES,$(LOCAL_MODULE),true)
619 QEMU_GDBSTUB_XML_C = $(intermediates)/gdbstub-xml.c
620 $(QEMU_GDBSTUB_XML_C): PRIVATE_PATH := $(LOCAL_PATH)
621 $(QEMU_GDBSTUB_XML_C): PRIVATE_SOURCES := $(TARGET_XML_SOURCES)
622 $(QEMU_GDBSTUB_XML_C): PRIVATE_CUSTOM_TOOL = $(PRIVATE_PATH)/feature_to_c.sh $@ $(QEMU_TARGET_XML_SOURCES)
623 $(QEMU_GDBSTUB_XML_C): $(QEMU_TARGET_XML_SOURCES) $(LOCAL_PATH)/feature_to_c.sh
Andrew Hsiehc7389bd2012-03-13 02:13:40 -0700624 $(hide) rm -f $@
625 $(transform-generated-source)
David 'Digit' Turner8be0af82014-01-14 14:39:13 +0100626 LOCAL_GENERATED_SOURCES += $(QEMU_GDBSTUB_XML_C)
627 LOCAL_CFLAGS += $(common_LOCAL_CFLAGS) -I$(intermediates) -m64
628 LOCAL_SRC_FILES += $(common_LOCAL_SRC_FILES)
629 $(call gen-hw-config-defs)
630 $(call end-emulator-library)
Andrew Hsieh83df59c2012-07-24 16:06:28 -0700631endif # HOST_OS == linux || darwin
Andrew Hsiehc7389bd2012-03-13 02:13:40 -0700632
633
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100634# Block sources, we must compile them with each executable because they
635# are only referenced by the rest of the code using constructor functions.
636# If their object files are put in a static library, these are never compiled
637# into the final linked executable that uses them.
638#
639# Normally, one would solve thus using LOCAL_WHOLE_STATIC_LIBRARIES, but
640# the Darwin linker doesn't support -Wl,--whole-archive or equivalent :-(
641#
642BLOCK_SOURCES += \
643 block.c \
644 blockdev.c \
645 block/qcow.c \
646 block/qcow2.c \
647 block/qcow2-refcount.c \
648 block/qcow2-snapshot.c \
649 block/qcow2-cluster.c \
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100650 block/raw.c
651
652ifeq ($(HOST_OS),windows)
653 BLOCK_SOURCES += block/raw-win32.c
654else
655 BLOCK_SOURCES += block/raw-posix.c
656endif
657
658BLOCK_CFLAGS += $(EMULATOR_COMMON_CFLAGS)
David 'Digit' Turnercef730b2014-02-04 01:02:30 +0100659BLOCK_CFLAGS += -DCONFIG_BDRV_WHITELIST=\"\"
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100660
Lars Poeschel33da99a2012-08-22 09:42:42 +0200661##############################################################################
662##############################################################################
663###
664### emulator-libjpeg: TARGET-INDEPENDENT QEMU FUNCTIONS
665###
666### THESE ARE USED BY EVERYTHING EXCEPT 'emulator-ui'
667###
668
669common_LOCAL_CFLAGS =
670common_LOCAL_SRC_FILES =
671
672###########################################################
673# Jpeg configuration
674#
675LIBJPEG_DIR := distrib/jpeg-6b
676include $(LOCAL_PATH)/$(LIBJPEG_DIR)/sources.make
677
678common_LOCAL_SRC_FILES += $(LIBJPEG_SOURCES)
679
680common_LOCAL_CFLAGS += \
681 $(LIBJPEG_CFLAGS) \
682 -I$(LOCAL_PATH)/$(LIBJPEG_DIR)
683
684## one for 32-bit
685$(call start-emulator-library, emulator-libjpeg)
686LOCAL_CFLAGS += $(common_LOCAL_CFLAGS)
687LOCAL_SRC_FILES += $(common_LOCAL_SRC_FILES)
688$(call end-emulator-library)
689
690
691## another for 64-bit, see note in emulator64-common
Andrew Hsieh6eb25c72012-08-24 08:18:22 +0800692ifneq ($(filter linux darwin,$(HOST_OS)),)
David 'Digit' Turner8be0af82014-01-14 14:39:13 +0100693 $(call start-emulator-library, emulator64-libjpeg)
694 LOCAL_CFLAGS += $(common_LOCAL_CFLAGS) -m64
695 LOCAL_SRC_FILES += $(common_LOCAL_SRC_FILES)
696 $(call end-emulator-library)
Lars Poeschel33da99a2012-08-22 09:42:42 +0200697endif # HOST_OS == linux
698
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100699
700##############################################################################
701##############################################################################
702###
David 'Digit' Turner8be0af82014-01-14 14:39:13 +0100703### emulator-libelff: TARGET-INDEPENDENT ELF/DWARF PARSER
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100704###
705### THESE ARE USED BY EVERYTHING EXCEPT 'emulator-ui', BUT WE CANNOT PUT
706### THEM IN emulator-libqemu SINCE THE SOURCES ARE C++
707###
708
Andrew Hsiehc7389bd2012-03-13 02:13:40 -0700709common_LOCAL_CFLAGS =
710common_LOCAL_SRC_FILES =
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100711
712ELFF_CFLAGS := -I$(LOCAL_PATH)/elff
713ELFF_LDLIBS := -lstdc++
714
715ELFF_SOURCES := \
716 dwarf_cu.cc \
717 dwarf_die.cc \
718 dwarf_utils.cc \
719 elf_alloc.cc \
720 elf_file.cc \
721 elf_mapped_section.cc \
722 elff_api.cc \
723
Andrew Hsiehc7389bd2012-03-13 02:13:40 -0700724common_LOCAL_SRC_FILES += $(ELFF_SOURCES:%=elff/%)
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100725
Andrew Hsiehc7389bd2012-03-13 02:13:40 -0700726common_LOCAL_CFLAGS += \
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100727 -fno-exceptions \
728 $(ELFF_CFLAGS) \
729
Andrew Hsiehc7389bd2012-03-13 02:13:40 -0700730
731## one for 32-bit
732$(call start-emulator-library, emulator-libelff)
733LOCAL_CPP_EXTENSION := .cc
734LOCAL_CFLAGS += $(common_LOCAL_CFLAGS)
735LOCAL_SRC_FILES += $(common_LOCAL_SRC_FILES)
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100736$(call end-emulator-library)
737
738
Andrew Hsiehc7389bd2012-03-13 02:13:40 -0700739## another for 64-bit, see note in emulator64-common
Andrew Hsieh83df59c2012-07-24 16:06:28 -0700740ifneq ($(filter linux darwin,$(HOST_OS)),)
David 'Digit' Turner8be0af82014-01-14 14:39:13 +0100741 $(call start-emulator-library, emulator64-libelff)
742 LOCAL_CPP_EXTENSION := .cc
743 LOCAL_CFLAGS += $(common_LOCAL_CFLAGS) -m64
744 LOCAL_SRC_FILES += $(common_LOCAL_SRC_FILES)
745 $(call end-emulator-library)
Andrew Hsieh83df59c2012-07-24 16:06:28 -0700746endif # HOST_OS == linux || darwin
Andrew Hsiehc7389bd2012-03-13 02:13:40 -0700747
748
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100749##############################################################################
750##############################################################################
751###
752### gen-hx-header: Generate headers from .hx file with "hxtool" script.
753###
754### The 'hxtool' script is used to generate header files from an input
755### file with the .hx suffix. I.e. foo.hx --> foo.h
756###
757### Due to the way the Android build system works, we need to regenerate
758### it for each module (the output will go into a module-specific directory).
759###
760### This defines a function that can be used inside a module definition
761###
David 'Digit' Turner088edf82011-05-09 15:59:28 +0200762### $(call gen-hx-header,<input>,<output>,<source-files>)
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100763###
764### Where: <input> is the input file, with a .hx suffix (e.g. foo.hx)
David 'Digit' Turner088edf82011-05-09 15:59:28 +0200765### <output> is the output file, with a .h or .def suffix
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100766### <source-files> is a list of source files that include the header
767###
768
769
770gen-hx-header = $(eval $(call gen-hx-header-ev,$1,$2,$3))
771
772define gen-hx-header-ev
David 'Digit' Turner42fc4492011-06-29 13:16:16 +0200773intermediates := $$(call intermediates-dir-for,$$(LOCAL_MODULE_CLASS),$$(LOCAL_MODULE),true)
David 'Digit' Turner317c9d52011-05-10 06:38:21 +0200774
David 'Digit' Turner088edf82011-05-09 15:59:28 +0200775QEMU_HEADER_H := $$(intermediates)/$$2
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100776$$(QEMU_HEADER_H): PRIVATE_PATH := $$(LOCAL_PATH)
777$$(QEMU_HEADER_H): PRIVATE_CUSTOM_TOOL = $$(PRIVATE_PATH)/hxtool -h < $$< > $$@
778$$(QEMU_HEADER_H): $$(LOCAL_PATH)/$$1 $$(LOCAL_PATH)/hxtool
779 $$(transform-generated-source)
780
781LOCAL_GENERATED_SOURCES += $$(QEMU_HEADER_H)
David 'Digit' Turner088edf82011-05-09 15:59:28 +0200782LOCAL_C_INCLUDES += $$(intermediates)
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100783endef
784