ia64/xen-unstable

view tools/ioemu/Makefile.target @ 17042:a905c582a406

Add stubdomain support. See stubdom/README for usage details.

- Move PAGE_SIZE and STACK_SIZE into __PAGE_SIZE and __STACK_SIZE in
arch_limits.h so as to permit getting them from there without
pulling all the internal Mini-OS defines.
- Setup a xen-elf cross-compilation environment in stubdom/cross-root
- Add a POSIX layer on top of Mini-OS by linking against the newlib C
library and lwIP, and implementing the Unixish part in mini-os/lib/sys.c
- Cross-compile zlib and libpci too.
- Add an xs.h-compatible layer on top of Mini-OS' xenbus.
- Cross-compile libxc with an additional xc_minios.c and a few things
disabled.
- Cross-compile ioemu with an additional block-vbd, but without sound,
tpm and other details. A few hacks are needed:
- Align ide and scsi buffers at least on sector size to permit
direct transmission to the block backend. While we are at it, just
page-align it to possibly save a segment. Also, limit the scsi
buffer size because of limitations of the block paravirtualization
protocol.
- Allocate big tables dynamically rather that letting them go to
bss: when Mini-OS gets installed in memory, bss is not lazily
allocated, and doing so during Mini-OS is unnecessarily trick while
we can simply use malloc.
- Had to change the Mini-OS compilation somehow, so as to export
Mini-OS compilation flags to the Makefiles of libxc and ioemu.

Signed-off-by: Samuel Thibault <samuel.thibault@eu.citrix.com>
author Keir Fraser <keir.fraser@citrix.com>
date Tue Feb 12 14:35:39 2008 +0000 (2008-02-12)
parents df9e3ec0490a
children 7e8334e651c4 d34e99141506
line source
1 include config.mak
3 XEN_ROOT=../../..
4 include $(XEN_ROOT)/tools/Rules.mk
6 TARGET_BASE_ARCH:=$(TARGET_ARCH)
7 ifeq ($(TARGET_ARCH), x86_64)
8 TARGET_BASE_ARCH:=i386
9 endif
10 ifeq ($(TARGET_ARCH), ppc64)
11 TARGET_BASE_ARCH:=ppc
12 endif
13 ifeq ($(TARGET_ARCH), sparc64)
14 TARGET_BASE_ARCH:=sparc
15 endif
16 TARGET_PATH=$(SRC_PATH)/target-$(TARGET_BASE_ARCH)$(TARGET_SUB)
17 VPATH=$(SRC_PATH):$(TARGET_PATH):$(SRC_PATH)/hw:$(SRC_PATH)/audio
18 CPPFLAGS+=-I. -I.. -I$(TARGET_PATH) -I$(SRC_PATH)
19 CPPFLAGS+= -I$(XEN_ROOT)/tools/libxc
20 CPPFLAGS+= -I$(XEN_ROOT)/tools/xenstore
21 CPPFLAGS+= -I$(XEN_ROOT)/tools/include
22 ifdef CONFIG_DARWIN_USER
23 VPATH+=:$(SRC_PATH)/darwin-user
24 CPPFLAGS+=-I$(SRC_PATH)/darwin-user -I$(SRC_PATH)/darwin-user/$(TARGET_ARCH)
25 endif
26 ifdef CONFIG_LINUX_USER
27 VPATH+=:$(SRC_PATH)/linux-user
28 CPPFLAGS+=-I$(SRC_PATH)/linux-user -I$(SRC_PATH)/linux-user/$(TARGET_ARCH)
29 endif
30 BASE_CFLAGS=
31 BASE_LDFLAGS=
32 SSE2 := $(call cc-option,$(CC),-msse2,)
33 ifeq ($(SSE2),-msse2)
34 CFLAGS += -DUSE_SSE2=1 -msse2
35 endif
36 #CFLAGS+=-Werror
37 LIBS=
38 HELPER_CFLAGS=$(CFLAGS)
39 DYNGEN=../dyngen$(EXESUF)
40 # user emulator name
41 TARGET_ARCH2=$(TARGET_ARCH)
42 ifeq ($(TARGET_ARCH),arm)
43 ifeq ($(TARGET_WORDS_BIGENDIAN),yes)
44 TARGET_ARCH2=armeb
45 endif
46 endif
47 ifeq ($(TARGET_ARCH),sh4)
48 ifeq ($(TARGET_WORDS_BIGENDIAN),yes)
49 TARGET_ARCH2=sh4eb
50 endif
51 endif
52 ifeq ($(TARGET_ARCH),mips)
53 ifneq ($(TARGET_WORDS_BIGENDIAN),yes)
54 TARGET_ARCH2=mipsel
55 endif
56 endif
57 QEMU_USER=qemu-$(TARGET_ARCH2)
58 # system emulator name
59 ifdef CONFIG_SOFTMMU
60 ifeq ($(TARGET_ARCH), i386)
61 QEMU_SYSTEM=qemu$(EXESUF)
62 else
63 QEMU_SYSTEM=qemu-system-$(TARGET_ARCH2)$(EXESUF)
64 endif
65 else
66 QEMU_SYSTEM=qemu-fast
67 endif
69 ifdef CONFIG_STUBDOM
70 QEMU_SYSTEM=qemu.a
71 else
72 QEMU_SYSTEM=qemu-dm
73 endif
75 ifdef CONFIG_USER_ONLY
76 PROGS=$(QEMU_USER)
77 else
78 PROGS+=$(QEMU_SYSTEM)
79 ifndef CONFIG_SOFTMMU
80 CONFIG_STATIC=y
81 endif
82 endif # !CONFIG_USER_ONLY
84 ifdef CONFIG_STATIC
85 BASE_LDFLAGS+=-static
86 endif
88 # We require -O2 to avoid the stack setup prologue in EXIT_TB
89 OP_CFLAGS = -Wall -O2 -g -fno-strict-aliasing
91 ifeq ($(ARCH),i386)
92 HELPER_CFLAGS+=-fomit-frame-pointer
93 OP_CFLAGS+=-mpreferred-stack-boundary=2 -fomit-frame-pointer
94 ifeq ($(HAVE_GCC3_OPTIONS),yes)
95 OP_CFLAGS+= -falign-functions=0 -fno-gcse
96 else
97 OP_CFLAGS+= -malign-functions=0
98 endif
99 ifdef TARGET_GPROF
100 USE_I386_LD=y
101 endif
102 ifdef CONFIG_STATIC
103 USE_I386_LD=y
104 endif
105 ifdef USE_I386_LD
106 BASE_LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
107 else
108 ifdef CONFIG_LINUX_USER
109 # WARNING: this LDFLAGS is _very_ tricky : qemu is an ELF shared object
110 # that the kernel ELF loader considers as an executable. I think this
111 # is the simplest way to make it self virtualizable!
112 BASE_LDFLAGS+=-Wl,-shared
113 endif
114 endif
115 endif
117 ifeq ($(ARCH),x86_64)
118 BASE_LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
119 endif
121 ifeq ($(ARCH),ppc)
122 CPPFLAGS+= -D__powerpc__
123 ifdef CONFIG_LINUX_USER
124 BASE_LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
125 endif
126 endif
128 ifeq ($(ARCH),s390)
129 BASE_LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
130 endif
132 ifeq ($(ARCH),sparc)
133 ifeq ($(CONFIG_SOLARIS),yes)
134 BASE_CFLAGS+=-mcpu=ultrasparc -m32 -ffixed-g2 -ffixed-g3
135 BASE_LDFLAGS+=-m32
136 OP_CFLAGS+=-fno-delayed-branch -fno-omit-frame-pointer -ffixed-i0
137 else
138 BASE_CFLAGS+=-mcpu=ultrasparc -m32 -ffixed-g1 -ffixed-g2 -ffixed-g3 -ffixed-g6
139 BASE_LDFLAGS+=-m32
140 OP_CFLAGS+=-fno-delayed-branch -ffixed-i0
141 HELPER_CFLAGS=$(CFLAGS) -ffixed-i0 -mflat
142 # -static is used to avoid g1/g3 usage by the dynamic linker
143 BASE_LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld -static
144 endif
145 endif
147 ifeq ($(ARCH),sparc64)
148 BASE_CFLAGS+=-mcpu=ultrasparc -m64 -ffixed-g1 -ffixed-g4 -ffixed-g5 -ffixed-g7
149 BASE_LDFLAGS+=-m64
150 BASE_LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
151 OP_CFLAGS+=-mcpu=ultrasparc -m64 -ffixed-g1 -ffixed-g4 -ffixed-g5 -ffixed-g7 -fno-delayed-branch -ffixed-i0
152 endif
154 ifeq ($(ARCH),alpha)
155 # -msmall-data is not used for OP_CFLAGS because we want two-instruction
156 # relocations for the constant constructions
157 # Ensure there's only a single GP
158 BASE_CFLAGS+=-msmall-data
159 BASE_LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
160 endif
162 ifeq ($(ARCH),ia64)
163 BASE_CFLAGS+=-mno-sdata
164 OP_CFLAGS+=-mno-sdata
165 BASE_LDFLAGS+=-Wl,-G0 -Wl,-T,$(SRC_PATH)/$(ARCH).ld
166 endif
168 ifeq ($(ARCH),arm)
169 OP_CFLAGS+=-mno-sched-prolog -fno-omit-frame-pointer
170 BASE_LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
171 endif
173 ifeq ($(ARCH),m68k)
174 OP_CFLAGS+=-fomit-frame-pointer
175 BASE_LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
176 endif
178 ifeq ($(ARCH),mips)
179 BASE_LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
180 endif
182 ifeq ($(HAVE_GCC3_OPTIONS),yes)
183 # very important to generate a return at the end of every operation
184 OP_CFLAGS+=-fno-reorder-blocks -fno-optimize-sibling-calls
185 endif
187 ifeq ($(CONFIG_DARWIN),yes)
188 LIBS+=-lmx
189 endif
191 ifdef CONFIG_DARWIN_USER
192 # Leave some space for the regular program loading zone
193 BASE_LDFLAGS+=-Wl,-segaddr,__STD_PROG_ZONE,0x1000 -image_base 0x0e000000
194 endif
196 OP_CFLAGS+=$(OS_CFLAGS)
198 #########################################################
200 CPPFLAGS+=-D_GNU_SOURCE
201 # -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE
202 LIBS+=-lm
203 LIBS+=-L../../libxc -lxenctrl -lxenguest
204 LIBS+=-L../../xenstore -lxenstore
205 ifndef CONFIG_USER_ONLY
206 LIBS+=-lz
207 endif
208 ifdef CONFIG_WIN32
209 LIBS+=-lwinmm -lws2_32 -liphlpapi
210 endif
211 ifdef CONFIG_SOLARIS
212 LIBS+=-lsocket -lnsl -lresolv
213 endif
215 # profiling code
216 ifdef TARGET_GPROF
217 BASE_LDFLAGS+=-p
218 main.o: BASE_CFLAGS+=-p
219 endif
221 ifdef CONFIG_LINUX_USER
222 OBJS= main.o syscall.o mmap.o signal.o path.o osdep.o thunk.o \
223 elfload.o linuxload.o
224 ifdef TARGET_HAS_BFLT
225 OBJS+= flatload.o
226 endif
228 ifeq ($(TARGET_ARCH), i386)
229 OBJS+= vm86.o
230 endif
231 ifeq ($(TARGET_ARCH), arm)
232 OBJS+=nwfpe/fpa11.o nwfpe/fpa11_cpdo.o \
233 nwfpe/fpa11_cpdt.o nwfpe/fpa11_cprt.o nwfpe/fpopcode.o nwfpe/single_cpdo.o \
234 nwfpe/double_cpdo.o nwfpe/extended_cpdo.o arm-semi.o
235 endif
236 ifeq ($(TARGET_ARCH), m68k)
237 OBJS+= m68k-sim.o m68k-semi.o
238 endif
239 endif #CONFIG_LINUX_USER
241 ifdef CONFIG_DARWIN_USER
242 OBJS= main.o commpage.o machload.o mmap.o osdep.o signal.o syscall.o thunk.o
243 endif
245 SRCS:= $(OBJS:.o=.c)
246 OBJS+= libqemu.a
248 # cpu emulator library
249 LIBOBJS=exec.o kqemu.o translate-op.o translate-all.o cpu-exec.o\
250 translate.o op.o
251 ifdef CONFIG_SOFTFLOAT
252 LIBOBJS+=fpu/softfloat.o
253 else
254 LIBOBJS+=fpu/softfloat-native.o
255 endif
256 CPPFLAGS+=-I$(SRC_PATH)/fpu
258 ifeq ($(TARGET_ARCH), i386)
259 LIBOBJS+=helper.o helper2.o
260 ifeq ($(ARCH), i386)
261 LIBOBJS+=translate-copy.o
262 endif
263 endif
265 ifeq ($(TARGET_ARCH), x86_64)
266 LIBOBJS+=helper.o helper2.o
267 endif
269 ifeq ($(TARGET_BASE_ARCH), ppc)
270 LIBOBJS+= op_helper.o helper.o
271 endif
273 ifeq ($(TARGET_ARCH), mips)
274 LIBOBJS+= op_helper.o helper.o
275 endif
277 ifeq ($(TARGET_BASE_ARCH), sparc)
278 LIBOBJS+= op_helper.o helper.o
279 endif
281 ifeq ($(TARGET_BASE_ARCH), arm)
282 LIBOBJS+= op_helper.o helper.o
283 endif
285 ifeq ($(TARGET_BASE_ARCH), sh4)
286 LIBOBJS+= op_helper.o helper.o
287 endif
289 ifeq ($(TARGET_BASE_ARCH), m68k)
290 LIBOBJS+= helper.o
291 endif
293 # NOTE: the disassembler code is only needed for debugging
294 LIBOBJS+=disas.o
295 ifeq ($(findstring i386, $(TARGET_ARCH) $(ARCH)),i386)
296 USE_I386_DIS=y
297 endif
298 ifeq ($(findstring x86_64, $(TARGET_ARCH) $(ARCH)),x86_64)
299 USE_I386_DIS=y
300 endif
301 ifdef USE_I386_DIS
302 LIBOBJS+=i386-dis.o
303 endif
304 ifeq ($(findstring alpha, $(TARGET_ARCH) $(ARCH)),alpha)
305 LIBOBJS+=alpha-dis.o
306 endif
307 ifeq ($(findstring ppc, $(TARGET_BASE_ARCH) $(ARCH)),ppc)
308 LIBOBJS+=ppc-dis.o
309 endif
310 ifeq ($(findstring mips, $(TARGET_ARCH) $(ARCH)),mips)
311 LIBOBJS+=mips-dis.o
312 endif
313 ifeq ($(findstring sparc, $(TARGET_BASE_ARCH) $(ARCH)),sparc)
314 LIBOBJS+=sparc-dis.o
315 endif
316 ifeq ($(findstring arm, $(TARGET_ARCH) $(ARCH)),arm)
317 LIBOBJS+=arm-dis.o
318 endif
319 ifeq ($(findstring m68k, $(TARGET_ARCH) $(ARCH)),m68k)
320 LIBOBJS+=m68k-dis.o
321 endif
322 ifeq ($(findstring sh4, $(TARGET_ARCH) $(ARCH)),sh4)
323 LIBOBJS+=sh4-dis.o
324 endif
326 ifdef CONFIG_GDBSTUB
327 OBJS+=gdbstub.o
328 endif
330 # qemu-dm objects
331 ifeq ($(ARCH),ia64)
332 LIBOBJS=helper2.o exec-dm.o i8259-dm.o piix_pci-dm.o
333 else
334 LIBOBJS=helper2.o exec-dm.o i8259-dm.o rtc-dm.o piix_pci-dm.o
335 endif
337 all: $(PROGS)
339 $(QEMU_USER): $(OBJS)
340 $(CC) $(CFLAGS) $(LDFLAGS) $(BASE_LDFLAGS) -o $@ $^ $(LIBS)
341 ifeq ($(ARCH),alpha)
342 # Mark as 32 bit binary, i. e. it will be mapped into the low 31 bit of
343 # the address space (31 bit so sign extending doesn't matter)
344 echo -ne '\001\000\000\000' | dd of=qemu bs=1 seek=48 count=4 conv=notrunc
345 endif
347 # must use static linking to avoid leaving stuff in virtual address space
348 VL_OBJS=vl.o osdep.o readline.o monitor.o pci.o console.o isa_mmio.o
349 VL_OBJS+=cutils.o
350 VL_OBJS+=block.o block-raw.o
351 VL_OBJS+=block-cow.o block-qcow.o aes.o block-vmdk.o block-cloop.o block-dmg.o block-bochs.o block-vpc.o block-vvfat.o block-qcow2.o
352 ifdef CONFIG_STUBDOM
353 VL_OBJS+=block-vbd.o
354 endif
355 ifdef CONFIG_WIN32
356 VL_OBJS+=tap-win32.o
357 endif
359 ifdef CONFIG_STUBDOM
360 CONFIG_PASSTHROUGH=1
361 else
362 ifeq (,$(wildcard /usr/include/pci))
363 $(warning *** pciutils-devl package not found - missing /usr/include/pci)
364 $(warning *** PCI passthrough capability has been disabled)
365 else
366 CONFIG_PASSTHROUGH=1
367 endif
368 endif
370 ifdef CONFIG_PASSTHROUGH
371 LIBS+=-lpci
372 VL_OBJS+= pass-through.o
373 CFLAGS += -DCONFIG_PASSTHROUGH
374 $(info *** PCI passthrough capability has been enabled ***)
375 endif
377 SOUND_HW = sb16.o es1370.o
378 AUDIODRV = audio.o noaudio.o wavaudio.o
379 ifdef CONFIG_SDL
380 AUDIODRV += sdlaudio.o
381 endif
382 ifdef CONFIG_OSS
383 AUDIODRV += ossaudio.o
384 endif
385 ifdef CONFIG_COREAUDIO
386 AUDIODRV += coreaudio.o
387 endif
388 ifdef CONFIG_ALSA
389 AUDIODRV += alsaaudio.o
390 LIBS += -lasound
391 endif
392 ifdef CONFIG_DSOUND
393 AUDIODRV += dsoundaudio.o
394 LIBS += -lole32 -ldxguid
395 endif
396 ifdef CONFIG_FMOD
397 AUDIODRV += fmodaudio.o
398 audio.o fmodaudio.o: CPPFLAGS := -I$(CONFIG_FMOD_INC) $(CPPFLAGS)
399 LIBS += $(CONFIG_FMOD_LIB)
400 endif
401 ifdef CONFIG_ADLIB
402 SOUND_HW += fmopl.o adlib.o
403 endif
404 AUDIODRV+= wavcapture.o
406 ifdef CONFIG_VNC_TLS
407 CPPFLAGS += $(CONFIG_VNC_TLS_CFLAGS)
408 LIBS += $(CONFIG_VNC_TLS_LIBS)
409 endif
411 # SCSI layer
412 VL_OBJS+= scsi-disk.o cdrom.o lsi53c895a.o
414 # USB layer
415 VL_OBJS+= usb.o usb-hub.o usb-linux.o usb-hid.o usb-ohci.o usb-msd.o
417 # PCI network cards
418 VL_OBJS+= ne2000.o rtl8139.o pcnet.o e100.o
420 ifeq ($(TARGET_BASE_ARCH), i386)
421 # Hardware support
422 VL_OBJS+= ide.o pckbd.o ps2.o vga.o dma.o extboot.o
423 ifeq ($(ARCH),ia64)
424 VL_OBJS+= fdc.o mc146818rtc.o serial.o pc.o
425 else
426 VL_OBJS+= fdc.o serial.o pc.o
427 endif
428 VL_OBJS+= cirrus_vga.o parallel.o acpi.o
429 VL_OBJS+= usb-uhci.o smbus_eeprom.o
430 VL_OBJS+= piix4acpi.o
431 VL_OBJS+= xenstore.o
432 VL_OBJS+= xen_platform.o
433 VL_OBJS+= xen_machine_fv.o
434 VL_OBJS+= xen_machine_pv.o
435 VL_OBJS+= xenfb.o
436 VL_OBJS+= xen_console.o
437 ifndef CONFIG_STUBDOM
438 VL_OBJS+= tpm_tis.o
439 VL_OBJS+= $(SOUND_HW) $(AUDIODRV) mixeng.o
440 CPPFLAGS += -DHAS_TPM
441 CPPFLAGS += -DHAS_AUDIO
442 endif
443 endif
444 ifeq ($(TARGET_BASE_ARCH), ppc)
445 VL_OBJS+= ppc.o ide.o pckbd.o ps2.o vga.o dma.o
446 VL_OBJS+= mc146818rtc.o serial.o i8259.o i8254.o fdc.o m48t59.o
447 VL_OBJS+= ppc_prep.o ppc_chrp.o cuda.o adb.o openpic.o heathrow_pic.o mixeng.o
448 VL_OBJS+= grackle_pci.o prep_pci.o unin_pci.o
449 ifndef CONFIG_STUBDOM
450 VL_OBJS+= $(SOUND_HW) $(AUDIODRV)
451 CPPFLAGS += -DHAS_AUDIO
452 endif
453 endif
454 ifeq ($(TARGET_ARCH), mips)
455 VL_OBJS+= mips_r4k.o mips_malta.o mips_timer.o mips_int.o dma.o vga.o serial.o i8254.o i8259.o
456 VL_OBJS+= ide.o gt64xxx.o pckbd.o ps2.o fdc.o mc146818rtc.o usb-uhci.o acpi.o
457 VL_OBJS+= piix_pci.o parallel.o mixeng.o cirrus_vga.o
458 ifndef CONFIG_STUBDOM
459 VL_OBJS+= $(SOUND_HW) $(AUDIODRV)
460 DEFINES += -DHAS_AUDIO
461 endif
462 endif
463 ifeq ($(TARGET_BASE_ARCH), sparc)
464 ifeq ($(TARGET_ARCH), sparc64)
465 VL_OBJS+= sun4u.o ide.o pckbd.o ps2.o vga.o apb_pci.o
466 VL_OBJS+= fdc.o mc146818rtc.o serial.o m48t59.o
467 VL_OBJS+= cirrus_vga.o parallel.o
468 else
469 VL_OBJS+= sun4m.o tcx.o pcnet.o iommu.o m48t59.o slavio_intctl.o
470 VL_OBJS+= slavio_timer.o slavio_serial.o slavio_misc.o fdc.o esp.o sparc32_dma.o
471 VL_OBJS+= cs4231.o
472 endif
473 endif
474 ifeq ($(TARGET_BASE_ARCH), arm)
475 VL_OBJS+= integratorcp.o versatilepb.o ps2.o smc91c111.o arm_pic.o arm_timer.o
476 VL_OBJS+= arm_boot.o pl011.o pl050.o pl080.o pl110.o pl190.o
477 VL_OBJS+= versatile_pci.o
478 VL_OBJS+= arm_gic.o realview.o arm_sysctl.o
479 VL_OBJS+= arm-semi.o
480 endif
481 ifeq ($(TARGET_BASE_ARCH), sh4)
482 VL_OBJS+= shix.o sh7750.o sh7750_regnames.o tc58128.o
483 endif
484 ifdef CONFIG_GDBSTUB
485 VL_OBJS+=gdbstub.o
486 endif
487 ifdef CONFIG_SDL
488 VL_OBJS+=sdl.o x_keymap.o
489 endif
490 VL_OBJS+=vnc.o d3des.o
491 ifdef CONFIG_COCOA
492 VL_OBJS+=cocoa.o
493 COCOA_LIBS=-F/System/Library/Frameworks -framework Cocoa -framework IOKit
494 ifdef CONFIG_COREAUDIO
495 COCOA_LIBS+=-framework CoreAudio
496 endif
497 endif
498 ifdef CONFIG_SLIRP
499 CPPFLAGS+=-I$(SRC_PATH)/slirp
500 SLIRP_OBJS=cksum.o if.o ip_icmp.o ip_input.o ip_output.o \
501 slirp.o mbuf.o misc.o sbuf.o socket.o tcp_input.o tcp_output.o \
502 tcp_subr.o tcp_timer.o udp.o bootp.o debug.o tftp.o
503 VL_OBJS+=$(addprefix slirp/, $(SLIRP_OBJS))
504 endif
506 VL_LDFLAGS=
507 # specific flags are needed for non soft mmu emulator
508 ifdef CONFIG_STATIC
509 VL_LDFLAGS+=-static
510 endif
511 ifndef CONFIG_SOFTMMU
512 VL_LDFLAGS+=-Wl,-T,$(SRC_PATH)/i386-vl.ld
513 endif
514 ifndef CONFIG_DARWIN
515 ifndef CONFIG_WIN32
516 ifndef CONFIG_SOLARIS
517 VL_LIBS=-lutil -lrt
518 endif
519 endif
520 endif
521 ifdef TARGET_GPROF
522 vl.o: BASE_CFLAGS+=-p
523 VL_LDFLAGS+=-p
524 endif
526 ifeq ($(ARCH),ia64)
527 VL_LDFLAGS+=-Wl,-G0 -Wl,-T,$(SRC_PATH)/ia64.ld
528 endif
530 ifeq ($(ARCH),sparc64)
531 VL_LDFLAGS+=-m64
532 VL_LDFLAGS+=-Wl,-T,$(SRC_PATH)/sparc64.ld
533 endif
535 ifdef CONFIG_WIN32
536 SDL_LIBS := $(filter-out -mwindows, $(SDL_LIBS)) -mconsole
537 endif
539 $(QEMU_SYSTEM): $(VL_OBJS) libqemu.a
540 ifdef CONFIG_STUBDOM
541 $(AR) rcs $@ $(VL_OBJS)
542 else
543 $(CC) $(VL_LDFLAGS) -o $@ $^ $(LIBS) $(SDL_LIBS) $(COCOA_LIBS) $(VL_LIBS)
544 endif
546 cocoa.o: cocoa.m
547 $(CC) $(CFLAGS) $(CPPFLAGS) $(BASE_CFLAGS) -c -o $@ $<
549 sdl.o: sdl.c keymaps.c sdl_keysym.h
550 $(CC) $(CFLAGS) $(CPPFLAGS) $(SDL_CFLAGS) $(BASE_CFLAGS) -c -o $@ $<
552 vnc.o: vnc.c keymaps.c sdl_keysym.h vnchextile.h d3des.c d3des.h
553 $(CC) $(CFLAGS) $(CPPFLAGS) $(BASE_CFLAGS) -c -o $@ $<
555 sdlaudio.o: sdlaudio.c
556 $(CC) $(CFLAGS) $(CPPFLAGS) $(SDL_CFLAGS) $(BASE_CFLAGS) -c -o $@ $<
558 depend: $(SRCS)
559 $(CC) -MM $(CFLAGS) $(CPPFLAGS) $(BASE_CFLAGS) $^ 1>.depend
561 vldepend: $(VL_OBJS:.o=.c)
562 $(CC) -MM $(CFLAGS) $(CPPFLAGS) $(BASE_CFLAGS) $^ 1>.depend
564 # libqemu
566 libqemu.a: $(LIBOBJS)
567 rm -f $@
568 $(AR) rcs $@ $(LIBOBJS)
570 translate.o: translate.c gen-op.h opc.h cpu.h
572 translate-all.o: translate-all.c opc.h cpu.h
574 translate-op.o: translate-all.c op.h opc.h cpu.h
576 op.h: op.o $(DYNGEN)
577 $(DYNGEN) -o $@ $<
579 opc.h: op.o $(DYNGEN)
580 $(DYNGEN) -c -o $@ $<
582 gen-op.h: op.o $(DYNGEN)
583 $(DYNGEN) -g -o $@ $<
585 op.o: op.c
586 $(CC) $(OP_CFLAGS) $(CPPFLAGS) -c -o $@ $<
588 # HELPER_CFLAGS is used for all the code compiled with static register
589 # variables
590 ifeq ($(TARGET_BASE_ARCH), i386)
591 # XXX: rename helper.c to op_helper.c
592 helper.o: helper.c
593 $(CC) $(HELPER_CFLAGS) $(CPPFLAGS) $(BASE_CFLAGS) -c -o $@ $<
594 else
595 op_helper.o: op_helper.c
596 $(CC) $(HELPER_CFLAGS) $(CPPFLAGS) $(BASE_CFLAGS) -c -o $@ $<
597 endif
599 cpu-exec.o: cpu-exec.c
600 $(CC) $(HELPER_CFLAGS) $(CPPFLAGS) $(BASE_CFLAGS) -c -o $@ $<
602 # Note: this is a workaround. The real fix is to avoid compiling
603 # cpu_signal_handler() in cpu-exec.c.
604 signal.o: signal.c
605 $(CC) $(HELPER_CFLAGS) $(CPPFLAGS) $(BASE_CFLAGS) -c -o $@ $<
607 ifeq ($(TARGET_BASE_ARCH), i386)
608 op.o: op.c opreg_template.h ops_template.h ops_template_mem.h ops_mem.h ops_sse.h
609 endif
611 ifeq ($(TARGET_ARCH), arm)
612 op.o: op.c op_template.h
613 pl110.o: pl110_template.h
614 endif
616 ifeq ($(TARGET_BASE_ARCH), sparc)
617 op.o: op.c op_template.h op_mem.h fop_template.h fbranch_template.h
618 magic_load.o: elf_op.h
619 endif
621 ifeq ($(TARGET_BASE_ARCH), ppc)
622 op.o: op.c op_template.h op_mem.h
623 op_helper.o: op_helper_mem.h
624 translate.o: translate.c translate_init.c
625 endif
627 ifeq ($(TARGET_ARCH), mips)
628 op.o: op.c op_template.c fop_template.c op_mem.c
629 op_helper.o: op_helper_mem.c
630 endif
632 loader.o: loader.c elf_ops.h
634 ifeq ($(TARGET_ARCH), sh4)
635 op.o: op.c op_mem.c cpu.h
636 op_helper.o: op_helper.c exec.h cpu.h
637 helper.o: helper.c exec.h cpu.h
638 sh7750.o: sh7750.c sh7750_regs.h sh7750_regnames.h cpu.h
639 shix.o: shix.c sh7750_regs.h sh7750_regnames.h
640 sh7750_regnames.o: sh7750_regnames.c sh7750_regnames.h sh7750_regs.h
641 tc58128.o: tc58128.c
642 endif
644 $(OBJS) $(LIBOBJS) $(VL_OBJS): config.h ../config-host.h
646 %.o: %.c
647 $(CC) $(CFLAGS) $(CPPFLAGS) $(BASE_CFLAGS) -c -o $@ $<
649 %.o: %.S
650 $(CC) $(CPPFLAGS) -c -o $@ $<
652 clean:
653 rm -f *.o *.a *~ $(PROGS) gen-op.h opc.h op.h nwfpe/*.o slirp/*.o fpu/*.o
655 distclean: clean
656 rm -rf config.mak config.h
658 install: all
659 mkdir -p "$(DESTDIR)$(bindir)" "$(DESTDIR)$(configdir)"
660 ifneq ($(PROGS),)
661 $(INSTALL_PROG) $(PROGS) "$(DESTDIR)$(bindir)"
662 endif
663 $(INSTALL_PROG) $(TARGET_PATH)/qemu-dm.debug "$(DESTDIR)$(bindir)"
664 $(INSTALL_PROG) $(TARGET_PATH)/qemu-ifup "$(DESTDIR)$(configdir)"
666 ifneq ($(wildcard .depend),)
667 include .depend
668 endif
670 ifeq (1, 0)
671 audio.o sdlaudio.o dsoundaudio.o ossaudio.o wavaudio.o noaudio.o \
672 fmodaudio.o alsaaudio.o mixeng.o sb16.o es1370.o gus.o adlib.o: \
673 CFLAGS := $(CFLAGS) -Wall -Werror -W -Wsign-compare
674 endif