|
1 include config.mak |
|
2 |
|
3 TARGET_BASE_ARCH:=$(TARGET_ARCH) |
|
4 ifeq ($(TARGET_ARCH), x86_64) |
|
5 TARGET_BASE_ARCH:=i386 |
|
6 endif |
|
7 ifeq ($(TARGET_ARCH), mipsn32) |
|
8 TARGET_BASE_ARCH:=mips |
|
9 endif |
|
10 ifeq ($(TARGET_ARCH), mips64) |
|
11 TARGET_BASE_ARCH:=mips |
|
12 endif |
|
13 ifeq ($(TARGET_ARCH), ppc64) |
|
14 TARGET_BASE_ARCH:=ppc |
|
15 endif |
|
16 ifeq ($(TARGET_ARCH), ppc64h) |
|
17 TARGET_BASE_ARCH:=ppc |
|
18 endif |
|
19 ifeq ($(TARGET_ARCH), ppcemb) |
|
20 TARGET_BASE_ARCH:=ppc |
|
21 endif |
|
22 ifeq ($(TARGET_ARCH), sparc64) |
|
23 TARGET_BASE_ARCH:=sparc |
|
24 endif |
|
25 TARGET_PATH=$(SRC_PATH)/target-$(TARGET_BASE_ARCH) |
|
26 VPATH=$(SRC_PATH):$(TARGET_PATH):$(SRC_PATH)/hw |
|
27 CPPFLAGS=-I. -I.. -I$(TARGET_PATH) -I$(SRC_PATH) -MMD -MT $@ -MP -DNEED_CPU_H |
|
28 #CFLAGS+=-Werror |
|
29 LIBS= |
|
30 # user emulator name |
|
31 ifndef TARGET_ARCH2 |
|
32 TARGET_ARCH2=$(TARGET_ARCH) |
|
33 endif |
|
34 ifeq ($(TARGET_ARCH),arm) |
|
35 ifeq ($(TARGET_WORDS_BIGENDIAN),yes) |
|
36 TARGET_ARCH2=armeb |
|
37 endif |
|
38 endif |
|
39 ifeq ($(TARGET_ARCH),sh4) |
|
40 ifeq ($(TARGET_WORDS_BIGENDIAN),yes) |
|
41 TARGET_ARCH2=sh4eb |
|
42 endif |
|
43 endif |
|
44 ifeq ($(TARGET_ARCH),mips) |
|
45 ifneq ($(TARGET_WORDS_BIGENDIAN),yes) |
|
46 TARGET_ARCH2=mipsel |
|
47 endif |
|
48 endif |
|
49 ifeq ($(TARGET_ARCH),mipsn32) |
|
50 ifneq ($(TARGET_WORDS_BIGENDIAN),yes) |
|
51 TARGET_ARCH2=mipsn32el |
|
52 endif |
|
53 endif |
|
54 ifeq ($(TARGET_ARCH),mips64) |
|
55 ifneq ($(TARGET_WORDS_BIGENDIAN),yes) |
|
56 TARGET_ARCH2=mips64el |
|
57 endif |
|
58 endif |
|
59 |
|
60 ifdef CONFIG_USER_ONLY |
|
61 # user emulator name |
|
62 QEMU_PROG=qemu-$(TARGET_ARCH2) |
|
63 else |
|
64 # system emulator name |
|
65 ifeq ($(TARGET_ARCH), i386) |
|
66 QEMU_PROG=qemu$(EXESUF) |
|
67 else |
|
68 QEMU_PROG=qemu-system-$(TARGET_ARCH2)$(EXESUF) |
|
69 endif |
|
70 endif |
|
71 |
|
72 PROGS=$(QEMU_PROG) |
|
73 |
|
74 # We require -O2 to avoid the stack setup prologue in EXIT_TB |
|
75 OP_CFLAGS := -O2 -g -fno-strict-aliasing |
|
76 OP_CFLAGS += -Wall -Wundef -Wendif-labels -Wwrite-strings -Wmissing-prototypes -Wstrict-prototypes -Wredundant-decls |
|
77 |
|
78 # cc-option |
|
79 # Usage: OP_CFLAGS+=$(call cc-option, -falign-functions=0, -malign-functions=0) |
|
80 |
|
81 cc-option = $(shell if $(CC) $(OP_CFLAGS) $(1) -S -o /dev/null -xc /dev/null \ |
|
82 > /dev/null 2>&1; then echo "$(1)"; else echo "$(2)"; fi ;) |
|
83 |
|
84 OP_CFLAGS+=$(call cc-option, -fno-reorder-blocks, "") |
|
85 OP_CFLAGS+=$(call cc-option, -fno-gcse, "") |
|
86 OP_CFLAGS+=$(call cc-option, -fno-tree-ch, "") |
|
87 OP_CFLAGS+=$(call cc-option, -fno-optimize-sibling-calls, "") |
|
88 OP_CFLAGS+=$(call cc-option, -fno-crossjumping, "") |
|
89 OP_CFLAGS+=$(call cc-option, -fno-align-labels, "") |
|
90 OP_CFLAGS+=$(call cc-option, -fno-align-jumps, "") |
|
91 OP_CFLAGS+=$(call cc-option, -fno-align-functions, $(call cc-option, -malign-functions=0, "")) |
|
92 OP_CFLAGS+=$(call cc-option, -fno-section-anchors, "") |
|
93 |
|
94 HELPER_CFLAGS= |
|
95 |
|
96 ifeq ($(ARCH),i386) |
|
97 HELPER_CFLAGS+=-fomit-frame-pointer |
|
98 OP_CFLAGS+=-mpreferred-stack-boundary=2 -fomit-frame-pointer |
|
99 endif |
|
100 |
|
101 ifeq ($(ARCH),ppc) |
|
102 CPPFLAGS+= -D__powerpc__ |
|
103 OP_CFLAGS+= -mlongcall |
|
104 endif |
|
105 |
|
106 ifeq ($(ARCH),sparc) |
|
107 CFLAGS+=-ffixed-g2 -ffixed-g3 |
|
108 OP_CFLAGS+=-fno-delayed-branch -ffixed-i0 |
|
109 ifeq ($(CONFIG_SOLARIS),yes) |
|
110 OP_CFLAGS+=-fno-omit-frame-pointer |
|
111 else |
|
112 CFLAGS+=-ffixed-g1 -ffixed-g6 |
|
113 HELPER_CFLAGS+=-ffixed-i0 |
|
114 endif |
|
115 endif |
|
116 |
|
117 ifeq ($(ARCH),sparc64) |
|
118 OP_CFLAGS+=-mcpu=ultrasparc -m64 -fno-delayed-branch -ffixed-i0 |
|
119 ifneq ($(CONFIG_SOLARIS),yes) |
|
120 CFLAGS+=-ffixed-g5 -ffixed-g6 -ffixed-g7 |
|
121 OP_CFLAGS+=-ffixed-g5 -ffixed-g6 -ffixed-g7 |
|
122 else |
|
123 CFLAGS+=-ffixed-g1 -ffixed-g4 -ffixed-g5 -ffixed-g7 |
|
124 endif |
|
125 endif |
|
126 |
|
127 ifeq ($(ARCH),alpha) |
|
128 # -msmall-data is not used for OP_CFLAGS because we want two-instruction |
|
129 # relocations for the constant constructions |
|
130 # Ensure there's only a single GP |
|
131 CFLAGS+=-msmall-data |
|
132 endif |
|
133 |
|
134 ifeq ($(ARCH),hppa) |
|
135 OP_CFLAGS=-O1 -fno-delayed-branch |
|
136 BASE_LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld |
|
137 endif |
|
138 |
|
139 ifeq ($(ARCH),ia64) |
|
140 CFLAGS+=-mno-sdata |
|
141 OP_CFLAGS+=-mno-sdata |
|
142 endif |
|
143 |
|
144 ifeq ($(ARCH),arm) |
|
145 OP_CFLAGS+=-mno-sched-prolog -fno-omit-frame-pointer |
|
146 endif |
|
147 |
|
148 ifeq ($(ARCH),m68k) |
|
149 OP_CFLAGS+=-fomit-frame-pointer |
|
150 endif |
|
151 |
|
152 ifeq ($(ARCH),mips) |
|
153 OP_CFLAGS+=-mabi=32 -G0 -fno-PIC -mno-abicalls -fomit-frame-pointer -fno-delayed-branch -Wa,-O0 |
|
154 endif |
|
155 |
|
156 ifeq ($(ARCH),mips64) |
|
157 OP_CFLAGS+=-mabi=n32 -G0 -fno-PIC -mno-abicalls -fomit-frame-pointer -fno-delayed-branch -Wa,-O0 |
|
158 endif |
|
159 |
|
160 CFLAGS+=$(OS_CFLAGS) $(ARCH_CFLAGS) |
|
161 LDFLAGS+=$(OS_LDFLAGS) $(ARCH_LDFLAGS) |
|
162 OP_CFLAGS+=$(OS_CFLAGS) $(ARCH_CFLAGS) |
|
163 |
|
164 CPPFLAGS+=-D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE |
|
165 LIBS+=-lm |
|
166 ifdef CONFIG_WIN32 |
|
167 LIBS+=-lwinmm -lws2_32 -liphlpapi |
|
168 endif |
|
169 ifdef CONFIG_SOLARIS |
|
170 LIBS+=-lsocket -lnsl -lresolv |
|
171 ifdef NEEDS_LIBSUNMATH |
|
172 LIBS+=-lsunmath |
|
173 LDFLAGS+=-L/opt/SUNWspro/prod/lib -R/opt/SUNWspro/prod/lib |
|
174 OP_CFLAGS+=-I/opt/SUNWspro/prod/include/cc |
|
175 CFLAGS+=-I/opt/SUNWspro/prod/include/cc |
|
176 endif |
|
177 endif |
|
178 |
|
179 kvm.o: CFLAGS+=$(KVM_CFLAGS) |
|
180 kvm-all.o: CFLAGS+=$(KVM_CFLAGS) |
|
181 |
|
182 # Python is sloppy about char * v.s. const char * |
|
183 python-plugin.o: CFLAGS+=-Wno-write-strings |
|
184 |
|
185 all: $(PROGS) |
|
186 |
|
187 ######################################################### |
|
188 # cpu emulator library |
|
189 LIBOBJS=exec.o kqemu.o translate-all.o cpu-exec.o\ |
|
190 translate.o host-utils.o |
|
191 # TCG code generator |
|
192 LIBOBJS+= tcg/tcg.o tcg/tcg-runtime.o |
|
193 CPPFLAGS+=-I$(SRC_PATH)/tcg -I$(SRC_PATH)/tcg/$(ARCH) |
|
194 ifeq ($(ARCH),sparc64) |
|
195 CPPFLAGS+=-I$(SRC_PATH)/tcg/sparc |
|
196 endif |
|
197 ifdef CONFIG_SOFTFLOAT |
|
198 LIBOBJS+=fpu/softfloat.o |
|
199 else |
|
200 LIBOBJS+=fpu/softfloat-native.o |
|
201 endif |
|
202 CPPFLAGS+=-I$(SRC_PATH)/fpu |
|
203 LIBOBJS+= op_helper.o helper.o |
|
204 |
|
205 ifeq ($(TARGET_BASE_ARCH), arm) |
|
206 LIBOBJS+= neon_helper.o iwmmxt_helper.o |
|
207 endif |
|
208 |
|
209 ifeq ($(TARGET_BASE_ARCH), alpha) |
|
210 LIBOBJS+= alpha_palcode.o |
|
211 endif |
|
212 |
|
213 ifeq ($(TARGET_BASE_ARCH), cris) |
|
214 LIBOBJS+= cris-dis.o |
|
215 |
|
216 ifndef CONFIG_USER_ONLY |
|
217 LIBOBJS+= mmu.o |
|
218 endif |
|
219 endif |
|
220 |
|
221 # NOTE: the disassembler code is only needed for debugging |
|
222 LIBOBJS+=disas.o |
|
223 ifeq ($(findstring i386, $(TARGET_ARCH) $(ARCH)),i386) |
|
224 USE_I386_DIS=y |
|
225 endif |
|
226 ifeq ($(findstring x86_64, $(TARGET_ARCH) $(ARCH)),x86_64) |
|
227 USE_I386_DIS=y |
|
228 endif |
|
229 ifdef USE_I386_DIS |
|
230 LIBOBJS+=i386-dis.o |
|
231 endif |
|
232 ifeq ($(findstring alpha, $(TARGET_ARCH) $(ARCH)),alpha) |
|
233 LIBOBJS+=alpha-dis.o |
|
234 endif |
|
235 ifeq ($(findstring ppc, $(TARGET_BASE_ARCH) $(ARCH)),ppc) |
|
236 LIBOBJS+=ppc-dis.o |
|
237 endif |
|
238 ifeq ($(findstring mips, $(TARGET_BASE_ARCH) $(ARCH)),mips) |
|
239 LIBOBJS+=mips-dis.o |
|
240 endif |
|
241 ifeq ($(findstring sparc, $(TARGET_BASE_ARCH) $(ARCH)),sparc) |
|
242 LIBOBJS+=sparc-dis.o |
|
243 endif |
|
244 ifeq ($(findstring arm, $(TARGET_ARCH) $(ARCH)),arm) |
|
245 LIBOBJS+=arm-dis.o |
|
246 endif |
|
247 ifeq ($(findstring m68k, $(TARGET_ARCH) $(ARCH)),m68k) |
|
248 LIBOBJS+=m68k-dis.o |
|
249 endif |
|
250 ifeq ($(findstring sh4, $(TARGET_ARCH) $(ARCH)),sh4) |
|
251 LIBOBJS+=sh4-dis.o |
|
252 endif |
|
253 ifeq ($(findstring hppa, $(TARGET_BASE_ARCH) $(ARCH)),hppa) |
|
254 LIBOBJS+=hppa-dis.o |
|
255 endif |
|
256 ifeq ($(findstring s390, $(TARGET_ARCH) $(ARCH)),s390) |
|
257 LIBOBJS+=s390-dis.o |
|
258 endif |
|
259 |
|
260 # libqemu |
|
261 |
|
262 libqemu.a: $(LIBOBJS) |
|
263 rm -f $@ |
|
264 $(AR) rcs $@ $(LIBOBJS) |
|
265 |
|
266 translate.o: translate.c cpu.h |
|
267 |
|
268 translate-all.o: translate-all.c cpu.h |
|
269 |
|
270 tcg/tcg.o: cpu.h |
|
271 |
|
272 machine.o: machine.c |
|
273 $(CC) $(OP_CFLAGS) $(CPPFLAGS) -c -o $@ $< |
|
274 |
|
275 # HELPER_CFLAGS is used for all the code compiled with static register |
|
276 # variables |
|
277 op_helper.o: op_helper.c |
|
278 $(CC) $(HELPER_CFLAGS) $(CPPFLAGS) $(CFLAGS) $(I386_CFLAGS) -c -o $@ $< |
|
279 |
|
280 cpu-exec.o: cpu-exec.c |
|
281 $(CC) $(HELPER_CFLAGS) $(CPPFLAGS) $(CFLAGS) -c -o $@ $< |
|
282 |
|
283 ######################################################### |
|
284 # Linux user emulator target |
|
285 |
|
286 ifdef CONFIG_LINUX_USER |
|
287 |
|
288 ifndef TARGET_ABI_DIR |
|
289 TARGET_ABI_DIR=$(TARGET_ARCH) |
|
290 endif |
|
291 VPATH+=:$(SRC_PATH)/linux-user:$(SRC_PATH)/linux-user/$(TARGET_ABI_DIR) |
|
292 CPPFLAGS+=-I$(SRC_PATH)/linux-user -I$(SRC_PATH)/linux-user/$(TARGET_ABI_DIR) |
|
293 |
|
294 ifdef CONFIG_STATIC |
|
295 LDFLAGS+=-static |
|
296 endif |
|
297 |
|
298 ifeq ($(ARCH),i386) |
|
299 LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld |
|
300 endif |
|
301 |
|
302 ifeq ($(ARCH),x86_64) |
|
303 LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld |
|
304 endif |
|
305 |
|
306 ifeq ($(ARCH),ppc) |
|
307 LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld |
|
308 endif |
|
309 |
|
310 ifeq ($(ARCH),ppc64) |
|
311 LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld |
|
312 endif |
|
313 |
|
314 ifeq ($(ARCH),s390) |
|
315 LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld |
|
316 endif |
|
317 |
|
318 ifeq ($(ARCH),sparc) |
|
319 # -static is used to avoid g1/g3 usage by the dynamic linker |
|
320 LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld -static |
|
321 endif |
|
322 |
|
323 ifeq ($(ARCH),sparc64) |
|
324 LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld |
|
325 endif |
|
326 |
|
327 ifeq ($(ARCH),alpha) |
|
328 LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld |
|
329 endif |
|
330 |
|
331 ifeq ($(ARCH),ia64) |
|
332 LDFLAGS+=-Wl,-G0 -Wl,-T,$(SRC_PATH)/$(ARCH).ld |
|
333 endif |
|
334 |
|
335 ifeq ($(ARCH),arm) |
|
336 LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld |
|
337 endif |
|
338 |
|
339 ifeq ($(ARCH),m68k) |
|
340 LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld |
|
341 endif |
|
342 |
|
343 ifeq ($(ARCH),mips) |
|
344 ifeq ($(WORDS_BIGENDIAN),yes) |
|
345 LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld |
|
346 else |
|
347 LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH)el.ld |
|
348 endif |
|
349 endif |
|
350 |
|
351 ifeq ($(ARCH),mips64) |
|
352 ifeq ($(WORDS_BIGENDIAN),yes) |
|
353 LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld |
|
354 else |
|
355 LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH)el.ld |
|
356 endif |
|
357 endif |
|
358 |
|
359 # profiling code |
|
360 ifdef TARGET_GPROF |
|
361 LDFLAGS+=-p |
|
362 CFLAGS+=-p |
|
363 endif |
|
364 |
|
365 OBJS= main.o syscall.o strace.o mmap.o signal.o path.o thunk.o \ |
|
366 elfload.o linuxload.o uaccess.o |
|
367 LIBS+= $(AIOLIBS) |
|
368 ifdef TARGET_HAS_BFLT |
|
369 OBJS+= flatload.o |
|
370 endif |
|
371 ifdef TARGET_HAS_ELFLOAD32 |
|
372 OBJS+= elfload32.o |
|
373 elfload32.o: elfload.c |
|
374 endif |
|
375 |
|
376 ifeq ($(TARGET_ARCH), i386) |
|
377 OBJS+= vm86.o |
|
378 endif |
|
379 ifeq ($(TARGET_ARCH), arm) |
|
380 OBJS+=nwfpe/fpa11.o nwfpe/fpa11_cpdo.o \ |
|
381 nwfpe/fpa11_cpdt.o nwfpe/fpa11_cprt.o nwfpe/fpopcode.o nwfpe/single_cpdo.o \ |
|
382 nwfpe/double_cpdo.o nwfpe/extended_cpdo.o arm-semi.o |
|
383 endif |
|
384 ifeq ($(TARGET_ARCH), m68k) |
|
385 OBJS+= m68k-sim.o m68k-semi.o |
|
386 endif |
|
387 |
|
388 ifdef CONFIG_GDBSTUB |
|
389 OBJS+=gdbstub.o gdbstub-xml.o |
|
390 endif |
|
391 |
|
392 OBJS+= libqemu.a |
|
393 |
|
394 # Note: this is a workaround. The real fix is to avoid compiling |
|
395 # cpu_signal_handler() in cpu-exec.c. |
|
396 signal.o: signal.c |
|
397 $(CC) $(HELPER_CFLAGS) $(CPPFLAGS) $(CFLAGS) -c -o $@ $< |
|
398 |
|
399 $(QEMU_PROG): $(OBJS) ../libqemu_user.a |
|
400 $(CC) $(LDFLAGS) -o $@ $^ $(LIBS) |
|
401 ifeq ($(ARCH),alpha) |
|
402 # Mark as 32 bit binary, i. e. it will be mapped into the low 31 bit of |
|
403 # the address space (31 bit so sign extending doesn't matter) |
|
404 echo -ne '\001\000\000\000' | dd of=qemu bs=1 seek=48 count=4 conv=notrunc |
|
405 endif |
|
406 |
|
407 endif #CONFIG_LINUX_USER |
|
408 |
|
409 ######################################################### |
|
410 # Darwin user emulator target |
|
411 |
|
412 ifdef CONFIG_DARWIN_USER |
|
413 |
|
414 VPATH+=:$(SRC_PATH)/darwin-user |
|
415 CPPFLAGS+=-I$(SRC_PATH)/darwin-user -I$(SRC_PATH)/darwin-user/$(TARGET_ARCH) |
|
416 |
|
417 # Leave some space for the regular program loading zone |
|
418 LDFLAGS+=-Wl,-segaddr,__STD_PROG_ZONE,0x1000 -image_base 0x0e000000 |
|
419 |
|
420 LIBS+=-lmx |
|
421 |
|
422 OBJS= main.o commpage.o machload.o mmap.o signal.o syscall.o thunk.o |
|
423 |
|
424 OBJS+= libqemu.a |
|
425 |
|
426 ifdef CONFIG_GDBSTUB |
|
427 OBJS+=gdbstub.o gdbstub-xml.o |
|
428 endif |
|
429 |
|
430 # Note: this is a workaround. The real fix is to avoid compiling |
|
431 # cpu_signal_handler() in cpu-exec.c. |
|
432 signal.o: signal.c |
|
433 $(CC) $(HELPER_CFLAGS) $(CPPFLAGS) $(CFLAGS) -c -o $@ $< |
|
434 |
|
435 $(QEMU_PROG): $(OBJS) |
|
436 $(CC) $(LDFLAGS) -o $@ $^ $(LIBS) |
|
437 |
|
438 endif #CONFIG_DARWIN_USER |
|
439 |
|
440 ######################################################### |
|
441 # BSD user emulator target |
|
442 |
|
443 ifdef CONFIG_BSD_USER |
|
444 |
|
445 VPATH+=:$(SRC_PATH)/bsd-user |
|
446 CPPFLAGS+=-I$(SRC_PATH)/bsd-user -I$(SRC_PATH)/bsd-user/$(TARGET_ARCH) |
|
447 |
|
448 ifdef CONFIG_STATIC |
|
449 LDFLAGS+=-static |
|
450 endif |
|
451 |
|
452 ifeq ($(ARCH),i386) |
|
453 ifdef TARGET_GPROF |
|
454 USE_I386_LD=y |
|
455 endif |
|
456 ifdef CONFIG_STATIC |
|
457 USE_I386_LD=y |
|
458 endif |
|
459 ifdef USE_I386_LD |
|
460 LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld |
|
461 else |
|
462 # WARNING: this LDFLAGS is _very_ tricky : qemu is an ELF shared object |
|
463 # that the kernel ELF loader considers as an executable. I think this |
|
464 # is the simplest way to make it self virtualizable! |
|
465 LDFLAGS+=-Wl,-shared |
|
466 endif |
|
467 endif |
|
468 |
|
469 ifeq ($(ARCH),x86_64) |
|
470 LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld |
|
471 endif |
|
472 |
|
473 ifeq ($(ARCH),ppc) |
|
474 LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld |
|
475 endif |
|
476 |
|
477 ifeq ($(ARCH),ppc64) |
|
478 LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld |
|
479 endif |
|
480 |
|
481 ifeq ($(ARCH),s390) |
|
482 LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld |
|
483 endif |
|
484 |
|
485 ifeq ($(ARCH),sparc) |
|
486 # -static is used to avoid g1/g3 usage by the dynamic linker |
|
487 LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld -static |
|
488 endif |
|
489 |
|
490 ifeq ($(ARCH),sparc64) |
|
491 LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld |
|
492 endif |
|
493 |
|
494 ifeq ($(ARCH),alpha) |
|
495 LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld |
|
496 endif |
|
497 |
|
498 ifeq ($(ARCH),ia64) |
|
499 LDFLAGS+=-Wl,-G0 -Wl,-T,$(SRC_PATH)/$(ARCH).ld |
|
500 endif |
|
501 |
|
502 ifeq ($(ARCH),arm) |
|
503 LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld |
|
504 endif |
|
505 |
|
506 ifeq ($(ARCH),m68k) |
|
507 LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld |
|
508 endif |
|
509 |
|
510 ifeq ($(ARCH),mips) |
|
511 ifeq ($(WORDS_BIGENDIAN),yes) |
|
512 LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld |
|
513 else |
|
514 LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH)el.ld |
|
515 endif |
|
516 endif |
|
517 |
|
518 ifeq ($(ARCH),mips64) |
|
519 ifeq ($(WORDS_BIGENDIAN),yes) |
|
520 LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld |
|
521 else |
|
522 LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH)el.ld |
|
523 endif |
|
524 endif |
|
525 |
|
526 OBJS= main.o bsdload.o elfload.o mmap.o path.o signal.o strace.o syscall.o |
|
527 OBJS+= uaccess.o |
|
528 |
|
529 OBJS+= libqemu.a |
|
530 |
|
531 ifdef CONFIG_GDBSTUB |
|
532 OBJS+=gdbstub.o |
|
533 endif |
|
534 |
|
535 # Note: this is a workaround. The real fix is to avoid compiling |
|
536 # cpu_signal_handler() in cpu-exec.c. |
|
537 signal.o: signal.c |
|
538 $(CC) $(HELPER_CFLAGS) $(CPPFLAGS) $(CFLAGS) -c -o $@ $< |
|
539 |
|
540 $(QEMU_PROG): $(OBJS) ../libqemu_user.a |
|
541 $(CC) $(LDFLAGS) -o $@ $^ $(LIBS) |
|
542 |
|
543 endif #CONFIG_BSD_USER |
|
544 |
|
545 ######################################################### |
|
546 # System emulator target |
|
547 ifndef CONFIG_USER_ONLY |
|
548 |
|
549 OBJS=vl.o osdep.o monitor.o pci.o loader.o isa_mmio.o machine.o |
|
550 # virtio has to be here due to weird dependency between PCI and virtio-net. |
|
551 # need to fix this properly |
|
552 OBJS+=virtio.o virtio-pci.o virtio-blk.o virtio-balloon.o virtio-net.o |
|
553 OBJS+=virtio-audio.o |
|
554 OBJS+=fw_cfg.o |
|
555 ifdef CONFIG_KVM |
|
556 OBJS+=kvm.o kvm-all.o |
|
557 endif |
|
558 OBJS+=devtree.o |
|
559 ifdef CONFIG_WIN32 |
|
560 OBJS+=block-raw-win32.o |
|
561 else |
|
562 ifdef CONFIG_AIO |
|
563 OBJS+=posix-aio-compat.o |
|
564 endif |
|
565 OBJS+=block-raw-posix.o |
|
566 endif |
|
567 |
|
568 LIBS+=-lz -lexpat |
|
569 ifdef CONFIG_ALSA |
|
570 LIBS += -lasound |
|
571 endif |
|
572 ifdef CONFIG_ESD |
|
573 LIBS += -lesd |
|
574 endif |
|
575 ifdef CONFIG_PA |
|
576 LIBS += -lpulse-simple |
|
577 endif |
|
578 ifdef CONFIG_DSOUND |
|
579 LIBS += -lole32 -ldxguid |
|
580 endif |
|
581 ifdef CONFIG_FMOD |
|
582 LIBS += $(CONFIG_FMOD_LIB) |
|
583 endif |
|
584 ifdef CONFIG_OSS |
|
585 LIBS += $(CONFIG_OSS_LIB) |
|
586 endif |
|
587 |
|
588 SOUND_HW = sb16.o es1370.o |
|
589 ifdef CONFIG_AC97 |
|
590 SOUND_HW += ac97.o |
|
591 endif |
|
592 ifdef CONFIG_ADLIB |
|
593 SOUND_HW += fmopl.o adlib.o |
|
594 adlib.o fmopl.o: CFLAGS := ${CFLAGS} -DBUILD_Y8950=0 |
|
595 endif |
|
596 ifdef CONFIG_GUS |
|
597 SOUND_HW += gus.o gusemu_hal.o gusemu_mixer.o |
|
598 endif |
|
599 ifdef CONFIG_CS4231A |
|
600 SOUND_HW += cs4231a.o |
|
601 endif |
|
602 |
|
603 ifdef CONFIG_VNC_TLS |
|
604 CPPFLAGS += $(CONFIG_VNC_TLS_CFLAGS) |
|
605 LIBS += $(CONFIG_VNC_TLS_LIBS) |
|
606 endif |
|
607 |
|
608 ifdef CONFIG_BLUEZ |
|
609 LIBS += $(CONFIG_BLUEZ_LIBS) |
|
610 endif |
|
611 |
|
612 ifdef CONFIG_PYTHON |
|
613 CPPFLAGS += $(PYTHON_CFLAGS) |
|
614 LIBS += $(PYTHON_LIBS) |
|
615 |
|
616 OBJS += python-plugin.o |
|
617 endif |
|
618 |
|
619 # SCSI layer |
|
620 OBJS+= lsi53c895a.o esp.o |
|
621 |
|
622 # USB layer |
|
623 OBJS+= usb-ohci.o |
|
624 |
|
625 # EEPROM emulation |
|
626 OBJS += eeprom93xx.o |
|
627 |
|
628 # PCI network cards |
|
629 OBJS += eepro100.o |
|
630 OBJS += ne2000.o |
|
631 OBJS += pcnet.o |
|
632 OBJS += rtl8139.o |
|
633 OBJS += e1000.o |
|
634 |
|
635 ifeq ($(TARGET_BASE_ARCH), i386) |
|
636 # Hardware support |
|
637 OBJS+= ide.o pckbd.o ps2.o vga.o $(SOUND_HW) dma.o |
|
638 OBJS+= fdc.o mc146818rtc.o serial.o i8259.o i8254.o pcspk.o pc.o |
|
639 OBJS+= cirrus_vga.o apic.o parallel.o acpi.o piix_pci.o |
|
640 OBJS+= usb-uhci.o vmmouse.o vmport.o vmware_vga.o hpet.o |
|
641 CPPFLAGS += -DHAS_AUDIO -DHAS_AUDIO_CHOICE |
|
642 endif |
|
643 ifeq ($(TARGET_BASE_ARCH), ppc) |
|
644 CPPFLAGS += -DHAS_AUDIO -DHAS_AUDIO_CHOICE |
|
645 # shared objects |
|
646 OBJS+= ppc.o ide.o vga.o $(SOUND_HW) dma.o openpic.o |
|
647 # PREP target |
|
648 OBJS+= pckbd.o ps2.o serial.o i8259.o i8254.o fdc.o m48t59.o mc146818rtc.o |
|
649 OBJS+= prep_pci.o ppc_prep.o |
|
650 # Mac shared devices |
|
651 OBJS+= macio.o cuda.o adb.o mac_nvram.o mac_dbdma.o |
|
652 # OldWorld PowerMac |
|
653 OBJS+= heathrow_pic.o grackle_pci.o ppc_oldworld.o |
|
654 # NewWorld PowerMac |
|
655 OBJS+= unin_pci.o ppc_chrp.o |
|
656 # Dummy board |
|
657 OBJS+= dummy_ppc.o ppc-semi.o |
|
658 # PowerPC 4xx boards |
|
659 OBJS+= pflash_cfi02.o ppc4xx_devs.o ppc4xx_pci.o ppc405_uc.o ppc405_boards.o |
|
660 OBJS+= ppc440.o ppc440_bamboo.o |
|
661 ifdef FDT_LIBS |
|
662 OBJS+= device_tree.o |
|
663 LIBS+= $(FDT_LIBS) |
|
664 endif |
|
665 ifdef CONFIG_KVM |
|
666 OBJS+= kvm_ppc.o |
|
667 endif |
|
668 endif |
|
669 ifeq ($(TARGET_BASE_ARCH), mips) |
|
670 OBJS+= mips_r4k.o mips_jazz.o mips_malta.o mips_mipssim.o |
|
671 OBJS+= mips_timer.o mips_int.o dma.o vga.o serial.o i8254.o i8259.o rc4030.o |
|
672 OBJS+= g364fb.o jazz_led.o |
|
673 OBJS+= ide.o gt64xxx.o pckbd.o ps2.o fdc.o mc146818rtc.o usb-uhci.o acpi.o ds1225y.o |
|
674 OBJS+= piix_pci.o parallel.o cirrus_vga.o pcspk.o $(SOUND_HW) |
|
675 OBJS+= mipsnet.o |
|
676 OBJS+= pflash_cfi01.o |
|
677 CPPFLAGS += -DHAS_AUDIO -DHAS_AUDIO_CHOICE |
|
678 endif |
|
679 ifeq ($(TARGET_BASE_ARCH), cris) |
|
680 OBJS+= etraxfs.o |
|
681 OBJS+= etraxfs_dma.o |
|
682 OBJS+= etraxfs_pic.o |
|
683 OBJS+= etraxfs_eth.o |
|
684 OBJS+= etraxfs_timer.o |
|
685 OBJS+= etraxfs_ser.o |
|
686 |
|
687 OBJS+= ptimer.o |
|
688 OBJS+= pflash_cfi02.o |
|
689 endif |
|
690 ifeq ($(TARGET_BASE_ARCH), sparc) |
|
691 ifeq ($(TARGET_ARCH), sparc64) |
|
692 OBJS+= sun4u.o ide.o pckbd.o ps2.o vga.o apb_pci.o |
|
693 OBJS+= fdc.o mc146818rtc.o serial.o m48t59.o |
|
694 OBJS+= cirrus_vga.o parallel.o ptimer.o |
|
695 else |
|
696 OBJS+= sun4m.o tcx.o pcnet.o iommu.o m48t59.o slavio_intctl.o |
|
697 OBJS+= slavio_timer.o slavio_serial.o slavio_misc.o fdc.o sparc32_dma.o |
|
698 OBJS+= cs4231.o ptimer.o eccmemctl.o sbi.o sun4c_intctl.o |
|
699 endif |
|
700 endif |
|
701 ifeq ($(TARGET_BASE_ARCH), arm) |
|
702 OBJS+= integratorcp.o versatilepb.o ps2.o smc91c111.o arm_pic.o arm_timer.o |
|
703 OBJS+= arm_boot.o pl011.o pl031.o pl050.o pl080.o pl110.o pl181.o pl190.o |
|
704 OBJS+= versatile_pci.o ptimer.o |
|
705 OBJS+= realview_gic.o realview.o arm_sysctl.o mpcore.o |
|
706 OBJS+= armv7m.o armv7m_nvic.o stellaris.o pl022.o stellaris_enet.o |
|
707 OBJS+= pl061.o |
|
708 OBJS+= arm-semi.o |
|
709 OBJS+= pxa2xx.o pxa2xx_pic.o pxa2xx_gpio.o pxa2xx_timer.o pxa2xx_dma.o |
|
710 OBJS+= pxa2xx_lcd.o pxa2xx_mmci.o pxa2xx_pcmcia.o pxa2xx_keypad.o |
|
711 OBJS+= pflash_cfi01.o gumstix.o |
|
712 OBJS+= zaurus.o ide.o serial.o nand.o ecc.o spitz.o tosa.o tc6393xb.o |
|
713 OBJS+= omap1.o omap_lcdc.o omap_dma.o omap_clk.o omap_mmc.o omap_i2c.o |
|
714 OBJS+= omap2.o omap_dss.o soc_dma.o |
|
715 OBJS+= omap_sx1.o palm.o tsc210x.o |
|
716 OBJS+= nseries.o blizzard.o onenand.o vga.o cbus.o tusb6010.o usb-musb.o |
|
717 OBJS+= tsc2005.o bt-hci-csr.o |
|
718 OBJS+= mst_fpga.o mainstone.o |
|
719 OBJS+= musicpal.o pflash_cfi02.o |
|
720 OBJS+= fb_render_engine.o |
|
721 DEVICES =syborg_hostfs syborg_snapshot syborg_virtio syborg_nand |
|
722 DEVICES+=syborg_platform |
|
723 # Devices that have been replaced by plugins |
|
724 #DEVICES+=syborg_pointer syborg_keyboard |
|
725 #DEVICES+=syborg_interrupt syborg_timer syborg_rtc syborg_serial syborg_fb |
|
726 CPPFLAGS += -DHAS_AUDIO |
|
727 endif |
|
728 ifeq ($(TARGET_BASE_ARCH), sh4) |
|
729 OBJS+= shix.o r2d.o sh7750.o sh7750_regnames.o tc58128.o |
|
730 OBJS+= sh_timer.o ptimer.o sh_serial.o sh_intc.o sh_pci.o sm501.o serial.o |
|
731 OBJS+= ide.o |
|
732 endif |
|
733 ifeq ($(TARGET_BASE_ARCH), m68k) |
|
734 OBJS+= an5206.o mcf5206.o ptimer.o mcf_uart.o mcf_intc.o mcf5208.o mcf_fec.o |
|
735 OBJS+= m68k-semi.o dummy_m68k.o |
|
736 endif |
|
737 ifdef CONFIG_GDBSTUB |
|
738 OBJS+=gdbstub.o gdbstub-xml.o |
|
739 endif |
|
740 |
|
741 DEVICE_OBJS=$(addsuffix .o,$(DEVICES)) |
|
742 $(DEVICE_OBJS): CPPFLAGS+=-DDEVICE_NAME=$(@:.o=) |
|
743 |
|
744 OBJS+=$(DEVICE_OBJS) |
|
745 OBJS+=devices.o |
|
746 |
|
747 ifdef CONFIG_COCOA |
|
748 COCOA_LIBS=-F/System/Library/Frameworks -framework Cocoa -framework IOKit |
|
749 ifdef CONFIG_COREAUDIO |
|
750 COCOA_LIBS+=-framework CoreAudio |
|
751 endif |
|
752 endif |
|
753 ifdef CONFIG_SLIRP |
|
754 CPPFLAGS+=-I$(SRC_PATH)/slirp |
|
755 endif |
|
756 |
|
757 LIBS+=$(AIOLIBS) |
|
758 # specific flags are needed for non soft mmu emulator |
|
759 ifdef CONFIG_STATIC |
|
760 LDFLAGS+=-static |
|
761 endif |
|
762 ifndef CONFIG_DARWIN |
|
763 ifndef CONFIG_WIN32 |
|
764 ifndef CONFIG_SOLARIS |
|
765 ifndef CONFIG_AIX |
|
766 LIBS+=-lutil |
|
767 endif |
|
768 endif |
|
769 endif |
|
770 endif |
|
771 ifdef TARGET_GPROF |
|
772 vl.o: CFLAGS+=-p |
|
773 LDFLAGS+=-p |
|
774 endif |
|
775 |
|
776 ifeq ($(ARCH),ia64) |
|
777 LDFLAGS+=-Wl,-G0 -Wl,-T,$(SRC_PATH)/ia64.ld |
|
778 endif |
|
779 |
|
780 ifdef CONFIG_WIN32 |
|
781 SDL_LIBS := $(filter-out -mwindows, $(SDL_LIBS)) -mconsole |
|
782 endif |
|
783 |
|
784 # profiling code |
|
785 ifdef TARGET_GPROF |
|
786 LDFLAGS+=-p |
|
787 main.o: CFLAGS+=-p |
|
788 endif |
|
789 |
|
790 $(QEMU_PROG): $(OBJS) ../libqemu_common.a libqemu.a |
|
791 $(CC) $(LDFLAGS) -o $@ $^ $(LIBS) $(SDL_LIBS) $(PNG_LIBS) $(COCOA_LIBS) $(CURSES_LIBS) $(BRLAPI_LIBS) $(VDE_LIBS) |
|
792 |
|
793 endif # !CONFIG_USER_ONLY |
|
794 |
|
795 gdbstub-xml.c: $(TARGET_XML_FILES) feature_to_c.sh |
|
796 rm -f $@ |
|
797 ifeq ($(TARGET_XML_FILES),) |
|
798 echo > $@ |
|
799 else |
|
800 $(SHELL) $(SRC_PATH)/feature_to_c.sh $@ $(TARGET_XML_FILES) |
|
801 endif |
|
802 |
|
803 devices.c: gen_devices.sh Makefile.target config.mak |
|
804 $(SHELL) $(SRC_PATH)/gen_devices.sh $@ $(DEVICES) |
|
805 |
|
806 %.o: %.c |
|
807 $(CC) $(CPPFLAGS) $(CFLAGS) -c -o $@ $< |
|
808 |
|
809 %.o: %.S |
|
810 $(CC) $(CPPFLAGS) -c -o $@ $< |
|
811 |
|
812 clean: |
|
813 rm -f *.o *.a *~ $(PROGS) nwfpe/*.o fpu/*.o |
|
814 rm -f *.d */*.d tcg/*.o |
|
815 |
|
816 install: all |
|
817 ifneq ($(PROGS),) |
|
818 $(INSTALL) -m 755 -s $(PROGS) "$(DESTDIR)$(bindir)" |
|
819 endif |
|
820 |
|
821 # Include automatically generated dependency files |
|
822 -include $(wildcard *.d */*.d) |