blob: 54ab704fa0e51d7a19effe310307b702a193c07d [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
57$(call start-emulator-library, emulator-common)
58
59EMULATOR_COMMON_CFLAGS :=
60
61# Needed by everything about the host
62EMULATOR_COMMON_CFLAGS += \
63 -I$(LOCAL_PATH)/android/config/$(QEMU_HOST_TAG)
64
65# add the build ID to the default macro definitions
66ifeq ($(BUILD_STANDALONE_EMULATOR),)
67EMULATOR_COMMON_CFLAGS += -DANDROID_BUILD_ID="$(strip $(BUILD_ID))-$(strip $(BUILD_NUMBER))"
68endif
69
70# For non-standalone builds, extract the major version number from the Android SDK
71# tools revision number.
72ifneq ($(BUILD_STANDALONE_EMULATOR),true)
73 ANDROID_SDK_TOOLS_REVISION := $(shell awk -F= '/Pkg.Revision/ { print $$2; }' sdk/files/tools_source.properties)
74endif
75
76ANDROID_SDK_TOOLS_REVISION := $(strip $(ANDROID_SDK_TOOLS_REVISION))
77ifdef ANDROID_SDK_TOOLS_REVISION
78 EMULATOR_COMMON_CFLAGS += -DANDROID_SDK_TOOLS_REVISION=$(ANDROID_SDK_TOOLS_REVISION)
79endif
80
81# Enable large-file support (i.e. make off_t a 64-bit value)
82ifeq ($(HOST_OS),linux)
83EMULATOR_COMMON_CFLAGS += -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE
84endif
85
86###########################################################
87# Zlib sources
88#
89ZLIB_DIR := distrib/zlib-1.2.3
90include $(LOCAL_PATH)/$(ZLIB_DIR)/sources.make
91EMULATOR_COMMON_CFLAGS += -I$(LOCAL_PATH)/$(ZLIB_DIR)
92
93LOCAL_SRC_FILES += $(ZLIB_SOURCES)
94
95###########################################################
96# Android utility functions
97#
98LOCAL_SRC_FILES += \
99 sockets.c \
100 iolooper-select.c \
101 android/async-console.c \
102 android/async-utils.c \
103 android/charmap.c \
104 android/framebuffer.c \
105 android/keycode-array.c \
106 android/avd/hw-config.c \
107 android/avd/info.c \
David 'Digit' Turner2d238fd2011-03-25 10:34:47 +0100108 android/avd/util.c \
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100109 android/sync-utils.c \
110 android/utils/assert.c \
111 android/utils/bufprint.c \
112 android/utils/debug.c \
David 'Digit' Turner816e53c2011-08-17 18:33:45 +0200113 android/utils/dll.c \
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100114 android/utils/dirscanner.c \
115 android/utils/filelock.c \
116 android/utils/ini.c \
David 'Digit' Turnerbbb81042011-03-17 14:48:44 +0100117 android/utils/intmap.c \
David 'Digit' Turner0a879bf2011-05-12 18:45:18 +0200118 android/utils/lineinput.c \
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100119 android/utils/mapfile.c \
120 android/utils/misc.c \
121 android/utils/panic.c \
122 android/utils/path.c \
123 android/utils/reflist.c \
124 android/utils/refset.c \
125 android/utils/stralloc.c \
126 android/utils/system.c \
127 android/utils/tempfile.c \
128 android/utils/vector.c \
129
David 'Digit' Turner42fc4492011-06-29 13:16:16 +0200130$(call gen-hw-config-defs)
131
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100132LOCAL_CFLAGS += $(EMULATOR_COMMON_CFLAGS)
133
134$(call end-emulator-library)
135
136##############################################################################
137##############################################################################
138###
139### emulator-libui: LIBRARY OF UI-RELATED FUNCTIONS
140###
141### THESE ARE USED BY 'emulator-ui' AND THE STANDALONE PROGRAMS
142###
143
144$(call start-emulator-library, emulator-libui)
145
146EMULATOR_LIBUI_CFLAGS :=
147
148LOCAL_CFLAGS += $(EMULATOR_COMMON_CFLAGS)
149
150###########################################################
151# Libpng configuration
152#
153LIBPNG_DIR := distrib/libpng-1.2.19
154include $(LOCAL_PATH)/$(LIBPNG_DIR)/sources.make
155
156EMULATOR_LIBUI_CFLAGS += \
157 $(LIBPNG_CFLAGS) \
158 -I$(LOCAL_PATH)/$(LIBPNG_DIR)
159
160LOCAL_SRC_FILES += $(LIBPNG_SOURCES) loadpng.c
161
162##############################################################################
163# SDL-related definitions
164#
165
166# Build SDL from sources except in certain cases where we use
167# prebuilt libraries instead.
168#
169BUILD_SDL_FROM_SOURCES := true
170
171# On linux-x86, using the prebuilts avoid installing all the X11
172# development packages on our build servers.
173#
174ifeq ($(QEMU_HOST_TAG),linux-x86)
175 BUILD_SDL_FROM_SOURCES := false
176endif
177
178# On darwin-x86, a bug in the Android build system prevents the compilation
179# of Objective-C sources. Fixed recently in AOSP, but we still use the
180# prebuilts for the benefit of older platform branches.
181#
182ifeq ($(QEMU_HOST_TAG),darwin-x86)
183 BUILD_SDL_FROM_SOURCES := false
184endif
185
186# If we're building with android-configure.sh && make, always build from
187# sources to catch regressions as soon as they happen.
188#
189ifeq ($(BUILD_STANDALONE_EMULATOR),true)
190 BUILD_SDL_FROM_SOURCES := true
191endif
192
193# Except if we used android-configure.sh --sdl-config=<script>
194#
David 'Digit' Turnera4026682011-08-24 12:54:01 +0200195ifneq ($(QEMU_SDL_CONFIG),)
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100196 BUILD_SDL_FROM_SOURCES := false
David 'Digit' Turnera4026682011-08-24 12:54:01 +0200197 SDL_CONFIG := $(QEMU_SDL_CONFIG)
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100198endif
199
200ifneq ($(BUILD_SDL_FROM_SOURCES),true)
201
202 SDL_CONFIG ?= prebuilt/$(QEMU_HOST_TAG)/sdl/bin/sdl-config
203 SDL_CFLAGS := $(shell $(SDL_CONFIG) --cflags)
204
205 # We need to filter out the _GNU_SOURCE variable because it breaks recent
206 # releases of Cygwin when using the -mno-cygwin option. Moreover, we don't
207 # need this macro at all to build the Android emulator.
208 SDL_CFLAGS := $(filter-out -D_GNU_SOURCE=1,$(SDL_CFLAGS))
209 SDL_LDLIBS := $(filter-out %.a %.lib,$(shell $(SDL_CONFIG) --static-libs))
210
211 # Circular dependencies between libSDL and libSDLmain
212 # We repeat the libraries in the final link to work around it
213 SDL_STATIC_LIBRARIES := libSDL libSDLmain libSDL libSDLmain
214
215else # BUILD_SDL_FROM_SOURCES
216
217 SDL_DIR := distrib/sdl-1.2.12
218 include $(LOCAL_PATH)/$(SDL_DIR)/sources.make
219 LOCAL_SRC_FILES += $(SDL_SOURCES)
220
221 EMULATOR_LIBUI_CFLAGS += \
222 -I$(LOCAL_PATH)/$(SDL_DIR)/include
223
224 SDL_STATIC_LIBRARIES :=
225
226endif # BUILD_SDL_FROM_SOURCES
227
228EMULATOR_LIBUI_CFLAGS += $(SDL_CFLAGS)
229EMULATOR_LIBUI_LDLIBS += $(SDL_LDLIBS)
230
231# The following is needed by SDL_LoadObject
232ifneq ($(HOST_OS),windows)
233 EMULATOR_LIBUI_LDLIBS += -ldl
234endif
235
236# the skin support sources
237#
238SKIN_SOURCES := rect.c \
239 region.c \
240 image.c \
241 trackball.c \
242 keyboard.c \
243 keyset.c \
244 file.c \
245 window.c \
246 scaler.c \
247 composer.c \
248 surface.c \
249
250LOCAL_SRC_FILES += $(SKIN_SOURCES:%=android/skin/%)
251
252LOCAL_SRC_FILES += \
253 android/user-config.c \
254 android/resource.c \
255 android/qemulator.c \
256 android/keycode.c \
257
David 'Digit' Turner42fc4492011-06-29 13:16:16 +0200258$(call gen-hw-config-defs)
259
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100260# enable MMX code for our skin scaler
261ifeq ($(HOST_ARCH),x86)
262LOCAL_CFLAGS += -DUSE_MMX=1 -mmmx
263endif
264
265LOCAL_CFLAGS += $(EMULATOR_LIBUI_CFLAGS)
266
267$(call end-emulator-library)
268
269##############################################################################
270##############################################################################
271###
272### emulator-libqemu: TARGET-INDEPENDENT QEMU FUNCTIONS
273###
274### THESE ARE USED BY EVERYTHING EXCEPT 'emulator-ui'
275###
276
277$(call start-emulator-library, emulator-libqemu)
278
279EMULATOR_LIBQEMU_CFLAGS :=
280
281LOCAL_CFLAGS += $(EMULATOR_COMMON_CFLAGS)
282
Vladimir Chtchetkine70a18cd2012-01-31 16:21:06 -0800283###########################################################
284# Jpeg configuration
285#
286LIBJPEG_DIR := distrib/jpeg-6b
287include $(LOCAL_PATH)/$(LIBJPEG_DIR)/sources.make
288
289EMULATOR_LIBQEMU_CFLAGS += \
290 $(LIBJPEG_CFLAGS) \
291 -I$(LOCAL_PATH)/$(LIBJPEG_DIR)
292
293LOCAL_SRC_FILES += $(LIBJPEG_SOURCES)
294
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100295AUDIO_SOURCES := noaudio.c wavaudio.c wavcapture.c mixeng.c
296AUDIO_CFLAGS := -I$(LOCAL_PATH)/audio -DHAS_AUDIO
297AUDIO_LDLIBS :=
298
299LOCAL_CFLAGS += -Wall -Wno-missing-field-initializers
300
301ifeq ($(HOST_OS),darwin)
302 CONFIG_COREAUDIO ?= yes
303 AUDIO_CFLAGS += -DHOST_BSD=1
304endif
305
306ifeq ($(HOST_OS),windows)
307 CONFIG_WINAUDIO ?= yes
308endif
309
310ifeq ($(HOST_OS),linux)
311 CONFIG_OSS ?= yes
312 CONFIG_ALSA ?= yes
313 CONFIG_PULSEAUDIO ?= yes
314 CONFIG_ESD ?= yes
315endif
316
317ifeq ($(HOST_OS),freebsd)
318 CONFIG_OSS ?= yes
319endif
320
321ifeq ($(CONFIG_COREAUDIO),yes)
322 AUDIO_SOURCES += coreaudio.c
323 AUDIO_CFLAGS += -DCONFIG_COREAUDIO
324 AUDIO_LDLIBS += -Wl,-framework,CoreAudio
325endif
326
327ifeq ($(CONFIG_WINAUDIO),yes)
328 AUDIO_SOURCES += winaudio.c
329 AUDIO_CFLAGS += -DCONFIG_WINAUDIO
330endif
331
332ifeq ($(CONFIG_PULSEAUDIO),yes)
333 AUDIO_SOURCES += paaudio.c audio_pt_int.c
334 AUDIO_CFLAGS += -DCONFIG_PULSEAUDIO
335endif
336
337ifeq ($(CONFIG_ALSA),yes)
338 AUDIO_SOURCES += alsaaudio.c audio_pt_int.c
339 AUDIO_CFLAGS += -DCONFIG_ALSA
340endif
341
342ifeq ($(CONFIG_ESD),yes)
343 AUDIO_SOURCES += esdaudio.c
344 AUDIO_CFLAGS += -DCONFIG_ESD
345endif
346
347ifeq ($(CONFIG_OSS),yes)
348 AUDIO_SOURCES += ossaudio.c
349 AUDIO_CFLAGS += -DCONFIG_OSS
350endif
351
352AUDIO_SOURCES := $(call sort,$(AUDIO_SOURCES:%=audio/%))
353
354LOCAL_CFLAGS += -Wno-sign-compare \
355 -fno-strict-aliasing -W -Wall -Wno-unused-parameter \
356
357# this is very important, otherwise the generated binaries may
358# not link properly on our build servers
359ifeq ($(HOST_OS),linux)
360LOCAL_CFLAGS += -fno-stack-protector
361endif
362
363LOCAL_SRC_FILES += $(AUDIO_SOURCES)
364LOCAL_SRC_FILES += \
365 android/audio-test.c
366
367# other flags
368ifneq ($(HOST_OS),windows)
369 AUDIO_LDLIBS += -ldl
370else
371endif
372
373
374EMULATOR_LIBQEMU_CFLAGS += $(AUDIO_CFLAGS)
375EMULATOR_LIBQEMU_LDLIBS += $(AUDIO_LDLIBS)
376
377LOCAL_CFLAGS += -Wno-missing-field-initializers
378
379# migration sources
380#
381ifeq ($(HOST_OS),windows)
382 LOCAL_SRC_FILES += migration-dummy-android.c
383else
384 LOCAL_SRC_FILES += migration.c \
385 migration-exec.c \
386 migration-tcp-android.c
387endif
388
389# misc. sources
390#
391CORE_MISC_SOURCES = \
392 acl.c \
393 aes.c \
394 aio-android.c \
395 async.c \
396 bt-host.c \
397 bt-vhci.c \
398 buffered_file.c \
399 cbuffer.c \
400 charpipe.c \
401 console.c \
402 cutils.c \
403 d3des.c \
404 input.c \
David 'Digit' Turner8354d2d2011-05-11 00:19:06 +0200405 iohandler.c \
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100406 ioport.c \
407 module.c \
408 net-android.c \
409 notify.c \
410 osdep.c \
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100411 path.c \
David 'Digit' Turner3b2846a2011-05-11 01:34:40 +0200412 qemu-char.c \
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100413 qemu-config.c \
414 qemu-error.c \
415 qemu-malloc.c \
416 qemu-option.c \
417 qemu-sockets-android.c \
418 qerror.c \
419 readline.c \
420 savevm.c \
421 shaper.c \
422 tcpdump.c \
423 vnc-android.c \
424 android/boot-properties.c \
425 android/config.c \
426 android/core-init-utils.c \
427 android/gps.c \
428 android/hw-kmsg.c \
429 android/hw-lcd.c \
430 android/hw-events.c \
431 android/hw-control.c \
432 android/hw-sensors.c \
433 android/hw-qemud.c \
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100434 android/looper-qemu.c \
David 'Digit' Turnerc0ac7332011-05-02 15:05:35 +0200435 android/hw-pipe-net.c \
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100436 android/qemu-setup.c \
437 android/snapshot.c \
Vladimir Chtchetkinedb611d52011-11-01 17:35:07 -0700438 android/android-device.c \
439 android/sensors-port.c \
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100440 android/utils/timezone.c \
Vladimir Chtchetkinec646f5e2011-09-03 15:17:13 -0700441 android/camera/camera-format-converters.c \
Vladimir Chtchetkined86c7242011-12-09 15:45:46 -0800442 android/camera/camera-service.c \
443 android/adb-server.c \
Vladimir Chtchetkinedb450d72012-01-12 13:37:40 -0800444 android/adb-qemud.c \
Vladimir Chtchetkine8dd31e82012-02-15 17:16:04 -0800445 android/snaphost-android.c \
446 android/multitouch-screen.c \
447 android/multitouch-port.c \
448 android/utils/jpeg-compress.c
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100449
David 'Digit' Turner42fc4492011-06-29 13:16:16 +0200450$(call gen-hw-config-defs)
451
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100452ifeq ($(HOST_ARCH),x86)
453 CORE_MISC_SOURCES += i386-dis.c
454endif
455ifeq ($(HOST_ARCH),x86_64)
456 CORE_MISC_SOURCES += i386-dis.c
457endif
458ifeq ($(HOST_ARCH),ppc)
459 CORE_MISC_SOURCES += ppc-dis.c \
460 cache-utils.c
461endif
462
463ifeq ($(HOST_OS),linux)
464 CORE_MISC_SOURCES += usb-linux.c \
Vladimir Chtchetkine4ed09fd2011-08-18 09:42:40 -0700465 qemu-thread.c \
466 android/camera/camera-capture-linux.c
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100467else
468 CORE_MISC_SOURCES += usb-dummy-android.c
469endif
470
471ifeq ($(HOST_OS),windows)
Vladimir Chtchetkine4ed09fd2011-08-18 09:42:40 -0700472 CORE_MISC_SOURCES += tap-win32.c \
473 android/camera/camera-capture-windows.c
474
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100475else
476 CORE_MISC_SOURCES += posix-aio-compat.c
477endif
478
Vladimir Chtchetkineb92b3032011-09-12 15:29:32 -0700479ifeq ($(HOST_OS),darwin)
Vladimir Chtchetkine955a9972011-10-12 15:40:17 -0700480 CORE_MISC_SOURCES += android/camera/camera-capture-mac.m
Vladimir Chtchetkineb92b3032011-09-12 15:29:32 -0700481endif
482
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100483LOCAL_SRC_FILES += $(CORE_MISC_SOURCES)
484
485# Required
486LOCAL_CFLAGS += -D_XOPEN_SOURCE=600 -D_BSD_SOURCE=1
487
488SLIRP_SOURCES := \
489 bootp.c \
490 cksum.c \
491 debug.c \
492 if.c \
493 ip_icmp.c \
494 ip_input.c \
495 ip_output.c \
496 mbuf.c \
497 misc.c \
498 sbuf.c \
499 slirp.c \
500 socket.c \
501 tcp_input.c \
502 tcp_output.c \
503 tcp_subr.c \
504 tcp_timer.c \
505 tftp.c \
506 udp.c
507
508LOCAL_SRC_FILES += $(SLIRP_SOURCES:%=slirp-android/%)
509EMULATOR_LIBQEMU_CFLAGS += -I$(LOCAL_PATH)/slirp-android
510
511# socket proxy support
512#
513PROXY_SOURCES := \
514 proxy_common.c \
515 proxy_http.c \
516 proxy_http_connector.c \
517 proxy_http_rewriter.c \
518
519LOCAL_SRC_FILES += $(PROXY_SOURCES:%=proxy/%)
520EMULATOR_LIBQEMU_CFLAGS += -I$(LOCAL_PATH)/proxy
521
522# include telephony stuff
523#
524TELEPHONY_SOURCES := \
525 android_modem.c \
526 modem_driver.c \
527 gsm.c \
528 sim_card.c \
529 sysdeps_qemu.c \
530 sms.c \
531 remote_call.c
532
533LOCAL_SRC_FILES += $(TELEPHONY_SOURCES:%=telephony/%)
534EMULATOR_LIBQEMU_CFLAGS += -I$(LOCAL_PATH)/telephony
535
536# sources inherited from upstream, but not fully
537# integrated into android emulator
538#
539LOCAL_SRC_FILES += \
540 json-lexer.c \
541 json-parser.c \
542 json-streamer.c \
543 qjson.c \
544 qbool.c \
545 qdict.c \
546 qfloat.c \
547 qint.c \
548 qlist.c \
549 qstring.c \
550
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100551# gdbstub-xml.c contains C-compilable arrays corresponding to the content
552# of $(LOCAL_PATH)/gdb-xml/, and is generated with the 'feature_to_c.sh' script.
553#
554intermediates := $(call intermediates-dir-for,STATIC_LIBRARIES,$(LOCAL_MODULE),true)
555
556ifeq ($(QEMU_TARGET_XML_SOURCES),)
557 QEMU_TARGET_XML_SOURCES := arm-core arm-neon arm-vfp arm-vfp3
558 QEMU_TARGET_XML_SOURCES := $(QEMU_TARGET_XML_SOURCES:%=$(LOCAL_PATH)/gdb-xml/%.xml)
559endif
560
561QEMU_GDBSTUB_XML_C := $(intermediates)/gdbstub-xml.c
562$(QEMU_GDBSTUB_XML_C): PRIVATE_PATH := $(LOCAL_PATH)
563$(QEMU_GDBSTUB_XML_C): PRIVATE_SOURCES := $(TARGET_XML_SOURCES)
564$(QEMU_GDBSTUB_XML_C): PRIVATE_CUSTOM_TOOL = $(PRIVATE_PATH)/feature_to_c.sh $@ $(QEMU_TARGET_XML_SOURCES)
565$(QEMU_GDBSTUB_XML_C): $(QEMU_TARGET_XML_SOURCES) $(LOCAL_PATH)/feature_to_c.sh
566 $(hide) rm -f $@
567 $(transform-generated-source)
568
569LOCAL_GENERATED_SOURCES += $(QEMU_GDBSTUB_XML_C)
570
571EMULATOR_LIBQEMU_CFLAGS += -I$(intermediates)
572
573LOCAL_CFLAGS += $(EMULATOR_LIBQEMU_CFLAGS)
574
575$(call end-emulator-library)
576
577# Block sources, we must compile them with each executable because they
578# are only referenced by the rest of the code using constructor functions.
579# If their object files are put in a static library, these are never compiled
580# into the final linked executable that uses them.
581#
582# Normally, one would solve thus using LOCAL_WHOLE_STATIC_LIBRARIES, but
583# the Darwin linker doesn't support -Wl,--whole-archive or equivalent :-(
584#
585BLOCK_SOURCES += \
586 block.c \
587 blockdev.c \
588 block/qcow.c \
589 block/qcow2.c \
590 block/qcow2-refcount.c \
591 block/qcow2-snapshot.c \
592 block/qcow2-cluster.c \
593 block/cloop.c \
594 block/dmg.c \
595 block/vvfat.c \
596 block/raw.c
597
598ifeq ($(HOST_OS),windows)
599 BLOCK_SOURCES += block/raw-win32.c
600else
601 BLOCK_SOURCES += block/raw-posix.c
602endif
603
604BLOCK_CFLAGS += $(EMULATOR_COMMON_CFLAGS)
605BLOCK_CFLAGS += -DCONFIG_BDRV_WHITELIST=""
606
607
608##############################################################################
609##############################################################################
610###
611### emulator-libelff: TARGET-INDEPENDENT ELF/DWARD PARSER
612###
613### THESE ARE USED BY EVERYTHING EXCEPT 'emulator-ui', BUT WE CANNOT PUT
614### THEM IN emulator-libqemu SINCE THE SOURCES ARE C++
615###
616
617$(call start-emulator-library, emulator-libelff)
618
619LOCAL_CPP_EXTENSION := .cc
620
621ELFF_CFLAGS := -I$(LOCAL_PATH)/elff
622ELFF_LDLIBS := -lstdc++
623
624ELFF_SOURCES := \
625 dwarf_cu.cc \
626 dwarf_die.cc \
627 dwarf_utils.cc \
628 elf_alloc.cc \
629 elf_file.cc \
630 elf_mapped_section.cc \
631 elff_api.cc \
632
633LOCAL_SRC_FILES += $(ELFF_SOURCES:%=elff/%)
634
635LOCAL_CFLAGS += \
636 -fno-exceptions \
637 $(ELFF_CFLAGS) \
638
639$(call end-emulator-library)
640
641
642##############################################################################
643##############################################################################
644###
645### gen-hx-header: Generate headers from .hx file with "hxtool" script.
646###
647### The 'hxtool' script is used to generate header files from an input
648### file with the .hx suffix. I.e. foo.hx --> foo.h
649###
650### Due to the way the Android build system works, we need to regenerate
651### it for each module (the output will go into a module-specific directory).
652###
653### This defines a function that can be used inside a module definition
654###
David 'Digit' Turner088edf82011-05-09 15:59:28 +0200655### $(call gen-hx-header,<input>,<output>,<source-files>)
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100656###
657### Where: <input> is the input file, with a .hx suffix (e.g. foo.hx)
David 'Digit' Turner088edf82011-05-09 15:59:28 +0200658### <output> is the output file, with a .h or .def suffix
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100659### <source-files> is a list of source files that include the header
660###
661
662
663gen-hx-header = $(eval $(call gen-hx-header-ev,$1,$2,$3))
664
665define gen-hx-header-ev
David 'Digit' Turner42fc4492011-06-29 13:16:16 +0200666intermediates := $$(call intermediates-dir-for,$$(LOCAL_MODULE_CLASS),$$(LOCAL_MODULE),true)
David 'Digit' Turner317c9d52011-05-10 06:38:21 +0200667
David 'Digit' Turner088edf82011-05-09 15:59:28 +0200668QEMU_HEADER_H := $$(intermediates)/$$2
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100669$$(QEMU_HEADER_H): PRIVATE_PATH := $$(LOCAL_PATH)
670$$(QEMU_HEADER_H): PRIVATE_CUSTOM_TOOL = $$(PRIVATE_PATH)/hxtool -h < $$< > $$@
671$$(QEMU_HEADER_H): $$(LOCAL_PATH)/$$1 $$(LOCAL_PATH)/hxtool
672 $$(transform-generated-source)
673
674LOCAL_GENERATED_SOURCES += $$(QEMU_HEADER_H)
David 'Digit' Turner088edf82011-05-09 15:59:28 +0200675LOCAL_C_INCLUDES += $$(intermediates)
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100676endef
677