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