]> git.proxmox.com Git - qemu.git/blob - Makefile.target
Gravis Ultrasound GF1 sound card emulation (malc).
[qemu.git] / Makefile.target
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 -MP -DNEED_CPU_H
28 ifdef CONFIG_DARWIN_USER
29 VPATH+=:$(SRC_PATH)/darwin-user
30 CPPFLAGS+=-I$(SRC_PATH)/darwin-user -I$(SRC_PATH)/darwin-user/$(TARGET_ARCH)
31 endif
32 ifdef CONFIG_LINUX_USER
33 VPATH+=:$(SRC_PATH)/linux-user
34 ifndef TARGET_ABI_DIR
35 TARGET_ABI_DIR=$(TARGET_ARCH)
36 endif
37 CPPFLAGS+=-I$(SRC_PATH)/linux-user -I$(SRC_PATH)/linux-user/$(TARGET_ABI_DIR)
38 endif
39 BASE_CFLAGS=
40 BASE_LDFLAGS=
41 #CFLAGS+=-Werror
42 LIBS=
43 HELPER_CFLAGS=$(CFLAGS)
44 DYNGEN=../dyngen$(EXESUF)
45 # user emulator name
46 ifndef TARGET_ARCH2
47 TARGET_ARCH2=$(TARGET_ARCH)
48 endif
49 ifeq ($(TARGET_ARCH),arm)
50 ifeq ($(TARGET_WORDS_BIGENDIAN),yes)
51 TARGET_ARCH2=armeb
52 endif
53 endif
54 ifeq ($(TARGET_ARCH),sh4)
55 ifeq ($(TARGET_WORDS_BIGENDIAN),yes)
56 TARGET_ARCH2=sh4eb
57 endif
58 endif
59 ifeq ($(TARGET_ARCH),mips)
60 ifneq ($(TARGET_WORDS_BIGENDIAN),yes)
61 TARGET_ARCH2=mipsel
62 endif
63 endif
64 ifeq ($(TARGET_ARCH),mipsn32)
65 ifneq ($(TARGET_WORDS_BIGENDIAN),yes)
66 TARGET_ARCH2=mipsn32el
67 endif
68 endif
69 ifeq ($(TARGET_ARCH),mips64)
70 ifneq ($(TARGET_WORDS_BIGENDIAN),yes)
71 TARGET_ARCH2=mips64el
72 endif
73 endif
74 QEMU_USER=qemu-$(TARGET_ARCH2)
75 # system emulator name
76 ifdef CONFIG_SOFTMMU
77 ifeq ($(TARGET_ARCH), i386)
78 QEMU_SYSTEM=qemu$(EXESUF)
79 else
80 QEMU_SYSTEM=qemu-system-$(TARGET_ARCH2)$(EXESUF)
81 endif
82 else
83 QEMU_SYSTEM=qemu-fast
84 endif
85
86 ifdef CONFIG_USER_ONLY
87 PROGS=$(QEMU_USER)
88 else
89 PROGS+=$(QEMU_SYSTEM)
90 ifndef CONFIG_SOFTMMU
91 CONFIG_STATIC=y
92 endif
93 endif # !CONFIG_USER_ONLY
94
95 ifdef CONFIG_STATIC
96 BASE_LDFLAGS+=-static
97 endif
98
99 # We require -O2 to avoid the stack setup prologue in EXIT_TB
100 OP_CFLAGS := -Wall -O2 -g -fno-strict-aliasing
101
102 # cc-option
103 # Usage: OP_CFLAGS+=$(call cc-option, -falign-functions=0, -malign-functions=0)
104
105 cc-option = $(shell if $(CC) $(OP_CFLAGS) $(1) -S -o /dev/null -xc /dev/null \
106 > /dev/null 2>&1; then echo "$(1)"; else echo "$(2)"; fi ;)
107
108 OP_CFLAGS+=$(call cc-option, -fno-reorder-blocks, "")
109 OP_CFLAGS+=$(call cc-option, -fno-gcse, "")
110 OP_CFLAGS+=$(call cc-option, -fno-tree-ch, "")
111 OP_CFLAGS+=$(call cc-option, -fno-optimize-sibling-calls, "")
112 OP_CFLAGS+=$(call cc-option, -fno-crossjumping, "")
113 OP_CFLAGS+=$(call cc-option, -fno-align-labels, "")
114 OP_CFLAGS+=$(call cc-option, -fno-align-jumps, "")
115 OP_CFLAGS+=$(call cc-option, -fno-align-functions, $(call cc-option, -malign-functions=0, ""))
116 OP_CFLAGS+=$(call cc-option, -fno-section-anchors, "")
117
118 ifeq ($(ARCH),i386)
119 HELPER_CFLAGS+=-fomit-frame-pointer
120 OP_CFLAGS+=-mpreferred-stack-boundary=2 -fomit-frame-pointer
121 ifdef TARGET_GPROF
122 USE_I386_LD=y
123 endif
124 ifdef CONFIG_STATIC
125 USE_I386_LD=y
126 endif
127 ifdef USE_I386_LD
128 BASE_LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
129 else
130 ifdef CONFIG_LINUX_USER
131 # WARNING: this LDFLAGS is _very_ tricky : qemu is an ELF shared object
132 # that the kernel ELF loader considers as an executable. I think this
133 # is the simplest way to make it self virtualizable!
134 BASE_LDFLAGS+=-Wl,-shared
135 endif
136 endif
137 endif
138
139 ifeq ($(ARCH),x86_64)
140 ifneq ($(CONFIG_SOLARIS),yes)
141 BASE_LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
142 endif
143 endif
144
145 ifeq ($(ARCH),ppc)
146 CPPFLAGS+= -D__powerpc__
147 BASE_LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
148 endif
149
150 ifeq ($(ARCH),s390)
151 BASE_LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
152 endif
153
154 ifeq ($(ARCH),sparc)
155 BASE_CFLAGS+=-ffixed-g2 -ffixed-g3
156 OP_CFLAGS+=-fno-delayed-branch -ffixed-i0
157 ifeq ($(CONFIG_SOLARIS),yes)
158 OP_CFLAGS+=-fno-omit-frame-pointer
159 else
160 BASE_CFLAGS+=-ffixed-g1 -ffixed-g6
161 HELPER_CFLAGS=$(CFLAGS) -ffixed-i0
162 # -static is used to avoid g1/g3 usage by the dynamic linker
163 BASE_LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld -static
164 endif
165 endif
166
167 ifeq ($(ARCH),sparc64)
168 BASE_CFLAGS+=-ffixed-g1 -ffixed-g4 -ffixed-g5 -ffixed-g7
169 OP_CFLAGS+=-mcpu=ultrasparc -m64 -fno-delayed-branch -ffixed-i0
170 ifneq ($(CONFIG_SOLARIS),yes)
171 BASE_LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
172 OP_CFLAGS+=-ffixed-g1 -ffixed-g4 -ffixed-g5 -ffixed-g7
173 endif
174 endif
175
176 ifeq ($(ARCH),alpha)
177 # -msmall-data is not used for OP_CFLAGS because we want two-instruction
178 # relocations for the constant constructions
179 # Ensure there's only a single GP
180 BASE_CFLAGS+=-msmall-data
181 BASE_LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
182 endif
183
184 ifeq ($(ARCH),ia64)
185 BASE_CFLAGS+=-mno-sdata
186 OP_CFLAGS+=-mno-sdata
187 BASE_LDFLAGS+=-Wl,-G0 -Wl,-T,$(SRC_PATH)/$(ARCH).ld
188 endif
189
190 ifeq ($(ARCH),arm)
191 OP_CFLAGS+=-mno-sched-prolog -fno-omit-frame-pointer
192 BASE_LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
193 endif
194
195 ifeq ($(ARCH),m68k)
196 OP_CFLAGS+=-fomit-frame-pointer
197 BASE_LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
198 endif
199
200 ifeq ($(ARCH),mips)
201 OP_CFLAGS+=-mabi=32 -G0 -fno-PIC -mno-abicalls -fomit-frame-pointer -fno-delayed-branch -Wa,-O0
202 ifeq ($(WORDS_BIGENDIAN),yes)
203 BASE_LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
204 else
205 BASE_LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH)el.ld
206 endif
207 endif
208
209 ifeq ($(ARCH),mips64)
210 OP_CFLAGS+=-mabi=n32 -G0 -fno-PIC -mno-abicalls -fomit-frame-pointer -fno-delayed-branch -Wa,-O0
211 ifeq ($(WORDS_BIGENDIAN),yes)
212 BASE_LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
213 else
214 BASE_LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH)el.ld
215 endif
216 endif
217
218 ifeq ($(CONFIG_DARWIN),yes)
219 LIBS+=-lmx
220 endif
221
222 ifdef CONFIG_DARWIN_USER
223 # Leave some space for the regular program loading zone
224 BASE_LDFLAGS+=-Wl,-segaddr,__STD_PROG_ZONE,0x1000 -image_base 0x0e000000
225 endif
226
227 BASE_CFLAGS+=$(OS_CFLAGS) $(ARCH_CFLAGS)
228 BASE_LDFLAGS+=$(OS_LDFLAGS) $(ARCH_LDFLAGS)
229 OP_CFLAGS+=$(OS_CFLAGS) $(ARCH_CFLAGS)
230 OP_LDFLAGS+=$(OS_LDFLAGS) $(ARCH_LDFLAGS)
231
232 #########################################################
233
234 CPPFLAGS+=-D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE
235 LIBS+=-lm
236 ifndef CONFIG_USER_ONLY
237 LIBS+=-lz
238 endif
239 ifdef CONFIG_WIN32
240 LIBS+=-lwinmm -lws2_32 -liphlpapi
241 endif
242 ifdef CONFIG_SOLARIS
243 LIBS+=-lsocket -lnsl -lresolv
244 ifdef NEEDS_LIBSUNMATH
245 LIBS+=-lsunmath
246 LDFLAGS+=-L/opt/SUNWspro/prod/lib -R/opt/SUNWspro/prod/lib
247 OP_CFLAGS+=-I/opt/SUNWspro/prod/include/cc
248 BASE_CFLAGS+=-I/opt/SUNWspro/prod/include/cc
249 endif
250 endif
251
252 # profiling code
253 ifdef TARGET_GPROF
254 BASE_LDFLAGS+=-p
255 main.o: BASE_CFLAGS+=-p
256 endif
257
258 ifdef CONFIG_LINUX_USER
259 OBJS= main.o syscall.o strace.o mmap.o signal.o path.o osdep.o thunk.o \
260 elfload.o linuxload.o uaccess.o
261 LIBS+= $(AIOLIBS)
262 ifdef TARGET_HAS_BFLT
263 OBJS+= flatload.o
264 endif
265 ifdef TARGET_HAS_ELFLOAD32
266 OBJS+= elfload32.o
267 elfload32.o: elfload.c
268 endif
269
270 ifeq ($(TARGET_ARCH), i386)
271 OBJS+= vm86.o
272 endif
273 ifeq ($(TARGET_ARCH), arm)
274 OBJS+=nwfpe/fpa11.o nwfpe/fpa11_cpdo.o \
275 nwfpe/fpa11_cpdt.o nwfpe/fpa11_cprt.o nwfpe/fpopcode.o nwfpe/single_cpdo.o \
276 nwfpe/double_cpdo.o nwfpe/extended_cpdo.o arm-semi.o
277 endif
278 ifeq ($(TARGET_ARCH), m68k)
279 OBJS+= m68k-sim.o m68k-semi.o
280 endif
281 endif #CONFIG_LINUX_USER
282
283 ifdef CONFIG_DARWIN_USER
284 OBJS= main.o commpage.o machload.o mmap.o osdep.o signal.o syscall.o thunk.o
285 endif
286
287 SRCS:= $(OBJS:.o=.c)
288 OBJS+= libqemu.a
289
290 # cpu emulator library
291 LIBOBJS=exec.o kqemu.o translate-op.o translate-all.o cpu-exec.o\
292 translate.o op.o host-utils.o
293 ifdef CONFIG_SOFTFLOAT
294 LIBOBJS+=fpu/softfloat.o
295 else
296 LIBOBJS+=fpu/softfloat-native.o
297 endif
298 CPPFLAGS+=-I$(SRC_PATH)/fpu
299
300 ifeq ($(TARGET_ARCH), i386)
301 LIBOBJS+=helper.o helper2.o
302 endif
303
304 ifeq ($(TARGET_ARCH), x86_64)
305 LIBOBJS+=helper.o helper2.o
306 endif
307
308 ifeq ($(TARGET_BASE_ARCH), ppc)
309 LIBOBJS+= op_helper.o helper.o
310 endif
311
312 ifeq ($(TARGET_BASE_ARCH), mips)
313 LIBOBJS+= op_helper.o helper.o
314 endif
315
316 ifeq ($(TARGET_BASE_ARCH), sparc)
317 LIBOBJS+= op_helper.o helper.o
318 endif
319
320 ifeq ($(TARGET_BASE_ARCH), arm)
321 LIBOBJS+= op_helper.o helper.o
322 endif
323
324 ifeq ($(TARGET_BASE_ARCH), sh4)
325 LIBOBJS+= op_helper.o helper.o
326 endif
327
328 ifeq ($(TARGET_BASE_ARCH), m68k)
329 LIBOBJS+= op_helper.o helper.o
330 endif
331
332 ifeq ($(TARGET_BASE_ARCH), alpha)
333 LIBOBJS+= op_helper.o helper.o alpha_palcode.o
334 endif
335
336 ifeq ($(TARGET_BASE_ARCH), cris)
337 LIBOBJS+= op_helper.o helper.o
338 LIBOBJS+= cris-dis.o
339
340 ifndef CONFIG_USER_ONLY
341 LIBOBJS+= mmu.o
342 endif
343 endif
344
345 # NOTE: the disassembler code is only needed for debugging
346 LIBOBJS+=disas.o
347 ifeq ($(findstring i386, $(TARGET_ARCH) $(ARCH)),i386)
348 USE_I386_DIS=y
349 endif
350 ifeq ($(findstring x86_64, $(TARGET_ARCH) $(ARCH)),x86_64)
351 USE_I386_DIS=y
352 endif
353 ifdef USE_I386_DIS
354 LIBOBJS+=i386-dis.o
355 endif
356 ifeq ($(findstring alpha, $(TARGET_ARCH) $(ARCH)),alpha)
357 LIBOBJS+=alpha-dis.o
358 endif
359 ifeq ($(findstring ppc, $(TARGET_BASE_ARCH) $(ARCH)),ppc)
360 LIBOBJS+=ppc-dis.o
361 endif
362 ifeq ($(findstring mips, $(TARGET_BASE_ARCH) $(ARCH)),mips)
363 LIBOBJS+=mips-dis.o
364 endif
365 ifeq ($(findstring sparc, $(TARGET_BASE_ARCH) $(ARCH)),sparc)
366 LIBOBJS+=sparc-dis.o
367 endif
368 ifeq ($(findstring arm, $(TARGET_ARCH) $(ARCH)),arm)
369 LIBOBJS+=arm-dis.o
370 endif
371 ifeq ($(findstring m68k, $(TARGET_ARCH) $(ARCH)),m68k)
372 LIBOBJS+=m68k-dis.o
373 endif
374 ifeq ($(findstring sh4, $(TARGET_ARCH) $(ARCH)),sh4)
375 LIBOBJS+=sh4-dis.o
376 endif
377 ifeq ($(findstring s390, $(TARGET_ARCH) $(ARCH)),s390)
378 LIBOBJS+=s390-dis.o
379 endif
380
381 ifdef CONFIG_GDBSTUB
382 OBJS+=gdbstub.o
383 endif
384
385 all: $(PROGS)
386
387 $(QEMU_USER): $(OBJS)
388 $(CC) $(LDFLAGS) $(BASE_LDFLAGS) -o $@ $^ $(LIBS)
389 ifeq ($(ARCH),alpha)
390 # Mark as 32 bit binary, i. e. it will be mapped into the low 31 bit of
391 # the address space (31 bit so sign extending doesn't matter)
392 echo -ne '\001\000\000\000' | dd of=qemu bs=1 seek=48 count=4 conv=notrunc
393 endif
394
395 # must use static linking to avoid leaving stuff in virtual address space
396 VL_OBJS=vl.o osdep.o monitor.o pci.o loader.o isa_mmio.o
397 # XXX: suppress QEMU_TOOL tests
398 ifdef CONFIG_WIN32
399 VL_OBJS+=block-raw-win32.o
400 else
401 VL_OBJS+=block-raw-posix.o
402 endif
403
404 ifdef CONFIG_ALSA
405 LIBS += -lasound
406 endif
407 ifdef CONFIG_ESD
408 LIBS += -lesd
409 endif
410 ifdef CONFIG_DSOUND
411 LIBS += -lole32 -ldxguid
412 endif
413 ifdef CONFIG_FMOD
414 LIBS += $(CONFIG_FMOD_LIB)
415 endif
416
417 SOUND_HW = sb16.o es1370.o
418 ifdef CONFIG_AC97
419 SOUND_HW += ac97.o
420 endif
421 ifdef CONFIG_ADLIB
422 SOUND_HW += fmopl.o adlib.o
423 endif
424 ifdef CONFIG_GUS
425 SOUND_HW += gus.o gusemu_hal.o gusemu_mixer.o
426 endif
427
428 ifdef CONFIG_VNC_TLS
429 CPPFLAGS += $(CONFIG_VNC_TLS_CFLAGS)
430 LIBS += $(CONFIG_VNC_TLS_LIBS)
431 endif
432
433 # SCSI layer
434 VL_OBJS+= lsi53c895a.o
435
436 # USB layer
437 VL_OBJS+= usb-ohci.o
438
439 # EEPROM emulation
440 VL_OBJS += eeprom93xx.o
441
442 # PCI network cards
443 VL_OBJS += eepro100.o
444 VL_OBJS += ne2000.o
445 VL_OBJS += pcnet.o
446 VL_OBJS += rtl8139.o
447
448 ifeq ($(TARGET_BASE_ARCH), i386)
449 # Hardware support
450 VL_OBJS+= ide.o pckbd.o ps2.o vga.o $(SOUND_HW) dma.o
451 VL_OBJS+= fdc.o mc146818rtc.o serial.o i8259.o i8254.o pcspk.o pc.o
452 VL_OBJS+= cirrus_vga.o apic.o parallel.o acpi.o piix_pci.o
453 VL_OBJS+= usb-uhci.o vmmouse.o vmport.o vmware_vga.o
454 CPPFLAGS += -DHAS_AUDIO -DHAS_AUDIO_CHOICE
455 endif
456 ifeq ($(TARGET_BASE_ARCH), ppc)
457 CPPFLAGS += -DHAS_AUDIO -DHAS_AUDIO_CHOICE
458 # shared objects
459 VL_OBJS+= ppc.o ide.o vga.o $(SOUND_HW) dma.o openpic.o
460 # PREP target
461 VL_OBJS+= pckbd.o ps2.o serial.o i8259.o i8254.o fdc.o m48t59.o mc146818rtc.o
462 VL_OBJS+= prep_pci.o ppc_prep.o
463 # Mac shared devices
464 VL_OBJS+= macio.o cuda.o adb.o mac_nvram.o mac_dbdma.o
465 # OldWorld PowerMac
466 VL_OBJS+= heathrow_pic.o grackle_pci.o ppc_oldworld.o
467 # NewWorld PowerMac
468 VL_OBJS+= unin_pci.o ppc_chrp.o
469 # PowerPC 4xx boards
470 VL_OBJS+= pflash_cfi02.o ppc4xx_devs.o ppc405_uc.o ppc405_boards.o
471 endif
472 ifeq ($(TARGET_BASE_ARCH), mips)
473 VL_OBJS+= mips_r4k.o mips_malta.o mips_pica61.o mips_mipssim.o
474 VL_OBJS+= mips_timer.o mips_int.o dma.o vga.o serial.o i8254.o i8259.o
475 VL_OBJS+= jazz_led.o
476 VL_OBJS+= ide.o gt64xxx.o pckbd.o ps2.o fdc.o mc146818rtc.o usb-uhci.o acpi.o ds1225y.o
477 VL_OBJS+= piix_pci.o parallel.o cirrus_vga.o $(SOUND_HW)
478 VL_OBJS+= mipsnet.o
479 VL_OBJS+= pflash_cfi01.o
480 CPPFLAGS += -DHAS_AUDIO
481 endif
482 ifeq ($(TARGET_BASE_ARCH), cris)
483 VL_OBJS+= etraxfs.o
484 VL_OBJS+= ptimer.o
485 VL_OBJS+= etraxfs_timer.o
486 VL_OBJS+= etraxfs_ser.o
487 endif
488 ifeq ($(TARGET_BASE_ARCH), sparc)
489 ifeq ($(TARGET_ARCH), sparc64)
490 VL_OBJS+= sun4u.o ide.o pckbd.o ps2.o vga.o apb_pci.o
491 VL_OBJS+= fdc.o mc146818rtc.o serial.o m48t59.o
492 VL_OBJS+= cirrus_vga.o parallel.o ptimer.o
493 else
494 VL_OBJS+= sun4m.o tcx.o pcnet.o iommu.o m48t59.o slavio_intctl.o
495 VL_OBJS+= slavio_timer.o slavio_serial.o slavio_misc.o fdc.o esp.o sparc32_dma.o
496 VL_OBJS+= cs4231.o ptimer.o eccmemctl.o sbi.o sun4c_intctl.o
497 endif
498 endif
499 ifeq ($(TARGET_BASE_ARCH), arm)
500 VL_OBJS+= integratorcp.o versatilepb.o ps2.o smc91c111.o arm_pic.o arm_timer.o
501 VL_OBJS+= arm_boot.o pl011.o pl031.o pl050.o pl080.o pl110.o pl181.o pl190.o
502 VL_OBJS+= versatile_pci.o ptimer.o
503 VL_OBJS+= realview_gic.o realview.o arm_sysctl.o mpcore.o
504 VL_OBJS+= armv7m.o armv7m_nvic.o stellaris.o pl022.o stellaris_enet.o
505 VL_OBJS+= pl061.o
506 VL_OBJS+= arm-semi.o
507 VL_OBJS+= pxa2xx.o pxa2xx_pic.o pxa2xx_gpio.o pxa2xx_timer.o pxa2xx_dma.o
508 VL_OBJS+= pxa2xx_lcd.o pxa2xx_mmci.o pxa2xx_pcmcia.o pxa2xx_keypad.o
509 VL_OBJS+= pflash_cfi01.o gumstix.o
510 VL_OBJS+= spitz.o ide.o serial.o nand.o ecc.o
511 VL_OBJS+= omap.o omap_lcdc.o omap1_clk.o omap_mmc.o omap_i2c.o
512 VL_OBJS+= palm.o tsc210x.o
513 VL_OBJS+= mst_fpga.o mainstone.o
514 CPPFLAGS += -DHAS_AUDIO
515 endif
516 ifeq ($(TARGET_BASE_ARCH), sh4)
517 VL_OBJS+= shix.o r2d.o sh7750.o sh7750_regnames.o tc58128.o
518 VL_OBJS+= sh_timer.o ptimer.o sh_serial.o sh_intc.o
519 endif
520 ifeq ($(TARGET_BASE_ARCH), m68k)
521 VL_OBJS+= an5206.o mcf5206.o ptimer.o mcf_uart.o mcf_intc.o mcf5208.o mcf_fec.o
522 VL_OBJS+= m68k-semi.o dummy_m68k.o
523 endif
524 ifdef CONFIG_GDBSTUB
525 VL_OBJS+=gdbstub.o
526 endif
527 ifdef CONFIG_COCOA
528 COCOA_LIBS=-F/System/Library/Frameworks -framework Cocoa -framework IOKit
529 ifdef CONFIG_COREAUDIO
530 COCOA_LIBS+=-framework CoreAudio
531 endif
532 endif
533 ifdef CONFIG_SLIRP
534 CPPFLAGS+=-I$(SRC_PATH)/slirp
535 endif
536
537 VL_LDFLAGS=$(VL_OS_LDFLAGS)
538 VL_LIBS=$(AIOLIBS)
539 # specific flags are needed for non soft mmu emulator
540 ifdef CONFIG_STATIC
541 VL_LDFLAGS+=-static
542 endif
543 ifndef CONFIG_SOFTMMU
544 VL_LDFLAGS+=-Wl,-T,$(SRC_PATH)/i386-vl.ld
545 endif
546 ifndef CONFIG_DARWIN
547 ifndef CONFIG_WIN32
548 ifndef CONFIG_SOLARIS
549 VL_LIBS+=-lutil
550 endif
551 endif
552 endif
553 ifdef TARGET_GPROF
554 vl.o: BASE_CFLAGS+=-p
555 VL_LDFLAGS+=-p
556 endif
557
558 ifeq ($(ARCH),ia64)
559 VL_LDFLAGS+=-Wl,-G0 -Wl,-T,$(SRC_PATH)/ia64.ld
560 endif
561
562 ifeq ($(ARCH),sparc64)
563 VL_LDFLAGS+=-m64
564 ifneq ($(CONFIG_SOLARIS),yes)
565 VL_LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
566 endif
567 endif
568
569 ifeq ($(ARCH),x86_64)
570 VL_LDFLAGS+=-m64
571 ifneq ($(CONFIG_SOLARIS),yes)
572 VL_LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
573 endif
574 endif
575
576 ifdef CONFIG_WIN32
577 SDL_LIBS := $(filter-out -mwindows, $(SDL_LIBS)) -mconsole
578 endif
579
580 $(QEMU_SYSTEM): $(VL_OBJS) ../libqemu_common.a libqemu.a
581 $(CC) $(VL_LDFLAGS) $(LDFLAGS) -o $@ $^ $(LIBS) $(SDL_LIBS) $(COCOA_LIBS) $(VL_LIBS)
582
583 depend: $(SRCS)
584 $(CC) -MM $(CFLAGS) $(CPPFLAGS) $(BASE_CFLAGS) $^ 1>.depend
585
586 vldepend: $(VL_OBJS:.o=.c)
587 $(CC) -MM $(CFLAGS) $(CPPFLAGS) $(BASE_CFLAGS) $^ 1>.depend
588
589 # libqemu
590
591 libqemu.a: $(LIBOBJS)
592 rm -f $@
593 $(AR) rcs $@ $(LIBOBJS)
594
595 translate.o: translate.c gen-op.h opc.h cpu.h
596
597 translate-all.o: translate-all.c opc.h cpu.h
598
599 translate-op.o: translate-all.c op.h opc.h cpu.h
600
601 op.h: op.o $(DYNGEN)
602 $(DYNGEN) -o $@ $<
603
604 opc.h: op.o $(DYNGEN)
605 $(DYNGEN) -c -o $@ $<
606
607 gen-op.h: op.o $(DYNGEN)
608 $(DYNGEN) -g -o $@ $<
609
610 op.o: op.c
611 $(CC) $(OP_CFLAGS) $(CPPFLAGS) -c -o $@ $<
612
613 # HELPER_CFLAGS is used for all the code compiled with static register
614 # variables
615 ifeq ($(TARGET_BASE_ARCH), i386)
616 # XXX: rename helper.c to op_helper.c
617 helper.o: helper.c
618 $(CC) $(HELPER_CFLAGS) $(CPPFLAGS) $(BASE_CFLAGS) -c -o $@ $<
619 else
620 op_helper.o: op_helper.c
621 $(CC) $(HELPER_CFLAGS) $(CPPFLAGS) $(BASE_CFLAGS) -c -o $@ $<
622 endif
623
624 cpu-exec.o: cpu-exec.c
625 $(CC) $(HELPER_CFLAGS) $(CPPFLAGS) $(BASE_CFLAGS) -c -o $@ $<
626
627 # Note: this is a workaround. The real fix is to avoid compiling
628 # cpu_signal_handler() in cpu-exec.c.
629 signal.o: signal.c
630 $(CC) $(HELPER_CFLAGS) $(CPPFLAGS) $(BASE_CFLAGS) -c -o $@ $<
631
632 %.o: %.c
633 $(CC) $(CFLAGS) $(CPPFLAGS) $(BASE_CFLAGS) -c -o $@ $<
634
635 %.o: %.S
636 $(CC) $(CPPFLAGS) -c -o $@ $<
637
638 clean:
639 rm -f *.o *.a *~ $(PROGS) gen-op.h opc.h op.h nwfpe/*.o fpu/*.o
640 rm -f *.d */*.d
641
642 install: all
643 ifneq ($(PROGS),)
644 $(INSTALL) -m 755 -s $(PROGS) "$(DESTDIR)$(bindir)"
645 endif
646
647 ifneq ($(wildcard .depend),)
648 include .depend
649 endif
650
651 ifeq (1, 0)
652 audio.o sdlaudio.o dsoundaudio.o ossaudio.o wavaudio.o noaudio.o \
653 fmodaudio.o alsaaudio.o mixeng.o sb16.o es1370.o ac97.o gus.o adlib.o \
654 esdaudio.o audio_pt_int.o: \
655 CFLAGS := $(CFLAGS) -O0 -g -Wall -Werror -W -Wsign-compare -Wno-unused
656 endif
657
658 # Include automatically generated dependency files
659 -include $(wildcard *.d */*.d)