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