blob: 0d0e8273e329f39aefa4b55d22e14660f27901af [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 \
David 'Digit' Turner7a41eef2014-02-07 15:56:41 +0100121 android/base/Log.cpp \
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100122 android/utils/assert.c \
123 android/utils/bufprint.c \
124 android/utils/debug.c \
David 'Digit' Turner816e53c2011-08-17 18:33:45 +0200125 android/utils/dll.c \
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100126 android/utils/dirscanner.c \
David 'Digit' Turner52e99422014-02-03 17:11:18 +0100127 android/utils/eintr_wrapper.c \
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100128 android/utils/filelock.c \
129 android/utils/ini.c \
David 'Digit' Turnerbbb81042011-03-17 14:48:44 +0100130 android/utils/intmap.c \
David 'Digit' Turner0a879bf2011-05-12 18:45:18 +0200131 android/utils/lineinput.c \
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100132 android/utils/mapfile.c \
133 android/utils/misc.c \
134 android/utils/panic.c \
135 android/utils/path.c \
136 android/utils/reflist.c \
137 android/utils/refset.c \
138 android/utils/stralloc.c \
139 android/utils/system.c \
140 android/utils/tempfile.c \
141 android/utils/vector.c \
David 'Digit' Turner60d0a152014-01-22 01:09:57 +0100142 android/utils/win32_cmdline_quote.c \
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100143
Andrew Hsiehc7389bd2012-03-13 02:13:40 -0700144common_LOCAL_CFLAGS += $(EMULATOR_COMMON_CFLAGS)
145
146
147## one for 32-bit
148$(call start-emulator-library, emulator-common)
149LOCAL_CFLAGS += $(common_LOCAL_CFLAGS)
150LOCAL_SRC_FILES += $(common_LOCAL_SRC_FILES)
David 'Digit' Turner42fc4492011-06-29 13:16:16 +0200151$(call gen-hw-config-defs)
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100152$(call end-emulator-library)
153
Andrew Hsiehc7389bd2012-03-13 02:13:40 -0700154## another for 64-bit
David 'Digit' Turner8be0af82014-01-14 14:39:13 +0100155# NOTE: only linux and darwin is supported, because for Windows,
156# amd64-mingw32msvc-gcc doesn't work, see http://b/issue?id=5949152.
Andrew Hsieh83df59c2012-07-24 16:06:28 -0700157ifneq ($(filter linux darwin,$(HOST_OS)),)
David 'Digit' Turner8be0af82014-01-14 14:39:13 +0100158 $(call start-emulator-library, emulator64-common)
159 LOCAL_CFLAGS += $(common_LOCAL_CFLAGS) -m64
160 LOCAL_SRC_FILES += $(common_LOCAL_SRC_FILES)
161 $(call gen-hw-config-defs)
162 $(call end-emulator-library)
Andrew Hsieh83df59c2012-07-24 16:06:28 -0700163endif # HOST_OS == linux || darwin
Andrew Hsiehc7389bd2012-03-13 02:13:40 -0700164
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100165##############################################################################
166##############################################################################
167###
168### emulator-libui: LIBRARY OF UI-RELATED FUNCTIONS
169###
170### THESE ARE USED BY 'emulator-ui' AND THE STANDALONE PROGRAMS
171###
172
Andrew Hsiehc7389bd2012-03-13 02:13:40 -0700173common_LOCAL_CFLAGS =
174common_LOCAL_SRC_FILES =
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100175
Jesse Hall183e9272012-04-26 15:13:27 -0700176ifneq ($(QEMU_OPENGLES_INCLUDE),)
177 EMULATOR_LIBUI_CFLAGS := -I$(QEMU_OPENGLES_INCLUDE)
178endif
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100179
Andrew Hsiehc7389bd2012-03-13 02:13:40 -0700180common_LOCAL_CFLAGS += $(EMULATOR_COMMON_CFLAGS)
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100181
182###########################################################
183# Libpng configuration
184#
185LIBPNG_DIR := distrib/libpng-1.2.19
186include $(LOCAL_PATH)/$(LIBPNG_DIR)/sources.make
187
188EMULATOR_LIBUI_CFLAGS += \
189 $(LIBPNG_CFLAGS) \
190 -I$(LOCAL_PATH)/$(LIBPNG_DIR)
191
David 'Digit' Turner1634ff52013-12-14 23:31:41 +0100192common_LOCAL_SRC_FILES += $(LIBPNG_SOURCES) android/loadpng.c
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100193
194##############################################################################
195# SDL-related definitions
196#
197
198# Build SDL from sources except in certain cases where we use
199# prebuilt libraries instead.
200#
201BUILD_SDL_FROM_SOURCES := true
202
203# On linux-x86, using the prebuilts avoid installing all the X11
204# development packages on our build servers.
205#
206ifeq ($(QEMU_HOST_TAG),linux-x86)
207 BUILD_SDL_FROM_SOURCES := false
208endif
209
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100210# If we're building with android-configure.sh && make, always build from
211# sources to catch regressions as soon as they happen.
212#
213ifeq ($(BUILD_STANDALONE_EMULATOR),true)
214 BUILD_SDL_FROM_SOURCES := true
215endif
216
217# Except if we used android-configure.sh --sdl-config=<script>
218#
David 'Digit' Turnera4026682011-08-24 12:54:01 +0200219ifneq ($(QEMU_SDL_CONFIG),)
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100220 BUILD_SDL_FROM_SOURCES := false
David 'Digit' Turnera4026682011-08-24 12:54:01 +0200221 SDL_CONFIG := $(QEMU_SDL_CONFIG)
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100222endif
223
224ifneq ($(BUILD_SDL_FROM_SOURCES),true)
225
Xavier Ducrohet20821322012-04-03 16:39:24 -0700226 SDL_CONFIG ?= prebuilts/tools/$(QEMU_HOST_TAG)/sdl/bin/sdl-config
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100227 SDL_CFLAGS := $(shell $(SDL_CONFIG) --cflags)
228
229 # We need to filter out the _GNU_SOURCE variable because it breaks recent
230 # releases of Cygwin when using the -mno-cygwin option. Moreover, we don't
231 # need this macro at all to build the Android emulator.
232 SDL_CFLAGS := $(filter-out -D_GNU_SOURCE=1,$(SDL_CFLAGS))
233 SDL_LDLIBS := $(filter-out %.a %.lib,$(shell $(SDL_CONFIG) --static-libs))
234
235 # Circular dependencies between libSDL and libSDLmain
236 # We repeat the libraries in the final link to work around it
237 SDL_STATIC_LIBRARIES := libSDL libSDLmain libSDL libSDLmain
Andrew Hsiehc7389bd2012-03-13 02:13:40 -0700238 SDL_STATIC_LIBRARIES_64 := lib64SDL lib64SDLmain lib64SDL lib64SDLmain
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100239
240else # BUILD_SDL_FROM_SOURCES
241
Jesse Hallc60b1142012-07-17 17:01:04 -0700242 SDL_DIR := distrib/sdl-1.2.15
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100243 include $(LOCAL_PATH)/$(SDL_DIR)/sources.make
Andrew Hsiehc7389bd2012-03-13 02:13:40 -0700244 common_LOCAL_SRC_FILES += $(SDL_SOURCES)
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100245
246 EMULATOR_LIBUI_CFLAGS += \
247 -I$(LOCAL_PATH)/$(SDL_DIR)/include
248
249 SDL_STATIC_LIBRARIES :=
250
251endif # BUILD_SDL_FROM_SOURCES
252
253EMULATOR_LIBUI_CFLAGS += $(SDL_CFLAGS)
254EMULATOR_LIBUI_LDLIBS += $(SDL_LDLIBS)
255
256# The following is needed by SDL_LoadObject
257ifneq ($(HOST_OS),windows)
258 EMULATOR_LIBUI_LDLIBS += -ldl
259endif
260
261# the skin support sources
262#
263SKIN_SOURCES := rect.c \
264 region.c \
265 image.c \
266 trackball.c \
267 keyboard.c \
268 keyset.c \
269 file.c \
270 window.c \
271 scaler.c \
272 composer.c \
273 surface.c \
274
Andrew Hsiehc7389bd2012-03-13 02:13:40 -0700275common_LOCAL_SRC_FILES += $(SKIN_SOURCES:%=android/skin/%)
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100276
Andrew Hsiehc7389bd2012-03-13 02:13:40 -0700277common_LOCAL_SRC_FILES += \
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100278 android/user-config.c \
279 android/resource.c \
280 android/qemulator.c \
281 android/keycode.c \
282
283# enable MMX code for our skin scaler
284ifeq ($(HOST_ARCH),x86)
Andrew Hsiehc7389bd2012-03-13 02:13:40 -0700285common_LOCAL_CFLAGS += -DUSE_MMX=1 -mmmx
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100286endif
287
Andrew Hsiehc7389bd2012-03-13 02:13:40 -0700288common_LOCAL_CFLAGS += $(EMULATOR_LIBUI_CFLAGS)
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100289
Andrew Hsiehc7389bd2012-03-13 02:13:40 -0700290
291## one for 32-bit
292$(call start-emulator-library, emulator-libui)
293LOCAL_CFLAGS += $(common_LOCAL_CFLAGS)
294LOCAL_SRC_FILES += $(common_LOCAL_SRC_FILES)
295$(call gen-hw-config-defs)
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100296$(call end-emulator-library)
297
Andrew Hsiehc7389bd2012-03-13 02:13:40 -0700298
299## another for 64-bit, see note in emulator64-common
Andrew Hsieh83df59c2012-07-24 16:06:28 -0700300ifneq ($(filter linux darwin,$(HOST_OS)),)
David 'Digit' Turner8be0af82014-01-14 14:39:13 +0100301 $(call start-emulator-library, emulator64-libui)
302 LOCAL_CFLAGS += $(common_LOCAL_CFLAGS) -m64
303 LOCAL_SRC_FILES += $(common_LOCAL_SRC_FILES)
304 $(call gen-hw-config-defs)
305 $(call end-emulator-library)
Andrew Hsieh83df59c2012-07-24 16:06:28 -0700306endif # HOST_OS == linux || darwin
Andrew Hsiehc7389bd2012-03-13 02:13:40 -0700307
308
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100309##############################################################################
310##############################################################################
311###
312### emulator-libqemu: TARGET-INDEPENDENT QEMU FUNCTIONS
313###
314### THESE ARE USED BY EVERYTHING EXCEPT 'emulator-ui'
315###
316
Andrew Hsiehc7389bd2012-03-13 02:13:40 -0700317common_LOCAL_CFLAGS =
318common_LOCAL_SRC_FILES =
319
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100320
321EMULATOR_LIBQEMU_CFLAGS :=
322
Andrew Hsiehc7389bd2012-03-13 02:13:40 -0700323common_LOCAL_CFLAGS += $(EMULATOR_COMMON_CFLAGS)
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100324
325AUDIO_SOURCES := noaudio.c wavaudio.c wavcapture.c mixeng.c
326AUDIO_CFLAGS := -I$(LOCAL_PATH)/audio -DHAS_AUDIO
327AUDIO_LDLIBS :=
328
Raphael Moll9e319a92012-11-28 13:48:25 -0800329common_LOCAL_CFLAGS += -Wall $(GCC_W_NO_MISSING_FIELD_INITIALIZERS)
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100330
331ifeq ($(HOST_OS),darwin)
332 CONFIG_COREAUDIO ?= yes
333 AUDIO_CFLAGS += -DHOST_BSD=1
334endif
335
336ifeq ($(HOST_OS),windows)
337 CONFIG_WINAUDIO ?= yes
338endif
339
340ifeq ($(HOST_OS),linux)
341 CONFIG_OSS ?= yes
342 CONFIG_ALSA ?= yes
343 CONFIG_PULSEAUDIO ?= yes
344 CONFIG_ESD ?= yes
345endif
346
347ifeq ($(HOST_OS),freebsd)
348 CONFIG_OSS ?= yes
349endif
350
351ifeq ($(CONFIG_COREAUDIO),yes)
352 AUDIO_SOURCES += coreaudio.c
353 AUDIO_CFLAGS += -DCONFIG_COREAUDIO
354 AUDIO_LDLIBS += -Wl,-framework,CoreAudio
355endif
356
357ifeq ($(CONFIG_WINAUDIO),yes)
358 AUDIO_SOURCES += winaudio.c
359 AUDIO_CFLAGS += -DCONFIG_WINAUDIO
360endif
361
362ifeq ($(CONFIG_PULSEAUDIO),yes)
363 AUDIO_SOURCES += paaudio.c audio_pt_int.c
364 AUDIO_CFLAGS += -DCONFIG_PULSEAUDIO
365endif
366
367ifeq ($(CONFIG_ALSA),yes)
368 AUDIO_SOURCES += alsaaudio.c audio_pt_int.c
369 AUDIO_CFLAGS += -DCONFIG_ALSA
370endif
371
372ifeq ($(CONFIG_ESD),yes)
373 AUDIO_SOURCES += esdaudio.c
374 AUDIO_CFLAGS += -DCONFIG_ESD
375endif
376
377ifeq ($(CONFIG_OSS),yes)
378 AUDIO_SOURCES += ossaudio.c
379 AUDIO_CFLAGS += -DCONFIG_OSS
380endif
381
382AUDIO_SOURCES := $(call sort,$(AUDIO_SOURCES:%=audio/%))
383
Andrew Hsiehc7389bd2012-03-13 02:13:40 -0700384common_LOCAL_CFLAGS += -Wno-sign-compare \
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100385 -fno-strict-aliasing -W -Wall -Wno-unused-parameter \
386
387# this is very important, otherwise the generated binaries may
388# not link properly on our build servers
389ifeq ($(HOST_OS),linux)
Andrew Hsiehc7389bd2012-03-13 02:13:40 -0700390common_LOCAL_CFLAGS += -fno-stack-protector
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100391endif
392
Andrew Hsiehc7389bd2012-03-13 02:13:40 -0700393common_LOCAL_SRC_FILES += $(AUDIO_SOURCES)
394common_LOCAL_SRC_FILES += \
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100395 android/audio-test.c
396
397# other flags
398ifneq ($(HOST_OS),windows)
399 AUDIO_LDLIBS += -ldl
400else
401endif
402
403
404EMULATOR_LIBQEMU_CFLAGS += $(AUDIO_CFLAGS)
405EMULATOR_LIBQEMU_LDLIBS += $(AUDIO_LDLIBS)
406
Raphael Moll9e319a92012-11-28 13:48:25 -0800407common_LOCAL_CFLAGS += $(GCC_W_NO_MISSING_FIELD_INITIALIZERS)
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100408
409# migration sources
410#
411ifeq ($(HOST_OS),windows)
Andrew Hsiehc7389bd2012-03-13 02:13:40 -0700412 common_LOCAL_SRC_FILES += migration-dummy-android.c
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100413else
Andrew Hsiehc7389bd2012-03-13 02:13:40 -0700414 common_LOCAL_SRC_FILES += migration.c \
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100415 migration-exec.c \
416 migration-tcp-android.c
417endif
418
419# misc. sources
420#
421CORE_MISC_SOURCES = \
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100422 aio-android.c \
423 async.c \
424 bt-host.c \
425 bt-vhci.c \
426 buffered_file.c \
David 'Digit' Turner8354d2d2011-05-11 00:19:06 +0200427 iohandler.c \
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100428 ioport.c \
David 'Digit' Turner3b2846a2011-05-11 01:34:40 +0200429 qemu-char.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 \
465 ui/console.c \
466 ui/d3des.c \
David 'Digit' Turnerd7088e92013-12-17 09:25:19 +0100467 ui/input.c \
David 'Digit' Turner1c31e3e2013-12-14 20:07:17 +0100468 ui/vnc-android.c \
David 'Digit' Turner37dc41a2013-12-14 14:45:51 +0100469 util/acl.c \
470 util/aes.c \
David 'Digit' Turnere90d6652013-12-14 14:55:12 +0100471 util/cutils.c \
472 util/module.c \
473 util/notify.c \
David 'Digit' Turner84569132013-12-13 17:34:07 +0100474 util/osdep.c \
David 'Digit' Turner1c31e3e2013-12-14 20:07:17 +0100475 util/path.c \
476 util/qemu-config.c \
477 util/qemu-error.c \
478 util/qemu-option.c \
479 util/qemu-sockets-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' Turner1c31e3e2013-12-14 20:07:17 +0100494 util/qemu-thread.c \
Vladimir Chtchetkine4ed09fd2011-08-18 09:42:40 -0700495 android/camera/camera-capture-linux.c
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100496else
David 'Digit' Turnerd471c922013-12-17 09:52:48 +0100497 CORE_MISC_SOURCES += hw/usb/usb-dummy-android.c
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100498endif
499
500ifeq ($(HOST_OS),windows)
Vladimir Chtchetkine4ed09fd2011-08-18 09:42:40 -0700501 CORE_MISC_SOURCES += tap-win32.c \
502 android/camera/camera-capture-windows.c
503
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100504else
505 CORE_MISC_SOURCES += posix-aio-compat.c
506endif
507
Vladimir Chtchetkineb92b3032011-09-12 15:29:32 -0700508ifeq ($(HOST_OS),darwin)
Vladimir Chtchetkine955a9972011-10-12 15:40:17 -0700509 CORE_MISC_SOURCES += android/camera/camera-capture-mac.m
Vladimir Chtchetkineb92b3032011-09-12 15:29:32 -0700510endif
511
Andrew Hsiehc7389bd2012-03-13 02:13:40 -0700512common_LOCAL_SRC_FILES += $(CORE_MISC_SOURCES)
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100513
514# Required
Lars Poeschel33da99a2012-08-22 09:42:42 +0200515common_LOCAL_CFLAGS += -D_XOPEN_SOURCE=600 -D_BSD_SOURCE=1 -I$(LOCAL_PATH)/distrib/jpeg-6b
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100516
517SLIRP_SOURCES := \
518 bootp.c \
519 cksum.c \
520 debug.c \
521 if.c \
522 ip_icmp.c \
523 ip_input.c \
524 ip_output.c \
525 mbuf.c \
526 misc.c \
527 sbuf.c \
528 slirp.c \
529 socket.c \
530 tcp_input.c \
531 tcp_output.c \
532 tcp_subr.c \
533 tcp_timer.c \
534 tftp.c \
535 udp.c
536
Andrew Hsiehc7389bd2012-03-13 02:13:40 -0700537common_LOCAL_SRC_FILES += $(SLIRP_SOURCES:%=slirp-android/%)
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100538EMULATOR_LIBQEMU_CFLAGS += -I$(LOCAL_PATH)/slirp-android
539
540# socket proxy support
541#
542PROXY_SOURCES := \
543 proxy_common.c \
544 proxy_http.c \
545 proxy_http_connector.c \
546 proxy_http_rewriter.c \
547
Andrew Hsiehc7389bd2012-03-13 02:13:40 -0700548common_LOCAL_SRC_FILES += $(PROXY_SOURCES:%=proxy/%)
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100549EMULATOR_LIBQEMU_CFLAGS += -I$(LOCAL_PATH)/proxy
550
551# include telephony stuff
552#
553TELEPHONY_SOURCES := \
554 android_modem.c \
555 modem_driver.c \
556 gsm.c \
557 sim_card.c \
558 sysdeps_qemu.c \
559 sms.c \
560 remote_call.c
561
Andrew Hsiehc7389bd2012-03-13 02:13:40 -0700562common_LOCAL_SRC_FILES += $(TELEPHONY_SOURCES:%=telephony/%)
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100563EMULATOR_LIBQEMU_CFLAGS += -I$(LOCAL_PATH)/telephony
564
565# sources inherited from upstream, but not fully
566# integrated into android emulator
567#
Andrew Hsiehc7389bd2012-03-13 02:13:40 -0700568common_LOCAL_SRC_FILES += \
David 'Digit' Turner1c31e3e2013-12-14 20:07:17 +0100569 qobject/json-lexer.c \
570 qobject/json-parser.c \
571 qobject/json-streamer.c \
572 qobject/qjson.c \
573 qobject/qbool.c \
574 qobject/qdict.c \
575 qobject/qfloat.c \
576 qobject/qint.c \
577 qobject/qlist.c \
578 qobject/qstring.c \
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100579
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100580ifeq ($(QEMU_TARGET_XML_SOURCES),)
581 QEMU_TARGET_XML_SOURCES := arm-core arm-neon arm-vfp arm-vfp3
582 QEMU_TARGET_XML_SOURCES := $(QEMU_TARGET_XML_SOURCES:%=$(LOCAL_PATH)/gdb-xml/%.xml)
583endif
584
Andrew Hsiehc7389bd2012-03-13 02:13:40 -0700585common_LOCAL_CFLAGS += $(EMULATOR_LIBQEMU_CFLAGS)
586
587
588## one for 32-bit
589$(call start-emulator-library, emulator-libqemu)
590# gdbstub-xml.c contains C-compilable arrays corresponding to the content
591# of $(LOCAL_PATH)/gdb-xml/, and is generated with the 'feature_to_c.sh' script.
592#
593intermediates = $(call intermediates-dir-for,STATIC_LIBRARIES,$(LOCAL_MODULE),true)
594QEMU_GDBSTUB_XML_C = $(intermediates)/gdbstub-xml.c
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100595$(QEMU_GDBSTUB_XML_C): PRIVATE_PATH := $(LOCAL_PATH)
596$(QEMU_GDBSTUB_XML_C): PRIVATE_SOURCES := $(TARGET_XML_SOURCES)
597$(QEMU_GDBSTUB_XML_C): PRIVATE_CUSTOM_TOOL = $(PRIVATE_PATH)/feature_to_c.sh $@ $(QEMU_TARGET_XML_SOURCES)
598$(QEMU_GDBSTUB_XML_C): $(QEMU_TARGET_XML_SOURCES) $(LOCAL_PATH)/feature_to_c.sh
599 $(hide) rm -f $@
600 $(transform-generated-source)
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100601LOCAL_GENERATED_SOURCES += $(QEMU_GDBSTUB_XML_C)
Andrew Hsiehc7389bd2012-03-13 02:13:40 -0700602LOCAL_CFLAGS += $(common_LOCAL_CFLAGS) -I$(intermediates)
603LOCAL_SRC_FILES += $(common_LOCAL_SRC_FILES)
604$(call gen-hw-config-defs)
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100605$(call end-emulator-library)
606
Andrew Hsiehc7389bd2012-03-13 02:13:40 -0700607
608## another for 64-bit, see note in emulator64-common
Andrew Hsieh83df59c2012-07-24 16:06:28 -0700609ifneq ($(filter linux darwin,$(HOST_OS)),)
David 'Digit' Turner8be0af82014-01-14 14:39:13 +0100610 $(call start-emulator-library, emulator64-libqemu)
611 # gdbstub-xml.c contains C-compilable arrays corresponding to the content
612 # of $(LOCAL_PATH)/gdb-xml/, and is generated with the 'feature_to_c.sh' script.
613 #
614 intermediates = $(call intermediates-dir-for,STATIC_LIBRARIES,$(LOCAL_MODULE),true)
615 QEMU_GDBSTUB_XML_C = $(intermediates)/gdbstub-xml.c
616 $(QEMU_GDBSTUB_XML_C): PRIVATE_PATH := $(LOCAL_PATH)
617 $(QEMU_GDBSTUB_XML_C): PRIVATE_SOURCES := $(TARGET_XML_SOURCES)
618 $(QEMU_GDBSTUB_XML_C): PRIVATE_CUSTOM_TOOL = $(PRIVATE_PATH)/feature_to_c.sh $@ $(QEMU_TARGET_XML_SOURCES)
619 $(QEMU_GDBSTUB_XML_C): $(QEMU_TARGET_XML_SOURCES) $(LOCAL_PATH)/feature_to_c.sh
Andrew Hsiehc7389bd2012-03-13 02:13:40 -0700620 $(hide) rm -f $@
621 $(transform-generated-source)
David 'Digit' Turner8be0af82014-01-14 14:39:13 +0100622 LOCAL_GENERATED_SOURCES += $(QEMU_GDBSTUB_XML_C)
623 LOCAL_CFLAGS += $(common_LOCAL_CFLAGS) -I$(intermediates) -m64
624 LOCAL_SRC_FILES += $(common_LOCAL_SRC_FILES)
625 $(call gen-hw-config-defs)
626 $(call end-emulator-library)
Andrew Hsieh83df59c2012-07-24 16:06:28 -0700627endif # HOST_OS == linux || darwin
Andrew Hsiehc7389bd2012-03-13 02:13:40 -0700628
629
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100630# Block sources, we must compile them with each executable because they
631# are only referenced by the rest of the code using constructor functions.
632# If their object files are put in a static library, these are never compiled
633# into the final linked executable that uses them.
634#
635# Normally, one would solve thus using LOCAL_WHOLE_STATIC_LIBRARIES, but
636# the Darwin linker doesn't support -Wl,--whole-archive or equivalent :-(
637#
638BLOCK_SOURCES += \
639 block.c \
640 blockdev.c \
641 block/qcow.c \
642 block/qcow2.c \
643 block/qcow2-refcount.c \
644 block/qcow2-snapshot.c \
645 block/qcow2-cluster.c \
646 block/cloop.c \
647 block/dmg.c \
648 block/vvfat.c \
649 block/raw.c
650
651ifeq ($(HOST_OS),windows)
652 BLOCK_SOURCES += block/raw-win32.c
653else
654 BLOCK_SOURCES += block/raw-posix.c
655endif
656
657BLOCK_CFLAGS += $(EMULATOR_COMMON_CFLAGS)
David 'Digit' Turnercef730b2014-02-04 01:02:30 +0100658BLOCK_CFLAGS += -DCONFIG_BDRV_WHITELIST=\"\"
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100659
Lars Poeschel33da99a2012-08-22 09:42:42 +0200660##############################################################################
661##############################################################################
662###
663### emulator-libjpeg: TARGET-INDEPENDENT QEMU FUNCTIONS
664###
665### THESE ARE USED BY EVERYTHING EXCEPT 'emulator-ui'
666###
667
668common_LOCAL_CFLAGS =
669common_LOCAL_SRC_FILES =
670
671###########################################################
672# Jpeg configuration
673#
674LIBJPEG_DIR := distrib/jpeg-6b
675include $(LOCAL_PATH)/$(LIBJPEG_DIR)/sources.make
676
677common_LOCAL_SRC_FILES += $(LIBJPEG_SOURCES)
678
679common_LOCAL_CFLAGS += \
680 $(LIBJPEG_CFLAGS) \
681 -I$(LOCAL_PATH)/$(LIBJPEG_DIR)
682
683## one for 32-bit
684$(call start-emulator-library, emulator-libjpeg)
685LOCAL_CFLAGS += $(common_LOCAL_CFLAGS)
686LOCAL_SRC_FILES += $(common_LOCAL_SRC_FILES)
687$(call end-emulator-library)
688
689
690## another for 64-bit, see note in emulator64-common
Andrew Hsieh6eb25c72012-08-24 08:18:22 +0800691ifneq ($(filter linux darwin,$(HOST_OS)),)
David 'Digit' Turner8be0af82014-01-14 14:39:13 +0100692 $(call start-emulator-library, emulator64-libjpeg)
693 LOCAL_CFLAGS += $(common_LOCAL_CFLAGS) -m64
694 LOCAL_SRC_FILES += $(common_LOCAL_SRC_FILES)
695 $(call end-emulator-library)
Lars Poeschel33da99a2012-08-22 09:42:42 +0200696endif # HOST_OS == linux
697
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100698
699##############################################################################
700##############################################################################
701###
David 'Digit' Turner8be0af82014-01-14 14:39:13 +0100702### emulator-libelff: TARGET-INDEPENDENT ELF/DWARF PARSER
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100703###
704### THESE ARE USED BY EVERYTHING EXCEPT 'emulator-ui', BUT WE CANNOT PUT
705### THEM IN emulator-libqemu SINCE THE SOURCES ARE C++
706###
707
Andrew Hsiehc7389bd2012-03-13 02:13:40 -0700708common_LOCAL_CFLAGS =
709common_LOCAL_SRC_FILES =
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100710
711ELFF_CFLAGS := -I$(LOCAL_PATH)/elff
712ELFF_LDLIBS := -lstdc++
713
714ELFF_SOURCES := \
715 dwarf_cu.cc \
716 dwarf_die.cc \
717 dwarf_utils.cc \
718 elf_alloc.cc \
719 elf_file.cc \
720 elf_mapped_section.cc \
721 elff_api.cc \
722
Andrew Hsiehc7389bd2012-03-13 02:13:40 -0700723common_LOCAL_SRC_FILES += $(ELFF_SOURCES:%=elff/%)
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100724
Andrew Hsiehc7389bd2012-03-13 02:13:40 -0700725common_LOCAL_CFLAGS += \
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100726 -fno-exceptions \
727 $(ELFF_CFLAGS) \
728
Andrew Hsiehc7389bd2012-03-13 02:13:40 -0700729
730## one for 32-bit
731$(call start-emulator-library, emulator-libelff)
732LOCAL_CPP_EXTENSION := .cc
733LOCAL_CFLAGS += $(common_LOCAL_CFLAGS)
734LOCAL_SRC_FILES += $(common_LOCAL_SRC_FILES)
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100735$(call end-emulator-library)
736
737
Andrew Hsiehc7389bd2012-03-13 02:13:40 -0700738## another for 64-bit, see note in emulator64-common
Andrew Hsieh83df59c2012-07-24 16:06:28 -0700739ifneq ($(filter linux darwin,$(HOST_OS)),)
David 'Digit' Turner8be0af82014-01-14 14:39:13 +0100740 $(call start-emulator-library, emulator64-libelff)
741 LOCAL_CPP_EXTENSION := .cc
742 LOCAL_CFLAGS += $(common_LOCAL_CFLAGS) -m64
743 LOCAL_SRC_FILES += $(common_LOCAL_SRC_FILES)
744 $(call end-emulator-library)
Andrew Hsieh83df59c2012-07-24 16:06:28 -0700745endif # HOST_OS == linux || darwin
Andrew Hsiehc7389bd2012-03-13 02:13:40 -0700746
747
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100748##############################################################################
749##############################################################################
750###
751### gen-hx-header: Generate headers from .hx file with "hxtool" script.
752###
753### The 'hxtool' script is used to generate header files from an input
754### file with the .hx suffix. I.e. foo.hx --> foo.h
755###
756### Due to the way the Android build system works, we need to regenerate
757### it for each module (the output will go into a module-specific directory).
758###
759### This defines a function that can be used inside a module definition
760###
David 'Digit' Turner088edf82011-05-09 15:59:28 +0200761### $(call gen-hx-header,<input>,<output>,<source-files>)
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100762###
763### Where: <input> is the input file, with a .hx suffix (e.g. foo.hx)
David 'Digit' Turner088edf82011-05-09 15:59:28 +0200764### <output> is the output file, with a .h or .def suffix
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100765### <source-files> is a list of source files that include the header
766###
767
768
769gen-hx-header = $(eval $(call gen-hx-header-ev,$1,$2,$3))
770
771define gen-hx-header-ev
David 'Digit' Turner42fc4492011-06-29 13:16:16 +0200772intermediates := $$(call intermediates-dir-for,$$(LOCAL_MODULE_CLASS),$$(LOCAL_MODULE),true)
David 'Digit' Turner317c9d52011-05-10 06:38:21 +0200773
David 'Digit' Turner088edf82011-05-09 15:59:28 +0200774QEMU_HEADER_H := $$(intermediates)/$$2
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100775$$(QEMU_HEADER_H): PRIVATE_PATH := $$(LOCAL_PATH)
776$$(QEMU_HEADER_H): PRIVATE_CUSTOM_TOOL = $$(PRIVATE_PATH)/hxtool -h < $$< > $$@
777$$(QEMU_HEADER_H): $$(LOCAL_PATH)/$$1 $$(LOCAL_PATH)/hxtool
778 $$(transform-generated-source)
779
780LOCAL_GENERATED_SOURCES += $$(QEMU_HEADER_H)
David 'Digit' Turner088edf82011-05-09 15:59:28 +0200781LOCAL_C_INCLUDES += $$(intermediates)
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100782endef
783