]> git.proxmox.com Git - mirror_qemu.git/blame - Makefile.target
Consolidate compiler invocations (Avi Kivity)
[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
540635ba
TS
7ifeq ($(TARGET_ARCH), mipsn32)
8TARGET_BASE_ARCH:=mips
9endif
fbe4f65b
TS
10ifeq ($(TARGET_ARCH), mips64)
11TARGET_BASE_ARCH:=mips
12endif
a2458627
FB
13ifeq ($(TARGET_ARCH), ppc64)
14TARGET_BASE_ARCH:=ppc
15endif
22f8a8b3
JM
16ifeq ($(TARGET_ARCH), ppc64h)
17TARGET_BASE_ARCH:=ppc
18endif
d4082e95
JM
19ifeq ($(TARGET_ARCH), ppcemb)
20TARGET_BASE_ARCH:=ppc
21endif
64b3ab24
FB
22ifeq ($(TARGET_ARCH), sparc64)
23TARGET_BASE_ARCH:=sparc
24endif
0b0babc6 25TARGET_PATH=$(SRC_PATH)/target-$(TARGET_BASE_ARCH)
4fb240a4 26VPATH=$(SRC_PATH):$(TARGET_PATH):$(SRC_PATH)/hw
46dc3881 27CPPFLAGS=-I. -I.. -I$(TARGET_PATH) -I$(SRC_PATH) -MMD -MT $@ -MP -DNEED_CPU_H
0b0babc6 28#CFLAGS+=-Werror
626df76a 29LIBS=
1e43adfc 30# user emulator name
0c64b9cd 31ifndef TARGET_ARCH2
c91fde65 32TARGET_ARCH2=$(TARGET_ARCH)
0c64b9cd 33endif
808c4954
FB
34ifeq ($(TARGET_ARCH),arm)
35 ifeq ($(TARGET_WORDS_BIGENDIAN),yes)
c91fde65 36 TARGET_ARCH2=armeb
808c4954 37 endif
c91fde65 38endif
908f52b0
PB
39ifeq ($(TARGET_ARCH),sh4)
40 ifeq ($(TARGET_WORDS_BIGENDIAN),yes)
41 TARGET_ARCH2=sh4eb
42 endif
43endif
01f5e596 44ifeq ($(TARGET_ARCH),mips)
c91fde65
FB
45 ifneq ($(TARGET_WORDS_BIGENDIAN),yes)
46 TARGET_ARCH2=mipsel
01f5e596 47 endif
01f5e596 48endif
540635ba
TS
49ifeq ($(TARGET_ARCH),mipsn32)
50 ifneq ($(TARGET_WORDS_BIGENDIAN),yes)
51 TARGET_ARCH2=mipsn32el
52 endif
53endif
fbe4f65b
TS
54ifeq ($(TARGET_ARCH),mips64)
55 ifneq ($(TARGET_WORDS_BIGENDIAN),yes)
56 TARGET_ARCH2=mips64el
57 endif
58endif
40293e58
FB
59
60ifdef CONFIG_USER_ONLY
61# user emulator name
62QEMU_PROG=qemu-$(TARGET_ARCH2)
63else
1e43adfc 64# system emulator name
a541f297 65ifeq ($(TARGET_ARCH), i386)
40293e58 66QEMU_PROG=qemu$(EXESUF)
0db63474 67else
40293e58 68QEMU_PROG=qemu-system-$(TARGET_ARCH2)$(EXESUF)
a541f297 69endif
de5eaa64 70endif
626df76a 71
40293e58 72PROGS=$(QEMU_PROG)
626df76a 73
6c041c54 74# cc-option
c7328801 75# Usage: CFLAGS+=$(call cc-option, $(CFLAGS), -falign-functions=0, -malign-functions=0)
6c041c54 76
c7328801
AL
77cc-option = $(shell if $(CC) $(1) $(2) -S -o /dev/null -xc /dev/null \
78 > /dev/null 2>&1; then echo "$(2)"; else echo "$(3)"; fi ;)
6f30fa85 79
40293e58
FB
80HELPER_CFLAGS=
81
626df76a 82ifeq ($(ARCH),i386)
6f30fa85 83HELPER_CFLAGS+=-fomit-frame-pointer
bc51c5c9
FB
84endif
85
626df76a 86ifeq ($(ARCH),sparc)
40293e58 87 CFLAGS+=-ffixed-g2 -ffixed-g3
c7328801 88 ifneq ($(CONFIG_SOLARIS),yes)
40293e58
FB
89 CFLAGS+=-ffixed-g1 -ffixed-g6
90 HELPER_CFLAGS+=-ffixed-i0
3142255c 91 endif
fdbb4691 92endif
626df76a
FB
93
94ifeq ($(ARCH),sparc64)
3142255c 95 ifneq ($(CONFIG_SOLARIS),yes)
e97b640d 96 CFLAGS+=-ffixed-g5 -ffixed-g6 -ffixed-g7
e97b640d
BS
97 else
98 CFLAGS+=-ffixed-g1 -ffixed-g4 -ffixed-g5 -ffixed-g7
3142255c 99 endif
626df76a
FB
100endif
101
102ifeq ($(ARCH),alpha)
626df76a 103# Ensure there's only a single GP
40293e58 104CFLAGS+=-msmall-data
626df76a
FB
105endif
106
f54b3f92 107ifeq ($(ARCH),hppa)
f54b3f92
AJ
108BASE_LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
109endif
110
626df76a 111ifeq ($(ARCH),ia64)
40293e58 112CFLAGS+=-mno-sdata
83fb7adf
FB
113endif
114
40293e58
FB
115CFLAGS+=$(OS_CFLAGS) $(ARCH_CFLAGS)
116LDFLAGS+=$(OS_LDFLAGS) $(ARCH_LDFLAGS)
626df76a 117
6f30fa85 118CPPFLAGS+=-D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE
626df76a 119LIBS+=-lm
67b915a5 120ifdef CONFIG_WIN32
3db38e87 121LIBS+=-lwinmm -lws2_32 -liphlpapi
67b915a5 122endif
ec530c81
FB
123ifdef CONFIG_SOLARIS
124LIBS+=-lsocket -lnsl -lresolv
0475a5ca
TS
125ifdef NEEDS_LIBSUNMATH
126LIBS+=-lsunmath
127LDFLAGS+=-L/opt/SUNWspro/prod/lib -R/opt/SUNWspro/prod/lib
40293e58 128CFLAGS+=-I/opt/SUNWspro/prod/include/cc
f72b519c 129endif
831b7825
TS
130endif
131
7ba1e619
AL
132kvm.o: CFLAGS+=$(KVM_CFLAGS)
133kvm-all.o: CFLAGS+=$(KVM_CFLAGS)
134
40293e58 135all: $(PROGS)
626df76a 136
40293e58 137#########################################################
626df76a 138# cpu emulator library
57fec1fe 139LIBOBJS=exec.o kqemu.o translate-all.o cpu-exec.o\
cf2be984 140 translate.o host-utils.o
57fec1fe 141# TCG code generator
49516bc0 142LIBOBJS+= tcg/tcg.o tcg/tcg-runtime.o
57fec1fe 143CPPFLAGS+=-I$(SRC_PATH)/tcg -I$(SRC_PATH)/tcg/$(ARCH)
8289b279
BS
144ifeq ($(ARCH),sparc64)
145CPPFLAGS+=-I$(SRC_PATH)/tcg/sparc
146endif
158142c2
FB
147ifdef CONFIG_SOFTFLOAT
148LIBOBJS+=fpu/softfloat.o
149else
150LIBOBJS+=fpu/softfloat-native.o
151endif
6f30fa85 152CPPFLAGS+=-I$(SRC_PATH)/fpu
e95c8d51 153LIBOBJS+= op_helper.o helper.o
e95c8d51 154
b7bcbe95 155ifeq ($(TARGET_BASE_ARCH), arm)
eaa728ee 156LIBOBJS+= neon_helper.o iwmmxt_helper.o
e6e5906b
PB
157endif
158
cf6c1b16 159ifeq ($(TARGET_BASE_ARCH), alpha)
eaa728ee 160LIBOBJS+= alpha_palcode.o
cf6c1b16
JM
161endif
162
e7daa605 163ifeq ($(TARGET_BASE_ARCH), cris)
e7daa605
TS
164LIBOBJS+= cris-dis.o
165
166ifndef CONFIG_USER_ONLY
167LIBOBJS+= mmu.o
168endif
169endif
170
626df76a 171# NOTE: the disassembler code is only needed for debugging
5fafdf24 172LIBOBJS+=disas.o
626df76a 173ifeq ($(findstring i386, $(TARGET_ARCH) $(ARCH)),i386)
bc51c5c9
FB
174USE_I386_DIS=y
175endif
0b0babc6 176ifeq ($(findstring x86_64, $(TARGET_ARCH) $(ARCH)),x86_64)
bc51c5c9
FB
177USE_I386_DIS=y
178endif
179ifdef USE_I386_DIS
626df76a
FB
180LIBOBJS+=i386-dis.o
181endif
182ifeq ($(findstring alpha, $(TARGET_ARCH) $(ARCH)),alpha)
183LIBOBJS+=alpha-dis.o
184endif
a2458627 185ifeq ($(findstring ppc, $(TARGET_BASE_ARCH) $(ARCH)),ppc)
626df76a
FB
186LIBOBJS+=ppc-dis.o
187endif
fbe4f65b 188ifeq ($(findstring mips, $(TARGET_BASE_ARCH) $(ARCH)),mips)
6af0bf9c
FB
189LIBOBJS+=mips-dis.o
190endif
64b3ab24 191ifeq ($(findstring sparc, $(TARGET_BASE_ARCH) $(ARCH)),sparc)
626df76a
FB
192LIBOBJS+=sparc-dis.o
193endif
194ifeq ($(findstring arm, $(TARGET_ARCH) $(ARCH)),arm)
195LIBOBJS+=arm-dis.o
196endif
48024e4a
FB
197ifeq ($(findstring m68k, $(TARGET_ARCH) $(ARCH)),m68k)
198LIBOBJS+=m68k-dis.o
199endif
fdf9b3e8
FB
200ifeq ($(findstring sh4, $(TARGET_ARCH) $(ARCH)),sh4)
201LIBOBJS+=sh4-dis.o
202endif
f54b3f92
AJ
203ifeq ($(findstring hppa, $(TARGET_BASE_ARCH) $(ARCH)),hppa)
204LIBOBJS+=hppa-dis.o
205endif
8f860bb8
TS
206ifeq ($(findstring s390, $(TARGET_ARCH) $(ARCH)),s390)
207LIBOBJS+=s390-dis.o
208endif
626df76a 209
40293e58
FB
210# libqemu
211
212libqemu.a: $(LIBOBJS)
213 rm -f $@
214 $(AR) rcs $@ $(LIBOBJS)
215
86e840ee 216translate.o: translate.c cpu.h
40293e58 217
86e840ee 218translate-all.o: translate-all.c cpu.h
40293e58 219
86e840ee 220tcg/tcg.o: cpu.h
40293e58
FB
221
222# HELPER_CFLAGS is used for all the code compiled with static register
223# variables
807544e2 224op_helper.o: CFLAGS += $(HELPER_CFLAGS) $(I386_CFLAGS)
40293e58 225
807544e2 226cpu-exec.o: CFLAGS += $(HELPER_CFLAGS)
40293e58
FB
227
228#########################################################
229# Linux user emulator target
230
231ifdef CONFIG_LINUX_USER
232
40293e58
FB
233ifndef TARGET_ABI_DIR
234 TARGET_ABI_DIR=$(TARGET_ARCH)
235endif
3ebdd119 236VPATH+=:$(SRC_PATH)/linux-user:$(SRC_PATH)/linux-user/$(TARGET_ABI_DIR)
40293e58
FB
237CPPFLAGS+=-I$(SRC_PATH)/linux-user -I$(SRC_PATH)/linux-user/$(TARGET_ABI_DIR)
238
239ifdef CONFIG_STATIC
240LDFLAGS+=-static
241endif
242
243ifeq ($(ARCH),i386)
244ifdef TARGET_GPROF
245USE_I386_LD=y
246endif
247ifdef CONFIG_STATIC
248USE_I386_LD=y
249endif
250ifdef USE_I386_LD
251LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
252else
253# WARNING: this LDFLAGS is _very_ tricky : qemu is an ELF shared object
254# that the kernel ELF loader considers as an executable. I think this
255# is the simplest way to make it self virtualizable!
256LDFLAGS+=-Wl,-shared
257endif
258endif
259
260ifeq ($(ARCH),x86_64)
261LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
262endif
263
264ifeq ($(ARCH),ppc)
265LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
266endif
267
810260a8 268ifeq ($(ARCH),ppc64)
269LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
270endif
271
40293e58
FB
272ifeq ($(ARCH),s390)
273LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
274endif
275
276ifeq ($(ARCH),sparc)
277# -static is used to avoid g1/g3 usage by the dynamic linker
278LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld -static
279endif
280
281ifeq ($(ARCH),sparc64)
282LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
283endif
284
285ifeq ($(ARCH),alpha)
286LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
287endif
288
289ifeq ($(ARCH),ia64)
290LDFLAGS+=-Wl,-G0 -Wl,-T,$(SRC_PATH)/$(ARCH).ld
291endif
292
293ifeq ($(ARCH),arm)
294LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
295endif
296
297ifeq ($(ARCH),m68k)
298LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
299endif
300
301ifeq ($(ARCH),mips)
302ifeq ($(WORDS_BIGENDIAN),yes)
303LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
304else
305LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH)el.ld
306endif
307endif
308
309ifeq ($(ARCH),mips64)
310ifeq ($(WORDS_BIGENDIAN),yes)
311LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
312else
313LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH)el.ld
314endif
315endif
316
6d946cda
AJ
317# profiling code
318ifdef TARGET_GPROF
319LDFLAGS+=-p
320CFLAGS+=-p
321endif
322
17e2377a 323OBJS= main.o syscall.o strace.o mmap.o signal.o path.o thunk.o \
40293e58
FB
324 elfload.o linuxload.o uaccess.o
325LIBS+= $(AIOLIBS)
326ifdef TARGET_HAS_BFLT
327OBJS+= flatload.o
328endif
329ifdef TARGET_HAS_ELFLOAD32
330OBJS+= elfload32.o
331elfload32.o: elfload.c
332endif
333
334ifeq ($(TARGET_ARCH), i386)
335OBJS+= vm86.o
336endif
337ifeq ($(TARGET_ARCH), arm)
338OBJS+=nwfpe/fpa11.o nwfpe/fpa11_cpdo.o \
339nwfpe/fpa11_cpdt.o nwfpe/fpa11_cprt.o nwfpe/fpopcode.o nwfpe/single_cpdo.o \
340 nwfpe/double_cpdo.o nwfpe/extended_cpdo.o arm-semi.o
341endif
342ifeq ($(TARGET_ARCH), m68k)
343OBJS+= m68k-sim.o m68k-semi.o
344endif
345
1fddef4b 346ifdef CONFIG_GDBSTUB
56aebc89 347OBJS+=gdbstub.o gdbstub-xml.o
1fddef4b 348endif
626df76a 349
40293e58
FB
350OBJS+= libqemu.a
351
352# Note: this is a workaround. The real fix is to avoid compiling
353# cpu_signal_handler() in cpu-exec.c.
807544e2 354signal.o: CFLAGS += $(HELPER_CFLAGS)
626df76a 355
cec7d0b6 356$(QEMU_PROG): $(OBJS) ../libqemu_user.a
40293e58 357 $(CC) $(LDFLAGS) -o $@ $^ $(LIBS)
626df76a
FB
358ifeq ($(ARCH),alpha)
359# Mark as 32 bit binary, i. e. it will be mapped into the low 31 bit of
360# the address space (31 bit so sign extending doesn't matter)
361 echo -ne '\001\000\000\000' | dd of=qemu bs=1 seek=48 count=4 conv=notrunc
362endif
363
40293e58
FB
364endif #CONFIG_LINUX_USER
365
366#########################################################
367# Darwin user emulator target
368
369ifdef CONFIG_DARWIN_USER
370
371VPATH+=:$(SRC_PATH)/darwin-user
372CPPFLAGS+=-I$(SRC_PATH)/darwin-user -I$(SRC_PATH)/darwin-user/$(TARGET_ARCH)
373
374# Leave some space for the regular program loading zone
375LDFLAGS+=-Wl,-segaddr,__STD_PROG_ZONE,0x1000 -image_base 0x0e000000
376
377LIBS+=-lmx
378
17e2377a 379OBJS= main.o commpage.o machload.o mmap.o signal.o syscall.o thunk.o
40293e58
FB
380
381OBJS+= libqemu.a
382
383ifdef CONFIG_GDBSTUB
56aebc89 384OBJS+=gdbstub.o gdbstub-xml.o
40293e58
FB
385endif
386
387# Note: this is a workaround. The real fix is to avoid compiling
388# cpu_signal_handler() in cpu-exec.c.
807544e2 389signal.o: CFLAGS += $(HELPER_CFLAGS)
40293e58
FB
390
391$(QEMU_PROG): $(OBJS)
392 $(CC) $(LDFLAGS) -o $@ $^ $(LIBS)
393
394endif #CONFIG_DARWIN_USER
395
84778508
BS
396#########################################################
397# BSD user emulator target
398
399ifdef CONFIG_BSD_USER
400
401VPATH+=:$(SRC_PATH)/bsd-user
402CPPFLAGS+=-I$(SRC_PATH)/bsd-user -I$(SRC_PATH)/bsd-user/$(TARGET_ARCH)
403
404ifdef CONFIG_STATIC
405LDFLAGS+=-static
406endif
407
408ifeq ($(ARCH),i386)
409ifdef TARGET_GPROF
410USE_I386_LD=y
411endif
412ifdef CONFIG_STATIC
413USE_I386_LD=y
414endif
415ifdef USE_I386_LD
416LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
417else
418# WARNING: this LDFLAGS is _very_ tricky : qemu is an ELF shared object
419# that the kernel ELF loader considers as an executable. I think this
420# is the simplest way to make it self virtualizable!
421LDFLAGS+=-Wl,-shared
422endif
423endif
424
425ifeq ($(ARCH),x86_64)
426LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
427endif
428
429ifeq ($(ARCH),ppc)
430LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
431endif
432
433ifeq ($(ARCH),ppc64)
434LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
435endif
436
437ifeq ($(ARCH),s390)
438LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
439endif
440
441ifeq ($(ARCH),sparc)
442# -static is used to avoid g1/g3 usage by the dynamic linker
443LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld -static
444endif
445
446ifeq ($(ARCH),sparc64)
447LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
448endif
449
450ifeq ($(ARCH),alpha)
451LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
452endif
453
454ifeq ($(ARCH),ia64)
455LDFLAGS+=-Wl,-G0 -Wl,-T,$(SRC_PATH)/$(ARCH).ld
456endif
457
458ifeq ($(ARCH),arm)
459LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
460endif
461
462ifeq ($(ARCH),m68k)
463LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
464endif
465
466ifeq ($(ARCH),mips)
467ifeq ($(WORDS_BIGENDIAN),yes)
468LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
469else
470LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH)el.ld
471endif
472endif
473
474ifeq ($(ARCH),mips64)
475ifeq ($(WORDS_BIGENDIAN),yes)
476LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
477else
478LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH)el.ld
479endif
480endif
481
482OBJS= main.o bsdload.o elfload.o mmap.o path.o signal.o strace.o syscall.o
483OBJS+= uaccess.o
484
485OBJS+= libqemu.a
486
487ifdef CONFIG_GDBSTUB
488OBJS+=gdbstub.o
489endif
490
491# Note: this is a workaround. The real fix is to avoid compiling
492# cpu_signal_handler() in cpu-exec.c.
807544e2 493signal.o: CFLAGS += $(HELPER_CFLAGS)
84778508
BS
494
495$(QEMU_PROG): $(OBJS) ../libqemu_user.a
496 $(CC) $(LDFLAGS) -o $@ $^ $(LIBS)
497
498endif #CONFIG_BSD_USER
499
40293e58
FB
500#########################################################
501# System emulator target
502ifndef CONFIG_USER_ONLY
503
559b90fb 504OBJS=vl.o osdep.o monitor.o pci.o loader.o isa_mmio.o machine.o
1fd31ad7
AL
505# virtio has to be here due to weird dependency between PCI and virtio-net.
506# need to fix this properly
9ede2fde 507OBJS+=virtio.o virtio-blk.o virtio-balloon.o virtio-net.o virtio-console.o
559b90fb 508OBJS+=fw_cfg.o
7ba1e619
AL
509ifdef CONFIG_KVM
510OBJS+=kvm.o kvm-all.o
511endif
223d4670 512ifdef CONFIG_WIN32
40293e58 513OBJS+=block-raw-win32.o
223d4670 514else
3c529d93
AL
515ifdef CONFIG_AIO
516OBJS+=posix-aio-compat.o
517endif
559b90fb 518OBJS+=block-raw-posix.o
a3392f9b
AL
519endif
520
40293e58 521LIBS+=-lz
1d14ffa9 522ifdef CONFIG_ALSA
1d14ffa9
FB
523LIBS += -lasound
524endif
ca9cc28c
AZ
525ifdef CONFIG_ESD
526LIBS += -lesd
527endif
b8e59f18 528ifdef CONFIG_PA
529LIBS += -lpulse-simple
530endif
1d14ffa9 531ifdef CONFIG_DSOUND
1d14ffa9 532LIBS += -lole32 -ldxguid
85571bc7 533endif
102a52e4 534ifdef CONFIG_FMOD
102a52e4 535LIBS += $(CONFIG_FMOD_LIB)
85571bc7 536endif
2f6a1ab0
BS
537ifdef CONFIG_OSS
538LIBS += $(CONFIG_OSS_LIB)
539endif
4fb240a4 540
b0f3b8fa 541SOUND_HW = sb16.o es1370.o ac97.o
1d14ffa9
FB
542ifdef CONFIG_ADLIB
543SOUND_HW += fmopl.o adlib.o
c40e866f 544adlib.o fmopl.o: CFLAGS := ${CFLAGS} -DBUILD_Y8950=0
1d14ffa9 545endif
423d65f4
AZ
546ifdef CONFIG_GUS
547SOUND_HW += gus.o gusemu_hal.o gusemu_mixer.o
548endif
cc53d26d 549ifdef CONFIG_CS4231A
550SOUND_HW += cs4231a.o
551endif
85571bc7 552
8d5d2d4c
TS
553ifdef CONFIG_VNC_TLS
554CPPFLAGS += $(CONFIG_VNC_TLS_CFLAGS)
555LIBS += $(CONFIG_VNC_TLS_LIBS)
556endif
557
fb599c9a
AZ
558ifdef CONFIG_BLUEZ
559LIBS += $(CONFIG_BLUEZ_LIBS)
560endif
561
2e5d83bb 562# SCSI layer
8b17de88 563OBJS+= lsi53c895a.o esp.o
2e5d83bb 564
a594cfbf 565# USB layer
40293e58 566OBJS+= usb-ohci.o
a594cfbf 567
663e8e51 568# EEPROM emulation
40293e58 569OBJS += eeprom93xx.o
663e8e51 570
a41b2ff2 571# PCI network cards
40293e58
FB
572OBJS += eepro100.o
573OBJS += ne2000.o
574OBJS += pcnet.o
575OBJS += rtl8139.o
7c23b892 576OBJS += e1000.o
a41b2ff2 577
0b0babc6 578ifeq ($(TARGET_BASE_ARCH), i386)
a541f297 579# Hardware support
40293e58
FB
580OBJS+= ide.o pckbd.o ps2.o vga.o $(SOUND_HW) dma.o
581OBJS+= fdc.o mc146818rtc.o serial.o i8259.o i8254.o pcspk.o pc.o
582OBJS+= cirrus_vga.o apic.o parallel.o acpi.o piix_pci.o
16b29ae1 583OBJS+= usb-uhci.o vmmouse.o vmport.o vmware_vga.o hpet.o
b00052e4 584CPPFLAGS += -DHAS_AUDIO -DHAS_AUDIO_CHOICE
67b915a5 585endif
a2458627 586ifeq ($(TARGET_BASE_ARCH), ppc)
70ad3dec 587CPPFLAGS += -DHAS_AUDIO -DHAS_AUDIO_CHOICE
3cbee15b 588# shared objects
40293e58 589OBJS+= ppc.o ide.o vga.o $(SOUND_HW) dma.o openpic.o
3cbee15b 590# PREP target
40293e58
FB
591OBJS+= pckbd.o ps2.o serial.o i8259.o i8254.o fdc.o m48t59.o mc146818rtc.o
592OBJS+= prep_pci.o ppc_prep.o
3cbee15b 593# Mac shared devices
7fa9ae1a 594OBJS+= macio.o cuda.o adb.o mac_nvram.o mac_dbdma.o escc.o
3cbee15b 595# OldWorld PowerMac
40293e58 596OBJS+= heathrow_pic.o grackle_pci.o ppc_oldworld.o
3cbee15b 597# NewWorld PowerMac
40293e58 598OBJS+= unin_pci.o ppc_chrp.o
3cbee15b 599# PowerPC 4xx boards
825bb581 600OBJS+= pflash_cfi02.o ppc4xx_devs.o ppc4xx_pci.o ppc405_uc.o ppc405_boards.o
2c9fade2 601OBJS+= ppc440.o ppc440_bamboo.o
f652e6af
AJ
602ifdef FDT_LIBS
603OBJS+= device_tree.o
604LIBS+= $(FDT_LIBS)
605endif
d76d1650
AJ
606ifdef CONFIG_KVM
607OBJS+= kvm_ppc.o
608endif
a541f297 609endif
fbe4f65b 610ifeq ($(TARGET_BASE_ARCH), mips)
c171148c 611OBJS+= mips_r4k.o mips_jazz.o mips_malta.o mips_mipssim.o
4ce7ff6e
AJ
612OBJS+= mips_timer.o mips_int.o dma.o vga.o serial.o i8254.o i8259.o rc4030.o
613OBJS+= g364fb.o jazz_led.o
40293e58 614OBJS+= ide.o gt64xxx.o pckbd.o ps2.o fdc.o mc146818rtc.o usb-uhci.o acpi.o ds1225y.o
4ce7ff6e 615OBJS+= piix_pci.o parallel.o cirrus_vga.o pcspk.o $(SOUND_HW)
40293e58
FB
616OBJS+= mipsnet.o
617OBJS+= pflash_cfi01.o
4ce7ff6e 618CPPFLAGS += -DHAS_AUDIO -DHAS_AUDIO_CHOICE
6af0bf9c 619endif
e7daa605 620ifeq ($(TARGET_BASE_ARCH), cris)
10c144e2
EI
621# Boards
622OBJS+= etraxfs.o axis_dev88.o
623
624# IO blocks
48318011 625OBJS+= etraxfs_dma.o
e62b5b13 626OBJS+= etraxfs_pic.o
48318011 627OBJS+= etraxfs_eth.o
40293e58
FB
628OBJS+= etraxfs_timer.o
629OBJS+= etraxfs_ser.o
e62b5b13
EI
630
631OBJS+= ptimer.o
10c144e2 632OBJS+= pflash_cfi02.o nand.o
e7daa605 633endif
64b3ab24 634ifeq ($(TARGET_BASE_ARCH), sparc)
3475187d 635ifeq ($(TARGET_ARCH), sparc64)
40293e58
FB
636OBJS+= sun4u.o ide.o pckbd.o ps2.o vga.o apb_pci.o
637OBJS+= fdc.o mc146818rtc.o serial.o m48t59.o
638OBJS+= cirrus_vga.o parallel.o ptimer.o
3475187d 639else
40293e58 640OBJS+= sun4m.o tcx.o pcnet.o iommu.o m48t59.o slavio_intctl.o
2aa2ab3a 641OBJS+= slavio_timer.o escc.o slavio_misc.o fdc.o sparc32_dma.o
40293e58 642OBJS+= cs4231.o ptimer.o eccmemctl.o sbi.o sun4c_intctl.o
3475187d 643endif
e95c8d51 644endif
b5ff1b31 645ifeq ($(TARGET_BASE_ARCH), arm)
40293e58
FB
646OBJS+= integratorcp.o versatilepb.o ps2.o smc91c111.o arm_pic.o arm_timer.o
647OBJS+= arm_boot.o pl011.o pl031.o pl050.o pl080.o pl110.o pl181.o pl190.o
648OBJS+= versatile_pci.o ptimer.o
649OBJS+= realview_gic.o realview.o arm_sysctl.o mpcore.o
650OBJS+= armv7m.o armv7m_nvic.o stellaris.o pl022.o stellaris_enet.o
651OBJS+= pl061.o
652OBJS+= arm-semi.o
653OBJS+= pxa2xx.o pxa2xx_pic.o pxa2xx_gpio.o pxa2xx_timer.o pxa2xx_dma.o
654OBJS+= pxa2xx_lcd.o pxa2xx_mmci.o pxa2xx_pcmcia.o pxa2xx_keypad.o
655OBJS+= pflash_cfi01.o gumstix.o
88d2c950 656OBJS+= zaurus.o ide.o serial.o nand.o ecc.o spitz.o tosa.o tc6393xb.o
b4e3104b 657OBJS+= omap1.o omap_lcdc.o omap_dma.o omap_clk.o omap_mmc.o omap_i2c.o
afbb5194 658OBJS+= omap2.o omap_dss.o soc_dma.o
997641a8 659OBJS+= omap_sx1.o palm.o tsc210x.o
942ac052 660OBJS+= nseries.o blizzard.o onenand.o vga.o cbus.o tusb6010.o usb-musb.o
58a26b47 661OBJS+= tsc2005.o bt-hci-csr.o
40293e58 662OBJS+= mst_fpga.o mainstone.o
24859b68 663OBJS+= musicpal.o pflash_cfi02.o
5a1237c4 664CPPFLAGS += -DHAS_AUDIO
b5ff1b31 665endif
fdf9b3e8 666ifeq ($(TARGET_BASE_ARCH), sh4)
40293e58 667OBJS+= shix.o r2d.o sh7750.o sh7750_regnames.o tc58128.o
1e5459a3 668OBJS+= sh_timer.o ptimer.o sh_serial.o sh_intc.o sh_pci.o sm501.o serial.o
a4a771c0 669OBJS+= ide.o
fdf9b3e8 670endif
0633879f 671ifeq ($(TARGET_BASE_ARCH), m68k)
40293e58
FB
672OBJS+= an5206.o mcf5206.o ptimer.o mcf_uart.o mcf_intc.o mcf5208.o mcf_fec.o
673OBJS+= m68k-semi.o dummy_m68k.o
0633879f 674endif
a541f297 675ifdef CONFIG_GDBSTUB
56aebc89 676OBJS+=gdbstub.o gdbstub-xml.o
728c9fd5 677endif
5b0753e0 678ifdef CONFIG_COCOA
1d14ffa9
FB
679COCOA_LIBS=-F/System/Library/Frameworks -framework Cocoa -framework IOKit
680ifdef CONFIG_COREAUDIO
681COCOA_LIBS+=-framework CoreAudio
682endif
5b0753e0 683endif
7c1f25b4 684ifdef CONFIG_SLIRP
6f30fa85 685CPPFLAGS+=-I$(SRC_PATH)/slirp
626df76a
FB
686endif
687
40293e58 688LIBS+=$(AIOLIBS)
c321f673 689# specific flags are needed for non soft mmu emulator
c321f673 690ifdef CONFIG_STATIC
40293e58 691LDFLAGS+=-static
de5eaa64 692endif
83fb7adf 693ifndef CONFIG_DARWIN
11d9f695 694ifndef CONFIG_WIN32
ec530c81 695ifndef CONFIG_SOLARIS
b29fe3ed 696ifndef CONFIG_AIX
40293e58 697LIBS+=-lutil
11d9f695 698endif
b29fe3ed 699endif
83fb7adf 700endif
ec530c81 701endif
e3086fbf 702ifdef TARGET_GPROF
40293e58
FB
703vl.o: CFLAGS+=-p
704LDFLAGS+=-p
e3086fbf 705endif
c321f673 706
b8076a74 707ifeq ($(ARCH),ia64)
40293e58 708LDFLAGS+=-Wl,-G0 -Wl,-T,$(SRC_PATH)/ia64.ld
74ccb34e
FB
709endif
710
1d14ffa9
FB
711ifdef CONFIG_WIN32
712SDL_LIBS := $(filter-out -mwindows, $(SDL_LIBS)) -mconsole
713endif
714
40293e58
FB
715# profiling code
716ifdef TARGET_GPROF
717LDFLAGS+=-p
718main.o: CFLAGS+=-p
6e1b3e4d
FB
719endif
720
40293e58 721$(QEMU_PROG): $(OBJS) ../libqemu_common.a libqemu.a
8a16d273 722 $(CC) $(LDFLAGS) -o $@ $^ $(LIBS) $(SDL_LIBS) $(COCOA_LIBS) $(CURSES_LIBS) $(BRLAPI_LIBS) $(VDE_LIBS)
626df76a 723
40293e58 724endif # !CONFIG_USER_ONLY
00a67ba1 725
56aebc89
PB
726gdbstub-xml.c: $(TARGET_XML_FILES) feature_to_c.sh
727 rm -f $@
728ifeq ($(TARGET_XML_FILES),)
729 echo > $@
730else
731 $(SHELL) $(SRC_PATH)/feature_to_c.sh $@ $(TARGET_XML_FILES)
732endif
733
626df76a 734%.o: %.c
40293e58 735 $(CC) $(CPPFLAGS) $(CFLAGS) -c -o $@ $<
626df76a 736
f72b519c 737%.o: %.S
6f30fa85 738 $(CC) $(CPPFLAGS) -c -o $@ $<
f72b519c 739
626df76a 740clean:
86e840ee 741 rm -f *.o *.a *~ $(PROGS) nwfpe/*.o fpu/*.o
57fec1fe 742 rm -f *.d */*.d tcg/*.o
1e43adfc 743
5fafdf24 744install: all
9b14bb04 745ifneq ($(PROGS),)
6a882643 746 $(INSTALL) -m 755 -s $(PROGS) "$(DESTDIR)$(bindir)"
9b14bb04 747endif
626df76a 748
2f96c28d
JM
749# Include automatically generated dependency files
750-include $(wildcard *.d */*.d)