blob: 551f7e13e260b5e14eb4ab6a1f3adf97b48d5851 [file] [log] [blame]
bellard626df762003-08-10 21:39:31 +00001include config.mak
2
bellard0b0babc2005-01-03 23:38:40 +00003TARGET_BASE_ARCH:=$(TARGET_ARCH)
4ifeq ($(TARGET_ARCH), x86_64)
5TARGET_BASE_ARCH:=i386
6endif
bellarda2458622005-07-23 22:39:53 +00007ifeq ($(TARGET_ARCH), ppc64)
8TARGET_BASE_ARCH:=ppc
9endif
bellard64b3ab22005-01-30 22:43:42 +000010ifeq ($(TARGET_ARCH), sparc64)
11TARGET_BASE_ARCH:=sparc
12endif
bellard0b0babc2005-01-03 23:38:40 +000013TARGET_PATH=$(SRC_PATH)/target-$(TARGET_BASE_ARCH)
bellard85571bc2004-11-07 18:04:02 +000014VPATH=$(SRC_PATH):$(TARGET_PATH):$(SRC_PATH)/hw:$(SRC_PATH)/audio
pbrookad064842006-04-16 12:41:07 +000015DEFINES=-I. -I.. -I$(TARGET_PATH) -I$(SRC_PATH)
bellard3035f7f2004-03-21 17:02:00 +000016ifdef CONFIG_USER_ONLY
17VPATH+=:$(SRC_PATH)/linux-user
18DEFINES+=-I$(SRC_PATH)/linux-user -I$(SRC_PATH)/linux-user/$(TARGET_ARCH)
19endif
bellardab2572d2004-06-03 19:07:57 +000020CFLAGS=-Wall -O2 -g -fno-strict-aliasing
bellard0b0babc2005-01-03 23:38:40 +000021#CFLAGS+=-Werror
bellard626df762003-08-10 21:39:31 +000022LDFLAGS=-g
23LIBS=
bellard626df762003-08-10 21:39:31 +000024HELPER_CFLAGS=$(CFLAGS)
bellard67b915a2004-03-31 23:37:16 +000025DYNGEN=../dyngen$(EXESUF)
bellard1e43adf2003-09-30 20:54:24 +000026# user emulator name
bellardc91fde62006-05-02 22:52:36 +000027TARGET_ARCH2=$(TARGET_ARCH)
bellard808c4952004-12-19 23:33:47 +000028ifeq ($(TARGET_ARCH),arm)
29 ifeq ($(TARGET_WORDS_BIGENDIAN),yes)
bellardc91fde62006-05-02 22:52:36 +000030 TARGET_ARCH2=armeb
bellard808c4952004-12-19 23:33:47 +000031 endif
bellardc91fde62006-05-02 22:52:36 +000032endif
bellard01f5e592005-12-06 21:42:17 +000033ifeq ($(TARGET_ARCH),mips)
bellardc91fde62006-05-02 22:52:36 +000034 ifneq ($(TARGET_WORDS_BIGENDIAN),yes)
35 TARGET_ARCH2=mipsel
bellard01f5e592005-12-06 21:42:17 +000036 endif
bellard808c4952004-12-19 23:33:47 +000037endif
bellardc91fde62006-05-02 22:52:36 +000038QEMU_USER=qemu-$(TARGET_ARCH2)
bellard1e43adf2003-09-30 20:54:24 +000039# system emulator name
40ifdef CONFIG_SOFTMMU
bellarda541f292004-04-12 20:39:29 +000041ifeq ($(TARGET_ARCH), i386)
bellard67b915a2004-03-31 23:37:16 +000042QEMU_SYSTEM=qemu$(EXESUF)
bellard0db63472003-10-27 21:37:46 +000043else
bellardc91fde62006-05-02 22:52:36 +000044QEMU_SYSTEM=qemu-system-$(TARGET_ARCH2)$(EXESUF)
bellarda541f292004-04-12 20:39:29 +000045endif
46else
bellard0db63472003-10-27 21:37:46 +000047QEMU_SYSTEM=qemu-fast
bellard1e43adf2003-09-30 20:54:24 +000048endif
49
bellard16e9b7d2003-10-27 21:09:52 +000050ifdef CONFIG_USER_ONLY
bellard1e43adf2003-09-30 20:54:24 +000051PROGS=$(QEMU_USER)
bellard16e9b7d2003-10-27 21:09:52 +000052else
bellard16e9b7d2003-10-27 21:09:52 +000053PROGS+=$(QEMU_SYSTEM)
bellardde5eaa62003-11-16 23:18:17 +000054ifndef CONFIG_SOFTMMU
55CONFIG_STATIC=y
56endif
bellard728c9fd2004-01-05 00:08:14 +000057endif # !CONFIG_USER_ONLY
58
bellard626df762003-08-10 21:39:31 +000059ifdef CONFIG_STATIC
60LDFLAGS+=-static
61endif
62
63ifeq ($(ARCH),i386)
64CFLAGS+=-fomit-frame-pointer
65OP_CFLAGS=$(CFLAGS) -mpreferred-stack-boundary=2
66ifeq ($(HAVE_GCC3_OPTIONS),yes)
bellard3611a292004-08-03 21:42:45 +000067OP_CFLAGS+= -falign-functions=0 -fno-gcse
bellard626df762003-08-10 21:39:31 +000068else
69OP_CFLAGS+= -malign-functions=0
70endif
bellard3a4739d2003-10-28 00:48:22 +000071
bellard626df762003-08-10 21:39:31 +000072ifdef TARGET_GPROF
bellard3a4739d2003-10-28 00:48:22 +000073USE_I386_LD=y
74endif
75ifdef CONFIG_STATIC
76USE_I386_LD=y
77endif
78ifdef USE_I386_LD
bellard626df762003-08-10 21:39:31 +000079LDFLAGS+=-Wl,-T,$(SRC_PATH)/i386.ld
80else
81# WARNING: this LDFLAGS is _very_ tricky : qemu is an ELF shared object
82# that the kernel ELF loader considers as an executable. I think this
83# is the simplest way to make it self virtualizable!
84LDFLAGS+=-Wl,-shared
85endif
bellard626df762003-08-10 21:39:31 +000086endif
87
bellard0b0babc2005-01-03 23:38:40 +000088ifeq ($(ARCH),x86_64)
bellardbc51c5c2004-03-17 23:46:04 +000089OP_CFLAGS=$(CFLAGS) -falign-functions=0
bellard0b0babc2005-01-03 23:38:40 +000090LDFLAGS+=-Wl,-T,$(SRC_PATH)/x86_64.ld
bellardbc51c5c2004-03-17 23:46:04 +000091endif
92
bellard626df762003-08-10 21:39:31 +000093ifeq ($(ARCH),ppc)
bellard83fb7ad2004-07-05 21:25:26 +000094CFLAGS+= -D__powerpc__
bellard626df762003-08-10 21:39:31 +000095OP_CFLAGS=$(CFLAGS)
96LDFLAGS+=-Wl,-T,$(SRC_PATH)/ppc.ld
97endif
98
99ifeq ($(ARCH),s390)
100OP_CFLAGS=$(CFLAGS)
101LDFLAGS+=-Wl,-T,$(SRC_PATH)/s390.ld
102endif
103
104ifeq ($(ARCH),sparc)
bellardfdbb4692006-06-14 17:32:25 +0000105ifeq ($(CONFIG_SOLARIS),yes)
106CFLAGS+=-mcpu=ultrasparc -m32 -ffixed-g2 -ffixed-g3
107LDFLAGS+=-m32
108OP_CFLAGS=$(CFLAGS) -fno-delayed-branch -fno-omit-frame-pointer -ffixed-i0
109else
bellard626df762003-08-10 21:39:31 +0000110CFLAGS+=-m32 -ffixed-g1 -ffixed-g2 -ffixed-g3 -ffixed-g6
111LDFLAGS+=-m32
112OP_CFLAGS=$(CFLAGS) -fno-delayed-branch -ffixed-i0
113HELPER_CFLAGS=$(CFLAGS) -ffixed-i0 -mflat
114# -static is used to avoid g1/g3 usage by the dynamic linker
115LDFLAGS+=-Wl,-T,$(SRC_PATH)/sparc.ld -static
116endif
bellardfdbb4692006-06-14 17:32:25 +0000117endif
bellard626df762003-08-10 21:39:31 +0000118
119ifeq ($(ARCH),sparc64)
120CFLAGS+=-m64 -ffixed-g1 -ffixed-g2 -ffixed-g3 -ffixed-g6
121LDFLAGS+=-m64
122OP_CFLAGS=$(CFLAGS) -fno-delayed-branch -ffixed-i0
123endif
124
125ifeq ($(ARCH),alpha)
126# -msmall-data is not used because we want two-instruction relocations
127# for the constant constructions
128OP_CFLAGS=-Wall -O2 -g
129# Ensure there's only a single GP
130CFLAGS += -msmall-data
131LDFLAGS+=-Wl,-T,$(SRC_PATH)/alpha.ld
132endif
133
134ifeq ($(ARCH),ia64)
bellardb8076a72005-04-07 22:20:31 +0000135CFLAGS += -mno-sdata
bellard626df762003-08-10 21:39:31 +0000136OP_CFLAGS=$(CFLAGS)
bellardb8076a72005-04-07 22:20:31 +0000137LDFLAGS+=-Wl,-G0 -Wl,-T,$(SRC_PATH)/ia64.ld
bellard626df762003-08-10 21:39:31 +0000138endif
139
140ifeq ($(ARCH),arm)
bellardba680552005-03-13 09:49:52 +0000141OP_CFLAGS=$(CFLAGS) -mno-sched-prolog -fno-omit-frame-pointer
bellard626df762003-08-10 21:39:31 +0000142LDFLAGS+=-Wl,-T,$(SRC_PATH)/arm.ld
143endif
144
bellard38e584a2003-08-10 22:14:22 +0000145ifeq ($(ARCH),m68k)
146OP_CFLAGS=$(CFLAGS) -fomit-frame-pointer
147LDFLAGS+=-Wl,-T,m68k.ld
148endif
149
bellard626df762003-08-10 21:39:31 +0000150ifeq ($(HAVE_GCC3_OPTIONS),yes)
151# very important to generate a return at the end of every operation
152OP_CFLAGS+=-fno-reorder-blocks -fno-optimize-sibling-calls
153endif
154
bellard83fb7ad2004-07-05 21:25:26 +0000155ifeq ($(CONFIG_DARWIN),yes)
156OP_CFLAGS+= -mdynamic-no-pic
bellarde80cfcf2004-12-19 23:18:01 +0000157LIBS+=-lmx
bellard83fb7ad2004-07-05 21:25:26 +0000158endif
159
bellard626df762003-08-10 21:39:31 +0000160#########################################################
161
bellardd5249392004-08-03 21:14:23 +0000162DEFINES+=-D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE
bellard626df762003-08-10 21:39:31 +0000163LIBS+=-lm
bellardb932cab2004-08-01 21:46:49 +0000164ifndef CONFIG_USER_ONLY
165LIBS+=-lz
166endif
bellard67b915a2004-03-31 23:37:16 +0000167ifdef CONFIG_WIN32
bellard3db38e82004-07-14 17:19:55 +0000168LIBS+=-lwinmm -lws2_32 -liphlpapi
bellard67b915a2004-03-31 23:37:16 +0000169endif
bellardec530c82006-04-25 22:36:06 +0000170ifdef CONFIG_SOLARIS
171LIBS+=-lsocket -lnsl -lresolv
172endif
bellard626df762003-08-10 21:39:31 +0000173
174# profiling code
175ifdef TARGET_GPROF
176LDFLAGS+=-p
177main.o: CFLAGS+=-p
178endif
179
pbrooke5fe0c52006-06-11 13:32:59 +0000180OBJS= main.o syscall.o mmap.o signal.o path.o osdep.o thunk.o \
181 elfload.o linuxload.o
182ifdef TARGET_HAS_BFLT
183OBJS+= flatload.o
184endif
185
bellard626df762003-08-10 21:39:31 +0000186ifeq ($(TARGET_ARCH), i386)
187OBJS+= vm86.o
188endif
bellardf72b5192004-02-16 21:55:35 +0000189ifeq ($(TARGET_ARCH), arm)
bellard158142c2005-03-13 16:54:06 +0000190OBJS+=nwfpe/fpa11.o nwfpe/fpa11_cpdo.o \
bellardf72b5192004-02-16 21:55:35 +0000191nwfpe/fpa11_cpdt.o nwfpe/fpa11_cprt.o nwfpe/fpopcode.o nwfpe/single_cpdo.o \
bellarda4f81972005-04-23 18:25:41 +0000192 nwfpe/double_cpdo.o nwfpe/extended_cpdo.o arm-semi.o
bellardf72b5192004-02-16 21:55:35 +0000193endif
bellard626df762003-08-10 21:39:31 +0000194SRCS:= $(OBJS:.o=.c)
195OBJS+= libqemu.a
196
197# cpu emulator library
bellard158142c2005-03-13 16:54:06 +0000198LIBOBJS=exec.o kqemu.o translate-op.o translate-all.o cpu-exec.o\
bellarde3086fb2005-02-10 21:48:51 +0000199 translate.o op.o
bellard158142c2005-03-13 16:54:06 +0000200ifdef CONFIG_SOFTFLOAT
201LIBOBJS+=fpu/softfloat.o
202else
203LIBOBJS+=fpu/softfloat-native.o
204endif
205DEFINES+=-I$(SRC_PATH)/fpu
bellard626df762003-08-10 21:39:31 +0000206
207ifeq ($(TARGET_ARCH), i386)
bellard1e43adf2003-09-30 20:54:24 +0000208LIBOBJS+=helper.o helper2.o
bellardf72b5192004-02-16 21:55:35 +0000209ifeq ($(ARCH), i386)
210LIBOBJS+=translate-copy.o
211endif
bellard626df762003-08-10 21:39:31 +0000212endif
213
bellard0b0babc2005-01-03 23:38:40 +0000214ifeq ($(TARGET_ARCH), x86_64)
215LIBOBJS+=helper.o helper2.o
216endif
217
bellarda2458622005-07-23 22:39:53 +0000218ifeq ($(TARGET_BASE_ARCH), ppc)
bellard728c9fd2004-01-05 00:08:14 +0000219LIBOBJS+= op_helper.o helper.o
bellard67867302003-11-23 17:05:30 +0000220endif
221
bellard6af0bf92005-07-02 14:58:51 +0000222ifeq ($(TARGET_ARCH), mips)
223LIBOBJS+= op_helper.o helper.o
224endif
225
bellard64b3ab22005-01-30 22:43:42 +0000226ifeq ($(TARGET_BASE_ARCH), sparc)
bellarde95c8d52004-09-30 22:22:08 +0000227LIBOBJS+= op_helper.o helper.o
228endif
229
bellardb7bcbe92005-02-22 19:27:29 +0000230ifeq ($(TARGET_BASE_ARCH), arm)
bellardb5ff1b32005-11-26 10:38:39 +0000231LIBOBJS+= op_helper.o helper.o
bellardb7bcbe92005-02-22 19:27:29 +0000232endif
233
bellardfdf9b3e2006-04-27 21:07:38 +0000234ifeq ($(TARGET_BASE_ARCH), sh4)
235LIBOBJS+= op_helper.o helper.o
236endif
237
bellard626df762003-08-10 21:39:31 +0000238# NOTE: the disassembler code is only needed for debugging
239LIBOBJS+=disas.o
240ifeq ($(findstring i386, $(TARGET_ARCH) $(ARCH)),i386)
bellardbc51c5c2004-03-17 23:46:04 +0000241USE_I386_DIS=y
242endif
bellard0b0babc2005-01-03 23:38:40 +0000243ifeq ($(findstring x86_64, $(TARGET_ARCH) $(ARCH)),x86_64)
bellardbc51c5c2004-03-17 23:46:04 +0000244USE_I386_DIS=y
245endif
246ifdef USE_I386_DIS
bellard626df762003-08-10 21:39:31 +0000247LIBOBJS+=i386-dis.o
248endif
249ifeq ($(findstring alpha, $(TARGET_ARCH) $(ARCH)),alpha)
250LIBOBJS+=alpha-dis.o
251endif
bellarda2458622005-07-23 22:39:53 +0000252ifeq ($(findstring ppc, $(TARGET_BASE_ARCH) $(ARCH)),ppc)
bellard626df762003-08-10 21:39:31 +0000253LIBOBJS+=ppc-dis.o
254endif
bellard6af0bf92005-07-02 14:58:51 +0000255ifeq ($(findstring mips, $(TARGET_ARCH) $(ARCH)),mips)
256LIBOBJS+=mips-dis.o
257endif
bellard64b3ab22005-01-30 22:43:42 +0000258ifeq ($(findstring sparc, $(TARGET_BASE_ARCH) $(ARCH)),sparc)
bellard626df762003-08-10 21:39:31 +0000259LIBOBJS+=sparc-dis.o
260endif
261ifeq ($(findstring arm, $(TARGET_ARCH) $(ARCH)),arm)
262LIBOBJS+=arm-dis.o
263endif
bellard48024e42005-11-06 16:52:11 +0000264ifeq ($(findstring m68k, $(TARGET_ARCH) $(ARCH)),m68k)
265LIBOBJS+=m68k-dis.o
266endif
bellardfdf9b3e2006-04-27 21:07:38 +0000267ifeq ($(findstring sh4, $(TARGET_ARCH) $(ARCH)),sh4)
268LIBOBJS+=sh4-dis.o
269endif
bellard626df762003-08-10 21:39:31 +0000270
bellard1fddef42005-04-17 19:16:13 +0000271ifdef CONFIG_GDBSTUB
272OBJS+=gdbstub.o
273endif
bellard626df762003-08-10 21:39:31 +0000274
bellard1e43adf2003-09-30 20:54:24 +0000275all: $(PROGS)
bellard626df762003-08-10 21:39:31 +0000276
bellard1e43adf2003-09-30 20:54:24 +0000277$(QEMU_USER): $(OBJS)
bellard626df762003-08-10 21:39:31 +0000278 $(CC) $(LDFLAGS) -o $@ $^ $(LIBS)
279ifeq ($(ARCH),alpha)
280# Mark as 32 bit binary, i. e. it will be mapped into the low 31 bit of
281# the address space (31 bit so sign extending doesn't matter)
282 echo -ne '\001\000\000\000' | dd of=qemu bs=1 seek=48 count=4 conv=notrunc
283endif
284
285# must use static linking to avoid leaving stuff in virtual address space
bellard5fe141f2006-04-23 17:12:42 +0000286VL_OBJS=vl.o osdep.o block.o readline.o monitor.o pci.o console.o loader.o
bellardde167e42005-04-28 21:15:08 +0000287VL_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
bellard7fb843f2006-02-01 23:06:55 +0000288ifdef CONFIG_WIN32
289VL_OBJS+=tap-win32.o
290endif
bellarda541f292004-04-12 20:39:29 +0000291
bellard1d14ffa2005-10-30 18:58:22 +0000292SOUND_HW = sb16.o es1370.o
bellard7372f882004-11-11 16:55:09 +0000293AUDIODRV = audio.o noaudio.o wavaudio.o
bellardfb065182004-11-09 23:09:44 +0000294ifdef CONFIG_SDL
295AUDIODRV += sdlaudio.o
296endif
297ifdef CONFIG_OSS
298AUDIODRV += ossaudio.o
299endif
bellard1d14ffa2005-10-30 18:58:22 +0000300ifdef CONFIG_COREAUDIO
301AUDIODRV += coreaudio.o
bellard85571bc2004-11-07 18:04:02 +0000302endif
bellard1d14ffa2005-10-30 18:58:22 +0000303ifdef CONFIG_ALSA
304AUDIODRV += alsaaudio.o
305LIBS += -lasound
306endif
307ifdef CONFIG_DSOUND
308AUDIODRV += dsoundaudio.o
309LIBS += -lole32 -ldxguid
310endif
bellard102a52e2004-11-14 19:57:29 +0000311ifdef CONFIG_FMOD
bellard85571bc2004-11-07 18:04:02 +0000312AUDIODRV += fmodaudio.o
bellard102a52e2004-11-14 19:57:29 +0000313audio.o fmodaudio.o: DEFINES := -I$(CONFIG_FMOD_INC) $(DEFINES)
314LIBS += $(CONFIG_FMOD_LIB)
bellard85571bc2004-11-07 18:04:02 +0000315endif
bellard1d14ffa2005-10-30 18:58:22 +0000316ifdef CONFIG_ADLIB
317SOUND_HW += fmopl.o adlib.o
318endif
bellard85571bc2004-11-07 18:04:02 +0000319
pbrook2e5d83b2006-05-25 23:58:51 +0000320# SCSI layer
pbrook7d8406b2006-05-30 01:48:12 +0000321VL_OBJS+= scsi-disk.o cdrom.o lsi53c895a.o
pbrook2e5d83b2006-05-25 23:58:51 +0000322
bellarda594cfb2005-11-06 16:13:29 +0000323# USB layer
pbrook2e5d83b2006-05-25 23:58:51 +0000324VL_OBJS+= usb.o usb-hub.o usb-linux.o usb-hid.o usb-ohci.o usb-msd.o
bellarda594cfb2005-11-06 16:13:29 +0000325
pbrooka41b2ff2006-02-05 04:14:41 +0000326# PCI network cards
327VL_OBJS+= ne2000.o rtl8139.o
328
bellard0b0babc2005-01-03 23:38:40 +0000329ifeq ($(TARGET_BASE_ARCH), i386)
bellarda541f292004-04-12 20:39:29 +0000330# Hardware support
pbrooka41b2ff2006-02-05 04:14:41 +0000331VL_OBJS+= ide.o pckbd.o ps2.o vga.o $(SOUND_HW) dma.o $(AUDIODRV)
bellardfd06c372006-04-24 21:58:30 +0000332VL_OBJS+= fdc.o mc146818rtc.o serial.o i8259.o i8254.o pcspk.o pc.o
pbrook502a5392006-05-13 16:11:23 +0000333VL_OBJS+= cirrus_vga.o mixeng.o apic.o parallel.o acpi.o piix_pci.o
334VL_OBJS+= usb-uhci.o
bellard1d14ffa2005-10-30 18:58:22 +0000335DEFINES += -DHAS_AUDIO
bellard67b915a2004-03-31 23:37:16 +0000336endif
bellarda2458622005-07-23 22:39:53 +0000337ifeq ($(TARGET_BASE_ARCH), ppc)
pbrooka41b2ff2006-02-05 04:14:41 +0000338VL_OBJS+= ppc.o ide.o pckbd.o ps2.o vga.o $(SOUND_HW) dma.o $(AUDIODRV)
bellard64201202004-05-26 22:55:16 +0000339VL_OBJS+= mc146818rtc.o serial.o i8259.o i8254.o fdc.o m48t59.o
bellarde68b9b22005-06-05 15:21:57 +0000340VL_OBJS+= ppc_prep.o ppc_chrp.o cuda.o adb.o openpic.o heathrow_pic.o mixeng.o
pbrook502a5392006-05-13 16:11:23 +0000341VL_OBJS+= grackle_pci.o prep_pci.o unin_pci.o
bellard1d14ffa2005-10-30 18:58:22 +0000342DEFINES += -DHAS_AUDIO
bellarda541f292004-04-12 20:39:29 +0000343endif
bellard6af0bf92005-07-02 14:58:51 +0000344ifeq ($(TARGET_ARCH), mips)
pbrooka41b2ff2006-02-05 04:14:41 +0000345VL_OBJS+= mips_r4k.o dma.o vga.o serial.o i8254.o i8259.o
bellard697584a2005-08-21 09:41:56 +0000346#VL_OBJS+= #ide.o pckbd.o fdc.o m48t59.o
bellard6af0bf92005-07-02 14:58:51 +0000347endif
bellard64b3ab22005-01-30 22:43:42 +0000348ifeq ($(TARGET_BASE_ARCH), sparc)
bellard34751872005-07-02 14:31:34 +0000349ifeq ($(TARGET_ARCH), sparc64)
pbrook502a5392006-05-13 16:11:23 +0000350VL_OBJS+= sun4u.o ide.o pckbd.o ps2.o vga.o apb_pci.o
bellard83469012005-07-23 14:27:54 +0000351VL_OBJS+= fdc.o mc146818rtc.o serial.o m48t59.o
352VL_OBJS+= cirrus_vga.o parallel.o
bellard34751872005-07-02 14:31:34 +0000353else
bellard5fe141f2006-04-23 17:12:42 +0000354VL_OBJS+= sun4m.o tcx.o lance.o iommu.o m48t59.o slavio_intctl.o
bellard819385c2005-10-30 16:58:32 +0000355VL_OBJS+= slavio_timer.o slavio_serial.o slavio_misc.o fdc.o esp.o
bellard34751872005-07-02 14:31:34 +0000356endif
bellarde95c8d52004-09-30 22:22:08 +0000357endif
bellardb5ff1b32005-11-26 10:38:39 +0000358ifeq ($(TARGET_BASE_ARCH), arm)
pbrookcdbdb642006-04-09 01:32:52 +0000359VL_OBJS+= integratorcp.o versatilepb.o ps2.o smc91c111.o arm_pic.o arm_timer.o
pbrook16406952006-04-27 23:15:07 +0000360VL_OBJS+= arm_boot.o pl011.o pl050.o pl080.o pl110.o pl190.o
pbrook502a5392006-05-13 16:11:23 +0000361VL_OBJS+= versatile_pci.o
bellardb5ff1b32005-11-26 10:38:39 +0000362endif
bellardfdf9b3e2006-04-27 21:07:38 +0000363ifeq ($(TARGET_BASE_ARCH), sh4)
364VL_OBJS+= shix.o sh7750.o sh7750_regnames.o tc58128.o
365endif
bellarda541f292004-04-12 20:39:29 +0000366ifdef CONFIG_GDBSTUB
367VL_OBJS+=gdbstub.o
bellard728c9fd2004-01-05 00:08:14 +0000368endif
bellard626df762003-08-10 21:39:31 +0000369ifdef CONFIG_SDL
370VL_OBJS+=sdl.o
bellardde5eaa62003-11-16 23:18:17 +0000371endif
bellard24236862006-04-30 21:28:36 +0000372VL_OBJS+=vnc.o
bellard5b0753e2005-03-01 21:37:28 +0000373ifdef CONFIG_COCOA
374VL_OBJS+=cocoa.o
bellard1d14ffa2005-10-30 18:58:22 +0000375COCOA_LIBS=-F/System/Library/Frameworks -framework Cocoa -framework IOKit
376ifdef CONFIG_COREAUDIO
377COCOA_LIBS+=-framework CoreAudio
378endif
bellard5b0753e2005-03-01 21:37:28 +0000379endif
bellard7c1f25b2004-04-22 00:02:08 +0000380ifdef CONFIG_SLIRP
381DEFINES+=-I$(SRC_PATH)/slirp
382SLIRP_OBJS=cksum.o if.o ip_icmp.o ip_input.o ip_output.o \
383slirp.o mbuf.o misc.o sbuf.o socket.o tcp_input.o tcp_output.o \
bellardc7f74642004-08-24 21:57:12 +0000384tcp_subr.o tcp_timer.o udp.o bootp.o debug.o tftp.o
bellard7c1f25b2004-04-22 00:02:08 +0000385VL_OBJS+=$(addprefix slirp/, $(SLIRP_OBJS))
bellard626df762003-08-10 21:39:31 +0000386endif
387
bellardc321f672003-10-30 01:18:42 +0000388VL_LDFLAGS=
389# specific flags are needed for non soft mmu emulator
bellardc321f672003-10-30 01:18:42 +0000390ifdef CONFIG_STATIC
391VL_LDFLAGS+=-static
392endif
bellardde5eaa62003-11-16 23:18:17 +0000393ifndef CONFIG_SOFTMMU
394VL_LDFLAGS+=-Wl,-T,$(SRC_PATH)/i386-vl.ld
395endif
bellard83fb7ad2004-07-05 21:25:26 +0000396ifndef CONFIG_DARWIN
bellard11d9f692004-04-02 20:55:59 +0000397ifndef CONFIG_WIN32
bellardec530c82006-04-25 22:36:06 +0000398ifndef CONFIG_SOLARIS
bellard11d9f692004-04-02 20:55:59 +0000399VL_LIBS=-lutil
400endif
bellard83fb7ad2004-07-05 21:25:26 +0000401endif
bellardec530c82006-04-25 22:36:06 +0000402endif
bellarde3086fb2005-02-10 21:48:51 +0000403ifdef TARGET_GPROF
404vl.o: CFLAGS+=-p
405VL_LDFLAGS+=-p
406endif
bellardc321f672003-10-30 01:18:42 +0000407
bellardb8076a72005-04-07 22:20:31 +0000408ifeq ($(ARCH),ia64)
409VL_LDFLAGS+=-Wl,-G0 -Wl,-T,$(SRC_PATH)/ia64.ld
410endif
411
bellard1d14ffa2005-10-30 18:58:22 +0000412ifdef CONFIG_WIN32
413SDL_LIBS := $(filter-out -mwindows, $(SDL_LIBS)) -mconsole
414endif
415
bellard1e43adf2003-09-30 20:54:24 +0000416$(QEMU_SYSTEM): $(VL_OBJS) libqemu.a
bellard5b0753e2005-03-01 21:37:28 +0000417 $(CC) $(VL_LDFLAGS) -o $@ $^ $(LIBS) $(SDL_LIBS) $(COCOA_LIBS) $(VL_LIBS)
418
419cocoa.o: cocoa.m
420 $(CC) $(CFLAGS) $(DEFINES) -c -o $@ $<
bellard626df762003-08-10 21:39:31 +0000421
bellard3d11d0e2004-12-12 16:56:30 +0000422sdl.o: sdl.c keymaps.c sdl_keysym.h
bellard626df762003-08-10 21:39:31 +0000423 $(CC) $(CFLAGS) $(DEFINES) $(SDL_CFLAGS) -c -o $@ $<
424
bellard24236862006-04-30 21:28:36 +0000425vnc.o: vnc.c keymaps.c sdl_keysym.h vnchextile.h
426 $(CC) $(CFLAGS) $(DEFINES) -c -o $@ $<
427
bellard9f059ec2004-11-14 18:59:52 +0000428sdlaudio.o: sdlaudio.c
429 $(CC) $(CFLAGS) $(DEFINES) $(SDL_CFLAGS) -c -o $@ $<
430
bellard626df762003-08-10 21:39:31 +0000431depend: $(SRCS)
bellard16e9b7d2003-10-27 21:09:52 +0000432 $(CC) -MM $(CFLAGS) $(DEFINES) $^ 1>.depend
bellard626df762003-08-10 21:39:31 +0000433
bellard1d14ffa2005-10-30 18:58:22 +0000434vldepend: $(VL_OBJS:.o=.c)
435 $(CC) -MM $(CFLAGS) $(DEFINES) $^ 1>.depend
436
bellard626df762003-08-10 21:39:31 +0000437# libqemu
438
439libqemu.a: $(LIBOBJS)
440 rm -f $@
441 $(AR) rcs $@ $(LIBOBJS)
442
bellard1e43adf2003-09-30 20:54:24 +0000443translate.o: translate.c gen-op.h opc.h cpu.h
bellard626df762003-08-10 21:39:31 +0000444
bellard158142c2005-03-13 16:54:06 +0000445translate-all.o: translate-all.c opc.h cpu.h
446
447translate-op.o: translate-all.c op.h opc.h cpu.h
bellard626df762003-08-10 21:39:31 +0000448
bellard1e43adf2003-09-30 20:54:24 +0000449op.h: op.o $(DYNGEN)
bellard626df762003-08-10 21:39:31 +0000450 $(DYNGEN) -o $@ $<
451
bellard1e43adf2003-09-30 20:54:24 +0000452opc.h: op.o $(DYNGEN)
bellard626df762003-08-10 21:39:31 +0000453 $(DYNGEN) -c -o $@ $<
454
bellard1e43adf2003-09-30 20:54:24 +0000455gen-op.h: op.o $(DYNGEN)
bellard626df762003-08-10 21:39:31 +0000456 $(DYNGEN) -g -o $@ $<
457
bellard1e43adf2003-09-30 20:54:24 +0000458op.o: op.c
bellard626df762003-08-10 21:39:31 +0000459 $(CC) $(OP_CFLAGS) $(DEFINES) -c -o $@ $<
460
bellard1e43adf2003-09-30 20:54:24 +0000461helper.o: helper.c
bellard626df762003-08-10 21:39:31 +0000462 $(CC) $(HELPER_CFLAGS) $(DEFINES) -c -o $@ $<
463
bellard0b0babc2005-01-03 23:38:40 +0000464ifeq ($(TARGET_BASE_ARCH), i386)
bellard664e0f12005-01-08 18:58:29 +0000465op.o: op.c opreg_template.h ops_template.h ops_template_mem.h ops_mem.h ops_sse.h
bellard1e43adf2003-09-30 20:54:24 +0000466endif
bellard626df762003-08-10 21:39:31 +0000467
bellard1e43adf2003-09-30 20:54:24 +0000468ifeq ($(TARGET_ARCH), arm)
469op.o: op.c op_template.h
pbrookbdd50032006-02-06 04:11:15 +0000470pl110.o: pl110_template.h
bellard1e43adf2003-09-30 20:54:24 +0000471endif
472
bellard64b3ab22005-01-30 22:43:42 +0000473ifeq ($(TARGET_BASE_ARCH), sparc)
bellard34751872005-07-02 14:31:34 +0000474op.o: op.c op_template.h op_mem.h fop_template.h fbranch_template.h
475magic_load.o: elf_op.h
bellard1e43adf2003-09-30 20:54:24 +0000476endif
bellard626df762003-08-10 21:39:31 +0000477
bellarda2458622005-07-23 22:39:53 +0000478ifeq ($(TARGET_BASE_ARCH), ppc)
bellard728c9fd2004-01-05 00:08:14 +0000479op.o: op.c op_template.h op_mem.h
480op_helper.o: op_helper_mem.h
bellard3fc6c082005-07-02 20:59:34 +0000481translate.o: translate.c translate_init.c
bellard728c9fd2004-01-05 00:08:14 +0000482endif
483
bellard6af0bf92005-07-02 14:58:51 +0000484ifeq ($(TARGET_ARCH), mips)
485op.o: op.c op_template.c op_mem.c
486op_helper.o: op_helper_mem.c
487endif
488
bellard5fe141f2006-04-23 17:12:42 +0000489loader.o: loader.c elf_ops.h
490
bellard6515b202006-05-03 22:02:44 +0000491acpi.o: acpi.c acpi-dsdt.hex
492
493#$(SRC_PATH)/hw/acpi-dsdt.hex: acpi-dsdt.dsl
494# iasl -tc -p $@ $<
495
bellardfdf9b3e2006-04-27 21:07:38 +0000496ifeq ($(TARGET_ARCH), sh4)
497op.o: op.c op_mem.c cpu.h
498op_helper.o: op_helper.c exec.h cpu.h
499helper.o: helper.c exec.h cpu.h
bellard27c7ca72006-04-27 21:32:09 +0000500sh7750.o: sh7750.c sh7750_regs.h sh7750_regnames.h cpu.h
501shix.o: shix.c sh7750_regs.h sh7750_regnames.h
bellardfdf9b3e2006-04-27 21:07:38 +0000502sh7750_regnames.o: sh7750_regnames.c sh7750_regnames.h sh7750_regs.h
bellard27c7ca72006-04-27 21:32:09 +0000503tc58128.o: tc58128.c
bellardfdf9b3e2006-04-27 21:07:38 +0000504endif
505
pbrook214feb52006-05-13 16:30:17 +0000506$(OBJS) $(LIBOBJS) $(VL_OBJS): config.h ../config-host.h
507
bellard626df762003-08-10 21:39:31 +0000508%.o: %.c
509 $(CC) $(CFLAGS) $(DEFINES) -c -o $@ $<
510
bellardf72b5192004-02-16 21:55:35 +0000511%.o: %.S
512 $(CC) $(DEFINES) -c -o $@ $<
513
bellard626df762003-08-10 21:39:31 +0000514clean:
bellarde362b552005-04-26 20:34:26 +0000515 rm -f *.o *.a *~ $(PROGS) gen-op.h opc.h op.h nwfpe/*.o slirp/*.o fpu/*.o
bellard1e43adf2003-09-30 20:54:24 +0000516
517install: all
bellard9b14bb02004-03-26 22:43:34 +0000518ifneq ($(PROGS),)
pbrook6a882642006-04-17 13:57:12 +0000519 $(INSTALL) -m 755 -s $(PROGS) "$(DESTDIR)$(bindir)"
bellard9b14bb02004-03-26 22:43:34 +0000520endif
bellard626df762003-08-10 21:39:31 +0000521
522ifneq ($(wildcard .depend),)
523include .depend
524endif
bellard1d14ffa2005-10-30 18:58:22 +0000525
bellardc0fe3822005-11-05 18:55:28 +0000526ifeq (1, 0)
bellard1d14ffa2005-10-30 18:58:22 +0000527audio.o sdlaudio.o dsoundaudio.o ossaudio.o wavaudio.o noaudio.o \
bellardc0fe3822005-11-05 18:55:28 +0000528fmodaudio.o alsaaudio.o mixeng.o sb16.o es1370.o gus.o adlib.o: \
bellard1d14ffa2005-10-30 18:58:22 +0000529CFLAGS := $(CFLAGS) -Wall -Werror -W -Wsign-compare
530endif