blob: 51fcb85ed5621708faa9e474fb6ee0bdf5c8b148 [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
87###########################################################
88# Zlib sources
89#
90ZLIB_DIR := distrib/zlib-1.2.3
91include $(LOCAL_PATH)/$(ZLIB_DIR)/sources.make
92EMULATOR_COMMON_CFLAGS += -I$(LOCAL_PATH)/$(ZLIB_DIR)
93
Andrew Hsiehc7389bd2012-03-13 02:13:40 -070094common_LOCAL_SRC_FILES += $(ZLIB_SOURCES)
David 'Digit' Turneraff94b82011-02-07 18:10:54 +010095
96###########################################################
97# Android utility functions
98#
Andrew Hsiehc7389bd2012-03-13 02:13:40 -070099common_LOCAL_SRC_FILES += \
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100100 sockets.c \
101 iolooper-select.c \
102 android/async-console.c \
103 android/async-utils.c \
104 android/charmap.c \
105 android/framebuffer.c \
106 android/keycode-array.c \
107 android/avd/hw-config.c \
108 android/avd/info.c \
David 'Digit' Turner2d238fd2011-03-25 10:34:47 +0100109 android/avd/util.c \
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100110 android/sync-utils.c \
111 android/utils/assert.c \
112 android/utils/bufprint.c \
113 android/utils/debug.c \
David 'Digit' Turner816e53c2011-08-17 18:33:45 +0200114 android/utils/dll.c \
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100115 android/utils/dirscanner.c \
116 android/utils/filelock.c \
117 android/utils/ini.c \
David 'Digit' Turnerbbb81042011-03-17 14:48:44 +0100118 android/utils/intmap.c \
David 'Digit' Turner0a879bf2011-05-12 18:45:18 +0200119 android/utils/lineinput.c \
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100120 android/utils/mapfile.c \
121 android/utils/misc.c \
122 android/utils/panic.c \
123 android/utils/path.c \
124 android/utils/reflist.c \
125 android/utils/refset.c \
126 android/utils/stralloc.c \
127 android/utils/system.c \
128 android/utils/tempfile.c \
129 android/utils/vector.c \
130
Andrew Hsiehc7389bd2012-03-13 02:13:40 -0700131common_LOCAL_CFLAGS += $(EMULATOR_COMMON_CFLAGS)
132
133
134## one for 32-bit
135$(call start-emulator-library, emulator-common)
136LOCAL_CFLAGS += $(common_LOCAL_CFLAGS)
137LOCAL_SRC_FILES += $(common_LOCAL_SRC_FILES)
David 'Digit' Turner42fc4492011-06-29 13:16:16 +0200138$(call gen-hw-config-defs)
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100139$(call end-emulator-library)
140
Andrew Hsiehc7389bd2012-03-13 02:13:40 -0700141## another for 64-bit
142# NOTE: only linux in non-standalone mode is supported, because
143# 1) For Windows: amd64-mingw32msvc-gcc doesn't work, see http://b/issue?id=5949152.
144# 2) For MacOSX: 64-bit libSDL*.a 1.2.x depends on NSQuickDrawView doesn't exist
145# 3) Standalone has --try-64
Andrew Hsiehd0f2ab62012-03-23 17:35:11 +0800146ifeq ($(HOST_OS),linux)
Andrew Hsiehc7389bd2012-03-13 02:13:40 -0700147 ifneq ($(BUILD_STANDALONE_EMULATOR),true)
148 $(call start-emulator-library, emulator64-common)
149 LOCAL_CFLAGS += $(common_LOCAL_CFLAGS) -m64
150 LOCAL_SRC_FILES += $(common_LOCAL_SRC_FILES)
151 $(call gen-hw-config-defs)
152 $(call end-emulator-library)
153 endif # BUILD_STANDALONE_EMULATOR == nil
154endif # HOST_OS == linux
155
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100156##############################################################################
157##############################################################################
158###
159### emulator-libui: LIBRARY OF UI-RELATED FUNCTIONS
160###
161### THESE ARE USED BY 'emulator-ui' AND THE STANDALONE PROGRAMS
162###
163
Andrew Hsiehc7389bd2012-03-13 02:13:40 -0700164common_LOCAL_CFLAGS =
165common_LOCAL_SRC_FILES =
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100166
Jesse Hall183e9272012-04-26 15:13:27 -0700167ifneq ($(QEMU_OPENGLES_INCLUDE),)
168 EMULATOR_LIBUI_CFLAGS := -I$(QEMU_OPENGLES_INCLUDE)
169endif
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100170
Andrew Hsiehc7389bd2012-03-13 02:13:40 -0700171common_LOCAL_CFLAGS += $(EMULATOR_COMMON_CFLAGS)
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100172
173###########################################################
174# Libpng configuration
175#
176LIBPNG_DIR := distrib/libpng-1.2.19
177include $(LOCAL_PATH)/$(LIBPNG_DIR)/sources.make
178
179EMULATOR_LIBUI_CFLAGS += \
180 $(LIBPNG_CFLAGS) \
181 -I$(LOCAL_PATH)/$(LIBPNG_DIR)
182
Andrew Hsiehc7389bd2012-03-13 02:13:40 -0700183common_LOCAL_SRC_FILES += $(LIBPNG_SOURCES) loadpng.c
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100184
185##############################################################################
186# SDL-related definitions
187#
188
189# Build SDL from sources except in certain cases where we use
190# prebuilt libraries instead.
191#
192BUILD_SDL_FROM_SOURCES := true
193
194# On linux-x86, using the prebuilts avoid installing all the X11
195# development packages on our build servers.
196#
197ifeq ($(QEMU_HOST_TAG),linux-x86)
198 BUILD_SDL_FROM_SOURCES := false
199endif
200
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100201# If we're building with android-configure.sh && make, always build from
202# sources to catch regressions as soon as they happen.
203#
204ifeq ($(BUILD_STANDALONE_EMULATOR),true)
205 BUILD_SDL_FROM_SOURCES := true
206endif
207
208# Except if we used android-configure.sh --sdl-config=<script>
209#
David 'Digit' Turnera4026682011-08-24 12:54:01 +0200210ifneq ($(QEMU_SDL_CONFIG),)
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100211 BUILD_SDL_FROM_SOURCES := false
David 'Digit' Turnera4026682011-08-24 12:54:01 +0200212 SDL_CONFIG := $(QEMU_SDL_CONFIG)
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100213endif
214
215ifneq ($(BUILD_SDL_FROM_SOURCES),true)
216
Xavier Ducrohet20821322012-04-03 16:39:24 -0700217 SDL_CONFIG ?= prebuilts/tools/$(QEMU_HOST_TAG)/sdl/bin/sdl-config
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100218 SDL_CFLAGS := $(shell $(SDL_CONFIG) --cflags)
219
220 # We need to filter out the _GNU_SOURCE variable because it breaks recent
221 # releases of Cygwin when using the -mno-cygwin option. Moreover, we don't
222 # need this macro at all to build the Android emulator.
223 SDL_CFLAGS := $(filter-out -D_GNU_SOURCE=1,$(SDL_CFLAGS))
224 SDL_LDLIBS := $(filter-out %.a %.lib,$(shell $(SDL_CONFIG) --static-libs))
225
226 # Circular dependencies between libSDL and libSDLmain
227 # We repeat the libraries in the final link to work around it
228 SDL_STATIC_LIBRARIES := libSDL libSDLmain libSDL libSDLmain
Andrew Hsiehc7389bd2012-03-13 02:13:40 -0700229 SDL_STATIC_LIBRARIES_64 := lib64SDL lib64SDLmain lib64SDL lib64SDLmain
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100230
231else # BUILD_SDL_FROM_SOURCES
232
Jesse Hallc60b1142012-07-17 17:01:04 -0700233 SDL_DIR := distrib/sdl-1.2.15
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100234 include $(LOCAL_PATH)/$(SDL_DIR)/sources.make
Andrew Hsiehc7389bd2012-03-13 02:13:40 -0700235 common_LOCAL_SRC_FILES += $(SDL_SOURCES)
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100236
237 EMULATOR_LIBUI_CFLAGS += \
238 -I$(LOCAL_PATH)/$(SDL_DIR)/include
239
240 SDL_STATIC_LIBRARIES :=
241
242endif # BUILD_SDL_FROM_SOURCES
243
244EMULATOR_LIBUI_CFLAGS += $(SDL_CFLAGS)
245EMULATOR_LIBUI_LDLIBS += $(SDL_LDLIBS)
246
247# The following is needed by SDL_LoadObject
248ifneq ($(HOST_OS),windows)
249 EMULATOR_LIBUI_LDLIBS += -ldl
250endif
251
252# the skin support sources
253#
254SKIN_SOURCES := rect.c \
255 region.c \
256 image.c \
257 trackball.c \
258 keyboard.c \
259 keyset.c \
260 file.c \
261 window.c \
262 scaler.c \
263 composer.c \
264 surface.c \
265
Andrew Hsiehc7389bd2012-03-13 02:13:40 -0700266common_LOCAL_SRC_FILES += $(SKIN_SOURCES:%=android/skin/%)
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100267
Andrew Hsiehc7389bd2012-03-13 02:13:40 -0700268common_LOCAL_SRC_FILES += \
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100269 android/user-config.c \
270 android/resource.c \
271 android/qemulator.c \
272 android/keycode.c \
273
274# enable MMX code for our skin scaler
275ifeq ($(HOST_ARCH),x86)
Andrew Hsiehc7389bd2012-03-13 02:13:40 -0700276common_LOCAL_CFLAGS += -DUSE_MMX=1 -mmmx
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100277endif
278
Andrew Hsiehc7389bd2012-03-13 02:13:40 -0700279common_LOCAL_CFLAGS += $(EMULATOR_LIBUI_CFLAGS)
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100280
Andrew Hsiehc7389bd2012-03-13 02:13:40 -0700281
282## one for 32-bit
283$(call start-emulator-library, emulator-libui)
284LOCAL_CFLAGS += $(common_LOCAL_CFLAGS)
285LOCAL_SRC_FILES += $(common_LOCAL_SRC_FILES)
286$(call gen-hw-config-defs)
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100287$(call end-emulator-library)
288
Andrew Hsiehc7389bd2012-03-13 02:13:40 -0700289
290## another for 64-bit, see note in emulator64-common
Andrew Hsiehd0f2ab62012-03-23 17:35:11 +0800291ifeq ($(HOST_OS),linux)
Andrew Hsiehc7389bd2012-03-13 02:13:40 -0700292 ifneq ($(BUILD_STANDALONE_EMULATOR),true)
293 $(call start-emulator-library, emulator64-libui)
294 LOCAL_CFLAGS += $(common_LOCAL_CFLAGS) -m64
295 LOCAL_SRC_FILES += $(common_LOCAL_SRC_FILES)
296 $(call gen-hw-config-defs)
297 $(call end-emulator-library)
298 endif # BUILD_STANDALONE_EMULATOR == nil
299endif # HOST_OS == linux
300
301
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100302##############################################################################
303##############################################################################
304###
305### emulator-libqemu: TARGET-INDEPENDENT QEMU FUNCTIONS
306###
307### THESE ARE USED BY EVERYTHING EXCEPT 'emulator-ui'
308###
309
Andrew Hsiehc7389bd2012-03-13 02:13:40 -0700310common_LOCAL_CFLAGS =
311common_LOCAL_SRC_FILES =
312
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100313
314EMULATOR_LIBQEMU_CFLAGS :=
315
Andrew Hsiehc7389bd2012-03-13 02:13:40 -0700316common_LOCAL_CFLAGS += $(EMULATOR_COMMON_CFLAGS)
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100317
Vladimir Chtchetkine70a18cd2012-01-31 16:21:06 -0800318###########################################################
319# Jpeg configuration
320#
321LIBJPEG_DIR := distrib/jpeg-6b
322include $(LOCAL_PATH)/$(LIBJPEG_DIR)/sources.make
323
324EMULATOR_LIBQEMU_CFLAGS += \
325 $(LIBJPEG_CFLAGS) \
326 -I$(LOCAL_PATH)/$(LIBJPEG_DIR)
327
Andrew Hsiehc7389bd2012-03-13 02:13:40 -0700328common_LOCAL_SRC_FILES += $(LIBJPEG_SOURCES)
Vladimir Chtchetkine70a18cd2012-01-31 16:21:06 -0800329
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100330AUDIO_SOURCES := noaudio.c wavaudio.c wavcapture.c mixeng.c
331AUDIO_CFLAGS := -I$(LOCAL_PATH)/audio -DHAS_AUDIO
332AUDIO_LDLIBS :=
333
Andrew Hsiehc7389bd2012-03-13 02:13:40 -0700334common_LOCAL_CFLAGS += -Wall -Wno-missing-field-initializers
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100335
336ifeq ($(HOST_OS),darwin)
337 CONFIG_COREAUDIO ?= yes
338 AUDIO_CFLAGS += -DHOST_BSD=1
339endif
340
341ifeq ($(HOST_OS),windows)
342 CONFIG_WINAUDIO ?= yes
343endif
344
345ifeq ($(HOST_OS),linux)
346 CONFIG_OSS ?= yes
347 CONFIG_ALSA ?= yes
348 CONFIG_PULSEAUDIO ?= yes
349 CONFIG_ESD ?= yes
350endif
351
352ifeq ($(HOST_OS),freebsd)
353 CONFIG_OSS ?= yes
354endif
355
356ifeq ($(CONFIG_COREAUDIO),yes)
357 AUDIO_SOURCES += coreaudio.c
358 AUDIO_CFLAGS += -DCONFIG_COREAUDIO
359 AUDIO_LDLIBS += -Wl,-framework,CoreAudio
360endif
361
362ifeq ($(CONFIG_WINAUDIO),yes)
363 AUDIO_SOURCES += winaudio.c
364 AUDIO_CFLAGS += -DCONFIG_WINAUDIO
365endif
366
367ifeq ($(CONFIG_PULSEAUDIO),yes)
368 AUDIO_SOURCES += paaudio.c audio_pt_int.c
369 AUDIO_CFLAGS += -DCONFIG_PULSEAUDIO
370endif
371
372ifeq ($(CONFIG_ALSA),yes)
373 AUDIO_SOURCES += alsaaudio.c audio_pt_int.c
374 AUDIO_CFLAGS += -DCONFIG_ALSA
375endif
376
377ifeq ($(CONFIG_ESD),yes)
378 AUDIO_SOURCES += esdaudio.c
379 AUDIO_CFLAGS += -DCONFIG_ESD
380endif
381
382ifeq ($(CONFIG_OSS),yes)
383 AUDIO_SOURCES += ossaudio.c
384 AUDIO_CFLAGS += -DCONFIG_OSS
385endif
386
387AUDIO_SOURCES := $(call sort,$(AUDIO_SOURCES:%=audio/%))
388
Andrew Hsiehc7389bd2012-03-13 02:13:40 -0700389common_LOCAL_CFLAGS += -Wno-sign-compare \
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100390 -fno-strict-aliasing -W -Wall -Wno-unused-parameter \
391
392# this is very important, otherwise the generated binaries may
393# not link properly on our build servers
394ifeq ($(HOST_OS),linux)
Andrew Hsiehc7389bd2012-03-13 02:13:40 -0700395common_LOCAL_CFLAGS += -fno-stack-protector
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100396endif
397
Andrew Hsiehc7389bd2012-03-13 02:13:40 -0700398common_LOCAL_SRC_FILES += $(AUDIO_SOURCES)
399common_LOCAL_SRC_FILES += \
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100400 android/audio-test.c
401
402# other flags
403ifneq ($(HOST_OS),windows)
404 AUDIO_LDLIBS += -ldl
405else
406endif
407
408
409EMULATOR_LIBQEMU_CFLAGS += $(AUDIO_CFLAGS)
410EMULATOR_LIBQEMU_LDLIBS += $(AUDIO_LDLIBS)
411
Andrew Hsiehc7389bd2012-03-13 02:13:40 -0700412common_LOCAL_CFLAGS += -Wno-missing-field-initializers
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100413
414# migration sources
415#
416ifeq ($(HOST_OS),windows)
Andrew Hsiehc7389bd2012-03-13 02:13:40 -0700417 common_LOCAL_SRC_FILES += migration-dummy-android.c
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100418else
Andrew Hsiehc7389bd2012-03-13 02:13:40 -0700419 common_LOCAL_SRC_FILES += migration.c \
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100420 migration-exec.c \
421 migration-tcp-android.c
422endif
423
424# misc. sources
425#
426CORE_MISC_SOURCES = \
427 acl.c \
428 aes.c \
429 aio-android.c \
430 async.c \
431 bt-host.c \
432 bt-vhci.c \
433 buffered_file.c \
434 cbuffer.c \
435 charpipe.c \
436 console.c \
437 cutils.c \
438 d3des.c \
439 input.c \
David 'Digit' Turner8354d2d2011-05-11 00:19:06 +0200440 iohandler.c \
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100441 ioport.c \
442 module.c \
443 net-android.c \
444 notify.c \
445 osdep.c \
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100446 path.c \
David 'Digit' Turner3b2846a2011-05-11 01:34:40 +0200447 qemu-char.c \
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100448 qemu-config.c \
449 qemu-error.c \
450 qemu-malloc.c \
451 qemu-option.c \
452 qemu-sockets-android.c \
453 qerror.c \
454 readline.c \
455 savevm.c \
456 shaper.c \
457 tcpdump.c \
458 vnc-android.c \
459 android/boot-properties.c \
460 android/config.c \
461 android/core-init-utils.c \
462 android/gps.c \
463 android/hw-kmsg.c \
464 android/hw-lcd.c \
465 android/hw-events.c \
466 android/hw-control.c \
467 android/hw-sensors.c \
468 android/hw-qemud.c \
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100469 android/looper-qemu.c \
David 'Digit' Turnerc0ac7332011-05-02 15:05:35 +0200470 android/hw-pipe-net.c \
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100471 android/qemu-setup.c \
472 android/snapshot.c \
Vladimir Chtchetkine9d36fe72012-03-26 10:29:20 -0700473 android/async-socket-connector.c \
Vladimir Chtchetkinea7383ef2012-03-29 07:34:07 -0700474 android/async-socket.c \
Vladimir Chtchetkinec8aa2c52012-04-05 16:22:55 -0700475 android/sdk-controller-socket.c \
Vladimir Chtchetkinedb611d52011-11-01 17:35:07 -0700476 android/sensors-port.c \
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100477 android/utils/timezone.c \
Vladimir Chtchetkinec646f5e2011-09-03 15:17:13 -0700478 android/camera/camera-format-converters.c \
Vladimir Chtchetkined86c7242011-12-09 15:45:46 -0800479 android/camera/camera-service.c \
480 android/adb-server.c \
Vladimir Chtchetkinedb450d72012-01-12 13:37:40 -0800481 android/adb-qemud.c \
Vladimir Chtchetkine8dd31e82012-02-15 17:16:04 -0800482 android/snaphost-android.c \
483 android/multitouch-screen.c \
484 android/multitouch-port.c \
485 android/utils/jpeg-compress.c
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100486
487ifeq ($(HOST_ARCH),x86)
488 CORE_MISC_SOURCES += i386-dis.c
489endif
490ifeq ($(HOST_ARCH),x86_64)
491 CORE_MISC_SOURCES += i386-dis.c
492endif
493ifeq ($(HOST_ARCH),ppc)
494 CORE_MISC_SOURCES += ppc-dis.c \
495 cache-utils.c
496endif
497
498ifeq ($(HOST_OS),linux)
499 CORE_MISC_SOURCES += usb-linux.c \
Vladimir Chtchetkine4ed09fd2011-08-18 09:42:40 -0700500 qemu-thread.c \
501 android/camera/camera-capture-linux.c
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100502else
503 CORE_MISC_SOURCES += usb-dummy-android.c
504endif
505
506ifeq ($(HOST_OS),windows)
Vladimir Chtchetkine4ed09fd2011-08-18 09:42:40 -0700507 CORE_MISC_SOURCES += tap-win32.c \
508 android/camera/camera-capture-windows.c
509
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100510else
511 CORE_MISC_SOURCES += posix-aio-compat.c
512endif
513
Vladimir Chtchetkineb92b3032011-09-12 15:29:32 -0700514ifeq ($(HOST_OS),darwin)
Vladimir Chtchetkine955a9972011-10-12 15:40:17 -0700515 CORE_MISC_SOURCES += android/camera/camera-capture-mac.m
Vladimir Chtchetkineb92b3032011-09-12 15:29:32 -0700516endif
517
Andrew Hsiehc7389bd2012-03-13 02:13:40 -0700518common_LOCAL_SRC_FILES += $(CORE_MISC_SOURCES)
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100519
520# Required
Andrew Hsiehc7389bd2012-03-13 02:13:40 -0700521common_LOCAL_CFLAGS += -D_XOPEN_SOURCE=600 -D_BSD_SOURCE=1
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100522
523SLIRP_SOURCES := \
524 bootp.c \
525 cksum.c \
526 debug.c \
527 if.c \
528 ip_icmp.c \
529 ip_input.c \
530 ip_output.c \
531 mbuf.c \
532 misc.c \
533 sbuf.c \
534 slirp.c \
535 socket.c \
536 tcp_input.c \
537 tcp_output.c \
538 tcp_subr.c \
539 tcp_timer.c \
540 tftp.c \
541 udp.c
542
Andrew Hsiehc7389bd2012-03-13 02:13:40 -0700543common_LOCAL_SRC_FILES += $(SLIRP_SOURCES:%=slirp-android/%)
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100544EMULATOR_LIBQEMU_CFLAGS += -I$(LOCAL_PATH)/slirp-android
545
546# socket proxy support
547#
548PROXY_SOURCES := \
549 proxy_common.c \
550 proxy_http.c \
551 proxy_http_connector.c \
552 proxy_http_rewriter.c \
553
Andrew Hsiehc7389bd2012-03-13 02:13:40 -0700554common_LOCAL_SRC_FILES += $(PROXY_SOURCES:%=proxy/%)
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100555EMULATOR_LIBQEMU_CFLAGS += -I$(LOCAL_PATH)/proxy
556
557# include telephony stuff
558#
559TELEPHONY_SOURCES := \
560 android_modem.c \
561 modem_driver.c \
562 gsm.c \
563 sim_card.c \
564 sysdeps_qemu.c \
565 sms.c \
566 remote_call.c
567
Andrew Hsiehc7389bd2012-03-13 02:13:40 -0700568common_LOCAL_SRC_FILES += $(TELEPHONY_SOURCES:%=telephony/%)
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100569EMULATOR_LIBQEMU_CFLAGS += -I$(LOCAL_PATH)/telephony
570
571# sources inherited from upstream, but not fully
572# integrated into android emulator
573#
Andrew Hsiehc7389bd2012-03-13 02:13:40 -0700574common_LOCAL_SRC_FILES += \
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100575 json-lexer.c \
576 json-parser.c \
577 json-streamer.c \
578 qjson.c \
579 qbool.c \
580 qdict.c \
581 qfloat.c \
582 qint.c \
583 qlist.c \
584 qstring.c \
585
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100586ifeq ($(QEMU_TARGET_XML_SOURCES),)
587 QEMU_TARGET_XML_SOURCES := arm-core arm-neon arm-vfp arm-vfp3
588 QEMU_TARGET_XML_SOURCES := $(QEMU_TARGET_XML_SOURCES:%=$(LOCAL_PATH)/gdb-xml/%.xml)
589endif
590
Andrew Hsiehc7389bd2012-03-13 02:13:40 -0700591common_LOCAL_CFLAGS += $(EMULATOR_LIBQEMU_CFLAGS)
592
593
594## one for 32-bit
595$(call start-emulator-library, emulator-libqemu)
596# gdbstub-xml.c contains C-compilable arrays corresponding to the content
597# of $(LOCAL_PATH)/gdb-xml/, and is generated with the 'feature_to_c.sh' script.
598#
599intermediates = $(call intermediates-dir-for,STATIC_LIBRARIES,$(LOCAL_MODULE),true)
600QEMU_GDBSTUB_XML_C = $(intermediates)/gdbstub-xml.c
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100601$(QEMU_GDBSTUB_XML_C): PRIVATE_PATH := $(LOCAL_PATH)
602$(QEMU_GDBSTUB_XML_C): PRIVATE_SOURCES := $(TARGET_XML_SOURCES)
603$(QEMU_GDBSTUB_XML_C): PRIVATE_CUSTOM_TOOL = $(PRIVATE_PATH)/feature_to_c.sh $@ $(QEMU_TARGET_XML_SOURCES)
604$(QEMU_GDBSTUB_XML_C): $(QEMU_TARGET_XML_SOURCES) $(LOCAL_PATH)/feature_to_c.sh
605 $(hide) rm -f $@
606 $(transform-generated-source)
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100607LOCAL_GENERATED_SOURCES += $(QEMU_GDBSTUB_XML_C)
Andrew Hsiehc7389bd2012-03-13 02:13:40 -0700608LOCAL_CFLAGS += $(common_LOCAL_CFLAGS) -I$(intermediates)
609LOCAL_SRC_FILES += $(common_LOCAL_SRC_FILES)
610$(call gen-hw-config-defs)
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100611$(call end-emulator-library)
612
Andrew Hsiehc7389bd2012-03-13 02:13:40 -0700613
614## another for 64-bit, see note in emulator64-common
Andrew Hsiehd0f2ab62012-03-23 17:35:11 +0800615ifeq ($(HOST_OS),linux)
Andrew Hsiehc7389bd2012-03-13 02:13:40 -0700616 ifneq ($(BUILD_STANDALONE_EMULATOR),true)
617 $(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
627 $(hide) rm -f $@
628 $(transform-generated-source)
629 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)
634 endif # BUILD_STANDALONE_EMULATOR == nil
635endif # HOST_OS == linux
636
637
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100638# Block sources, we must compile them with each executable because they
639# are only referenced by the rest of the code using constructor functions.
640# If their object files are put in a static library, these are never compiled
641# into the final linked executable that uses them.
642#
643# Normally, one would solve thus using LOCAL_WHOLE_STATIC_LIBRARIES, but
644# the Darwin linker doesn't support -Wl,--whole-archive or equivalent :-(
645#
646BLOCK_SOURCES += \
647 block.c \
648 blockdev.c \
649 block/qcow.c \
650 block/qcow2.c \
651 block/qcow2-refcount.c \
652 block/qcow2-snapshot.c \
653 block/qcow2-cluster.c \
654 block/cloop.c \
655 block/dmg.c \
656 block/vvfat.c \
657 block/raw.c
658
659ifeq ($(HOST_OS),windows)
660 BLOCK_SOURCES += block/raw-win32.c
661else
662 BLOCK_SOURCES += block/raw-posix.c
663endif
664
665BLOCK_CFLAGS += $(EMULATOR_COMMON_CFLAGS)
666BLOCK_CFLAGS += -DCONFIG_BDRV_WHITELIST=""
667
668
669##############################################################################
670##############################################################################
671###
672### emulator-libelff: TARGET-INDEPENDENT ELF/DWARD PARSER
673###
674### THESE ARE USED BY EVERYTHING EXCEPT 'emulator-ui', BUT WE CANNOT PUT
675### THEM IN emulator-libqemu SINCE THE SOURCES ARE C++
676###
677
Andrew Hsiehc7389bd2012-03-13 02:13:40 -0700678common_LOCAL_CFLAGS =
679common_LOCAL_SRC_FILES =
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100680
681ELFF_CFLAGS := -I$(LOCAL_PATH)/elff
682ELFF_LDLIBS := -lstdc++
683
684ELFF_SOURCES := \
685 dwarf_cu.cc \
686 dwarf_die.cc \
687 dwarf_utils.cc \
688 elf_alloc.cc \
689 elf_file.cc \
690 elf_mapped_section.cc \
691 elff_api.cc \
692
Andrew Hsiehc7389bd2012-03-13 02:13:40 -0700693common_LOCAL_SRC_FILES += $(ELFF_SOURCES:%=elff/%)
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100694
Andrew Hsiehc7389bd2012-03-13 02:13:40 -0700695common_LOCAL_CFLAGS += \
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100696 -fno-exceptions \
697 $(ELFF_CFLAGS) \
698
Andrew Hsiehc7389bd2012-03-13 02:13:40 -0700699
700## one for 32-bit
701$(call start-emulator-library, emulator-libelff)
702LOCAL_CPP_EXTENSION := .cc
703LOCAL_CFLAGS += $(common_LOCAL_CFLAGS)
704LOCAL_SRC_FILES += $(common_LOCAL_SRC_FILES)
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100705$(call end-emulator-library)
706
707
Andrew Hsiehc7389bd2012-03-13 02:13:40 -0700708## another for 64-bit, see note in emulator64-common
Andrew Hsiehd0f2ab62012-03-23 17:35:11 +0800709ifeq ($(HOST_OS),linux)
Andrew Hsiehc7389bd2012-03-13 02:13:40 -0700710 ifneq ($(BUILD_STANDALONE_EMULATOR),true)
711 $(call start-emulator-library, emulator64-libelff)
712 LOCAL_CPP_EXTENSION := .cc
713 LOCAL_CFLAGS += $(common_LOCAL_CFLAGS) -m64
714 LOCAL_SRC_FILES += $(common_LOCAL_SRC_FILES)
715 $(call end-emulator-library)
716 endif # BUILD_STANDALONE_EMULATOR == nil
717endif # HOST_OS == linux
718
719
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100720##############################################################################
721##############################################################################
722###
723### gen-hx-header: Generate headers from .hx file with "hxtool" script.
724###
725### The 'hxtool' script is used to generate header files from an input
726### file with the .hx suffix. I.e. foo.hx --> foo.h
727###
728### Due to the way the Android build system works, we need to regenerate
729### it for each module (the output will go into a module-specific directory).
730###
731### This defines a function that can be used inside a module definition
732###
David 'Digit' Turner088edf82011-05-09 15:59:28 +0200733### $(call gen-hx-header,<input>,<output>,<source-files>)
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100734###
735### Where: <input> is the input file, with a .hx suffix (e.g. foo.hx)
David 'Digit' Turner088edf82011-05-09 15:59:28 +0200736### <output> is the output file, with a .h or .def suffix
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100737### <source-files> is a list of source files that include the header
738###
739
740
741gen-hx-header = $(eval $(call gen-hx-header-ev,$1,$2,$3))
742
743define gen-hx-header-ev
David 'Digit' Turner42fc4492011-06-29 13:16:16 +0200744intermediates := $$(call intermediates-dir-for,$$(LOCAL_MODULE_CLASS),$$(LOCAL_MODULE),true)
David 'Digit' Turner317c9d52011-05-10 06:38:21 +0200745
David 'Digit' Turner088edf82011-05-09 15:59:28 +0200746QEMU_HEADER_H := $$(intermediates)/$$2
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100747$$(QEMU_HEADER_H): PRIVATE_PATH := $$(LOCAL_PATH)
748$$(QEMU_HEADER_H): PRIVATE_CUSTOM_TOOL = $$(PRIVATE_PATH)/hxtool -h < $$< > $$@
749$$(QEMU_HEADER_H): $$(LOCAL_PATH)/$$1 $$(LOCAL_PATH)/hxtool
750 $$(transform-generated-source)
751
752LOCAL_GENERATED_SOURCES += $$(QEMU_HEADER_H)
David 'Digit' Turner088edf82011-05-09 15:59:28 +0200753LOCAL_C_INCLUDES += $$(intermediates)
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100754endef
755