blob: 36cd710ed3996d5d4eba9ad82df7cc12c17ad78b [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 \
David 'Digit' Turneraf81d742014-02-03 17:11:18 +0100126 android/utils/eintr_wrapper.c \
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100127 android/utils/filelock.c \
128 android/utils/ini.c \
David 'Digit' Turnerbbb81042011-03-17 14:48:44 +0100129 android/utils/intmap.c \
David 'Digit' Turner0a879bf2011-05-12 18:45:18 +0200130 android/utils/lineinput.c \
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100131 android/utils/mapfile.c \
132 android/utils/misc.c \
133 android/utils/panic.c \
134 android/utils/path.c \
135 android/utils/reflist.c \
136 android/utils/refset.c \
137 android/utils/stralloc.c \
138 android/utils/system.c \
139 android/utils/tempfile.c \
140 android/utils/vector.c \
David 'Digit' Turner7745b322014-01-22 01:09:57 +0100141 android/utils/win32_cmdline_quote.c \
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100142
Andrew Hsiehc7389bd2012-03-13 02:13:40 -0700143common_LOCAL_CFLAGS += $(EMULATOR_COMMON_CFLAGS)
144
145
146## one for 32-bit
147$(call start-emulator-library, emulator-common)
148LOCAL_CFLAGS += $(common_LOCAL_CFLAGS)
149LOCAL_SRC_FILES += $(common_LOCAL_SRC_FILES)
David 'Digit' Turner42fc4492011-06-29 13:16:16 +0200150$(call gen-hw-config-defs)
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100151$(call end-emulator-library)
152
Andrew Hsiehc7389bd2012-03-13 02:13:40 -0700153## another for 64-bit
David 'Digit' Turnerf6f50072014-01-14 14:39:13 +0100154# NOTE: only linux and darwin is supported, because for Windows,
155# amd64-mingw32msvc-gcc doesn't work, see http://b/issue?id=5949152.
Andrew Hsieh83df59c2012-07-24 16:06:28 -0700156ifneq ($(filter linux darwin,$(HOST_OS)),)
David 'Digit' Turnerf6f50072014-01-14 14:39:13 +0100157 $(call start-emulator-library, emulator64-common)
158 LOCAL_CFLAGS += $(common_LOCAL_CFLAGS) -m64
159 LOCAL_SRC_FILES += $(common_LOCAL_SRC_FILES)
160 $(call gen-hw-config-defs)
161 $(call end-emulator-library)
Andrew Hsieh83df59c2012-07-24 16:06:28 -0700162endif # HOST_OS == linux || darwin
Andrew Hsiehc7389bd2012-03-13 02:13:40 -0700163
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100164##############################################################################
165##############################################################################
166###
167### emulator-libui: LIBRARY OF UI-RELATED FUNCTIONS
168###
169### THESE ARE USED BY 'emulator-ui' AND THE STANDALONE PROGRAMS
170###
171
Andrew Hsiehc7389bd2012-03-13 02:13:40 -0700172common_LOCAL_CFLAGS =
173common_LOCAL_SRC_FILES =
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100174
Jesse Hall183e9272012-04-26 15:13:27 -0700175ifneq ($(QEMU_OPENGLES_INCLUDE),)
176 EMULATOR_LIBUI_CFLAGS := -I$(QEMU_OPENGLES_INCLUDE)
177endif
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100178
Andrew Hsiehc7389bd2012-03-13 02:13:40 -0700179common_LOCAL_CFLAGS += $(EMULATOR_COMMON_CFLAGS)
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100180
181###########################################################
182# Libpng configuration
183#
184LIBPNG_DIR := distrib/libpng-1.2.19
185include $(LOCAL_PATH)/$(LIBPNG_DIR)/sources.make
186
187EMULATOR_LIBUI_CFLAGS += \
188 $(LIBPNG_CFLAGS) \
189 -I$(LOCAL_PATH)/$(LIBPNG_DIR)
190
David 'Digit' Turner1634ff52013-12-14 23:31:41 +0100191common_LOCAL_SRC_FILES += $(LIBPNG_SOURCES) android/loadpng.c
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100192
193##############################################################################
194# SDL-related definitions
195#
196
197# Build SDL from sources except in certain cases where we use
198# prebuilt libraries instead.
199#
200BUILD_SDL_FROM_SOURCES := true
201
202# On linux-x86, using the prebuilts avoid installing all the X11
203# development packages on our build servers.
204#
205ifeq ($(QEMU_HOST_TAG),linux-x86)
206 BUILD_SDL_FROM_SOURCES := false
207endif
208
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100209# If we're building with android-configure.sh && make, always build from
210# sources to catch regressions as soon as they happen.
211#
212ifeq ($(BUILD_STANDALONE_EMULATOR),true)
213 BUILD_SDL_FROM_SOURCES := true
214endif
215
216# Except if we used android-configure.sh --sdl-config=<script>
217#
David 'Digit' Turnera4026682011-08-24 12:54:01 +0200218ifneq ($(QEMU_SDL_CONFIG),)
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100219 BUILD_SDL_FROM_SOURCES := false
David 'Digit' Turnera4026682011-08-24 12:54:01 +0200220 SDL_CONFIG := $(QEMU_SDL_CONFIG)
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100221endif
222
223ifneq ($(BUILD_SDL_FROM_SOURCES),true)
224
Xavier Ducrohet20821322012-04-03 16:39:24 -0700225 SDL_CONFIG ?= prebuilts/tools/$(QEMU_HOST_TAG)/sdl/bin/sdl-config
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100226 SDL_CFLAGS := $(shell $(SDL_CONFIG) --cflags)
227
228 # We need to filter out the _GNU_SOURCE variable because it breaks recent
229 # releases of Cygwin when using the -mno-cygwin option. Moreover, we don't
230 # need this macro at all to build the Android emulator.
231 SDL_CFLAGS := $(filter-out -D_GNU_SOURCE=1,$(SDL_CFLAGS))
232 SDL_LDLIBS := $(filter-out %.a %.lib,$(shell $(SDL_CONFIG) --static-libs))
233
234 # Circular dependencies between libSDL and libSDLmain
235 # We repeat the libraries in the final link to work around it
236 SDL_STATIC_LIBRARIES := libSDL libSDLmain libSDL libSDLmain
Andrew Hsiehc7389bd2012-03-13 02:13:40 -0700237 SDL_STATIC_LIBRARIES_64 := lib64SDL lib64SDLmain lib64SDL lib64SDLmain
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100238
239else # BUILD_SDL_FROM_SOURCES
240
Jesse Hallc60b1142012-07-17 17:01:04 -0700241 SDL_DIR := distrib/sdl-1.2.15
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100242 include $(LOCAL_PATH)/$(SDL_DIR)/sources.make
Andrew Hsiehc7389bd2012-03-13 02:13:40 -0700243 common_LOCAL_SRC_FILES += $(SDL_SOURCES)
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100244
245 EMULATOR_LIBUI_CFLAGS += \
246 -I$(LOCAL_PATH)/$(SDL_DIR)/include
247
248 SDL_STATIC_LIBRARIES :=
249
250endif # BUILD_SDL_FROM_SOURCES
251
252EMULATOR_LIBUI_CFLAGS += $(SDL_CFLAGS)
253EMULATOR_LIBUI_LDLIBS += $(SDL_LDLIBS)
254
255# The following is needed by SDL_LoadObject
256ifneq ($(HOST_OS),windows)
257 EMULATOR_LIBUI_LDLIBS += -ldl
258endif
259
260# the skin support sources
261#
262SKIN_SOURCES := rect.c \
263 region.c \
264 image.c \
265 trackball.c \
266 keyboard.c \
267 keyset.c \
268 file.c \
269 window.c \
270 scaler.c \
271 composer.c \
272 surface.c \
273
Andrew Hsiehc7389bd2012-03-13 02:13:40 -0700274common_LOCAL_SRC_FILES += $(SKIN_SOURCES:%=android/skin/%)
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100275
Andrew Hsiehc7389bd2012-03-13 02:13:40 -0700276common_LOCAL_SRC_FILES += \
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100277 android/user-config.c \
278 android/resource.c \
279 android/qemulator.c \
280 android/keycode.c \
281
282# enable MMX code for our skin scaler
283ifeq ($(HOST_ARCH),x86)
Andrew Hsiehc7389bd2012-03-13 02:13:40 -0700284common_LOCAL_CFLAGS += -DUSE_MMX=1 -mmmx
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100285endif
286
Andrew Hsiehc7389bd2012-03-13 02:13:40 -0700287common_LOCAL_CFLAGS += $(EMULATOR_LIBUI_CFLAGS)
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100288
Andrew Hsiehc7389bd2012-03-13 02:13:40 -0700289
290## one for 32-bit
291$(call start-emulator-library, emulator-libui)
292LOCAL_CFLAGS += $(common_LOCAL_CFLAGS)
293LOCAL_SRC_FILES += $(common_LOCAL_SRC_FILES)
294$(call gen-hw-config-defs)
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100295$(call end-emulator-library)
296
Andrew Hsiehc7389bd2012-03-13 02:13:40 -0700297
298## another for 64-bit, see note in emulator64-common
Andrew Hsieh83df59c2012-07-24 16:06:28 -0700299ifneq ($(filter linux darwin,$(HOST_OS)),)
David 'Digit' Turnerf6f50072014-01-14 14:39:13 +0100300 $(call start-emulator-library, emulator64-libui)
301 LOCAL_CFLAGS += $(common_LOCAL_CFLAGS) -m64
302 LOCAL_SRC_FILES += $(common_LOCAL_SRC_FILES)
303 $(call gen-hw-config-defs)
304 $(call end-emulator-library)
Andrew Hsieh83df59c2012-07-24 16:06:28 -0700305endif # HOST_OS == linux || darwin
Andrew Hsiehc7389bd2012-03-13 02:13:40 -0700306
307
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100308##############################################################################
309##############################################################################
310###
311### emulator-libqemu: TARGET-INDEPENDENT QEMU FUNCTIONS
312###
313### THESE ARE USED BY EVERYTHING EXCEPT 'emulator-ui'
314###
315
Andrew Hsiehc7389bd2012-03-13 02:13:40 -0700316common_LOCAL_CFLAGS =
317common_LOCAL_SRC_FILES =
318
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100319
320EMULATOR_LIBQEMU_CFLAGS :=
321
Andrew Hsiehc7389bd2012-03-13 02:13:40 -0700322common_LOCAL_CFLAGS += $(EMULATOR_COMMON_CFLAGS)
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100323
324AUDIO_SOURCES := noaudio.c wavaudio.c wavcapture.c mixeng.c
325AUDIO_CFLAGS := -I$(LOCAL_PATH)/audio -DHAS_AUDIO
326AUDIO_LDLIBS :=
327
Raphael Moll9e319a92012-11-28 13:48:25 -0800328common_LOCAL_CFLAGS += -Wall $(GCC_W_NO_MISSING_FIELD_INITIALIZERS)
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100329
330ifeq ($(HOST_OS),darwin)
331 CONFIG_COREAUDIO ?= yes
332 AUDIO_CFLAGS += -DHOST_BSD=1
333endif
334
335ifeq ($(HOST_OS),windows)
336 CONFIG_WINAUDIO ?= yes
337endif
338
339ifeq ($(HOST_OS),linux)
340 CONFIG_OSS ?= yes
341 CONFIG_ALSA ?= yes
342 CONFIG_PULSEAUDIO ?= yes
343 CONFIG_ESD ?= yes
344endif
345
346ifeq ($(HOST_OS),freebsd)
347 CONFIG_OSS ?= yes
348endif
349
350ifeq ($(CONFIG_COREAUDIO),yes)
351 AUDIO_SOURCES += coreaudio.c
352 AUDIO_CFLAGS += -DCONFIG_COREAUDIO
353 AUDIO_LDLIBS += -Wl,-framework,CoreAudio
354endif
355
356ifeq ($(CONFIG_WINAUDIO),yes)
357 AUDIO_SOURCES += winaudio.c
358 AUDIO_CFLAGS += -DCONFIG_WINAUDIO
359endif
360
361ifeq ($(CONFIG_PULSEAUDIO),yes)
362 AUDIO_SOURCES += paaudio.c audio_pt_int.c
363 AUDIO_CFLAGS += -DCONFIG_PULSEAUDIO
364endif
365
366ifeq ($(CONFIG_ALSA),yes)
367 AUDIO_SOURCES += alsaaudio.c audio_pt_int.c
368 AUDIO_CFLAGS += -DCONFIG_ALSA
369endif
370
371ifeq ($(CONFIG_ESD),yes)
372 AUDIO_SOURCES += esdaudio.c
373 AUDIO_CFLAGS += -DCONFIG_ESD
374endif
375
376ifeq ($(CONFIG_OSS),yes)
377 AUDIO_SOURCES += ossaudio.c
378 AUDIO_CFLAGS += -DCONFIG_OSS
379endif
380
381AUDIO_SOURCES := $(call sort,$(AUDIO_SOURCES:%=audio/%))
382
Andrew Hsiehc7389bd2012-03-13 02:13:40 -0700383common_LOCAL_CFLAGS += -Wno-sign-compare \
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100384 -fno-strict-aliasing -W -Wall -Wno-unused-parameter \
385
386# this is very important, otherwise the generated binaries may
387# not link properly on our build servers
388ifeq ($(HOST_OS),linux)
Andrew Hsiehc7389bd2012-03-13 02:13:40 -0700389common_LOCAL_CFLAGS += -fno-stack-protector
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100390endif
391
Andrew Hsiehc7389bd2012-03-13 02:13:40 -0700392common_LOCAL_SRC_FILES += $(AUDIO_SOURCES)
393common_LOCAL_SRC_FILES += \
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100394 android/audio-test.c
395
396# other flags
397ifneq ($(HOST_OS),windows)
398 AUDIO_LDLIBS += -ldl
399else
400endif
401
402
403EMULATOR_LIBQEMU_CFLAGS += $(AUDIO_CFLAGS)
404EMULATOR_LIBQEMU_LDLIBS += $(AUDIO_LDLIBS)
405
Raphael Moll9e319a92012-11-28 13:48:25 -0800406common_LOCAL_CFLAGS += $(GCC_W_NO_MISSING_FIELD_INITIALIZERS)
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100407
408# migration sources
409#
410ifeq ($(HOST_OS),windows)
Andrew Hsiehc7389bd2012-03-13 02:13:40 -0700411 common_LOCAL_SRC_FILES += migration-dummy-android.c
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100412else
Andrew Hsiehc7389bd2012-03-13 02:13:40 -0700413 common_LOCAL_SRC_FILES += migration.c \
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100414 migration-exec.c \
415 migration-tcp-android.c
416endif
417
418# misc. sources
419#
420CORE_MISC_SOURCES = \
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100421 aio-android.c \
422 async.c \
423 bt-host.c \
424 bt-vhci.c \
425 buffered_file.c \
David 'Digit' Turner8354d2d2011-05-11 00:19:06 +0200426 iohandler.c \
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100427 ioport.c \
David 'Digit' Turner3b2846a2011-05-11 01:34:40 +0200428 qemu-char.c \
David 'Digit' Turner67c35562014-01-16 18:24:09 +0100429 qemu-log.c \
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100430 readline.c \
431 savevm.c \
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100432 android/boot-properties.c \
David 'Digit' Turnere1e03df2013-12-15 00:42:21 +0100433 android/cbuffer.c \
434 android/charpipe.c \
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100435 android/config.c \
436 android/core-init-utils.c \
437 android/gps.c \
438 android/hw-kmsg.c \
439 android/hw-lcd.c \
440 android/hw-events.c \
441 android/hw-control.c \
442 android/hw-sensors.c \
443 android/hw-qemud.c \
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100444 android/looper-qemu.c \
David 'Digit' Turnerc0ac7332011-05-02 15:05:35 +0200445 android/hw-pipe-net.c \
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100446 android/qemu-setup.c \
David 'Digit' Turner6e2eb782013-12-15 00:54:21 +0100447 android/qemu-tcpdump.c \
David 'Digit' Turnercc330d42013-12-14 23:26:42 +0100448 android/shaper.c \
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100449 android/snapshot.c \
Vladimir Chtchetkine9d36fe72012-03-26 10:29:20 -0700450 android/async-socket-connector.c \
Vladimir Chtchetkinea7383ef2012-03-29 07:34:07 -0700451 android/async-socket.c \
Vladimir Chtchetkinec8aa2c52012-04-05 16:22:55 -0700452 android/sdk-controller-socket.c \
Vladimir Chtchetkinedb611d52011-11-01 17:35:07 -0700453 android/sensors-port.c \
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100454 android/utils/timezone.c \
Vladimir Chtchetkinec646f5e2011-09-03 15:17:13 -0700455 android/camera/camera-format-converters.c \
Vladimir Chtchetkined86c7242011-12-09 15:45:46 -0800456 android/camera/camera-service.c \
457 android/adb-server.c \
Vladimir Chtchetkinedb450d72012-01-12 13:37:40 -0800458 android/adb-qemud.c \
Vladimir Chtchetkine8dd31e82012-02-15 17:16:04 -0800459 android/snaphost-android.c \
460 android/multitouch-screen.c \
461 android/multitouch-port.c \
David 'Digit' Turner84569132013-12-13 17:34:07 +0100462 android/utils/jpeg-compress.c \
David 'Digit' Turnercc330d42013-12-14 23:26:42 +0100463 net/net-android.c \
David 'Digit' Turner1c31e3e2013-12-14 20:07:17 +0100464 qobject/qerror.c \
David 'Digit' Turner2e36f052014-01-16 16:22:47 +0100465 qom/container.c \
466 qom/object.c \
467 qom/qom-qobject.c \
David 'Digit' Turner1c31e3e2013-12-14 20:07:17 +0100468 ui/console.c \
469 ui/d3des.c \
David 'Digit' Turnerd7088e92013-12-17 09:25:19 +0100470 ui/input.c \
David 'Digit' Turner1c31e3e2013-12-14 20:07:17 +0100471 ui/vnc-android.c \
David 'Digit' Turner37dc41a2013-12-14 14:45:51 +0100472 util/acl.c \
473 util/aes.c \
David 'Digit' Turnere90d6652013-12-14 14:55:12 +0100474 util/cutils.c \
David 'Digit' Turner910aea92014-01-15 16:53:38 +0100475 util/error.c \
David 'Digit' Turner1befd342014-01-15 17:56:45 +0100476 util/hexdump.c \
477 util/iov.c \
David 'Digit' Turnere90d6652013-12-14 14:55:12 +0100478 util/module.c \
479 util/notify.c \
David 'Digit' Turner84569132013-12-13 17:34:07 +0100480 util/osdep.c \
David 'Digit' Turner1c31e3e2013-12-14 20:07:17 +0100481 util/path.c \
482 util/qemu-config.c \
483 util/qemu-error.c \
484 util/qemu-option.c \
485 util/qemu-sockets-android.c \
David 'Digit' Turner910aea92014-01-15 16:53:38 +0100486 util/unicode.c \
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100487
488ifeq ($(HOST_ARCH),x86)
David 'Digit' Turnercc33b2d2013-12-15 00:09:42 +0100489 CORE_MISC_SOURCES += disas/i386.c
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100490endif
491ifeq ($(HOST_ARCH),x86_64)
David 'Digit' Turnercc33b2d2013-12-15 00:09:42 +0100492 CORE_MISC_SOURCES += disas/i386.c
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100493endif
494ifeq ($(HOST_ARCH),ppc)
David 'Digit' Turnercc33b2d2013-12-15 00:09:42 +0100495 CORE_MISC_SOURCES += disas/ppc.c \
David 'Digit' Turner37dc41a2013-12-14 14:45:51 +0100496 util/cache-utils.c
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100497endif
498
499ifeq ($(HOST_OS),linux)
David 'Digit' Turnerd471c922013-12-17 09:52:48 +0100500 CORE_MISC_SOURCES += hw/usb/usb-linux.c \
David 'Digit' Turner1c31e3e2013-12-14 20:07:17 +0100501 util/qemu-thread.c \
Vladimir Chtchetkine4ed09fd2011-08-18 09:42:40 -0700502 android/camera/camera-capture-linux.c
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100503else
David 'Digit' Turnerd471c922013-12-17 09:52:48 +0100504 CORE_MISC_SOURCES += hw/usb/usb-dummy-android.c
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100505endif
506
507ifeq ($(HOST_OS),windows)
Vladimir Chtchetkine4ed09fd2011-08-18 09:42:40 -0700508 CORE_MISC_SOURCES += tap-win32.c \
509 android/camera/camera-capture-windows.c
510
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100511else
512 CORE_MISC_SOURCES += posix-aio-compat.c
513endif
514
Vladimir Chtchetkineb92b3032011-09-12 15:29:32 -0700515ifeq ($(HOST_OS),darwin)
Vladimir Chtchetkine955a9972011-10-12 15:40:17 -0700516 CORE_MISC_SOURCES += android/camera/camera-capture-mac.m
Vladimir Chtchetkineb92b3032011-09-12 15:29:32 -0700517endif
518
Andrew Hsiehc7389bd2012-03-13 02:13:40 -0700519common_LOCAL_SRC_FILES += $(CORE_MISC_SOURCES)
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100520
521# Required
Lars Poeschel33da99a2012-08-22 09:42:42 +0200522common_LOCAL_CFLAGS += -D_XOPEN_SOURCE=600 -D_BSD_SOURCE=1 -I$(LOCAL_PATH)/distrib/jpeg-6b
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100523
524SLIRP_SOURCES := \
525 bootp.c \
526 cksum.c \
527 debug.c \
528 if.c \
529 ip_icmp.c \
530 ip_input.c \
531 ip_output.c \
532 mbuf.c \
533 misc.c \
534 sbuf.c \
535 slirp.c \
536 socket.c \
537 tcp_input.c \
538 tcp_output.c \
539 tcp_subr.c \
540 tcp_timer.c \
541 tftp.c \
542 udp.c
543
Andrew Hsiehc7389bd2012-03-13 02:13:40 -0700544common_LOCAL_SRC_FILES += $(SLIRP_SOURCES:%=slirp-android/%)
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100545EMULATOR_LIBQEMU_CFLAGS += -I$(LOCAL_PATH)/slirp-android
546
547# socket proxy support
548#
549PROXY_SOURCES := \
550 proxy_common.c \
551 proxy_http.c \
552 proxy_http_connector.c \
553 proxy_http_rewriter.c \
554
Andrew Hsiehc7389bd2012-03-13 02:13:40 -0700555common_LOCAL_SRC_FILES += $(PROXY_SOURCES:%=proxy/%)
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100556EMULATOR_LIBQEMU_CFLAGS += -I$(LOCAL_PATH)/proxy
557
558# include telephony stuff
559#
560TELEPHONY_SOURCES := \
561 android_modem.c \
562 modem_driver.c \
563 gsm.c \
564 sim_card.c \
565 sysdeps_qemu.c \
566 sms.c \
567 remote_call.c
568
Andrew Hsiehc7389bd2012-03-13 02:13:40 -0700569common_LOCAL_SRC_FILES += $(TELEPHONY_SOURCES:%=telephony/%)
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100570EMULATOR_LIBQEMU_CFLAGS += -I$(LOCAL_PATH)/telephony
571
572# sources inherited from upstream, but not fully
573# integrated into android emulator
574#
Andrew Hsiehc7389bd2012-03-13 02:13:40 -0700575common_LOCAL_SRC_FILES += \
David 'Digit' Turner1c31e3e2013-12-14 20:07:17 +0100576 qobject/json-lexer.c \
577 qobject/json-parser.c \
578 qobject/json-streamer.c \
579 qobject/qjson.c \
580 qobject/qbool.c \
581 qobject/qdict.c \
582 qobject/qfloat.c \
583 qobject/qint.c \
584 qobject/qlist.c \
585 qobject/qstring.c \
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100586
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100587ifeq ($(QEMU_TARGET_XML_SOURCES),)
588 QEMU_TARGET_XML_SOURCES := arm-core arm-neon arm-vfp arm-vfp3
589 QEMU_TARGET_XML_SOURCES := $(QEMU_TARGET_XML_SOURCES:%=$(LOCAL_PATH)/gdb-xml/%.xml)
590endif
591
Andrew Hsiehc7389bd2012-03-13 02:13:40 -0700592common_LOCAL_CFLAGS += $(EMULATOR_LIBQEMU_CFLAGS)
593
594
595## one for 32-bit
596$(call start-emulator-library, emulator-libqemu)
597# gdbstub-xml.c contains C-compilable arrays corresponding to the content
598# of $(LOCAL_PATH)/gdb-xml/, and is generated with the 'feature_to_c.sh' script.
599#
600intermediates = $(call intermediates-dir-for,STATIC_LIBRARIES,$(LOCAL_MODULE),true)
601QEMU_GDBSTUB_XML_C = $(intermediates)/gdbstub-xml.c
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100602$(QEMU_GDBSTUB_XML_C): PRIVATE_PATH := $(LOCAL_PATH)
603$(QEMU_GDBSTUB_XML_C): PRIVATE_SOURCES := $(TARGET_XML_SOURCES)
604$(QEMU_GDBSTUB_XML_C): PRIVATE_CUSTOM_TOOL = $(PRIVATE_PATH)/feature_to_c.sh $@ $(QEMU_TARGET_XML_SOURCES)
605$(QEMU_GDBSTUB_XML_C): $(QEMU_TARGET_XML_SOURCES) $(LOCAL_PATH)/feature_to_c.sh
606 $(hide) rm -f $@
607 $(transform-generated-source)
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100608LOCAL_GENERATED_SOURCES += $(QEMU_GDBSTUB_XML_C)
Andrew Hsiehc7389bd2012-03-13 02:13:40 -0700609LOCAL_CFLAGS += $(common_LOCAL_CFLAGS) -I$(intermediates)
610LOCAL_SRC_FILES += $(common_LOCAL_SRC_FILES)
611$(call gen-hw-config-defs)
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100612$(call end-emulator-library)
613
Andrew Hsiehc7389bd2012-03-13 02:13:40 -0700614
615## another for 64-bit, see note in emulator64-common
Andrew Hsieh83df59c2012-07-24 16:06:28 -0700616ifneq ($(filter linux darwin,$(HOST_OS)),)
David 'Digit' Turnerf6f50072014-01-14 14:39:13 +0100617 $(call start-emulator-library, emulator64-libqemu)
618 # gdbstub-xml.c contains C-compilable arrays corresponding to the content
619 # of $(LOCAL_PATH)/gdb-xml/, and is generated with the 'feature_to_c.sh' script.
620 #
621 intermediates = $(call intermediates-dir-for,STATIC_LIBRARIES,$(LOCAL_MODULE),true)
622 QEMU_GDBSTUB_XML_C = $(intermediates)/gdbstub-xml.c
623 $(QEMU_GDBSTUB_XML_C): PRIVATE_PATH := $(LOCAL_PATH)
624 $(QEMU_GDBSTUB_XML_C): PRIVATE_SOURCES := $(TARGET_XML_SOURCES)
625 $(QEMU_GDBSTUB_XML_C): PRIVATE_CUSTOM_TOOL = $(PRIVATE_PATH)/feature_to_c.sh $@ $(QEMU_TARGET_XML_SOURCES)
626 $(QEMU_GDBSTUB_XML_C): $(QEMU_TARGET_XML_SOURCES) $(LOCAL_PATH)/feature_to_c.sh
Andrew Hsiehc7389bd2012-03-13 02:13:40 -0700627 $(hide) rm -f $@
628 $(transform-generated-source)
David 'Digit' Turnerf6f50072014-01-14 14:39:13 +0100629 LOCAL_GENERATED_SOURCES += $(QEMU_GDBSTUB_XML_C)
630 LOCAL_CFLAGS += $(common_LOCAL_CFLAGS) -I$(intermediates) -m64
631 LOCAL_SRC_FILES += $(common_LOCAL_SRC_FILES)
632 $(call gen-hw-config-defs)
633 $(call end-emulator-library)
Andrew Hsieh83df59c2012-07-24 16:06:28 -0700634endif # HOST_OS == linux || darwin
Andrew Hsiehc7389bd2012-03-13 02:13:40 -0700635
636
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100637# Block sources, we must compile them with each executable because they
638# are only referenced by the rest of the code using constructor functions.
639# If their object files are put in a static library, these are never compiled
640# into the final linked executable that uses them.
641#
642# Normally, one would solve thus using LOCAL_WHOLE_STATIC_LIBRARIES, but
643# the Darwin linker doesn't support -Wl,--whole-archive or equivalent :-(
644#
645BLOCK_SOURCES += \
646 block.c \
647 blockdev.c \
648 block/qcow.c \
649 block/qcow2.c \
650 block/qcow2-refcount.c \
651 block/qcow2-snapshot.c \
652 block/qcow2-cluster.c \
653 block/cloop.c \
654 block/dmg.c \
655 block/vvfat.c \
656 block/raw.c
657
658ifeq ($(HOST_OS),windows)
659 BLOCK_SOURCES += block/raw-win32.c
660else
661 BLOCK_SOURCES += block/raw-posix.c
662endif
663
664BLOCK_CFLAGS += $(EMULATOR_COMMON_CFLAGS)
David 'Digit' Turnera2c14f92014-02-04 01:02:30 +0100665BLOCK_CFLAGS += -DCONFIG_BDRV_WHITELIST=\"\"
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100666
Lars Poeschel33da99a2012-08-22 09:42:42 +0200667##############################################################################
668##############################################################################
669###
670### emulator-libjpeg: TARGET-INDEPENDENT QEMU FUNCTIONS
671###
672### THESE ARE USED BY EVERYTHING EXCEPT 'emulator-ui'
673###
674
675common_LOCAL_CFLAGS =
676common_LOCAL_SRC_FILES =
677
678###########################################################
679# Jpeg configuration
680#
681LIBJPEG_DIR := distrib/jpeg-6b
682include $(LOCAL_PATH)/$(LIBJPEG_DIR)/sources.make
683
684common_LOCAL_SRC_FILES += $(LIBJPEG_SOURCES)
685
686common_LOCAL_CFLAGS += \
687 $(LIBJPEG_CFLAGS) \
688 -I$(LOCAL_PATH)/$(LIBJPEG_DIR)
689
690## one for 32-bit
691$(call start-emulator-library, emulator-libjpeg)
692LOCAL_CFLAGS += $(common_LOCAL_CFLAGS)
693LOCAL_SRC_FILES += $(common_LOCAL_SRC_FILES)
694$(call end-emulator-library)
695
696
697## another for 64-bit, see note in emulator64-common
Andrew Hsieh6eb25c72012-08-24 08:18:22 +0800698ifneq ($(filter linux darwin,$(HOST_OS)),)
David 'Digit' Turnerf6f50072014-01-14 14:39:13 +0100699 $(call start-emulator-library, emulator64-libjpeg)
700 LOCAL_CFLAGS += $(common_LOCAL_CFLAGS) -m64
701 LOCAL_SRC_FILES += $(common_LOCAL_SRC_FILES)
702 $(call end-emulator-library)
Lars Poeschel33da99a2012-08-22 09:42:42 +0200703endif # HOST_OS == linux
704
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100705
706##############################################################################
707##############################################################################
708###
David 'Digit' Turnerf6f50072014-01-14 14:39:13 +0100709### emulator-libelff: TARGET-INDEPENDENT ELF/DWARF PARSER
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100710###
711### THESE ARE USED BY EVERYTHING EXCEPT 'emulator-ui', BUT WE CANNOT PUT
712### THEM IN emulator-libqemu SINCE THE SOURCES ARE C++
713###
714
Andrew Hsiehc7389bd2012-03-13 02:13:40 -0700715common_LOCAL_CFLAGS =
716common_LOCAL_SRC_FILES =
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100717
718ELFF_CFLAGS := -I$(LOCAL_PATH)/elff
719ELFF_LDLIBS := -lstdc++
720
721ELFF_SOURCES := \
722 dwarf_cu.cc \
723 dwarf_die.cc \
724 dwarf_utils.cc \
725 elf_alloc.cc \
726 elf_file.cc \
727 elf_mapped_section.cc \
728 elff_api.cc \
729
Andrew Hsiehc7389bd2012-03-13 02:13:40 -0700730common_LOCAL_SRC_FILES += $(ELFF_SOURCES:%=elff/%)
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100731
Andrew Hsiehc7389bd2012-03-13 02:13:40 -0700732common_LOCAL_CFLAGS += \
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100733 -fno-exceptions \
734 $(ELFF_CFLAGS) \
735
Andrew Hsiehc7389bd2012-03-13 02:13:40 -0700736
737## one for 32-bit
738$(call start-emulator-library, emulator-libelff)
739LOCAL_CPP_EXTENSION := .cc
740LOCAL_CFLAGS += $(common_LOCAL_CFLAGS)
741LOCAL_SRC_FILES += $(common_LOCAL_SRC_FILES)
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100742$(call end-emulator-library)
743
744
Andrew Hsiehc7389bd2012-03-13 02:13:40 -0700745## another for 64-bit, see note in emulator64-common
Andrew Hsieh83df59c2012-07-24 16:06:28 -0700746ifneq ($(filter linux darwin,$(HOST_OS)),)
David 'Digit' Turnerf6f50072014-01-14 14:39:13 +0100747 $(call start-emulator-library, emulator64-libelff)
748 LOCAL_CPP_EXTENSION := .cc
749 LOCAL_CFLAGS += $(common_LOCAL_CFLAGS) -m64
750 LOCAL_SRC_FILES += $(common_LOCAL_SRC_FILES)
751 $(call end-emulator-library)
Andrew Hsieh83df59c2012-07-24 16:06:28 -0700752endif # HOST_OS == linux || darwin
Andrew Hsiehc7389bd2012-03-13 02:13:40 -0700753
754
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100755##############################################################################
756##############################################################################
757###
758### gen-hx-header: Generate headers from .hx file with "hxtool" script.
759###
760### The 'hxtool' script is used to generate header files from an input
761### file with the .hx suffix. I.e. foo.hx --> foo.h
762###
763### Due to the way the Android build system works, we need to regenerate
764### it for each module (the output will go into a module-specific directory).
765###
766### This defines a function that can be used inside a module definition
767###
David 'Digit' Turner088edf82011-05-09 15:59:28 +0200768### $(call gen-hx-header,<input>,<output>,<source-files>)
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100769###
770### Where: <input> is the input file, with a .hx suffix (e.g. foo.hx)
David 'Digit' Turner088edf82011-05-09 15:59:28 +0200771### <output> is the output file, with a .h or .def suffix
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100772### <source-files> is a list of source files that include the header
773###
774
775
776gen-hx-header = $(eval $(call gen-hx-header-ev,$1,$2,$3))
777
778define gen-hx-header-ev
David 'Digit' Turner42fc4492011-06-29 13:16:16 +0200779intermediates := $$(call intermediates-dir-for,$$(LOCAL_MODULE_CLASS),$$(LOCAL_MODULE),true)
David 'Digit' Turner317c9d52011-05-10 06:38:21 +0200780
David 'Digit' Turner088edf82011-05-09 15:59:28 +0200781QEMU_HEADER_H := $$(intermediates)/$$2
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100782$$(QEMU_HEADER_H): PRIVATE_PATH := $$(LOCAL_PATH)
783$$(QEMU_HEADER_H): PRIVATE_CUSTOM_TOOL = $$(PRIVATE_PATH)/hxtool -h < $$< > $$@
784$$(QEMU_HEADER_H): $$(LOCAL_PATH)/$$1 $$(LOCAL_PATH)/hxtool
785 $$(transform-generated-source)
786
787LOCAL_GENERATED_SOURCES += $$(QEMU_HEADER_H)
David 'Digit' Turner088edf82011-05-09 15:59:28 +0200788LOCAL_C_INCLUDES += $$(intermediates)
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100789endef
790