blob: 1074184ffde405896e63b1e49cc7c157527afeb3 [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#
91ZLIB_DIR := distrib/zlib-1.2.3
92include $(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 \
121 android/utils/assert.c \
122 android/utils/bufprint.c \
123 android/utils/debug.c \
David 'Digit' Turner816e53c2011-08-17 18:33:45 +0200124 android/utils/dll.c \
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100125 android/utils/dirscanner.c \
126 android/utils/filelock.c \
127 android/utils/ini.c \
David 'Digit' Turnerbbb81042011-03-17 14:48:44 +0100128 android/utils/intmap.c \
David 'Digit' Turner0a879bf2011-05-12 18:45:18 +0200129 android/utils/lineinput.c \
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100130 android/utils/mapfile.c \
131 android/utils/misc.c \
132 android/utils/panic.c \
133 android/utils/path.c \
134 android/utils/reflist.c \
135 android/utils/refset.c \
136 android/utils/stralloc.c \
137 android/utils/system.c \
138 android/utils/tempfile.c \
139 android/utils/vector.c \
140
Andrew Hsiehc7389bd2012-03-13 02:13:40 -0700141common_LOCAL_CFLAGS += $(EMULATOR_COMMON_CFLAGS)
142
143
144## one for 32-bit
145$(call start-emulator-library, emulator-common)
146LOCAL_CFLAGS += $(common_LOCAL_CFLAGS)
147LOCAL_SRC_FILES += $(common_LOCAL_SRC_FILES)
David 'Digit' Turner42fc4492011-06-29 13:16:16 +0200148$(call gen-hw-config-defs)
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100149$(call end-emulator-library)
150
Andrew Hsiehc7389bd2012-03-13 02:13:40 -0700151## another for 64-bit
David 'Digit' Turnerf6f50072014-01-14 14:39:13 +0100152# NOTE: only linux and darwin is supported, because for Windows,
153# amd64-mingw32msvc-gcc doesn't work, see http://b/issue?id=5949152.
Andrew Hsieh83df59c2012-07-24 16:06:28 -0700154ifneq ($(filter linux darwin,$(HOST_OS)),)
David 'Digit' Turnerf6f50072014-01-14 14:39:13 +0100155 $(call start-emulator-library, emulator64-common)
156 LOCAL_CFLAGS += $(common_LOCAL_CFLAGS) -m64
157 LOCAL_SRC_FILES += $(common_LOCAL_SRC_FILES)
158 $(call gen-hw-config-defs)
159 $(call end-emulator-library)
Andrew Hsieh83df59c2012-07-24 16:06:28 -0700160endif # HOST_OS == linux || darwin
Andrew Hsiehc7389bd2012-03-13 02:13:40 -0700161
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100162##############################################################################
163##############################################################################
164###
165### emulator-libui: LIBRARY OF UI-RELATED FUNCTIONS
166###
167### THESE ARE USED BY 'emulator-ui' AND THE STANDALONE PROGRAMS
168###
169
Andrew Hsiehc7389bd2012-03-13 02:13:40 -0700170common_LOCAL_CFLAGS =
171common_LOCAL_SRC_FILES =
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100172
Jesse Hall183e9272012-04-26 15:13:27 -0700173ifneq ($(QEMU_OPENGLES_INCLUDE),)
174 EMULATOR_LIBUI_CFLAGS := -I$(QEMU_OPENGLES_INCLUDE)
175endif
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100176
Andrew Hsiehc7389bd2012-03-13 02:13:40 -0700177common_LOCAL_CFLAGS += $(EMULATOR_COMMON_CFLAGS)
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100178
179###########################################################
180# Libpng configuration
181#
182LIBPNG_DIR := distrib/libpng-1.2.19
183include $(LOCAL_PATH)/$(LIBPNG_DIR)/sources.make
184
185EMULATOR_LIBUI_CFLAGS += \
186 $(LIBPNG_CFLAGS) \
187 -I$(LOCAL_PATH)/$(LIBPNG_DIR)
188
David 'Digit' Turner1634ff52013-12-14 23:31:41 +0100189common_LOCAL_SRC_FILES += $(LIBPNG_SOURCES) android/loadpng.c
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100190
191##############################################################################
192# SDL-related definitions
193#
194
195# Build SDL from sources except in certain cases where we use
196# prebuilt libraries instead.
197#
198BUILD_SDL_FROM_SOURCES := true
199
200# On linux-x86, using the prebuilts avoid installing all the X11
201# development packages on our build servers.
202#
203ifeq ($(QEMU_HOST_TAG),linux-x86)
204 BUILD_SDL_FROM_SOURCES := false
205endif
206
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100207# If we're building with android-configure.sh && make, always build from
208# sources to catch regressions as soon as they happen.
209#
210ifeq ($(BUILD_STANDALONE_EMULATOR),true)
211 BUILD_SDL_FROM_SOURCES := true
212endif
213
214# Except if we used android-configure.sh --sdl-config=<script>
215#
David 'Digit' Turnera4026682011-08-24 12:54:01 +0200216ifneq ($(QEMU_SDL_CONFIG),)
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100217 BUILD_SDL_FROM_SOURCES := false
David 'Digit' Turnera4026682011-08-24 12:54:01 +0200218 SDL_CONFIG := $(QEMU_SDL_CONFIG)
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100219endif
220
221ifneq ($(BUILD_SDL_FROM_SOURCES),true)
222
Xavier Ducrohet20821322012-04-03 16:39:24 -0700223 SDL_CONFIG ?= prebuilts/tools/$(QEMU_HOST_TAG)/sdl/bin/sdl-config
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100224 SDL_CFLAGS := $(shell $(SDL_CONFIG) --cflags)
225
226 # We need to filter out the _GNU_SOURCE variable because it breaks recent
227 # releases of Cygwin when using the -mno-cygwin option. Moreover, we don't
228 # need this macro at all to build the Android emulator.
229 SDL_CFLAGS := $(filter-out -D_GNU_SOURCE=1,$(SDL_CFLAGS))
230 SDL_LDLIBS := $(filter-out %.a %.lib,$(shell $(SDL_CONFIG) --static-libs))
231
232 # Circular dependencies between libSDL and libSDLmain
233 # We repeat the libraries in the final link to work around it
234 SDL_STATIC_LIBRARIES := libSDL libSDLmain libSDL libSDLmain
Andrew Hsiehc7389bd2012-03-13 02:13:40 -0700235 SDL_STATIC_LIBRARIES_64 := lib64SDL lib64SDLmain lib64SDL lib64SDLmain
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100236
237else # BUILD_SDL_FROM_SOURCES
238
Jesse Hallc60b1142012-07-17 17:01:04 -0700239 SDL_DIR := distrib/sdl-1.2.15
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100240 include $(LOCAL_PATH)/$(SDL_DIR)/sources.make
Andrew Hsiehc7389bd2012-03-13 02:13:40 -0700241 common_LOCAL_SRC_FILES += $(SDL_SOURCES)
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100242
243 EMULATOR_LIBUI_CFLAGS += \
244 -I$(LOCAL_PATH)/$(SDL_DIR)/include
245
246 SDL_STATIC_LIBRARIES :=
247
248endif # BUILD_SDL_FROM_SOURCES
249
250EMULATOR_LIBUI_CFLAGS += $(SDL_CFLAGS)
251EMULATOR_LIBUI_LDLIBS += $(SDL_LDLIBS)
252
253# The following is needed by SDL_LoadObject
254ifneq ($(HOST_OS),windows)
255 EMULATOR_LIBUI_LDLIBS += -ldl
256endif
257
258# the skin support sources
259#
260SKIN_SOURCES := rect.c \
261 region.c \
262 image.c \
263 trackball.c \
264 keyboard.c \
265 keyset.c \
266 file.c \
267 window.c \
268 scaler.c \
269 composer.c \
270 surface.c \
271
Andrew Hsiehc7389bd2012-03-13 02:13:40 -0700272common_LOCAL_SRC_FILES += $(SKIN_SOURCES:%=android/skin/%)
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100273
Andrew Hsiehc7389bd2012-03-13 02:13:40 -0700274common_LOCAL_SRC_FILES += \
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100275 android/user-config.c \
276 android/resource.c \
277 android/qemulator.c \
278 android/keycode.c \
279
280# enable MMX code for our skin scaler
281ifeq ($(HOST_ARCH),x86)
Andrew Hsiehc7389bd2012-03-13 02:13:40 -0700282common_LOCAL_CFLAGS += -DUSE_MMX=1 -mmmx
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100283endif
284
Andrew Hsiehc7389bd2012-03-13 02:13:40 -0700285common_LOCAL_CFLAGS += $(EMULATOR_LIBUI_CFLAGS)
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100286
Andrew Hsiehc7389bd2012-03-13 02:13:40 -0700287
288## one for 32-bit
289$(call start-emulator-library, emulator-libui)
290LOCAL_CFLAGS += $(common_LOCAL_CFLAGS)
291LOCAL_SRC_FILES += $(common_LOCAL_SRC_FILES)
292$(call gen-hw-config-defs)
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100293$(call end-emulator-library)
294
Andrew Hsiehc7389bd2012-03-13 02:13:40 -0700295
296## another for 64-bit, see note in emulator64-common
Andrew Hsieh83df59c2012-07-24 16:06:28 -0700297ifneq ($(filter linux darwin,$(HOST_OS)),)
David 'Digit' Turnerf6f50072014-01-14 14:39:13 +0100298 $(call start-emulator-library, emulator64-libui)
299 LOCAL_CFLAGS += $(common_LOCAL_CFLAGS) -m64
300 LOCAL_SRC_FILES += $(common_LOCAL_SRC_FILES)
301 $(call gen-hw-config-defs)
302 $(call end-emulator-library)
Andrew Hsieh83df59c2012-07-24 16:06:28 -0700303endif # HOST_OS == linux || darwin
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
406# migration sources
407#
408ifeq ($(HOST_OS),windows)
Andrew Hsiehc7389bd2012-03-13 02:13:40 -0700409 common_LOCAL_SRC_FILES += migration-dummy-android.c
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100410else
Andrew Hsiehc7389bd2012-03-13 02:13:40 -0700411 common_LOCAL_SRC_FILES += migration.c \
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100412 migration-exec.c \
413 migration-tcp-android.c
414endif
415
416# misc. sources
417#
418CORE_MISC_SOURCES = \
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100419 aio-android.c \
420 async.c \
421 bt-host.c \
422 bt-vhci.c \
423 buffered_file.c \
David 'Digit' Turner8354d2d2011-05-11 00:19:06 +0200424 iohandler.c \
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100425 ioport.c \
David 'Digit' Turner3b2846a2011-05-11 01:34:40 +0200426 qemu-char.c \
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100427 readline.c \
428 savevm.c \
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100429 android/boot-properties.c \
David 'Digit' Turnere1e03df2013-12-15 00:42:21 +0100430 android/cbuffer.c \
431 android/charpipe.c \
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100432 android/config.c \
433 android/core-init-utils.c \
434 android/gps.c \
435 android/hw-kmsg.c \
436 android/hw-lcd.c \
437 android/hw-events.c \
438 android/hw-control.c \
439 android/hw-sensors.c \
440 android/hw-qemud.c \
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100441 android/looper-qemu.c \
David 'Digit' Turnerc0ac7332011-05-02 15:05:35 +0200442 android/hw-pipe-net.c \
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100443 android/qemu-setup.c \
David 'Digit' Turner6e2eb782013-12-15 00:54:21 +0100444 android/qemu-tcpdump.c \
David 'Digit' Turnercc330d42013-12-14 23:26:42 +0100445 android/shaper.c \
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100446 android/snapshot.c \
Vladimir Chtchetkine9d36fe72012-03-26 10:29:20 -0700447 android/async-socket-connector.c \
Vladimir Chtchetkinea7383ef2012-03-29 07:34:07 -0700448 android/async-socket.c \
Vladimir Chtchetkinec8aa2c52012-04-05 16:22:55 -0700449 android/sdk-controller-socket.c \
Vladimir Chtchetkinedb611d52011-11-01 17:35:07 -0700450 android/sensors-port.c \
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100451 android/utils/timezone.c \
Vladimir Chtchetkinec646f5e2011-09-03 15:17:13 -0700452 android/camera/camera-format-converters.c \
Vladimir Chtchetkined86c7242011-12-09 15:45:46 -0800453 android/camera/camera-service.c \
454 android/adb-server.c \
Vladimir Chtchetkinedb450d72012-01-12 13:37:40 -0800455 android/adb-qemud.c \
Vladimir Chtchetkine8dd31e82012-02-15 17:16:04 -0800456 android/snaphost-android.c \
457 android/multitouch-screen.c \
458 android/multitouch-port.c \
David 'Digit' Turner84569132013-12-13 17:34:07 +0100459 android/utils/jpeg-compress.c \
David 'Digit' Turnercc330d42013-12-14 23:26:42 +0100460 net/net-android.c \
David 'Digit' Turner1c31e3e2013-12-14 20:07:17 +0100461 qobject/qerror.c \
462 ui/console.c \
463 ui/d3des.c \
David 'Digit' Turnerd7088e92013-12-17 09:25:19 +0100464 ui/input.c \
David 'Digit' Turner1c31e3e2013-12-14 20:07:17 +0100465 ui/vnc-android.c \
David 'Digit' Turner37dc41a2013-12-14 14:45:51 +0100466 util/acl.c \
467 util/aes.c \
David 'Digit' Turnere90d6652013-12-14 14:55:12 +0100468 util/cutils.c \
469 util/module.c \
470 util/notify.c \
David 'Digit' Turner84569132013-12-13 17:34:07 +0100471 util/osdep.c \
David 'Digit' Turner1c31e3e2013-12-14 20:07:17 +0100472 util/path.c \
473 util/qemu-config.c \
474 util/qemu-error.c \
475 util/qemu-option.c \
476 util/qemu-sockets-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' Turner1c31e3e2013-12-14 20:07:17 +0100491 util/qemu-thread.c \
Vladimir Chtchetkine4ed09fd2011-08-18 09:42:40 -0700492 android/camera/camera-capture-linux.c
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100493else
David 'Digit' Turnerd471c922013-12-17 09:52:48 +0100494 CORE_MISC_SOURCES += hw/usb/usb-dummy-android.c
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100495endif
496
497ifeq ($(HOST_OS),windows)
Vladimir Chtchetkine4ed09fd2011-08-18 09:42:40 -0700498 CORE_MISC_SOURCES += tap-win32.c \
499 android/camera/camera-capture-windows.c
500
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100501else
502 CORE_MISC_SOURCES += posix-aio-compat.c
503endif
504
Vladimir Chtchetkineb92b3032011-09-12 15:29:32 -0700505ifeq ($(HOST_OS),darwin)
Vladimir Chtchetkine955a9972011-10-12 15:40:17 -0700506 CORE_MISC_SOURCES += android/camera/camera-capture-mac.m
Vladimir Chtchetkineb92b3032011-09-12 15:29:32 -0700507endif
508
Andrew Hsiehc7389bd2012-03-13 02:13:40 -0700509common_LOCAL_SRC_FILES += $(CORE_MISC_SOURCES)
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100510
511# Required
Lars Poeschel33da99a2012-08-22 09:42:42 +0200512common_LOCAL_CFLAGS += -D_XOPEN_SOURCE=600 -D_BSD_SOURCE=1 -I$(LOCAL_PATH)/distrib/jpeg-6b
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100513
514SLIRP_SOURCES := \
515 bootp.c \
516 cksum.c \
517 debug.c \
518 if.c \
519 ip_icmp.c \
520 ip_input.c \
521 ip_output.c \
522 mbuf.c \
523 misc.c \
524 sbuf.c \
525 slirp.c \
526 socket.c \
527 tcp_input.c \
528 tcp_output.c \
529 tcp_subr.c \
530 tcp_timer.c \
531 tftp.c \
532 udp.c
533
Andrew Hsiehc7389bd2012-03-13 02:13:40 -0700534common_LOCAL_SRC_FILES += $(SLIRP_SOURCES:%=slirp-android/%)
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100535EMULATOR_LIBQEMU_CFLAGS += -I$(LOCAL_PATH)/slirp-android
536
537# socket proxy support
538#
539PROXY_SOURCES := \
540 proxy_common.c \
541 proxy_http.c \
542 proxy_http_connector.c \
543 proxy_http_rewriter.c \
544
Andrew Hsiehc7389bd2012-03-13 02:13:40 -0700545common_LOCAL_SRC_FILES += $(PROXY_SOURCES:%=proxy/%)
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100546EMULATOR_LIBQEMU_CFLAGS += -I$(LOCAL_PATH)/proxy
547
548# include telephony stuff
549#
550TELEPHONY_SOURCES := \
551 android_modem.c \
552 modem_driver.c \
553 gsm.c \
554 sim_card.c \
555 sysdeps_qemu.c \
556 sms.c \
557 remote_call.c
558
Andrew Hsiehc7389bd2012-03-13 02:13:40 -0700559common_LOCAL_SRC_FILES += $(TELEPHONY_SOURCES:%=telephony/%)
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100560EMULATOR_LIBQEMU_CFLAGS += -I$(LOCAL_PATH)/telephony
561
562# sources inherited from upstream, but not fully
563# integrated into android emulator
564#
Andrew Hsiehc7389bd2012-03-13 02:13:40 -0700565common_LOCAL_SRC_FILES += \
David 'Digit' Turner1c31e3e2013-12-14 20:07:17 +0100566 qobject/json-lexer.c \
567 qobject/json-parser.c \
568 qobject/json-streamer.c \
569 qobject/qjson.c \
570 qobject/qbool.c \
571 qobject/qdict.c \
572 qobject/qfloat.c \
573 qobject/qint.c \
574 qobject/qlist.c \
575 qobject/qstring.c \
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100576
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100577ifeq ($(QEMU_TARGET_XML_SOURCES),)
578 QEMU_TARGET_XML_SOURCES := arm-core arm-neon arm-vfp arm-vfp3
579 QEMU_TARGET_XML_SOURCES := $(QEMU_TARGET_XML_SOURCES:%=$(LOCAL_PATH)/gdb-xml/%.xml)
580endif
581
Andrew Hsiehc7389bd2012-03-13 02:13:40 -0700582common_LOCAL_CFLAGS += $(EMULATOR_LIBQEMU_CFLAGS)
583
584
585## one for 32-bit
586$(call start-emulator-library, emulator-libqemu)
587# gdbstub-xml.c contains C-compilable arrays corresponding to the content
588# of $(LOCAL_PATH)/gdb-xml/, and is generated with the 'feature_to_c.sh' script.
589#
590intermediates = $(call intermediates-dir-for,STATIC_LIBRARIES,$(LOCAL_MODULE),true)
591QEMU_GDBSTUB_XML_C = $(intermediates)/gdbstub-xml.c
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100592$(QEMU_GDBSTUB_XML_C): PRIVATE_PATH := $(LOCAL_PATH)
593$(QEMU_GDBSTUB_XML_C): PRIVATE_SOURCES := $(TARGET_XML_SOURCES)
594$(QEMU_GDBSTUB_XML_C): PRIVATE_CUSTOM_TOOL = $(PRIVATE_PATH)/feature_to_c.sh $@ $(QEMU_TARGET_XML_SOURCES)
595$(QEMU_GDBSTUB_XML_C): $(QEMU_TARGET_XML_SOURCES) $(LOCAL_PATH)/feature_to_c.sh
596 $(hide) rm -f $@
597 $(transform-generated-source)
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100598LOCAL_GENERATED_SOURCES += $(QEMU_GDBSTUB_XML_C)
Andrew Hsiehc7389bd2012-03-13 02:13:40 -0700599LOCAL_CFLAGS += $(common_LOCAL_CFLAGS) -I$(intermediates)
600LOCAL_SRC_FILES += $(common_LOCAL_SRC_FILES)
601$(call gen-hw-config-defs)
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100602$(call end-emulator-library)
603
Andrew Hsiehc7389bd2012-03-13 02:13:40 -0700604
605## another for 64-bit, see note in emulator64-common
Andrew Hsieh83df59c2012-07-24 16:06:28 -0700606ifneq ($(filter linux darwin,$(HOST_OS)),)
David 'Digit' Turnerf6f50072014-01-14 14:39:13 +0100607 $(call start-emulator-library, emulator64-libqemu)
608 # gdbstub-xml.c contains C-compilable arrays corresponding to the content
609 # of $(LOCAL_PATH)/gdb-xml/, and is generated with the 'feature_to_c.sh' script.
610 #
611 intermediates = $(call intermediates-dir-for,STATIC_LIBRARIES,$(LOCAL_MODULE),true)
612 QEMU_GDBSTUB_XML_C = $(intermediates)/gdbstub-xml.c
613 $(QEMU_GDBSTUB_XML_C): PRIVATE_PATH := $(LOCAL_PATH)
614 $(QEMU_GDBSTUB_XML_C): PRIVATE_SOURCES := $(TARGET_XML_SOURCES)
615 $(QEMU_GDBSTUB_XML_C): PRIVATE_CUSTOM_TOOL = $(PRIVATE_PATH)/feature_to_c.sh $@ $(QEMU_TARGET_XML_SOURCES)
616 $(QEMU_GDBSTUB_XML_C): $(QEMU_TARGET_XML_SOURCES) $(LOCAL_PATH)/feature_to_c.sh
Andrew Hsiehc7389bd2012-03-13 02:13:40 -0700617 $(hide) rm -f $@
618 $(transform-generated-source)
David 'Digit' Turnerf6f50072014-01-14 14:39:13 +0100619 LOCAL_GENERATED_SOURCES += $(QEMU_GDBSTUB_XML_C)
620 LOCAL_CFLAGS += $(common_LOCAL_CFLAGS) -I$(intermediates) -m64
621 LOCAL_SRC_FILES += $(common_LOCAL_SRC_FILES)
622 $(call gen-hw-config-defs)
623 $(call end-emulator-library)
Andrew Hsieh83df59c2012-07-24 16:06:28 -0700624endif # HOST_OS == linux || darwin
Andrew Hsiehc7389bd2012-03-13 02:13:40 -0700625
626
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100627# Block sources, we must compile them with each executable because they
628# are only referenced by the rest of the code using constructor functions.
629# If their object files are put in a static library, these are never compiled
630# into the final linked executable that uses them.
631#
632# Normally, one would solve thus using LOCAL_WHOLE_STATIC_LIBRARIES, but
633# the Darwin linker doesn't support -Wl,--whole-archive or equivalent :-(
634#
635BLOCK_SOURCES += \
636 block.c \
637 blockdev.c \
638 block/qcow.c \
639 block/qcow2.c \
640 block/qcow2-refcount.c \
641 block/qcow2-snapshot.c \
642 block/qcow2-cluster.c \
643 block/cloop.c \
644 block/dmg.c \
645 block/vvfat.c \
646 block/raw.c
647
648ifeq ($(HOST_OS),windows)
649 BLOCK_SOURCES += block/raw-win32.c
650else
651 BLOCK_SOURCES += block/raw-posix.c
652endif
653
654BLOCK_CFLAGS += $(EMULATOR_COMMON_CFLAGS)
655BLOCK_CFLAGS += -DCONFIG_BDRV_WHITELIST=""
656
Lars Poeschel33da99a2012-08-22 09:42:42 +0200657##############################################################################
658##############################################################################
659###
660### emulator-libjpeg: TARGET-INDEPENDENT QEMU FUNCTIONS
661###
662### THESE ARE USED BY EVERYTHING EXCEPT 'emulator-ui'
663###
664
665common_LOCAL_CFLAGS =
666common_LOCAL_SRC_FILES =
667
668###########################################################
669# Jpeg configuration
670#
671LIBJPEG_DIR := distrib/jpeg-6b
672include $(LOCAL_PATH)/$(LIBJPEG_DIR)/sources.make
673
674common_LOCAL_SRC_FILES += $(LIBJPEG_SOURCES)
675
676common_LOCAL_CFLAGS += \
677 $(LIBJPEG_CFLAGS) \
678 -I$(LOCAL_PATH)/$(LIBJPEG_DIR)
679
680## one for 32-bit
681$(call start-emulator-library, emulator-libjpeg)
682LOCAL_CFLAGS += $(common_LOCAL_CFLAGS)
683LOCAL_SRC_FILES += $(common_LOCAL_SRC_FILES)
684$(call end-emulator-library)
685
686
687## another for 64-bit, see note in emulator64-common
Andrew Hsieh6eb25c72012-08-24 08:18:22 +0800688ifneq ($(filter linux darwin,$(HOST_OS)),)
David 'Digit' Turnerf6f50072014-01-14 14:39:13 +0100689 $(call start-emulator-library, emulator64-libjpeg)
690 LOCAL_CFLAGS += $(common_LOCAL_CFLAGS) -m64
691 LOCAL_SRC_FILES += $(common_LOCAL_SRC_FILES)
692 $(call end-emulator-library)
Lars Poeschel33da99a2012-08-22 09:42:42 +0200693endif # HOST_OS == linux
694
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100695
696##############################################################################
697##############################################################################
698###
David 'Digit' Turnerf6f50072014-01-14 14:39:13 +0100699### emulator-libelff: TARGET-INDEPENDENT ELF/DWARF PARSER
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100700###
701### THESE ARE USED BY EVERYTHING EXCEPT 'emulator-ui', BUT WE CANNOT PUT
702### THEM IN emulator-libqemu SINCE THE SOURCES ARE C++
703###
704
Andrew Hsiehc7389bd2012-03-13 02:13:40 -0700705common_LOCAL_CFLAGS =
706common_LOCAL_SRC_FILES =
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100707
708ELFF_CFLAGS := -I$(LOCAL_PATH)/elff
709ELFF_LDLIBS := -lstdc++
710
711ELFF_SOURCES := \
712 dwarf_cu.cc \
713 dwarf_die.cc \
714 dwarf_utils.cc \
715 elf_alloc.cc \
716 elf_file.cc \
717 elf_mapped_section.cc \
718 elff_api.cc \
719
Andrew Hsiehc7389bd2012-03-13 02:13:40 -0700720common_LOCAL_SRC_FILES += $(ELFF_SOURCES:%=elff/%)
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100721
Andrew Hsiehc7389bd2012-03-13 02:13:40 -0700722common_LOCAL_CFLAGS += \
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100723 -fno-exceptions \
724 $(ELFF_CFLAGS) \
725
Andrew Hsiehc7389bd2012-03-13 02:13:40 -0700726
727## one for 32-bit
728$(call start-emulator-library, emulator-libelff)
729LOCAL_CPP_EXTENSION := .cc
730LOCAL_CFLAGS += $(common_LOCAL_CFLAGS)
731LOCAL_SRC_FILES += $(common_LOCAL_SRC_FILES)
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100732$(call end-emulator-library)
733
734
Andrew Hsiehc7389bd2012-03-13 02:13:40 -0700735## another for 64-bit, see note in emulator64-common
Andrew Hsieh83df59c2012-07-24 16:06:28 -0700736ifneq ($(filter linux darwin,$(HOST_OS)),)
David 'Digit' Turnerf6f50072014-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)
Andrew Hsieh83df59c2012-07-24 16:06:28 -0700742endif # HOST_OS == linux || darwin
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