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
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
|
ifeq ($(TARGET_ARCH),arm)
LOCAL_PATH:= $(call my-dir)
# determine the host tag to use
QEMU_HOST_TAG := $(HOST_PREBUILT_TAG)
ifneq ($(USE_MINGW),)
QEMU_HOST_TAG := windows
endif
# determine the location of platform-specific directories
#
CONFIG_DIRS := \
$(LOCAL_PATH)/android/config \
$(LOCAL_PATH)/android/config/$(QEMU_HOST_TAG)
ifeq ($(BUILD_STANDALONE_EMULATOR),true)
CONFIG_DIRS := $(LOCAL_PATH)/objs $(CONFIG_DIRS)
endif
CONFIG_INCLUDES := $(CONFIG_DIRS:%=-I%)
MY_CC := $(HOST_CC)
MY_OPTIM := -O2 -g -fno-PIC -falign-functions=0 -fomit-frame-pointer
ifeq ($(BUILD_DEBUG_EMULATOR),true)
MY_OPTIM := -O0 -g
endif
MY_CFLAGS := $(CONFIG_INCLUDES) $(MY_OPTIM)
# Overwrite configuration for debug builds.
#
ifeq ($(BUILD_DEBUG_EMULATOR),true)
MY_CFLAGS := $(CONFIG_INCLUDES) -O0 -g \
-fno-PIC -falign-functions=0
endif
MY_CFLAGS += -DCONFIG_MEMCHECK
MY_LDLIBS :=
# this is needed to build the emulator on 64-bit Linux systems
ifeq ($(HOST_OS)-$(HOST_ARCH),linux-x86)
MY_CFLAGS += -Wa,--32
endif
ifeq ($(HOST_OS),freebsd)
MY_CFLAGS += -Wa,--32 -I /usr/local/include
endif
ifeq ($(HOST_OS),windows)
MY_CFLAGS += -D_WIN32 -mno-cygwin
# we need Win32 features that are available since Windows 2000 Professional/Server (NT 5.0)
MY_CFLAGS += -DWINVER=0x501
endif
ifeq ($(HOST_ARCH),ppc)
MY_CFLAGS += -D__powerpc__
endif
ifeq ($(HOST_OS),darwin)
MY_CFLAGS += -mdynamic-no-pic
# When building on Leopard or above, we need to use the 10.4 SDK
# or the generated binary will not run on Tiger.
DARWIN_VERSION := $(strip $(shell sw_vers -productVersion))
ifneq ($(filter 10.1 10.2 10.3 10.1.% 10.2.% 10.3.% 10.4 10.4.%,$(DARWIN_VERSION)),)
$(error Building the Android emulator requires OS X 10.5 or above)
endif
ifeq ($(filter 10.5 10.5.%,$(DARWIN_VERSION)),)
# We are on Snow Leopard or above
LEOPARD_SDK := /Developer/SDKs/MacOSX10.5.sdk
ifeq ($(strip $(wildcard $(LEOPARD_SDK))),)
$(info Please install the 10.5 SDK on this machine at $(LEOPARD_SDK))
$(error Aborting the build.)
endif
MY_CFLAGS += -isysroot $(LEOPARD_SDK) -mmacosx-version-min=10.5 -DMACOSX_DEPLOYMENT_TARGET=10.5
MY_LDLIBS += -isysroot $(LEOPARD_SDK) -Wl,-syslibroot,$(LEOPARD_SDK) -mmacosx-version-min=10.5
endif
endif
# BUILD_STANDALONE_EMULATOR is only defined when building with
# the android-rebuild.sh script. The script will also provide
# adequate values for HOST_CC
#
ifneq ($(BUILD_STANDALONE_EMULATOR),true)
ifneq ($(USE_CCACHE),)
ccache := prebuilt/$(HOST_PREBUILT_TAG)/ccache/ccache
ifneq ($(ccache),$(firstword $(MY_CC)))
MY_CC := $(ccache) $(MY_CC)
endif
ccache :=
endif
endif
ifneq ($(combo_target)$(TARGET_SIMULATOR),HOST_true)
ifneq ($(HOST_ARCH),x86_64)
MY_CFLAGS += -m32
MY_LDLIBS += -m32
endif
endif
# Enable warning, except those related to missing field initializers
# (the QEMU coding style loves using these).
#
MY_CFLAGS += -Wall -Wno-missing-field-initializers
include $(CLEAR_VARS)
###########################################################
# Zlib configuration
#
ZLIB_DIR := distrib/zlib-1.2.3
include $(LOCAL_PATH)/$(ZLIB_DIR)/sources.make
###########################################################
# Libpng configuration
#
LIBPNG_DIR := distrib/libpng-1.2.19
include $(LOCAL_PATH)/$(LIBPNG_DIR)/sources.make
###############################################################################
# build the TCG code generator
#
include $(CLEAR_VARS)
LOCAL_NO_DEFAULT_COMPILER_FLAGS := true
LOCAL_CC := $(MY_CC)
LOCAL_CFLAGS := $(MY_CFLAGS) $(LOCAL_CFLAGS)
LOCAL_LDLIBS := $(MY_LDLIBS)
LOCAL_MODULE := emulator-tcg
TCG_TARGET := $(HOST_ARCH)
ifeq ($(TCG_TARGET),x86)
TCG_TARGET := i386
endif
TCG_CFLAGS := -I$(LOCAL_PATH)/tcg -I$(LOCAL_PATH)/tcg/$(TCG_TARGET)
LOCAL_CFLAGS += $(TCG_CFLAGS) -DNEED_CPU_H \
-I$(LOCAL_PATH)/target-arm \
-I$(LOCAL_PATH)/fpu \
LOCAL_SRC_FILES := \
tcg/tcg.c \
include $(BUILD_HOST_STATIC_LIBRARY)
##############################################################################
# build the HW emulation support
#
include $(CLEAR_VARS)
LOCAL_NO_DEFAULT_COMPILER_FLAGS := true
LOCAL_CC := $(MY_CC)
LOCAL_LDLIBS := $(MY_LDLIBS)
LOCAL_MODULE := emulator-hw
HW_CFLAGS := -I$(LOCAL_PATH)/hw
LOCAL_CFLAGS := $(MY_CFLAGS) $(LOCAL_CFLAGS) -DNEED_CPU_H
LOCAL_CFLAGS += -I$(LOCAL_PATH)/target-arm -I$(LOCAL_PATH)/fpu $(HW_CFLAGS)
LOCAL_CFLAGS += $(ZLIB_CFLAGS) -I$(LOCAL_PATH)/$(ZLIB_DIR)
HW_SOURCES := \
android_arm.c \
arm_pic.c \
bt.c \
bt-hci.c \
bt-hid.c \
bt-l2cap.c \
bt-sdp.c \
cdrom.c \
dma.c \
irq.c \
goldfish_audio.c \
goldfish_battery.c \
goldfish_device.c \
goldfish_events_device.c \
goldfish_fb.c \
goldfish_interrupt.c \
goldfish_memlog.c \
goldfish_mmc.c \
goldfish_nand.c \
goldfish_switch.c \
goldfish_timer.c \
goldfish_trace.c \
goldfish_tty.c \
msmouse.c \
pci.c \
qdev.c \
scsi-disk.c \
smc91c111.c \
sysbus.c \
usb-hid.c \
usb-hub.c \
usb-msd.c \
usb-ohci.c \
usb.c \
watchdog.c \
LOCAL_SRC_FILES += $(HW_SOURCES:%=hw/%)
include $(BUILD_HOST_STATIC_LIBRARY)
##############################################################################
# build the ELF/DWARF stuff
# This library is used by emulator's memory checker to extract debug information
# from the symbol files when reporting memory allocation violations. In
# particular, this library is used to extract routine name and source file
# location for the code address where violation has been detected.
#
include $(CLEAR_VARS)
LOCAL_NO_DEFAULT_COMPILER_FLAGS := true
LOCAL_CC := $(MY_CC)
LOCAL_LDLIBS := $(MY_LDLIBS)
LOCAL_MODULE := emulator-elff
LOCAL_CPP_EXTENSION := .cc
ELFF_CFLAGS := -I$(LOCAL_PATH)/elff
LOCAL_CFLAGS := $(MY_CFLAGS) $(LOCAL_CFLAGS) -fno-exceptions
LOCAL_CFLAGS += -I$(LOCAL_PATH)/target-arm -I$(LOCAL_PATH)/fpu $(ELFF_CFLAGS)
LOCAL_CFLAGS += $(ZLIB_CFLAGS) -I$(LOCAL_PATH)/$(ZLIB_DIR)
ELFF_SOURCES := \
dwarf_cu.cc \
dwarf_die.cc \
dwarf_utils.cc \
elf_alloc.cc \
elf_file.cc \
elf_mapped_section.cc \
elff_api.cc \
LOCAL_SRC_FILES += $(ELFF_SOURCES:%=elff/%)
ELFF_LDLIBS := -lstdc++
include $(BUILD_HOST_STATIC_LIBRARY)
##############################################################################
# build the memory access checking support
# Memory access checker uses information collected by instrumented code in
# libc.so in order to keep track of memory blocks allocated from heap. Memory
# checker then uses this information to make sure that every access to allocated
# memory is within allocated block. This information also allows detecting
# memory leaks and attempts to free/realloc invalid pointers.
#
include $(CLEAR_VARS)
LOCAL_NO_DEFAULT_COMPILER_FLAGS := true
LOCAL_CC := $(MY_CC)
LOCAL_LDLIBS := $(MY_LDLIBS)
LOCAL_MODULE := emulator-memcheck
MCHK_CFLAGS := -I$(LOCAL_PATH)/memcheck -I$(LOCAL_PATH)/elff
LOCAL_CFLAGS := $(MY_CFLAGS) $(LOCAL_CFLAGS) -DNEED_CPU_H
LOCAL_CFLAGS += -I$(LOCAL_PATH)/target-arm -I$(LOCAL_PATH)/fpu $(MCHK_CFLAGS)
LOCAL_CFLAGS += $(ZLIB_CFLAGS) -I$(LOCAL_PATH)/$(ZLIB_DIR)
MCHK_SOURCES := \
memcheck.c \
memcheck_proc_management.c \
memcheck_malloc_map.c \
memcheck_mmrange_map.c \
memcheck_util.c \
LOCAL_SRC_FILES += $(MCHK_SOURCES:%=memcheck/%)
include $(BUILD_HOST_STATIC_LIBRARY)
##############################################################################
# build the ARM-specific emulation engine sources
#
include $(CLEAR_VARS)
LOCAL_NO_DEFAULT_COMPILER_FLAGS := true
LOCAL_CC := $(MY_CC)
LOCAL_MODULE := emulator-arm
LOCAL_LDLIBS := $(MY_LDLIBS)
LOCAL_CFLAGS := $(MY_CFLAGS) $(LOCAL_CFLAGS)
LOCAL_STATIC_LIBRARIES := emulator-hw
LOCAL_CFLAGS := -fno-PIC -fomit-frame-pointer -Wno-sign-compare
LOCAL_CFLAGS := $(MY_CFLAGS) $(LOCAL_CFLAGS)
LOCAL_CFLAGS += -I$(LOCAL_PATH) \
-I$(LOCAL_PATH)/target-arm \
-I$(LOCAL_PATH)/fpu \
$(TCG_CFLAGS) \
$(HW_CFLAGS) \
-DNEED_CPU_H \
ifeq ($(HOST_ARCH),ppc)
LOCAL_CFLAGS += -D__powerpc__
endif
LOCAL_SRC_FILES += exec.c cpu-exec.c \
target-arm/op_helper.c \
target-arm/iwmmxt_helper.c \
target-arm/neon_helper.c \
target-arm/helper.c \
target-arm/translate.c \
target-arm/machine.c \
translate-all.c \
hw/armv7m.c \
hw/armv7m_nvic.c \
arm-semi.c \
trace.c \
varint.c \
dcache.c \
softmmu_outside_jit.c \
LOCAL_SRC_FILES += fpu/softfloat.c
include $(BUILD_HOST_STATIC_LIBRARY)
##############################################################################
# SDL-related definitions
#
# Build SDL from sources except on linux-x86, to avoid installing all
# the X11 development packages on our build servers.
#
BUILD_SDL_FROM_SOURCES := true
ifeq ($(QEMU_HOST_TAG),linux-x86)
BUILD_SDL_FROM_SOURCES := false
endif
ifeq ($(QEMU_HOST_TAG),darwin-x86)
BUILD_SDL_FROM_SOURCES := false
endif
ifeq ($(BUILD_STANDALONE_EMULATOR),true)
BUILD_SDL_FROM_SOURCES := true
endif
ifneq ($(SDL_CONFIG),)
BUILD_SDL_FROM_SOURCES := false
endif
ifneq ($(BUILD_SDL_FROM_SOURCES),true)
SDL_CONFIG ?= prebuilt/$(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
else # !BUILD_STANDALONE_EMULATOR
SDL_DIR := distrib/sdl-1.2.12
include $(LOCAL_PATH)/$(SDL_DIR)/sources.make
endif # !BUILD_STANDALONE_EMULATOR
##############################################################################
# determine audio sources, build the prebuilt audio-library if needed
#
# determine AUDIO sources based on current configuration
#
AUDIO_SOURCES := audio.c noaudio.c wavaudio.c wavcapture.c mixeng.c
AUDIO_CFLAGS := -I$(LOCAL_PATH)/audio -DHAS_AUDIO
AUDIO_LDLIBS :=
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/%))
# determine whether we're going to use the prebuilt
# audio library (this is useful on Linux to avoid requiring
# all sound-related development packages to be installed on
# the build and developer machines).
#
# note that you can define BUILD_QEMU_AUDIO_LIB to true
# in your environment to force recompilation.
#
QEMU_AUDIO_LIB :=
ifneq ($(BUILD_STANDALONE_EMULATOR),true)
QEMU_AUDIO_LIB := $(wildcard \
prebuilt/$(QEMU_HOST_TAG)/emulator/libqemu-audio.a)
endif
ifeq ($(BUILD_QEMU_AUDIO_LIB),true)
include $(CLEAR_VARS)
LOCAL_NO_DEFAULT_COMPILER_FLAGS := true
LOCAL_CC := $(MY_CC)
LOCAL_MODULE := libqemu-audio
LOCAL_LDLIBS := $(MY_LDLIBS)
LOCAL_CFLAGS := -Wno-sign-compare \
-fno-strict-aliasing -W -Wall -Wno-unused-parameter \
-I$(LOCAL_PATH) \
-I$(LOCAL_PATH)/target-arm \
-I$(LOCAL_PATH)/fpu \
# this is very important, otherwise the generated binaries may
# not link properly on our build servers
ifeq ($(HOST_OS),linux)
LOCAL_CFLAGS += -fno-stack-protector
endif
LOCAL_CFLAGS := $(MY_CFLAGS) $(LOCAL_CFLAGS) $(AUDIO_CFLAGS)
LOCAL_CFLAGS += $(SDL_CFLAGS)
LOCAL_SRC_FILES += $(AUDIO_SOURCES)
include $(BUILD_HOST_STATIC_LIBRARY)
QEMU_AUDIO_LIB := $(LOCAL_BUILT_MODULE)
endif # !QEMU_AUDIO_LIB
##############################################################################
# Common CFLAGS for UI and Core builds
# add the build ID to the default macro definitions
UI_AND_CORE_CFLAGS := -DANDROID_BUILD_ID="$(strip $(BUILD_ID))-$(strip $(BUILD_NUMBER))"
# 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
UI_AND_CORE_CFLAGS += -DANDROID_SDK_TOOLS_REVISION=$(ANDROID_SDK_TOOLS_REVISION)
endif
UI_AND_CORE_CFLAGS += -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE
##############################################################################
# Build emulator core library.
# This library contains "pure" emulation code separated from the intricacies
# of the UI.
#
include $(CLEAR_VARS)
LOCAL_NO_DEFAULT_COMPILER_FLAGS := true
LOCAL_CC := $(MY_CC)
LOCAL_LDLIBS := $(MY_LDLIBS)
LOCAL_MODULE := emulator-core
# don't remove the -fno-strict-aliasing, or you'll break things
# (e.g. slirp-android/network support)
#
EMULATOR_CORE_CFLAGS := -fno-PIC -Wno-sign-compare \
-fno-strict-aliasing -g -W -Wall -Wno-unused-parameter
# Needed by the upstream code
EMULATOR_CORE_CFLAGS += -DNEED_CPU_H
# Common includes for the emulator
EMULATOR_CORE_CFLAGS += -I$(LOCAL_PATH)/ \
-I$(LOCAL_PATH)/target-arm \
-I$(LOCAL_PATH)/fpu \
$(TCG_CFLAGS) \
$(HW_CFLAGS) \
# include slirp-android code, i.e. the user-level networking stuff
#
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
LOCAL_SRC_FILES += $(SLIRP_SOURCES:%=slirp-android/%)
EMULATOR_CORE_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 \
LOCAL_SRC_FILES += $(PROXY_SOURCES:%=proxy/%)
EMULATOR_CORE_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
LOCAL_SRC_FILES += $(TELEPHONY_SOURCES:%=telephony/%)
EMULATOR_CORE_CFLAGS += -I$(LOCAL_PATH)/telephony
# include android related stuff
#
ANDROID_SOURCES := qemu-setup.c
LOCAL_SRC_FILES += $(ANDROID_SOURCES:%=android/%)
LOCAL_CFLAGS := $(MY_CFLAGS) $(LOCAL_CFLAGS) $(EMULATOR_CORE_CFLAGS)
LOCAL_CFLAGS += $(UI_AND_CORE_CFLAGS)
include $(BUILD_HOST_STATIC_LIBRARY)
##############################################################################
# Build emulator UI library.
# This library contains some emulator related UI components.
#
include $(CLEAR_VARS)
LOCAL_NO_DEFAULT_COMPILER_FLAGS := true
LOCAL_CC := $(MY_CC)
LOCAL_LDLIBS := $(MY_LDLIBS)
LOCAL_MODULE := emulator-uilib
EMULATOR_UI_CFLAGS :=
# include the SDL sources
#
# IMPORTANT: Normally, we should add SDLMAIN_SOURCES here, however this breaks
# the Linux mingw32 build. Apparently, the i586-mingw32-ld wants the
# implementation of _WinMain@16 to be in an object file on the final
# link command used to generate the executable, and will not search
# in the static libraries that are used to build it.
#
LOCAL_SRC_FILES += $(SDL_SOURCES) #$(SDLMAIN_SOURCES)
EMULATOR_UI_CFLAGS += $(SDL_CFLAGS) -I$(LOCAL_PATH)/$(SDL_DIR)/include
# 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 \
LOCAL_SRC_FILES += $(SKIN_SOURCES:%=android/skin/%)
EMULATOR_UI_CFLAGS += -I$(LOCAL_PATH)/skin
LOCAL_CFLAGS := $(MY_CFLAGS) $(LOCAL_CFLAGS) $(EMULATOR_CORE_CFLAGS) $(EMULATOR_UI_CFLAGS)
LOCAL_MODULE_TAGS := debug
include $(BUILD_HOST_STATIC_LIBRARY)
##############################################################################
# lists of source files used to build the emulator core
#
# block sources
#
CORE_BLOCK_SOURCES = block.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
ifeq ($(HOST_OS),windows)
CORE_BLOCK_SOURCES += block/raw-win32.c
else
CORE_BLOCK_SOURCES += block/raw-posix.c
endif
# hw sources
#
CORE_HW_SOURCES = hw/arm_boot.c \
hw/android_arm.c
# migration sources
#
CORE_MIGRATION_SOURCES = iolooper-select.c
ifeq ($(HOST_OS),windows)
CORE_MIGRATION_SOURCES += migration-dummy-android.c
else
CORE_MIGRATION_SOURCES += migration.c \
migration-exec.c \
migration-tcp-android.c
endif
# misc. sources
#
CORE_MISC_SOURCES = vl-android.c \
console.c \
qemu-malloc.c \
cutils.c \
osdep.c \
loader.c \
monitor.c \
readline.c \
qemu-char-android.c \
qemu-error.c \
qerror.c \
disas.c \
arm-dis.c \
aes.c \
d3des.c \
vnc-android.c \
acl.c \
keymaps.c \
buffered_file.c \
cbuffer.c \
gdbstub.c \
input.c \
ioport.c \
notify.c \
path.c \
shaper.c \
charpipe.c \
tcpdump.c \
qemu-option.c \
savevm.c \
net-android.c \
aio-android.c \
dma-helpers.c \
qemu-config.c \
qemu-sockets-android.c \
bt-host.c \
bt-vhci.c \
module.c \
qemu-timer.c \
android/boot-properties.c \
android/display.c \
android/hw-kmsg.c \
android/hw-lcd.c \
android/gps.c \
android/hw-events.c \
android/hw-control.c \
android/console.c \
android/hw-sensors.c \
android/hw-qemud.c \
android/core-init-utils.c \
android/config.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
endif
ifeq ($(HOST_OS),linux)
CORE_MISC_SOURCES += usb-linux.c \
qemu-thread.c
else
CORE_MISC_SOURCES += usb-dummy-android.c
endif
ifeq ($(HOST_OS),windows)
CORE_MISC_SOURCES += tap-win32.c
endif
# sources inherited from upstream, but not fully
# integrated into android emulator
#
CORE_UPSTREAM_SOURCES = json-lexer.c \
json-parser.c \
json-streamer.c \
qjson.c \
qbool.c \
qdict.c \
qfloat.c \
qint.c \
qlist.c \
qstring.c \
CORE_SOURCES = $(CORE_BLOCK_SOURCES) $(CORE_HW_SOURCES)
CORE_SOURCES += $(CORE_MIGRATION_SOURCES) $(CORE_MISC_SOURCES)
CORE_SOURCES += $(CORE_UPSTREAM_SOURCES)
##############################################################################
# lists of source files used to build the emulator UI
#
UI_SOURCES = loadpng.c \
android/user-config.c \
android/resource.c \
android/qemulator.c \
android/keycode.c \
android/help.c \
##############################################################################
# lists of source files used by both, emulator UI and emulator core
#
UI_AND_CORE_SOURCES = \
sockets.c \
android/keycode-array.c \
android/charmap.c \
android/utils/bufprint.c \
android/utils/debug.c \
android/utils/path.c \
android/utils/dirscanner.c \
android/utils/filelock.c \
android/utils/misc.c \
android/utils/reflist.c \
android/utils/stralloc.c \
android/utils/system.c \
android/utils/tempfile.c \
android/utils/timezone.c \
android/utils/mapfile.c \
android/avd/hw-config.c \
android/avd/info.c \
android/utils/ini.c \
# include the Zlib sources
#
UI_AND_CORE_SOURCES += $(ZLIB_SOURCES)
UI_AND_CORE_CFLAGS += $(ZLIB_CFLAGS) -I$(LOCAL_PATH)/$(ZLIB_DIR)
# include the Libpng sources
#
UI_AND_CORE_SOURCES += $(LIBPNG_SOURCES)
UI_AND_CORE_CFLAGS += $(LIBPNG_CFLAGS) -I$(LOCAL_PATH)/$(LIBPNG_DIR)
# temp files used to collect UI->Core exchange protocol.
UI_AND_CORE_SOURCES += android/ui-core-protocol.c android/core-ui-protocol.c
# The common libraries
#
QEMU_SYSTEM_LDLIBS := -lm
ifeq ($(HOST_OS),windows)
QEMU_SYSTEM_LDLIBS += -mno-cygwin -mwindows -mconsole
endif
ifeq ($(HOST_OS),freebsd)
QEMU_SYSTEM_LDLIBS += -L/usr/local/lib -lpthread -lX11 -lutil
endif
ifeq ($(HOST_OS),linux)
QEMU_SYSTEM_LDLIBS += -lutil -lrt
endif
ifeq ($(HOST_OS),windows)
QEMU_SYSTEM_LDLIBS += -lwinmm -lws2_32 -liphlpapi
else
QEMU_SYSTEM_LDLIBS += -lpthread
endif
ifeq ($(HOST_OS),darwin)
QEMU_SYSTEM_LDLIBS += -Wl,-framework,Cocoa
endif
##############################################################################
# now build the emulator itself
#
include $(CLEAR_VARS)
LOCAL_GENERATED_SOURCES :=
LOCAL_NO_DEFAULT_COMPILER_FLAGS := true
LOCAL_CC := $(MY_CC)
LOCAL_MODULE := emulator
LOCAL_STATIC_LIBRARIES := emulator-memcheck emulator-hw emulator-arm emulator-tcg
LOCAL_STATIC_LIBRARIES += emulator-elff
LOCAL_STATIC_LIBRARIES += emulator-core emulator-uilib
LOCAL_LDLIBS := $(MY_LDLIBS)
LOCAL_CFLAGS := $(MY_CFLAGS) $(LOCAL_CFLAGS) $(EMULATOR_CORE_CFLAGS) $(EMULATOR_UI_CFLAGS)
# add the build ID to the default macro definitions
LOCAL_CFLAGS += $(UI_AND_CORE_CFLAGS)
# include sound support source files. we first try to see if we have a prebuilt audio
# library. if not, we build things the "hard" way.
#
# note that to generate the prebuilt audio library, you should do the following:
#
# cd tools/qemu
# ./android-rebuild.sh
# distrib/update-audio.sh
#
ifeq ($(QEMU_AUDIO_LIB),)
LOCAL_SRC_FILES += $(AUDIO_SOURCES)
endif # !QEMU_AUDIO_LIB
LOCAL_CFLAGS += $(AUDIO_CFLAGS)
LOCAL_LDLIBS += $(AUDIO_LDLIBS)
# the linux-user sources, I doubt we really need these
#
#LINUX_SOURCES := main.c elfload.c mmap.c signal.c path.c syscall.c
#LOCAL_SRC_FILES += $(LINUX_SOURCES:%=linux-user/%)
ifeq ($(HOST_ARCH),x86)
# enable MMX code for our skin scaler
LOCAL_CFLAGS += -DUSE_MMX=1 -mmmx
endif
# include other sources
#
VL_SOURCES := framebuffer.c \
user-events-qemu.c \
android/cmdline-option.c \
android/main.c \
# Add common system libraries
#
LOCAL_LDLIBS += $(QEMU_SYSTEM_LDLIBS)
LOCAL_SRC_FILES += $(VL_SOURCES) $(CORE_SOURCES) $(UI_SOURCES) $(UI_AND_CORE_SOURCES)
# add SDL-specific flags
#
LOCAL_CFLAGS += $(SDL_CFLAGS)
LOCAL_LDLIBS += $(SDL_LDLIBS)
LOCAL_STATIC_LIBRARIES += $(SDL_STATIC_LIBRARIES)
# add ELFF-specific flags
#
LOCAL_LDLIBS += $(ELFF_LDLIBS)
# on Windows, link the icon file as well into the executable
# unfortunately, our build system doesn't help us much, so we need
# to use some weird pathnames to make this work...
#
ifeq ($(HOST_OS),windows)
# Locate windres executable
WINDRES := windres
ifneq ($(USE_MINGW),)
# When building the Windows emulator under Linux, use the MinGW one
WINDRES := i586-mingw32msvc-windres
endif
INTERMEDIATE := $(call intermediates-dir-for,EXECUTABLES,$(LOCAL_MODULE),true)
ANDROID_ICON_OBJ := android_icon.o
ANDROID_ICON_PATH := $(LOCAL_PATH)/images
$(ANDROID_ICON_PATH)/$(ANDROID_ICON_OBJ): $(ANDROID_ICON_PATH)/android_icon.rc
$(WINDRES) $< -I $(ANDROID_ICON_PATH) -o $@
# seems to be the only way to add an object file that was not generated from
# a C/C++/Java source file to our build system. and very unfortunately,
# $(TOPDIR)/$(LOCALPATH) will always be prepended to this value, which forces
# us to put the object file in the source directory...
#
LOCAL_PREBUILT_OBJ_FILES += images/$(ANDROID_ICON_OBJ)
endif
# qemu-options.h is generated from qemu-options.hx with the "hxtool" shell script
#
intermediates := $(call intermediates-dir-for,EXECUTABLES,$(LOCAL_MODULE),true)
QEMU_OPTIONS_H := $(intermediates)/qemu-options.h
$(QEMU_OPTIONS_H): PRIVATE_PATH := $(LOCAL_PATH)
$(QEMU_OPTIONS_H): PRIVATE_CUSTOM_TOOL = $(PRIVATE_PATH)/hxtool -h < $< > $@
$(QEMU_OPTIONS_H): $(LOCAL_PATH)/qemu-options.hx $(LOCAL_PATH)/hxtool
$(transform-generated-source)
$(intermediates)/vl-android.o: $(QEMU_OPTIONS_H)
LOCAL_GENERATED_SOURCES += $(QEMU_OPTIONS_H)
# qemu-monitor.h is generated from qemu-monitor.hx with the "hxtool" shell script
#
intermediates := $(call intermediates-dir-for,EXECUTABLES,$(LOCAL_MODULE),true)
QEMU_MONITOR_H := $(intermediates)/qemu-monitor.h
$(QEMU_MONITOR_H): PRIVATE_PATH := $(LOCAL_PATH)
$(QEMU_MONITOR_H): PRIVATE_CUSTOM_TOOL = $(PRIVATE_PATH)/hxtool -h < $< > $@
$(QEMU_MONITOR_H): $(LOCAL_PATH)/qemu-monitor.hx $(LOCAL_PATH)/hxtool
$(transform-generated-source)
$(intermediates)/vl-android.o: $(QEMU_MONITOR_H)
LOCAL_GENERATED_SOURCES += $(QEMU_MONITOR_H)
# 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.
#
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
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)
$(intermediates)/vl-android.o: $(QEMU_GDBSTUB_XML_C)
LOCAL_GENERATED_SOURCES += $(QEMU_GDBSTUB_XML_C)
# hw-config-defs.h is generated from android/avd/hardware-properties.ini
#
QEMU_HARDWARE_PROPERTIES_INI := $(LOCAL_PATH)/android/avd/hardware-properties.ini
QEMU_HW_CONFIG_DEFS_H := $(LOCAL_PATH)/android/avd/hw-config-defs.h
$(QEMU_HW_CONFIG_DEFS_H): PRIVATE_PATH := $(LOCAL_PATH)
$(QEMU_HW_CONFIG_DEFS_H): PRIVATE_SOURCES := $(QEMU_HARDWARE_PROPERTIES_INI)
$(QEMU_HW_CONFIG_DEFS_H): PRIVATE_CUSTOM_TOOL = $(PRIVATE_PATH)/android/tools/gen-hw-config.py $(QEMU_HARDWARE_PROPERTIES_INI) $@
$(QEMU_HW_CONFIG_DEFS_H): $(QEMU_HARDWARE_PROPERTIES_INI) $(LOCAL_PATH)/android/tools/gen-hw-config.py
$(hide) rm -f $@
$(transform-generated-source)
$(LOCAL_PATH)/android/avd/hw-config.h: $(QEMU_HW_CONFIG_DEFS_H)
LOCAL_GENERATED_SOURCES += $(QEMU_HW_CONFIG_DEFS_H)
# this is already done by the Android build system, but is done for the
# benefit of the stand-alone one.
#
ifeq ($(BUILD_STANDALONE_EMULATOR),true)
LOCAL_CFLAGS += -I$(intermediates)
endif
LOCAL_LDLIBS += $(QEMU_AUDIO_LIB)
# Generate a completely static executable if needed.
# Note that this means no sound and graphics on Linux.
#
ifeq ($(CONFIG_STATIC_EXECUTABLE),true)
LOCAL_SRC_FILES += dynlink-static.c
LOCAL_LDLIBS += -static
endif
LOCAL_MODULE := emulator
# See comment about SDLMAIN_SOURCES in the 'emulator-uilib' module declarations.
LOCAL_SRC_FILES += $(SDLMAIN_SOURCES)
include $(BUILD_HOST_EXECUTABLE)
##############################################################################
# Build standalone emulator core.
#
include $(CLEAR_VARS)
LOCAL_GENERATED_SOURCES :=
LOCAL_NO_DEFAULT_COMPILER_FLAGS := true
LOCAL_CC := $(MY_CC)
LOCAL_MODULE := qemu-android
LOCAL_STATIC_LIBRARIES := emulator-memcheck emulator-hw emulator-arm emulator-tcg
LOCAL_STATIC_LIBRARIES += emulator-elff
LOCAL_STATIC_LIBRARIES += emulator-core
LOCAL_LDLIBS := $(MY_LDLIBS)
LOCAL_CFLAGS := $(MY_CFLAGS) $(LOCAL_CFLAGS) $(EMULATOR_CORE_CFLAGS)
LOCAL_CFLAGS += $(UI_AND_CORE_CFLAGS) -DCONFIG_STANDALONE_CORE
# include sound support source files. we first try to see if we have a prebuilt audio
# library. if not, we build things the "hard" way.
#
# note that to generate the prebuilt audio library, you should do the following:
#
# cd tools/qemu
# ./android-rebuild.sh
# distrib/update-audio.sh
#
ifeq ($(QEMU_AUDIO_LIB),)
LOCAL_SRC_FILES += $(AUDIO_SOURCES)
endif # !QEMU_AUDIO_LIB
LOCAL_CFLAGS += $(AUDIO_CFLAGS)
LOCAL_LDLIBS += $(AUDIO_LDLIBS)
# the linux-user sources, I doubt we really need these
#
#LINUX_SOURCES := main.c elfload.c mmap.c signal.c path.c syscall.c
#LOCAL_SRC_FILES += $(LINUX_SOURCES:%=linux-user/%)
# include other sources
#
VL_SOURCES := framebuffer.c \
user-events-qemu.c \
# Add common system libraries
#
LOCAL_LDLIBS += $(QEMU_SYSTEM_LDLIBS)
LOCAL_SRC_FILES += $(VL_SOURCES) $(CORE_SOURCES) $(UI_AND_CORE_SOURCES)
# add ELFF-specific flags
#
LOCAL_LDLIBS += $(ELFF_LDLIBS)
# on Windows, link the icon file as well into the executable
# unfortunately, our build system doesn't help us much, so we need
# to use some weird pathnames to make this work...
#
ifeq ($(HOST_OS),windows)
# Locate windres executable
WINDRES := windres
ifneq ($(USE_MINGW),)
# When building the Windows emulator under Linux, use the MinGW one
WINDRES := i586-mingw32msvc-windres
endif
INTERMEDIATE := $(call intermediates-dir-for,EXECUTABLES,$(LOCAL_MODULE),true)
ANDROID_ICON_OBJ := android_icon.o
ANDROID_ICON_PATH := $(LOCAL_PATH)/images
$(ANDROID_ICON_PATH)/$(ANDROID_ICON_OBJ): $(ANDROID_ICON_PATH)/android_icon.rc
$(WINDRES) $< -I $(ANDROID_ICON_PATH) -o $@
# seems to be the only way to add an object file that was not generated from
# a C/C++/Java source file to our build system. and very unfortunately,
# $(TOPDIR)/$(LOCALPATH) will always be prepended to this value, which forces
# us to put the object file in the source directory...
#
LOCAL_PREBUILT_OBJ_FILES += images/$(ANDROID_ICON_OBJ)
endif
# qemu-options.h is generated from qemu-options.hx with the "hxtool" shell script
#
intermediates := $(call intermediates-dir-for,EXECUTABLES,$(LOCAL_MODULE),true)
QEMU_OPTIONS_H := $(intermediates)/qemu-options.h
$(QEMU_OPTIONS_H): PRIVATE_PATH := $(LOCAL_PATH)
$(QEMU_OPTIONS_H): PRIVATE_CUSTOM_TOOL = $(PRIVATE_PATH)/hxtool -h < $< > $@
$(QEMU_OPTIONS_H): $(LOCAL_PATH)/qemu-options.hx $(LOCAL_PATH)/hxtool
$(transform-generated-source)
$(intermediates)/vl-android.o: $(QEMU_OPTIONS_H)
LOCAL_GENERATED_SOURCES += $(QEMU_OPTIONS_H)
# qemu-monitor.h is generated from qemu-monitor.hx with the "hxtool" shell script
#
intermediates := $(call intermediates-dir-for,EXECUTABLES,$(LOCAL_MODULE),true)
QEMU_MONITOR_H := $(intermediates)/qemu-monitor.h
$(QEMU_MONITOR_H): PRIVATE_PATH := $(LOCAL_PATH)
$(QEMU_MONITOR_H): PRIVATE_CUSTOM_TOOL = $(PRIVATE_PATH)/hxtool -h < $< > $@
$(QEMU_MONITOR_H): $(LOCAL_PATH)/qemu-monitor.hx $(LOCAL_PATH)/hxtool
$(transform-generated-source)
$(intermediates)/vl-android.o: $(QEMU_MONITOR_H)
LOCAL_GENERATED_SOURCES += $(QEMU_MONITOR_H)
# 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.
#
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
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)
$(intermediates)/vl-android.o: $(QEMU_GDBSTUB_XML_C)
LOCAL_GENERATED_SOURCES += $(QEMU_GDBSTUB_XML_C)
# this is already done by the Android build system, but is done for the
# benefit of the stand-alone one.
#
ifeq ($(BUILD_STANDALONE_EMULATOR),true)
LOCAL_CFLAGS += -I$(intermediates)
endif
# other flags
ifneq ($(HOST_OS),windows)
LOCAL_LDLIBS += -ldl
endif
LOCAL_LDLIBS += $(QEMU_AUDIO_LIB)
ifeq ($(HOST_OS),darwin)
FRAMEWORKS := OpenGL Cocoa QuickTime ApplicationServices Carbon IOKit
LOCAL_LDLIBS += $(FRAMEWORKS:%=-Wl,-framework,%)
endif
# Generate a completely static executable if needed.
# Note that this means no sound and graphics on Linux.
#
ifeq ($(CONFIG_STATIC_EXECUTABLE),true)
LOCAL_SRC_FILES += dynlink-static.c
LOCAL_LDLIBS += -static
endif
LOCAL_MODULE := qemu-android
LOCAL_MODULE_TAGS := debug
include $(BUILD_HOST_EXECUTABLE)
##############################################################################
# now build the emulator UI
#
include $(CLEAR_VARS)
LOCAL_GENERATED_SOURCES :=
LOCAL_NO_DEFAULT_COMPILER_FLAGS := true
LOCAL_CC := $(MY_CC)
LOCAL_MODULE := emulator-ui
LOCAL_STATIC_LIBRARIES := emulator-uilib
LOCAL_LDLIBS := $(MY_LDLIBS)
LOCAL_CFLAGS := $(MY_CFLAGS) $(LOCAL_CFLAGS) $(EMULATOR_UI_CFLAGS)
# add the build ID to the default macro definitions
LOCAL_CFLAGS += $(UI_AND_CORE_CFLAGS) -DCONFIG_STANDALONE_UI
ifeq ($(HOST_ARCH),x86)
# enable MMX code for our skin scaler
LOCAL_CFLAGS += -DUSE_MMX=1 -mmmx
endif
# include other sources
#
VL_SOURCES := framebuffer.c \
user-events-ui.c \
android/cmdline-option.c \
android/config.c \
android/display.c \
android/main.c \
qemu-timer-ui.c \
vl-android-ui.c \
console-ui.c \
# Add common system libraries
#
LOCAL_LDLIBS += $(QEMU_SYSTEM_LDLIBS)
LOCAL_SRC_FILES += $(VL_SOURCES) $(UI_SOURCES) $(UI_AND_CORE_SOURCES)
# add SDL-specific flags
#
LOCAL_CFLAGS += $(SDL_CFLAGS)
LOCAL_LDLIBS += $(SDL_LDLIBS)
LOCAL_STATIC_LIBRARIES += $(SDL_STATIC_LIBRARIES)
# on Windows, link the icon file as well into the executable
# unfortunately, our build system doesn't help us much, so we need
# to use some weird pathnames to make this work...
#
ifeq ($(HOST_OS),windows)
# Locate windres executable
WINDRES := windres
ifneq ($(USE_MINGW),)
# When building the Windows emulator under Linux, use the MinGW one
WINDRES := i586-mingw32msvc-windres
endif
INTERMEDIATE := $(call intermediates-dir-for,EXECUTABLES,$(LOCAL_MODULE),true)
ANDROID_ICON_OBJ := android_icon.o
ANDROID_ICON_PATH := $(LOCAL_PATH)/images
$(ANDROID_ICON_PATH)/$(ANDROID_ICON_OBJ): $(ANDROID_ICON_PATH)/android_icon.rc
$(WINDRES) $< -I $(ANDROID_ICON_PATH) -o $@
# seems to be the only way to add an object file that was not generated from
# a C/C++/Java source file to our build system. and very unfortunately,
# $(TOPDIR)/$(LOCALPATH) will always be prepended to this value, which forces
# us to put the object file in the source directory...
#
LOCAL_PREBUILT_OBJ_FILES += images/$(ANDROID_ICON_OBJ)
endif
# this is already done by the Android build system, but is done for the
# benefit of the stand-alone one.
#
ifeq ($(BUILD_STANDALONE_EMULATOR),true)
LOCAL_CFLAGS += -I$(intermediates)
endif
# Generate a completely static executable if needed.
# Note that this means no sound and graphics on Linux.
#
ifeq ($(CONFIG_STATIC_EXECUTABLE),true)
LOCAL_SRC_FILES += dynlink-static.c
LOCAL_LDLIBS += -static
endif
# See comment about SDLMAIN_SOURCES in the 'emulator-uilib' module declarations.
LOCAL_SRC_FILES += $(SDLMAIN_SOURCES)
include $(BUILD_HOST_EXECUTABLE)
endif # TARGET_ARCH == arm
|