forked from mozilla-b2g/platform_external_qemu
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile.common
772 lines (644 loc) · 22 KB
/
Makefile.common
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
# When building this project, we actually generate several components which
# are the following:
#
# - the emulator-ui program (which is target-agnostic)
# - the target-specific qemu-android-$ARCH programs (headless emulation engines)
# - the "standalone" emulator programs (embed both UI and engine in a single
# binary and process), i.e. "emulator" for ARM and "emulator-x86" for x86.
#
# This file defines static host libraries that will be used by at least two
# of these components.
#
##############################################################################
##############################################################################
###
### gen-hw-config-defs: Generate hardware configuration definitions header
###
### The 'gen-hw-config.py' script is used to generate the hw-config-defs.h
### header from the an .ini file like android/avd/hardware-properties.ini
###
### Due to the way the Android build system works, we need to regenerate
### it for each module (the output will go into a module-specific directory).
###
### This defines a function that can be used inside a module definition
###
### $(call gen-hw-config-defs)
###
# First, define a rule to generate a dummy "emulator_hw_config_defs" module
# which purpose is simply to host the generated header in its output directory.
intermediates := $(call intermediates-dir-for,SHARED_LIBRARIES,emulator_hw_config_defs,true)
QEMU_HARDWARE_PROPERTIES_INI := $(LOCAL_PATH)/android/avd/hardware-properties.ini
QEMU_HW_CONFIG_DEFS_H := $(intermediates)/android/avd/hw-config-defs.h
$(QEMU_HW_CONFIG_DEFS_H): PRIVATE_PATH := $(LOCAL_PATH)
$(QEMU_HW_CONFIG_DEFS_H): PRIVATE_CUSTOM_TOOL = $(PRIVATE_PATH)/android/tools/gen-hw-config.py $< $@
$(QEMU_HW_CONFIG_DEFS_H): $(QEMU_HARDWARE_PROPERTIES_INI) $(LOCAL_PATH)/android/tools/gen-hw-config.py
$(hide) rm -f $@
$(transform-generated-source)
QEMU_HW_CONFIG_DEFS_INCLUDES := $(intermediates)
# Second, define a function that needs to be called inside each module that contains
# a source file that includes the generated header file.
gen-hw-config-defs = \
$(eval LOCAL_GENERATED_SOURCES += $(QEMU_HW_CONFIG_DEFS_H))\
$(eval LOCAL_C_INCLUDES += $(QEMU_HW_CONFIG_DEFS_INCLUDES))
##############################################################################
##############################################################################
###
### emulator-common: LIBRARY OF COMMON FUNCTIONS
###
### THESE ARE POTENTIALLY USED BY ALL COMPONENTS
###
common_LOCAL_CFLAGS =
common_LOCAL_SRC_FILES =
EMULATOR_COMMON_CFLAGS :=
# Needed by everything about the host
EMULATOR_COMMON_CFLAGS += \
-I$(LOCAL_PATH)/android/config/$(QEMU_HOST_TAG)
# add the build ID to the default macro definitions
ifeq ($(BUILD_STANDALONE_EMULATOR),)
EMULATOR_COMMON_CFLAGS += -DANDROID_BUILD_ID="$(strip $(BUILD_ID))-$(strip $(BUILD_NUMBER))"
endif
# For non-standalone builds, extract the major version number from the Android SDK
# tools revision number.
ifneq ($(BUILD_STANDALONE_EMULATOR),true)
ANDROID_SDK_TOOLS_REVISION := $(shell awk -F= '/Pkg.Revision/ { print $$2; }' sdk/files/tools_source.properties)
endif
ANDROID_SDK_TOOLS_REVISION := $(strip $(ANDROID_SDK_TOOLS_REVISION))
ifdef ANDROID_SDK_TOOLS_REVISION
EMULATOR_COMMON_CFLAGS += -DANDROID_SDK_TOOLS_REVISION=$(ANDROID_SDK_TOOLS_REVISION)
endif
# Enable large-file support (i.e. make off_t a 64-bit value)
ifeq ($(HOST_OS),linux)
EMULATOR_COMMON_CFLAGS += -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE
endif
###########################################################
# Zlib sources
#
ZLIB_DIR := distrib/zlib-1.2.3
include $(LOCAL_PATH)/$(ZLIB_DIR)/sources.make
EMULATOR_COMMON_CFLAGS += -I$(LOCAL_PATH)/$(ZLIB_DIR)
common_LOCAL_SRC_FILES += $(ZLIB_SOURCES)
###########################################################
# Android utility functions
#
common_LOCAL_SRC_FILES += \
sockets.c \
iolooper-select.c \
android/async-console.c \
android/async-utils.c \
android/charmap.c \
android/framebuffer.c \
android/keycode-array.c \
android/avd/hw-config.c \
android/avd/info.c \
android/avd/util.c \
android/sync-utils.c \
android/utils/assert.c \
android/utils/bufprint.c \
android/utils/debug.c \
android/utils/dll.c \
android/utils/dirscanner.c \
android/utils/filelock.c \
android/utils/ini.c \
android/utils/intmap.c \
android/utils/lineinput.c \
android/utils/mapfile.c \
android/utils/misc.c \
android/utils/panic.c \
android/utils/path.c \
android/utils/reflist.c \
android/utils/refset.c \
android/utils/stralloc.c \
android/utils/system.c \
android/utils/tempfile.c \
android/utils/vector.c \
common_LOCAL_CFLAGS += $(EMULATOR_COMMON_CFLAGS)
## one for 32-bit
$(call start-emulator-library, emulator-common)
LOCAL_CFLAGS += $(common_LOCAL_CFLAGS)
LOCAL_SRC_FILES += $(common_LOCAL_SRC_FILES)
$(call gen-hw-config-defs)
$(call end-emulator-library)
## another for 64-bit
# NOTE: only linux in non-standalone mode is supported, because
# 1) For Windows: amd64-mingw32msvc-gcc doesn't work, see http://b/issue?id=5949152.
# 2) For MacOSX: 64-bit libSDL*.a 1.2.x depends on NSQuickDrawView doesn't exist
# 3) Standalone has --try-64
ifeq ($(HOST_OS),linux)
ifneq ($(BUILD_STANDALONE_EMULATOR),true)
$(call start-emulator-library, emulator64-common)
LOCAL_CFLAGS += $(common_LOCAL_CFLAGS) -m64
LOCAL_SRC_FILES += $(common_LOCAL_SRC_FILES)
$(call gen-hw-config-defs)
$(call end-emulator-library)
endif # BUILD_STANDALONE_EMULATOR == nil
endif # HOST_OS == linux
##############################################################################
##############################################################################
###
### emulator-libui: LIBRARY OF UI-RELATED FUNCTIONS
###
### THESE ARE USED BY 'emulator-ui' AND THE STANDALONE PROGRAMS
###
common_LOCAL_CFLAGS =
common_LOCAL_SRC_FILES =
ifneq ($(QEMU_OPENGLES_INCLUDE),)
EMULATOR_LIBUI_CFLAGS := -I$(QEMU_OPENGLES_INCLUDE)
endif
common_LOCAL_CFLAGS += $(EMULATOR_COMMON_CFLAGS)
###########################################################
# Libpng configuration
#
LIBPNG_DIR := distrib/libpng-1.2.19
include $(LOCAL_PATH)/$(LIBPNG_DIR)/sources.make
EMULATOR_LIBUI_CFLAGS += \
$(LIBPNG_CFLAGS) \
-I$(LOCAL_PATH)/$(LIBPNG_DIR)
common_LOCAL_SRC_FILES += $(LIBPNG_SOURCES) loadpng.c
##############################################################################
# SDL-related definitions
#
# Build SDL from sources except in certain cases where we use
# prebuilt libraries instead.
#
BUILD_SDL_FROM_SOURCES := true
# On linux-x86, using the prebuilts avoid installing all the X11
# development packages on our build servers.
#
ifeq ($(QEMU_HOST_TAG),linux-x86)
BUILD_SDL_FROM_SOURCES := false
endif
# On darwin-x86, a bug in the Android build system prevents the compilation
# of Objective-C sources. Fixed recently in AOSP, but we still use the
# prebuilts for the benefit of older platform branches.
#
ifeq ($(QEMU_HOST_TAG),darwin-x86)
ifeq ($(FORCE_PREBUILT_SDL),true)
BUILD_SDL_FROM_SOURCES := false
endif
endif
# If we're building with android-configure.sh && make, always build from
# sources to catch regressions as soon as they happen.
#
ifeq ($(BUILD_STANDALONE_EMULATOR),true)
BUILD_SDL_FROM_SOURCES := true
endif
# Except if we used android-configure.sh --sdl-config=<script>
#
ifneq ($(QEMU_SDL_CONFIG),)
BUILD_SDL_FROM_SOURCES := false
SDL_CONFIG := $(QEMU_SDL_CONFIG)
endif
ifneq ($(BUILD_SDL_FROM_SOURCES),true)
SDL_CONFIG ?= prebuilts/tools/$(QEMU_HOST_TAG)/sdl/bin/sdl-config
SDL_CFLAGS := $(shell $(SDL_CONFIG) --cflags)
# We need to filter out the _GNU_SOURCE variable because it breaks recent
# releases of Cygwin when using the -mno-cygwin option. Moreover, we don't
# need this macro at all to build the Android emulator.
SDL_CFLAGS := $(filter-out -D_GNU_SOURCE=1,$(SDL_CFLAGS))
SDL_LDLIBS := $(filter-out %.a %.lib,$(shell $(SDL_CONFIG) --static-libs))
# Circular dependencies between libSDL and libSDLmain
# We repeat the libraries in the final link to work around it
SDL_STATIC_LIBRARIES := libSDL libSDLmain libSDL libSDLmain
SDL_STATIC_LIBRARIES_64 := lib64SDL lib64SDLmain lib64SDL lib64SDLmain
else # BUILD_SDL_FROM_SOURCES
SDL_DIR := distrib/sdl-1.2.12
include $(LOCAL_PATH)/$(SDL_DIR)/sources.make
common_LOCAL_SRC_FILES += $(SDL_SOURCES)
EMULATOR_LIBUI_CFLAGS += \
-I$(LOCAL_PATH)/$(SDL_DIR)/include
SDL_STATIC_LIBRARIES :=
# Set the 10.6 / 10.5 sysroot for Mac OS X, which enables QuickDraw
# compatibility headers
ifeq ($(QEMU_HOST_TAG),darwin-x86)
SDL_CFLAGS += -isysroot $(HOST_SYSROOT)
endif
endif # BUILD_SDL_FROM_SOURCES
EMULATOR_LIBUI_CFLAGS += $(SDL_CFLAGS)
EMULATOR_LIBUI_LDLIBS += $(SDL_LDLIBS)
# The following is needed by SDL_LoadObject
ifneq ($(HOST_OS),windows)
EMULATOR_LIBUI_LDLIBS += -ldl
endif
# the skin support sources
#
SKIN_SOURCES := rect.c \
region.c \
image.c \
trackball.c \
keyboard.c \
keyset.c \
file.c \
window.c \
scaler.c \
composer.c \
surface.c \
common_LOCAL_SRC_FILES += $(SKIN_SOURCES:%=android/skin/%)
common_LOCAL_SRC_FILES += \
android/user-config.c \
android/resource.c \
android/qemulator.c \
android/keycode.c \
# enable MMX code for our skin scaler
ifeq ($(HOST_ARCH),x86)
common_LOCAL_CFLAGS += -DUSE_MMX=1 -mmmx
endif
common_LOCAL_CFLAGS += $(EMULATOR_LIBUI_CFLAGS)
## one for 32-bit
$(call start-emulator-library, emulator-libui)
LOCAL_CFLAGS += $(common_LOCAL_CFLAGS)
LOCAL_SRC_FILES += $(common_LOCAL_SRC_FILES)
$(call gen-hw-config-defs)
$(call end-emulator-library)
## another for 64-bit, see note in emulator64-common
ifeq ($(HOST_OS),linux)
ifneq ($(BUILD_STANDALONE_EMULATOR),true)
$(call start-emulator-library, emulator64-libui)
LOCAL_CFLAGS += $(common_LOCAL_CFLAGS) -m64
LOCAL_SRC_FILES += $(common_LOCAL_SRC_FILES)
$(call gen-hw-config-defs)
$(call end-emulator-library)
endif # BUILD_STANDALONE_EMULATOR == nil
endif # HOST_OS == linux
##############################################################################
##############################################################################
###
### emulator-libqemu: TARGET-INDEPENDENT QEMU FUNCTIONS
###
### THESE ARE USED BY EVERYTHING EXCEPT 'emulator-ui'
###
common_LOCAL_CFLAGS =
common_LOCAL_SRC_FILES =
EMULATOR_LIBQEMU_CFLAGS :=
common_LOCAL_CFLAGS += $(EMULATOR_COMMON_CFLAGS)
###########################################################
# Jpeg configuration
#
LIBJPEG_DIR := distrib/jpeg-6b
include $(LOCAL_PATH)/$(LIBJPEG_DIR)/sources.make
EMULATOR_LIBQEMU_CFLAGS += \
$(LIBJPEG_CFLAGS) \
-I$(LOCAL_PATH)/$(LIBJPEG_DIR)
common_LOCAL_SRC_FILES += $(LIBJPEG_SOURCES)
AUDIO_SOURCES := noaudio.c wavaudio.c wavcapture.c mixeng.c
AUDIO_CFLAGS := -I$(LOCAL_PATH)/audio -DHAS_AUDIO
AUDIO_LDLIBS :=
common_LOCAL_CFLAGS += -Wall -Wno-missing-field-initializers
ifeq ($(HOST_OS),darwin)
CONFIG_COREAUDIO ?= yes
AUDIO_CFLAGS += -DHOST_BSD=1
endif
ifeq ($(HOST_OS),windows)
CONFIG_WINAUDIO ?= yes
endif
ifeq ($(HOST_OS),linux)
CONFIG_OSS ?= yes
CONFIG_ALSA ?= yes
CONFIG_PULSEAUDIO ?= yes
CONFIG_ESD ?= yes
endif
ifeq ($(HOST_OS),freebsd)
CONFIG_OSS ?= yes
endif
ifeq ($(CONFIG_COREAUDIO),yes)
AUDIO_SOURCES += coreaudio.c
AUDIO_CFLAGS += -DCONFIG_COREAUDIO
AUDIO_LDLIBS += -Wl,-framework,CoreAudio
endif
ifeq ($(CONFIG_WINAUDIO),yes)
AUDIO_SOURCES += winaudio.c
AUDIO_CFLAGS += -DCONFIG_WINAUDIO
endif
ifeq ($(CONFIG_PULSEAUDIO),yes)
AUDIO_SOURCES += paaudio.c audio_pt_int.c
AUDIO_CFLAGS += -DCONFIG_PULSEAUDIO
endif
ifeq ($(CONFIG_ALSA),yes)
AUDIO_SOURCES += alsaaudio.c audio_pt_int.c
AUDIO_CFLAGS += -DCONFIG_ALSA
endif
ifeq ($(CONFIG_ESD),yes)
AUDIO_SOURCES += esdaudio.c
AUDIO_CFLAGS += -DCONFIG_ESD
endif
ifeq ($(CONFIG_OSS),yes)
AUDIO_SOURCES += ossaudio.c
AUDIO_CFLAGS += -DCONFIG_OSS
endif
AUDIO_SOURCES := $(call sort,$(AUDIO_SOURCES:%=audio/%))
common_LOCAL_CFLAGS += -Wno-sign-compare \
-fno-strict-aliasing -W -Wall -Wno-unused-parameter \
# this is very important, otherwise the generated binaries may
# not link properly on our build servers
ifeq ($(HOST_OS),linux)
common_LOCAL_CFLAGS += -fno-stack-protector
endif
common_LOCAL_SRC_FILES += $(AUDIO_SOURCES)
common_LOCAL_SRC_FILES += \
android/audio-test.c
# other flags
ifneq ($(HOST_OS),windows)
AUDIO_LDLIBS += -ldl
else
endif
EMULATOR_LIBQEMU_CFLAGS += $(AUDIO_CFLAGS)
EMULATOR_LIBQEMU_LDLIBS += $(AUDIO_LDLIBS)
common_LOCAL_CFLAGS += -Wno-missing-field-initializers
# migration sources
#
ifeq ($(HOST_OS),windows)
common_LOCAL_SRC_FILES += migration-dummy-android.c
else
common_LOCAL_SRC_FILES += migration.c \
migration-exec.c \
migration-tcp-android.c
endif
# misc. sources
#
CORE_MISC_SOURCES = \
acl.c \
aes.c \
aio-android.c \
async.c \
bt-host.c \
bt-vhci.c \
buffered_file.c \
cbuffer.c \
charpipe.c \
console.c \
cutils.c \
d3des.c \
input.c \
iohandler.c \
ioport.c \
module.c \
net-android.c \
notify.c \
osdep.c \
path.c \
qemu-char.c \
qemu-config.c \
qemu-error.c \
qemu-malloc.c \
qemu-option.c \
qemu-sockets-android.c \
qerror.c \
readline.c \
savevm.c \
shaper.c \
tcpdump.c \
vnc-android.c \
android/boot-properties.c \
android/config.c \
android/core-init-utils.c \
android/gps.c \
android/hw-kmsg.c \
android/hw-lcd.c \
android/hw-events.c \
android/hw-control.c \
android/hw-sensors.c \
android/hw-qemud.c \
android/looper-qemu.c \
android/hw-pipe-net.c \
android/qemu-setup.c \
android/snapshot.c \
android/async-socket-connector.c \
android/async-socket.c \
android/sdk-controller-socket.c \
android/sensors-port.c \
android/utils/timezone.c \
android/camera/camera-format-converters.c \
android/camera/camera-service.c \
android/adb-server.c \
android/adb-qemud.c \
android/snaphost-android.c \
android/multitouch-screen.c \
android/multitouch-port.c \
android/utils/jpeg-compress.c
ifeq ($(HOST_ARCH),x86)
CORE_MISC_SOURCES += i386-dis.c
endif
ifeq ($(HOST_ARCH),x86_64)
CORE_MISC_SOURCES += i386-dis.c
endif
ifeq ($(HOST_ARCH),ppc)
CORE_MISC_SOURCES += ppc-dis.c \
cache-utils.c
endif
ifeq ($(HOST_OS),linux)
CORE_MISC_SOURCES += usb-linux.c \
qemu-thread.c \
android/camera/camera-capture-linux.c
else
CORE_MISC_SOURCES += usb-dummy-android.c
endif
ifeq ($(HOST_OS),windows)
CORE_MISC_SOURCES += tap-win32.c \
android/camera/camera-capture-windows.c
else
CORE_MISC_SOURCES += posix-aio-compat.c
endif
ifeq ($(HOST_OS),darwin)
CORE_MISC_SOURCES += android/camera/camera-capture-mac.m
endif
common_LOCAL_SRC_FILES += $(CORE_MISC_SOURCES)
# Required
common_LOCAL_CFLAGS += -D_XOPEN_SOURCE=600 -D_BSD_SOURCE=1
SLIRP_SOURCES := \
bootp.c \
cksum.c \
debug.c \
if.c \
ip_icmp.c \
ip_input.c \
ip_output.c \
mbuf.c \
misc.c \
sbuf.c \
slirp.c \
socket.c \
tcp_input.c \
tcp_output.c \
tcp_subr.c \
tcp_timer.c \
tftp.c \
udp.c
common_LOCAL_SRC_FILES += $(SLIRP_SOURCES:%=slirp-android/%)
EMULATOR_LIBQEMU_CFLAGS += -I$(LOCAL_PATH)/slirp-android
# socket proxy support
#
PROXY_SOURCES := \
proxy_common.c \
proxy_http.c \
proxy_http_connector.c \
proxy_http_rewriter.c \
common_LOCAL_SRC_FILES += $(PROXY_SOURCES:%=proxy/%)
EMULATOR_LIBQEMU_CFLAGS += -I$(LOCAL_PATH)/proxy
# include telephony stuff
#
TELEPHONY_SOURCES := \
android_modem.c \
modem_driver.c \
gsm.c \
sim_card.c \
sysdeps_qemu.c \
sms.c \
remote_call.c \
supplementary_service.c
common_LOCAL_SRC_FILES += $(TELEPHONY_SOURCES:%=telephony/%)
EMULATOR_LIBQEMU_CFLAGS += -I$(LOCAL_PATH)/telephony
# sources inherited from upstream, but not fully
# integrated into android emulator
#
common_LOCAL_SRC_FILES += \
json-lexer.c \
json-parser.c \
json-streamer.c \
qjson.c \
qbool.c \
qdict.c \
qfloat.c \
qint.c \
qlist.c \
qstring.c \
ifeq ($(QEMU_TARGET_XML_SOURCES),)
QEMU_TARGET_XML_SOURCES := arm-core arm-neon arm-vfp arm-vfp3
QEMU_TARGET_XML_SOURCES := $(QEMU_TARGET_XML_SOURCES:%=$(LOCAL_PATH)/gdb-xml/%.xml)
endif
common_LOCAL_CFLAGS += $(EMULATOR_LIBQEMU_CFLAGS)
## one for 32-bit
$(call start-emulator-library, emulator-libqemu)
# gdbstub-xml.c contains C-compilable arrays corresponding to the content
# of $(LOCAL_PATH)/gdb-xml/, and is generated with the 'feature_to_c.sh' script.
#
intermediates = $(call intermediates-dir-for,STATIC_LIBRARIES,$(LOCAL_MODULE),true)
QEMU_GDBSTUB_XML_C = $(intermediates)/gdbstub-xml.c
$(QEMU_GDBSTUB_XML_C): PRIVATE_PATH := $(LOCAL_PATH)
$(QEMU_GDBSTUB_XML_C): PRIVATE_SOURCES := $(TARGET_XML_SOURCES)
$(QEMU_GDBSTUB_XML_C): PRIVATE_CUSTOM_TOOL = $(PRIVATE_PATH)/feature_to_c.sh $@ $(QEMU_TARGET_XML_SOURCES)
$(QEMU_GDBSTUB_XML_C): $(QEMU_TARGET_XML_SOURCES) $(LOCAL_PATH)/feature_to_c.sh
$(hide) rm -f $@
$(transform-generated-source)
LOCAL_GENERATED_SOURCES += $(QEMU_GDBSTUB_XML_C)
LOCAL_CFLAGS += $(common_LOCAL_CFLAGS) -I$(intermediates)
LOCAL_SRC_FILES += $(common_LOCAL_SRC_FILES)
$(call gen-hw-config-defs)
$(call end-emulator-library)
## another for 64-bit, see note in emulator64-common
ifeq ($(HOST_OS),linux)
ifneq ($(BUILD_STANDALONE_EMULATOR),true)
$(call start-emulator-library, emulator64-libqemu)
# gdbstub-xml.c contains C-compilable arrays corresponding to the content
# of $(LOCAL_PATH)/gdb-xml/, and is generated with the 'feature_to_c.sh' script.
#
intermediates = $(call intermediates-dir-for,STATIC_LIBRARIES,$(LOCAL_MODULE),true)
QEMU_GDBSTUB_XML_C = $(intermediates)/gdbstub-xml.c
$(QEMU_GDBSTUB_XML_C): PRIVATE_PATH := $(LOCAL_PATH)
$(QEMU_GDBSTUB_XML_C): PRIVATE_SOURCES := $(TARGET_XML_SOURCES)
$(QEMU_GDBSTUB_XML_C): PRIVATE_CUSTOM_TOOL = $(PRIVATE_PATH)/feature_to_c.sh $@ $(QEMU_TARGET_XML_SOURCES)
$(QEMU_GDBSTUB_XML_C): $(QEMU_TARGET_XML_SOURCES) $(LOCAL_PATH)/feature_to_c.sh
$(hide) rm -f $@
$(transform-generated-source)
LOCAL_GENERATED_SOURCES += $(QEMU_GDBSTUB_XML_C)
LOCAL_CFLAGS += $(common_LOCAL_CFLAGS) -I$(intermediates) -m64
LOCAL_SRC_FILES += $(common_LOCAL_SRC_FILES)
$(call gen-hw-config-defs)
$(call end-emulator-library)
endif # BUILD_STANDALONE_EMULATOR == nil
endif # HOST_OS == linux
# Block sources, we must compile them with each executable because they
# are only referenced by the rest of the code using constructor functions.
# If their object files are put in a static library, these are never compiled
# into the final linked executable that uses them.
#
# Normally, one would solve thus using LOCAL_WHOLE_STATIC_LIBRARIES, but
# the Darwin linker doesn't support -Wl,--whole-archive or equivalent :-(
#
BLOCK_SOURCES += \
block.c \
blockdev.c \
block/qcow.c \
block/qcow2.c \
block/qcow2-refcount.c \
block/qcow2-snapshot.c \
block/qcow2-cluster.c \
block/cloop.c \
block/dmg.c \
block/vvfat.c \
block/raw.c
ifeq ($(HOST_OS),windows)
BLOCK_SOURCES += block/raw-win32.c
else
BLOCK_SOURCES += block/raw-posix.c
endif
BLOCK_CFLAGS += $(EMULATOR_COMMON_CFLAGS)
BLOCK_CFLAGS += -DCONFIG_BDRV_WHITELIST=""
##############################################################################
##############################################################################
###
### emulator-libelff: TARGET-INDEPENDENT ELF/DWARD PARSER
###
### THESE ARE USED BY EVERYTHING EXCEPT 'emulator-ui', BUT WE CANNOT PUT
### THEM IN emulator-libqemu SINCE THE SOURCES ARE C++
###
common_LOCAL_CFLAGS =
common_LOCAL_SRC_FILES =
ELFF_CFLAGS := -I$(LOCAL_PATH)/elff
ELFF_LDLIBS := -lstdc++
ELFF_SOURCES := \
dwarf_cu.cc \
dwarf_die.cc \
dwarf_utils.cc \
elf_alloc.cc \
elf_file.cc \
elf_mapped_section.cc \
elff_api.cc \
common_LOCAL_SRC_FILES += $(ELFF_SOURCES:%=elff/%)
common_LOCAL_CFLAGS += \
-fno-exceptions \
$(ELFF_CFLAGS) \
## one for 32-bit
$(call start-emulator-library, emulator-libelff)
LOCAL_CPP_EXTENSION := .cc
LOCAL_CFLAGS += $(common_LOCAL_CFLAGS)
LOCAL_SRC_FILES += $(common_LOCAL_SRC_FILES)
$(call end-emulator-library)
## another for 64-bit, see note in emulator64-common
ifeq ($(HOST_OS),linux)
ifneq ($(BUILD_STANDALONE_EMULATOR),true)
$(call start-emulator-library, emulator64-libelff)
LOCAL_CPP_EXTENSION := .cc
LOCAL_CFLAGS += $(common_LOCAL_CFLAGS) -m64
LOCAL_SRC_FILES += $(common_LOCAL_SRC_FILES)
$(call end-emulator-library)
endif # BUILD_STANDALONE_EMULATOR == nil
endif # HOST_OS == linux
##############################################################################
##############################################################################
###
### gen-hx-header: Generate headers from .hx file with "hxtool" script.
###
### The 'hxtool' script is used to generate header files from an input
### file with the .hx suffix. I.e. foo.hx --> foo.h
###
### Due to the way the Android build system works, we need to regenerate
### it for each module (the output will go into a module-specific directory).
###
### This defines a function that can be used inside a module definition
###
### $(call gen-hx-header,<input>,<output>,<source-files>)
###
### Where: <input> is the input file, with a .hx suffix (e.g. foo.hx)
### <output> is the output file, with a .h or .def suffix
### <source-files> is a list of source files that include the header
###
gen-hx-header = $(eval $(call gen-hx-header-ev,$1,$2,$3))
define gen-hx-header-ev
intermediates := $$(call intermediates-dir-for,$$(LOCAL_MODULE_CLASS),$$(LOCAL_MODULE),true)
QEMU_HEADER_H := $$(intermediates)/$$2
$$(QEMU_HEADER_H): PRIVATE_PATH := $$(LOCAL_PATH)
$$(QEMU_HEADER_H): PRIVATE_CUSTOM_TOOL = $$(PRIVATE_PATH)/hxtool -h < $$< > $$@
$$(QEMU_HEADER_H): $$(LOCAL_PATH)/$$1 $$(LOCAL_PATH)/hxtool
$$(transform-generated-source)
LOCAL_GENERATED_SOURCES += $$(QEMU_HEADER_H)
LOCAL_C_INCLUDES += $$(intermediates)
endef