]> git.proxmox.com Git - mirror_qemu.git/blame - Makefile.target
Sparc host update (Ben Taylor, Martin Bochnig)
[mirror_qemu.git] / Makefile.target
CommitLineData
626df76a
FB
1include config.mak
2
0b0babc6
FB
3TARGET_BASE_ARCH:=$(TARGET_ARCH)
4ifeq ($(TARGET_ARCH), x86_64)
5TARGET_BASE_ARCH:=i386
6endif
fbe4f65b
TS
7ifeq ($(TARGET_ARCH), mips64)
8TARGET_BASE_ARCH:=mips
9endif
a2458627
FB
10ifeq ($(TARGET_ARCH), ppc64)
11TARGET_BASE_ARCH:=ppc
12endif
64b3ab24
FB
13ifeq ($(TARGET_ARCH), sparc64)
14TARGET_BASE_ARCH:=sparc
15endif
0b0babc6 16TARGET_PATH=$(SRC_PATH)/target-$(TARGET_BASE_ARCH)
85571bc7 17VPATH=$(SRC_PATH):$(TARGET_PATH):$(SRC_PATH)/hw:$(SRC_PATH)/audio
6f30fa85 18CPPFLAGS=-I. -I.. -I$(TARGET_PATH) -I$(SRC_PATH)
831b7825
TS
19ifdef CONFIG_DARWIN_USER
20VPATH+=:$(SRC_PATH)/darwin-user
21CPPFLAGS+=-I$(SRC_PATH)/darwin-user -I$(SRC_PATH)/darwin-user/$(TARGET_ARCH)
22endif
23ifdef CONFIG_LINUX_USER
3035f7ff 24VPATH+=:$(SRC_PATH)/linux-user
6f30fa85 25CPPFLAGS+=-I$(SRC_PATH)/linux-user -I$(SRC_PATH)/linux-user/$(TARGET_ARCH)
3035f7ff 26endif
6f30fa85
TS
27BASE_CFLAGS=
28BASE_LDFLAGS=
0b0babc6 29#CFLAGS+=-Werror
626df76a 30LIBS=
626df76a 31HELPER_CFLAGS=$(CFLAGS)
67b915a5 32DYNGEN=../dyngen$(EXESUF)
1e43adfc 33# user emulator name
c91fde65 34TARGET_ARCH2=$(TARGET_ARCH)
808c4954
FB
35ifeq ($(TARGET_ARCH),arm)
36 ifeq ($(TARGET_WORDS_BIGENDIAN),yes)
c91fde65 37 TARGET_ARCH2=armeb
808c4954 38 endif
c91fde65 39endif
908f52b0
PB
40ifeq ($(TARGET_ARCH),sh4)
41 ifeq ($(TARGET_WORDS_BIGENDIAN),yes)
42 TARGET_ARCH2=sh4eb
43 endif
44endif
01f5e596 45ifeq ($(TARGET_ARCH),mips)
c91fde65
FB
46 ifneq ($(TARGET_WORDS_BIGENDIAN),yes)
47 TARGET_ARCH2=mipsel
01f5e596 48 endif
01f5e596 49endif
fbe4f65b
TS
50ifeq ($(TARGET_ARCH),mips64)
51 ifneq ($(TARGET_WORDS_BIGENDIAN),yes)
52 TARGET_ARCH2=mips64el
53 endif
54endif
c91fde65 55QEMU_USER=qemu-$(TARGET_ARCH2)
1e43adfc
FB
56# system emulator name
57ifdef CONFIG_SOFTMMU
a541f297 58ifeq ($(TARGET_ARCH), i386)
67b915a5 59QEMU_SYSTEM=qemu$(EXESUF)
0db63474 60else
c91fde65 61QEMU_SYSTEM=qemu-system-$(TARGET_ARCH2)$(EXESUF)
a541f297
FB
62endif
63else
0db63474 64QEMU_SYSTEM=qemu-fast
1e43adfc
FB
65endif
66
16e9b7de 67ifdef CONFIG_USER_ONLY
1e43adfc 68PROGS=$(QEMU_USER)
16e9b7de 69else
c321f673 70PROGS+=$(QEMU_SYSTEM)
de5eaa64
FB
71ifndef CONFIG_SOFTMMU
72CONFIG_STATIC=y
73endif
728c9fd5 74endif # !CONFIG_USER_ONLY
626df76a
FB
75
76ifdef CONFIG_STATIC
6f30fa85 77BASE_LDFLAGS+=-static
626df76a
FB
78endif
79
6f30fa85 80# We require -O2 to avoid the stack setup prologue in EXIT_TB
6c041c54
TS
81OP_CFLAGS := -Wall -O2 -g -fno-strict-aliasing
82
83# cc-option
84# Usage: OP_CFLAGS+=$(call cc-option, -falign-functions=0, -malign-functions=0)
85
86cc-option = $(shell if $(CC) $(OP_CFLAGS) $(1) -S -o /dev/null -xc /dev/null \
87 > /dev/null 2>&1; then echo "$(1)"; else echo "$(2)"; fi ;)
88
89OP_CFLAGS+=$(call cc-option, -fno-reorder-blocks, "")
90OP_CFLAGS+=$(call cc-option, -fno-gcse, "")
91OP_CFLAGS+=$(call cc-option, -fno-tree-ch, "")
92OP_CFLAGS+=$(call cc-option, -fno-optimize-sibling-calls, "")
93OP_CFLAGS+=$(call cc-option, -fno-crossjumping, "")
94OP_CFLAGS+=$(call cc-option, -fno-align-labels, "")
95OP_CFLAGS+=$(call cc-option, -fno-align-jumps, "")
96OP_CFLAGS+=$(call cc-option, -fno-align-functions, $(call cc-option, -malign-functions=0, ""))
6f30fa85 97
626df76a 98ifeq ($(ARCH),i386)
6f30fa85
TS
99HELPER_CFLAGS+=-fomit-frame-pointer
100OP_CFLAGS+=-mpreferred-stack-boundary=2 -fomit-frame-pointer
626df76a 101ifdef TARGET_GPROF
3a4739d6
FB
102USE_I386_LD=y
103endif
104ifdef CONFIG_STATIC
105USE_I386_LD=y
106endif
107ifdef USE_I386_LD
6f30fa85 108BASE_LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
626df76a 109else
831b7825 110ifdef CONFIG_LINUX_USER
626df76a
FB
111# WARNING: this LDFLAGS is _very_ tricky : qemu is an ELF shared object
112# that the kernel ELF loader considers as an executable. I think this
113# is the simplest way to make it self virtualizable!
6f30fa85 114BASE_LDFLAGS+=-Wl,-shared
626df76a 115endif
626df76a 116endif
831b7825 117endif
626df76a 118
0b0babc6 119ifeq ($(ARCH),x86_64)
6f30fa85 120BASE_LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
bc51c5c9
FB
121endif
122
626df76a 123ifeq ($(ARCH),ppc)
6f30fa85 124CPPFLAGS+= -D__powerpc__
831b7825 125ifdef CONFIG_LINUX_USER
6f30fa85 126BASE_LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
626df76a 127endif
831b7825 128endif
626df76a
FB
129
130ifeq ($(ARCH),s390)
6f30fa85 131BASE_LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
626df76a
FB
132endif
133
134ifeq ($(ARCH),sparc)
3142255c
BS
135 BASE_CFLAGS+=-ffixed-g2 -ffixed-g3
136 OP_CFLAGS+=-fno-delayed-branch -ffixed-i0
137 ifeq ($(CONFIG_SOLARIS),yes)
138 OP_CFLAGS+=-fno-omit-frame-pointer
139 else
140 BASE_CFLAGS+=-ffixed-g1 -ffixed-g6
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
fdbb4691 145endif
626df76a
FB
146
147ifeq ($(ARCH),sparc64)
3142255c
BS
148 BASE_CFLAGS+=-ffixed-g1 -ffixed-g4 -ffixed-g5 -ffixed-g7
149 OP_CFLAGS+=-mcpu=ultrasparc -m64 -fno-delayed-branch -ffixed-i0
150 ifneq ($(CONFIG_SOLARIS),yes)
151 BASE_LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
152 OP_CFLAGS+=-ffixed-g1 -ffixed-g4 -ffixed-g5 -ffixed-g7
153 endif
626df76a
FB
154endif
155
156ifeq ($(ARCH),alpha)
6f30fa85
TS
157# -msmall-data is not used for OP_CFLAGS because we want two-instruction
158# relocations for the constant constructions
626df76a 159# Ensure there's only a single GP
6f30fa85
TS
160BASE_CFLAGS+=-msmall-data
161BASE_LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
626df76a
FB
162endif
163
164ifeq ($(ARCH),ia64)
6f30fa85
TS
165BASE_CFLAGS+=-mno-sdata
166OP_CFLAGS+=-mno-sdata
167BASE_LDFLAGS+=-Wl,-G0 -Wl,-T,$(SRC_PATH)/$(ARCH).ld
626df76a
FB
168endif
169
170ifeq ($(ARCH),arm)
6f30fa85
TS
171OP_CFLAGS+=-mno-sched-prolog -fno-omit-frame-pointer
172BASE_LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
626df76a
FB
173endif
174
38e584a0 175ifeq ($(ARCH),m68k)
6f30fa85
TS
176OP_CFLAGS+=-fomit-frame-pointer
177BASE_LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
178endif
179
180ifeq ($(ARCH),mips)
fbe4f65b
TS
181ifeq ($(WORDS_BIGENDIAN),yes)
182BASE_LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
183else
184BASE_LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH)el.ld
185endif
186endif
187
188ifeq ($(ARCH),mips64)
189ifeq ($(WORDS_BIGENDIAN),yes)
6f30fa85 190BASE_LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
fbe4f65b
TS
191else
192BASE_LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH)el.ld
193endif
38e584a0
FB
194endif
195
83fb7adf 196ifeq ($(CONFIG_DARWIN),yes)
e80cfcfc 197LIBS+=-lmx
83fb7adf
FB
198endif
199
01feaa05
TS
200ifdef CONFIG_DARWIN_USER
201# Leave some space for the regular program loading zone
202BASE_LDFLAGS+=-Wl,-segaddr,__STD_PROG_ZONE,0x1000 -image_base 0x0e000000
203endif
204
3142255c
BS
205BASE_CFLAGS+=$(OS_CFLAGS) $(ARCH_CFLAGS)
206BASE_LDFLAGS+=$(OS_LDFLAGS) $(ARCH_LDFLAGS)
207OP_CFLAGS+=$(OS_CFLAGS) $(ARCH_CFLAGS)
208OP_LDFLAGS+=$(OS_LDFLAGS) $(ARCH_LDFLAGS)
6f30fa85 209
626df76a
FB
210#########################################################
211
6f30fa85 212CPPFLAGS+=-D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE
626df76a 213LIBS+=-lm
b932caba
FB
214ifndef CONFIG_USER_ONLY
215LIBS+=-lz
216endif
67b915a5 217ifdef CONFIG_WIN32
3db38e87 218LIBS+=-lwinmm -lws2_32 -liphlpapi
67b915a5 219endif
ec530c81
FB
220ifdef CONFIG_SOLARIS
221LIBS+=-lsocket -lnsl -lresolv
0475a5ca
TS
222ifdef NEEDS_LIBSUNMATH
223LIBS+=-lsunmath
224LDFLAGS+=-L/opt/SUNWspro/prod/lib -R/opt/SUNWspro/prod/lib
225OP_CFLAGS+=-I/opt/SUNWspro/prod/include/cc
226BASE_CFLAGS+=-I/opt/SUNWspro/prod/include/cc
227endif
ec530c81 228endif
626df76a
FB
229
230# profiling code
231ifdef TARGET_GPROF
6f30fa85
TS
232BASE_LDFLAGS+=-p
233main.o: BASE_CFLAGS+=-p
626df76a
FB
234endif
235
831b7825 236ifdef CONFIG_LINUX_USER
e5fe0c52
PB
237OBJS= main.o syscall.o mmap.o signal.o path.o osdep.o thunk.o \
238 elfload.o linuxload.o
b5906f95 239LIBS+= $(AIOLIBS)
e5fe0c52
PB
240ifdef TARGET_HAS_BFLT
241OBJS+= flatload.o
242endif
243
626df76a
FB
244ifeq ($(TARGET_ARCH), i386)
245OBJS+= vm86.o
246endif
f72b519c 247ifeq ($(TARGET_ARCH), arm)
158142c2 248OBJS+=nwfpe/fpa11.o nwfpe/fpa11_cpdo.o \
f72b519c 249nwfpe/fpa11_cpdt.o nwfpe/fpa11_cprt.o nwfpe/fpopcode.o nwfpe/single_cpdo.o \
a4f81979 250 nwfpe/double_cpdo.o nwfpe/extended_cpdo.o arm-semi.o
f72b519c 251endif
e6e5906b
PB
252ifeq ($(TARGET_ARCH), m68k)
253OBJS+= m68k-sim.o m68k-semi.o
254endif
831b7825
TS
255endif #CONFIG_LINUX_USER
256
257ifdef CONFIG_DARWIN_USER
258OBJS= main.o commpage.o machload.o mmap.o osdep.o signal.o syscall.o thunk.o
259endif
260
626df76a
FB
261SRCS:= $(OBJS:.o=.c)
262OBJS+= libqemu.a
263
264# cpu emulator library
158142c2 265LIBOBJS=exec.o kqemu.o translate-op.o translate-all.o cpu-exec.o\
e3086fbf 266 translate.o op.o
158142c2
FB
267ifdef CONFIG_SOFTFLOAT
268LIBOBJS+=fpu/softfloat.o
269else
270LIBOBJS+=fpu/softfloat-native.o
271endif
6f30fa85 272CPPFLAGS+=-I$(SRC_PATH)/fpu
626df76a
FB
273
274ifeq ($(TARGET_ARCH), i386)
1e43adfc 275LIBOBJS+=helper.o helper2.o
f72b519c
FB
276ifeq ($(ARCH), i386)
277LIBOBJS+=translate-copy.o
278endif
626df76a
FB
279endif
280
0b0babc6
FB
281ifeq ($(TARGET_ARCH), x86_64)
282LIBOBJS+=helper.o helper2.o
283endif
284
a2458627 285ifeq ($(TARGET_BASE_ARCH), ppc)
728c9fd5 286LIBOBJS+= op_helper.o helper.o
67867308
FB
287endif
288
fbe4f65b 289ifeq ($(TARGET_BASE_ARCH), mips)
6af0bf9c
FB
290LIBOBJS+= op_helper.o helper.o
291endif
292
64b3ab24 293ifeq ($(TARGET_BASE_ARCH), sparc)
e95c8d51
FB
294LIBOBJS+= op_helper.o helper.o
295endif
296
b7bcbe95 297ifeq ($(TARGET_BASE_ARCH), arm)
b5ff1b31 298LIBOBJS+= op_helper.o helper.o
b7bcbe95
FB
299endif
300
fdf9b3e8
FB
301ifeq ($(TARGET_BASE_ARCH), sh4)
302LIBOBJS+= op_helper.o helper.o
303endif
304
e6e5906b
PB
305ifeq ($(TARGET_BASE_ARCH), m68k)
306LIBOBJS+= helper.o
307endif
308
cf6c1b16
JM
309ifeq ($(TARGET_BASE_ARCH), alpha)
310LIBOBJS+= op_helper.o helper.o alpha_palcode.o
311endif
312
626df76a
FB
313# NOTE: the disassembler code is only needed for debugging
314LIBOBJS+=disas.o
315ifeq ($(findstring i386, $(TARGET_ARCH) $(ARCH)),i386)
bc51c5c9
FB
316USE_I386_DIS=y
317endif
0b0babc6 318ifeq ($(findstring x86_64, $(TARGET_ARCH) $(ARCH)),x86_64)
bc51c5c9
FB
319USE_I386_DIS=y
320endif
321ifdef USE_I386_DIS
626df76a
FB
322LIBOBJS+=i386-dis.o
323endif
324ifeq ($(findstring alpha, $(TARGET_ARCH) $(ARCH)),alpha)
325LIBOBJS+=alpha-dis.o
326endif
a2458627 327ifeq ($(findstring ppc, $(TARGET_BASE_ARCH) $(ARCH)),ppc)
626df76a
FB
328LIBOBJS+=ppc-dis.o
329endif
fbe4f65b 330ifeq ($(findstring mips, $(TARGET_BASE_ARCH) $(ARCH)),mips)
6af0bf9c
FB
331LIBOBJS+=mips-dis.o
332endif
64b3ab24 333ifeq ($(findstring sparc, $(TARGET_BASE_ARCH) $(ARCH)),sparc)
626df76a
FB
334LIBOBJS+=sparc-dis.o
335endif
336ifeq ($(findstring arm, $(TARGET_ARCH) $(ARCH)),arm)
337LIBOBJS+=arm-dis.o
338endif
48024e4a
FB
339ifeq ($(findstring m68k, $(TARGET_ARCH) $(ARCH)),m68k)
340LIBOBJS+=m68k-dis.o
341endif
fdf9b3e8
FB
342ifeq ($(findstring sh4, $(TARGET_ARCH) $(ARCH)),sh4)
343LIBOBJS+=sh4-dis.o
344endif
626df76a 345
1fddef4b
FB
346ifdef CONFIG_GDBSTUB
347OBJS+=gdbstub.o
348endif
626df76a 349
1e43adfc 350all: $(PROGS)
626df76a 351
1e43adfc 352$(QEMU_USER): $(OBJS)
6f30fa85 353 $(CC) $(LDFLAGS) $(BASE_LDFLAGS) -o $@ $^ $(LIBS)
626df76a
FB
354ifeq ($(ARCH),alpha)
355# Mark as 32 bit binary, i. e. it will be mapped into the low 31 bit of
356# the address space (31 bit so sign extending doesn't matter)
357 echo -ne '\001\000\000\000' | dd of=qemu bs=1 seek=48 count=4 conv=notrunc
358endif
359
360# must use static linking to avoid leaving stuff in virtual address space
aef445bd 361VL_OBJS=vl.o osdep.o readline.o monitor.o pci.o console.o loader.o isa_mmio.o
18607dcb 362VL_OBJS+=cutils.o
83f64091 363VL_OBJS+=block.o block-raw.o
42ca6388 364VL_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
d537cf6c 365VL_OBJS+=irq.o
7fb843f8
FB
366ifdef CONFIG_WIN32
367VL_OBJS+=tap-win32.o
368endif
a541f297 369
1d14ffa9 370SOUND_HW = sb16.o es1370.o
7372f88d 371AUDIODRV = audio.o noaudio.o wavaudio.o
fb065187
FB
372ifdef CONFIG_SDL
373AUDIODRV += sdlaudio.o
374endif
375ifdef CONFIG_OSS
376AUDIODRV += ossaudio.o
377endif
1d14ffa9
FB
378ifdef CONFIG_COREAUDIO
379AUDIODRV += coreaudio.o
380endif
381ifdef CONFIG_ALSA
382AUDIODRV += alsaaudio.o
383LIBS += -lasound
384endif
385ifdef CONFIG_DSOUND
386AUDIODRV += dsoundaudio.o
387LIBS += -lole32 -ldxguid
85571bc7 388endif
102a52e4 389ifdef CONFIG_FMOD
85571bc7 390AUDIODRV += fmodaudio.o
6f30fa85 391audio.o fmodaudio.o: CPPFLAGS := -I$(CONFIG_FMOD_INC) $(CPPFLAGS)
102a52e4 392LIBS += $(CONFIG_FMOD_LIB)
85571bc7 393endif
1d14ffa9
FB
394ifdef CONFIG_ADLIB
395SOUND_HW += fmopl.o adlib.o
396endif
ec36b695 397AUDIODRV+= wavcapture.o
85571bc7 398
2e5d83bb 399# SCSI layer
7d8406be 400VL_OBJS+= scsi-disk.o cdrom.o lsi53c895a.o
2e5d83bb 401
a594cfbf 402# USB layer
2e5d83bb 403VL_OBJS+= usb.o usb-hub.o usb-linux.o usb-hid.o usb-ohci.o usb-msd.o
a594cfbf 404
663e8e51
TS
405# EEPROM emulation
406VL_OBJS += eeprom93xx.o
407
a41b2ff2 408# PCI network cards
663e8e51
TS
409VL_OBJS += eepro100.o
410VL_OBJS += ne2000.o
411VL_OBJS += pcnet.o
412VL_OBJS += rtl8139.o
a41b2ff2 413
0b0babc6 414ifeq ($(TARGET_BASE_ARCH), i386)
a541f297 415# Hardware support
a41b2ff2 416VL_OBJS+= ide.o pckbd.o ps2.o vga.o $(SOUND_HW) dma.o $(AUDIODRV)
fd06c375 417VL_OBJS+= fdc.o mc146818rtc.o serial.o i8259.o i8254.o pcspk.o pc.o
502a5395 418VL_OBJS+= cirrus_vga.o mixeng.o apic.o parallel.o acpi.o piix_pci.o
d34cab9f 419VL_OBJS+= usb-uhci.o smbus_eeprom.o vmmouse.o vmware_vga.o
6f30fa85 420CPPFLAGS += -DHAS_AUDIO
67b915a5 421endif
a2458627 422ifeq ($(TARGET_BASE_ARCH), ppc)
a41b2ff2 423VL_OBJS+= ppc.o ide.o pckbd.o ps2.o vga.o $(SOUND_HW) dma.o $(AUDIODRV)
64201201 424VL_OBJS+= mc146818rtc.o serial.o i8259.o i8254.o fdc.o m48t59.o
e68b9b2b 425VL_OBJS+= ppc_prep.o ppc_chrp.o cuda.o adb.o openpic.o heathrow_pic.o mixeng.o
502a5395 426VL_OBJS+= grackle_pci.o prep_pci.o unin_pci.o
6f30fa85 427CPPFLAGS += -DHAS_AUDIO
a541f297 428endif
fbe4f65b 429ifeq ($(TARGET_BASE_ARCH), mips)
ad6fe1d2
TS
430VL_OBJS+= mips_r4k.o mips_malta.o mips_pica61.o
431VL_OBJS+= mips_timer.o mips_int.o dma.o vga.o serial.o i8254.o i8259.o
9542611a 432VL_OBJS+= ide.o gt64xxx.o pckbd.o ps2.o fdc.o mc146818rtc.o usb-uhci.o acpi.o ds1225y.o
5856de80 433VL_OBJS+= piix_pci.o parallel.o mixeng.o cirrus_vga.o $(SOUND_HW) $(AUDIODRV)
83b1fb88 434CPPFLAGS += -DHAS_AUDIO
6af0bf9c 435endif
64b3ab24 436ifeq ($(TARGET_BASE_ARCH), sparc)
3475187d 437ifeq ($(TARGET_ARCH), sparc64)
502a5395 438VL_OBJS+= sun4u.o ide.o pckbd.o ps2.o vga.o apb_pci.o
83469015
FB
439VL_OBJS+= fdc.o mc146818rtc.o serial.o m48t59.o
440VL_OBJS+= cirrus_vga.o parallel.o
3475187d 441else
67e999be
FB
442VL_OBJS+= sun4m.o tcx.o pcnet.o iommu.o m48t59.o slavio_intctl.o
443VL_OBJS+= slavio_timer.o slavio_serial.o slavio_misc.o fdc.o esp.o sparc32_dma.o
b8174937 444VL_OBJS+= cs4231.o
3475187d 445endif
e95c8d51 446endif
b5ff1b31 447ifeq ($(TARGET_BASE_ARCH), arm)
cdbdb648 448VL_OBJS+= integratorcp.o versatilepb.o ps2.o smc91c111.o arm_pic.o arm_timer.o
a1bb27b1
PB
449VL_OBJS+= arm_boot.o pl011.o pl050.o pl080.o pl110.o pl181.o pl190.o
450VL_OBJS+= versatile_pci.o sd.o
e69954b9 451VL_OBJS+= arm_gic.o realview.o arm_sysctl.o
8e71621f 452VL_OBJS+= arm-semi.o
b5ff1b31 453endif
fdf9b3e8
FB
454ifeq ($(TARGET_BASE_ARCH), sh4)
455VL_OBJS+= shix.o sh7750.o sh7750_regnames.o tc58128.o
456endif
a541f297
FB
457ifdef CONFIG_GDBSTUB
458VL_OBJS+=gdbstub.o
728c9fd5 459endif
626df76a 460ifdef CONFIG_SDL
6070dd07 461VL_OBJS+=sdl.o x_keymap.o
de5eaa64 462endif
24236869 463VL_OBJS+=vnc.o
5b0753e0
FB
464ifdef CONFIG_COCOA
465VL_OBJS+=cocoa.o
1d14ffa9
FB
466COCOA_LIBS=-F/System/Library/Frameworks -framework Cocoa -framework IOKit
467ifdef CONFIG_COREAUDIO
468COCOA_LIBS+=-framework CoreAudio
469endif
5b0753e0 470endif
7c1f25b4 471ifdef CONFIG_SLIRP
6f30fa85 472CPPFLAGS+=-I$(SRC_PATH)/slirp
7c1f25b4
FB
473SLIRP_OBJS=cksum.o if.o ip_icmp.o ip_input.o ip_output.o \
474slirp.o mbuf.o misc.o sbuf.o socket.o tcp_input.o tcp_output.o \
c7f74643 475tcp_subr.o tcp_timer.o udp.o bootp.o debug.o tftp.o
7c1f25b4 476VL_OBJS+=$(addprefix slirp/, $(SLIRP_OBJS))
626df76a
FB
477endif
478
c321f673 479VL_LDFLAGS=
70956b77 480VL_LIBS=$(AIOLIBS)
c321f673 481# specific flags are needed for non soft mmu emulator
c321f673
FB
482ifdef CONFIG_STATIC
483VL_LDFLAGS+=-static
484endif
de5eaa64
FB
485ifndef CONFIG_SOFTMMU
486VL_LDFLAGS+=-Wl,-T,$(SRC_PATH)/i386-vl.ld
487endif
83fb7adf 488ifndef CONFIG_DARWIN
11d9f695 489ifndef CONFIG_WIN32
ec530c81 490ifndef CONFIG_SOLARIS
70956b77 491VL_LIBS+=-lutil
11d9f695 492endif
83fb7adf 493endif
ec530c81 494endif
e3086fbf 495ifdef TARGET_GPROF
6f30fa85 496vl.o: BASE_CFLAGS+=-p
e3086fbf
FB
497VL_LDFLAGS+=-p
498endif
c321f673 499
b8076a74
FB
500ifeq ($(ARCH),ia64)
501VL_LDFLAGS+=-Wl,-G0 -Wl,-T,$(SRC_PATH)/ia64.ld
502endif
503
74ccb34e 504ifeq ($(ARCH),sparc64)
3142255c
BS
505 VL_LDFLAGS+=-m64
506 ifneq ($(CONFIG_SOLARIS),yes)
507 VL_LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
508 endif
74ccb34e
FB
509endif
510
1d14ffa9
FB
511ifdef CONFIG_WIN32
512SDL_LIBS := $(filter-out -mwindows, $(SDL_LIBS)) -mconsole
513endif
514
1e43adfc 515$(QEMU_SYSTEM): $(VL_OBJS) libqemu.a
3a11702b 516 $(CC) $(VL_LDFLAGS) $(LDFLAGS) -o $@ $^ $(LIBS) $(SDL_LIBS) $(COCOA_LIBS) $(VL_LIBS)
5b0753e0
FB
517
518cocoa.o: cocoa.m
6f30fa85 519 $(CC) $(CFLAGS) $(CPPFLAGS) $(BASE_CFLAGS) -c -o $@ $<
626df76a 520
3d11d0eb 521sdl.o: sdl.c keymaps.c sdl_keysym.h
6f30fa85 522 $(CC) $(CFLAGS) $(CPPFLAGS) $(SDL_CFLAGS) $(BASE_CFLAGS) -c -o $@ $<
626df76a 523
24236869 524vnc.o: vnc.c keymaps.c sdl_keysym.h vnchextile.h
6f30fa85 525 $(CC) $(CFLAGS) $(CPPFLAGS) $(BASE_CFLAGS) -c -o $@ $<
24236869 526
9f059eca 527sdlaudio.o: sdlaudio.c
6f30fa85 528 $(CC) $(CFLAGS) $(CPPFLAGS) $(SDL_CFLAGS) $(BASE_CFLAGS) -c -o $@ $<
9f059eca 529
626df76a 530depend: $(SRCS)
6f30fa85 531 $(CC) -MM $(CFLAGS) $(CPPFLAGS) $(BASE_CFLAGS) $^ 1>.depend
626df76a 532
1d14ffa9 533vldepend: $(VL_OBJS:.o=.c)
6f30fa85 534 $(CC) -MM $(CFLAGS) $(CPPFLAGS) $(BASE_CFLAGS) $^ 1>.depend
1d14ffa9 535
626df76a
FB
536# libqemu
537
538libqemu.a: $(LIBOBJS)
539 rm -f $@
540 $(AR) rcs $@ $(LIBOBJS)
541
1e43adfc 542translate.o: translate.c gen-op.h opc.h cpu.h
626df76a 543
158142c2
FB
544translate-all.o: translate-all.c opc.h cpu.h
545
546translate-op.o: translate-all.c op.h opc.h cpu.h
626df76a 547
1e43adfc 548op.h: op.o $(DYNGEN)
626df76a
FB
549 $(DYNGEN) -o $@ $<
550
1e43adfc 551opc.h: op.o $(DYNGEN)
626df76a
FB
552 $(DYNGEN) -c -o $@ $<
553
1e43adfc 554gen-op.h: op.o $(DYNGEN)
626df76a
FB
555 $(DYNGEN) -g -o $@ $<
556
1e43adfc 557op.o: op.c
6f30fa85 558 $(CC) $(OP_CFLAGS) $(CPPFLAGS) -c -o $@ $<
626df76a 559
6e1b3e4d
FB
560# HELPER_CFLAGS is used for all the code compiled with static register
561# variables
562ifeq ($(TARGET_BASE_ARCH), i386)
563# XXX: rename helper.c to op_helper.c
1e43adfc 564helper.o: helper.c
6f30fa85 565 $(CC) $(HELPER_CFLAGS) $(CPPFLAGS) $(BASE_CFLAGS) -c -o $@ $<
6e1b3e4d
FB
566else
567op_helper.o: op_helper.c
6f30fa85 568 $(CC) $(HELPER_CFLAGS) $(CPPFLAGS) $(BASE_CFLAGS) -c -o $@ $<
6e1b3e4d
FB
569endif
570
571cpu-exec.o: cpu-exec.c
6f30fa85 572 $(CC) $(HELPER_CFLAGS) $(CPPFLAGS) $(BASE_CFLAGS) -c -o $@ $<
626df76a 573
00a67ba1
FB
574# Note: this is a workaround. The real fix is to avoid compiling
575# cpu_signal_handler() in cpu-exec.c.
576signal.o: signal.c
6f30fa85 577 $(CC) $(HELPER_CFLAGS) $(CPPFLAGS) $(BASE_CFLAGS) -c -o $@ $<
00a67ba1 578
0b0babc6 579ifeq ($(TARGET_BASE_ARCH), i386)
664e0f19 580op.o: op.c opreg_template.h ops_template.h ops_template_mem.h ops_mem.h ops_sse.h
1e43adfc
FB
581endif
582
583ifeq ($(TARGET_ARCH), arm)
584op.o: op.c op_template.h
bdd5003a 585pl110.o: pl110_template.h
1e43adfc 586endif
626df76a 587
64b3ab24 588ifeq ($(TARGET_BASE_ARCH), sparc)
3475187d
FB
589op.o: op.c op_template.h op_mem.h fop_template.h fbranch_template.h
590magic_load.o: elf_op.h
1e43adfc 591endif
626df76a 592
a2458627 593ifeq ($(TARGET_BASE_ARCH), ppc)
728c9fd5
FB
594op.o: op.c op_template.h op_mem.h
595op_helper.o: op_helper_mem.h
3fc6c082 596translate.o: translate.c translate_init.c
728c9fd5
FB
597endif
598
fbe4f65b
TS
599ifeq ($(TARGET_BASE_ARCH), mips)
600helper.o: cpu.h exec-all.h
601op.o: op_template.c fop_template.c op_mem.c exec.h
602op_helper.o: op_helper_mem.c exec.h softmmu_template.h
603translate.o: translate_init.c exec-all.h disas.h
6af0bf9c
FB
604endif
605
5fe141fd
FB
606loader.o: loader.c elf_ops.h
607
fdf9b3e8
FB
608ifeq ($(TARGET_ARCH), sh4)
609op.o: op.c op_mem.c cpu.h
610op_helper.o: op_helper.c exec.h cpu.h
611helper.o: helper.c exec.h cpu.h
27c7ca7e
FB
612sh7750.o: sh7750.c sh7750_regs.h sh7750_regnames.h cpu.h
613shix.o: shix.c sh7750_regs.h sh7750_regnames.h
fdf9b3e8 614sh7750_regnames.o: sh7750_regnames.c sh7750_regnames.h sh7750_regs.h
27c7ca7e 615tc58128.o: tc58128.c
fdf9b3e8
FB
616endif
617
cf6c1b16
JM
618ifeq ($(TARGET_BASE_ARCH), alpha)
619op.o: op.c op_template.h op_mem.h
620op_helper.o: op_helper_mem.h
621endif
622
214feb51
PB
623$(OBJS) $(LIBOBJS) $(VL_OBJS): config.h ../config-host.h
624
626df76a 625%.o: %.c
6f30fa85 626 $(CC) $(CFLAGS) $(CPPFLAGS) $(BASE_CFLAGS) -c -o $@ $<
626df76a 627
f72b519c 628%.o: %.S
6f30fa85 629 $(CC) $(CPPFLAGS) -c -o $@ $<
f72b519c 630
626df76a 631clean:
e362b55a 632 rm -f *.o *.a *~ $(PROGS) gen-op.h opc.h op.h nwfpe/*.o slirp/*.o fpu/*.o
1e43adfc
FB
633
634install: all
9b14bb04 635ifneq ($(PROGS),)
6a882643 636 $(INSTALL) -m 755 -s $(PROGS) "$(DESTDIR)$(bindir)"
9b14bb04 637endif
626df76a
FB
638
639ifneq ($(wildcard .depend),)
640include .depend
641endif
1d14ffa9 642
c0fe3827 643ifeq (1, 0)
1d14ffa9 644audio.o sdlaudio.o dsoundaudio.o ossaudio.o wavaudio.o noaudio.o \
c0fe3827 645fmodaudio.o alsaaudio.o mixeng.o sb16.o es1370.o gus.o adlib.o: \
1d14ffa9
FB
646CFLAGS := $(CFLAGS) -Wall -Werror -W -Wsign-compare
647endif