blob: 57f94989186ddaac140326e8fa7d4df58fae17f2 [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
pbrook908f52b2006-06-18 19:16:53 +000033ifeq ($(TARGET_ARCH),sh4)
34 ifeq ($(TARGET_WORDS_BIGENDIAN),yes)
35 TARGET_ARCH2=sh4eb
36 endif
37endif
bellard01f5e592005-12-06 21:42:17 +000038ifeq ($(TARGET_ARCH),mips)
bellardc91fde62006-05-02 22:52:36 +000039 ifneq ($(TARGET_WORDS_BIGENDIAN),yes)
40 TARGET_ARCH2=mipsel
bellard01f5e592005-12-06 21:42:17 +000041 endif
bellard808c4952004-12-19 23:33:47 +000042endif
bellardc91fde62006-05-02 22:52:36 +000043QEMU_USER=qemu-$(TARGET_ARCH2)
bellard1e43adf2003-09-30 20:54:24 +000044# system emulator name
45ifdef CONFIG_SOFTMMU
bellarda541f292004-04-12 20:39:29 +000046ifeq ($(TARGET_ARCH), i386)
bellard67b915a2004-03-31 23:37:16 +000047QEMU_SYSTEM=qemu$(EXESUF)
bellard0db63472003-10-27 21:37:46 +000048else
bellardc91fde62006-05-02 22:52:36 +000049QEMU_SYSTEM=qemu-system-$(TARGET_ARCH2)$(EXESUF)
bellarda541f292004-04-12 20:39:29 +000050endif
51else
bellard0db63472003-10-27 21:37:46 +000052QEMU_SYSTEM=qemu-fast
bellard1e43adf2003-09-30 20:54:24 +000053endif
54
bellard16e9b7d2003-10-27 21:09:52 +000055ifdef CONFIG_USER_ONLY
bellard1e43adf2003-09-30 20:54:24 +000056PROGS=$(QEMU_USER)
bellard16e9b7d2003-10-27 21:09:52 +000057else
bellard16e9b7d2003-10-27 21:09:52 +000058PROGS+=$(QEMU_SYSTEM)
bellardde5eaa62003-11-16 23:18:17 +000059ifndef CONFIG_SOFTMMU
60CONFIG_STATIC=y
61endif
bellard728c9fd2004-01-05 00:08:14 +000062endif # !CONFIG_USER_ONLY
63
bellard626df762003-08-10 21:39:31 +000064ifdef CONFIG_STATIC
65LDFLAGS+=-static
66endif
67
68ifeq ($(ARCH),i386)
bellard6e1b3e42006-08-17 17:41:26 +000069HELPER_CFLAGS:=$(CFLAGS) -fomit-frame-pointer
70OP_CFLAGS:=$(CFLAGS) -mpreferred-stack-boundary=2 -fomit-frame-pointer
bellard626df762003-08-10 21:39:31 +000071ifeq ($(HAVE_GCC3_OPTIONS),yes)
bellard3611a292004-08-03 21:42:45 +000072OP_CFLAGS+= -falign-functions=0 -fno-gcse
bellard626df762003-08-10 21:39:31 +000073else
74OP_CFLAGS+= -malign-functions=0
75endif
bellard3a4739d2003-10-28 00:48:22 +000076
bellard626df762003-08-10 21:39:31 +000077ifdef TARGET_GPROF
bellard3a4739d2003-10-28 00:48:22 +000078USE_I386_LD=y
79endif
80ifdef CONFIG_STATIC
81USE_I386_LD=y
82endif
83ifdef USE_I386_LD
bellard626df762003-08-10 21:39:31 +000084LDFLAGS+=-Wl,-T,$(SRC_PATH)/i386.ld
85else
86# WARNING: this LDFLAGS is _very_ tricky : qemu is an ELF shared object
87# that the kernel ELF loader considers as an executable. I think this
88# is the simplest way to make it self virtualizable!
89LDFLAGS+=-Wl,-shared
90endif
bellard626df762003-08-10 21:39:31 +000091endif
92
bellard0b0babc2005-01-03 23:38:40 +000093ifeq ($(ARCH),x86_64)
bellardbc51c5c2004-03-17 23:46:04 +000094OP_CFLAGS=$(CFLAGS) -falign-functions=0
bellard0b0babc2005-01-03 23:38:40 +000095LDFLAGS+=-Wl,-T,$(SRC_PATH)/x86_64.ld
bellardbc51c5c2004-03-17 23:46:04 +000096endif
97
bellard626df762003-08-10 21:39:31 +000098ifeq ($(ARCH),ppc)
bellard83fb7ad2004-07-05 21:25:26 +000099CFLAGS+= -D__powerpc__
bellard626df762003-08-10 21:39:31 +0000100OP_CFLAGS=$(CFLAGS)
101LDFLAGS+=-Wl,-T,$(SRC_PATH)/ppc.ld
102endif
103
104ifeq ($(ARCH),s390)
105OP_CFLAGS=$(CFLAGS)
106LDFLAGS+=-Wl,-T,$(SRC_PATH)/s390.ld
107endif
108
109ifeq ($(ARCH),sparc)
bellardfdbb4692006-06-14 17:32:25 +0000110ifeq ($(CONFIG_SOLARIS),yes)
111CFLAGS+=-mcpu=ultrasparc -m32 -ffixed-g2 -ffixed-g3
112LDFLAGS+=-m32
113OP_CFLAGS=$(CFLAGS) -fno-delayed-branch -fno-omit-frame-pointer -ffixed-i0
114else
bellard74ccb342006-07-18 21:23:34 +0000115CFLAGS+=-mcpu=ultrasparc -m32 -ffixed-g1 -ffixed-g2 -ffixed-g3 -ffixed-g6
bellard626df762003-08-10 21:39:31 +0000116LDFLAGS+=-m32
117OP_CFLAGS=$(CFLAGS) -fno-delayed-branch -ffixed-i0
118HELPER_CFLAGS=$(CFLAGS) -ffixed-i0 -mflat
119# -static is used to avoid g1/g3 usage by the dynamic linker
120LDFLAGS+=-Wl,-T,$(SRC_PATH)/sparc.ld -static
121endif
bellardfdbb4692006-06-14 17:32:25 +0000122endif
bellard626df762003-08-10 21:39:31 +0000123
124ifeq ($(ARCH),sparc64)
bellard74ccb342006-07-18 21:23:34 +0000125CFLAGS+=-mcpu=ultrasparc -m64 -ffixed-g1 -ffixed-g4 -ffixed-g5 -ffixed-g7
bellard626df762003-08-10 21:39:31 +0000126LDFLAGS+=-m64
bellard74ccb342006-07-18 21:23:34 +0000127LDFLAGS+=-Wl,-T,$(SRC_PATH)/sparc64.ld
bellard626df762003-08-10 21:39:31 +0000128OP_CFLAGS=$(CFLAGS) -fno-delayed-branch -ffixed-i0
129endif
130
131ifeq ($(ARCH),alpha)
132# -msmall-data is not used because we want two-instruction relocations
133# for the constant constructions
134OP_CFLAGS=-Wall -O2 -g
135# Ensure there's only a single GP
136CFLAGS += -msmall-data
137LDFLAGS+=-Wl,-T,$(SRC_PATH)/alpha.ld
138endif
139
140ifeq ($(ARCH),ia64)
bellardb8076a72005-04-07 22:20:31 +0000141CFLAGS += -mno-sdata
bellard626df762003-08-10 21:39:31 +0000142OP_CFLAGS=$(CFLAGS)
bellardb8076a72005-04-07 22:20:31 +0000143LDFLAGS+=-Wl,-G0 -Wl,-T,$(SRC_PATH)/ia64.ld
bellard626df762003-08-10 21:39:31 +0000144endif
145
146ifeq ($(ARCH),arm)
bellardba680552005-03-13 09:49:52 +0000147OP_CFLAGS=$(CFLAGS) -mno-sched-prolog -fno-omit-frame-pointer
bellard626df762003-08-10 21:39:31 +0000148LDFLAGS+=-Wl,-T,$(SRC_PATH)/arm.ld
149endif
150
bellard38e584a2003-08-10 22:14:22 +0000151ifeq ($(ARCH),m68k)
152OP_CFLAGS=$(CFLAGS) -fomit-frame-pointer
153LDFLAGS+=-Wl,-T,m68k.ld
154endif
155
bellard626df762003-08-10 21:39:31 +0000156ifeq ($(HAVE_GCC3_OPTIONS),yes)
157# very important to generate a return at the end of every operation
158OP_CFLAGS+=-fno-reorder-blocks -fno-optimize-sibling-calls
159endif
160
bellard83fb7ad2004-07-05 21:25:26 +0000161ifeq ($(CONFIG_DARWIN),yes)
162OP_CFLAGS+= -mdynamic-no-pic
bellarde80cfcf2004-12-19 23:18:01 +0000163LIBS+=-lmx
bellard83fb7ad2004-07-05 21:25:26 +0000164endif
165
bellard626df762003-08-10 21:39:31 +0000166#########################################################
167
bellardd5249392004-08-03 21:14:23 +0000168DEFINES+=-D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE
bellard626df762003-08-10 21:39:31 +0000169LIBS+=-lm
bellardb932cab2004-08-01 21:46:49 +0000170ifndef CONFIG_USER_ONLY
171LIBS+=-lz
172endif
bellard67b915a2004-03-31 23:37:16 +0000173ifdef CONFIG_WIN32
bellard3db38e82004-07-14 17:19:55 +0000174LIBS+=-lwinmm -lws2_32 -liphlpapi
bellard67b915a2004-03-31 23:37:16 +0000175endif
bellardec530c82006-04-25 22:36:06 +0000176ifdef CONFIG_SOLARIS
177LIBS+=-lsocket -lnsl -lresolv
178endif
bellard626df762003-08-10 21:39:31 +0000179
180# profiling code
181ifdef TARGET_GPROF
182LDFLAGS+=-p
183main.o: CFLAGS+=-p
184endif
185
pbrooke5fe0c52006-06-11 13:32:59 +0000186OBJS= main.o syscall.o mmap.o signal.o path.o osdep.o thunk.o \
187 elfload.o linuxload.o
188ifdef TARGET_HAS_BFLT
189OBJS+= flatload.o
190endif
191
bellard626df762003-08-10 21:39:31 +0000192ifeq ($(TARGET_ARCH), i386)
193OBJS+= vm86.o
194endif
bellardf72b5192004-02-16 21:55:35 +0000195ifeq ($(TARGET_ARCH), arm)
bellard158142c2005-03-13 16:54:06 +0000196OBJS+=nwfpe/fpa11.o nwfpe/fpa11_cpdo.o \
bellardf72b5192004-02-16 21:55:35 +0000197nwfpe/fpa11_cpdt.o nwfpe/fpa11_cprt.o nwfpe/fpopcode.o nwfpe/single_cpdo.o \
bellarda4f81972005-04-23 18:25:41 +0000198 nwfpe/double_cpdo.o nwfpe/extended_cpdo.o arm-semi.o
bellardf72b5192004-02-16 21:55:35 +0000199endif
pbrooke6e59062006-10-22 00:18:54 +0000200ifeq ($(TARGET_ARCH), m68k)
201OBJS+= m68k-sim.o m68k-semi.o
202endif
bellard626df762003-08-10 21:39:31 +0000203SRCS:= $(OBJS:.o=.c)
204OBJS+= libqemu.a
205
206# cpu emulator library
bellard158142c2005-03-13 16:54:06 +0000207LIBOBJS=exec.o kqemu.o translate-op.o translate-all.o cpu-exec.o\
bellarde3086fb2005-02-10 21:48:51 +0000208 translate.o op.o
bellard158142c2005-03-13 16:54:06 +0000209ifdef CONFIG_SOFTFLOAT
210LIBOBJS+=fpu/softfloat.o
211else
212LIBOBJS+=fpu/softfloat-native.o
213endif
214DEFINES+=-I$(SRC_PATH)/fpu
bellard626df762003-08-10 21:39:31 +0000215
216ifeq ($(TARGET_ARCH), i386)
bellard1e43adf2003-09-30 20:54:24 +0000217LIBOBJS+=helper.o helper2.o
bellardf72b5192004-02-16 21:55:35 +0000218ifeq ($(ARCH), i386)
219LIBOBJS+=translate-copy.o
220endif
bellard626df762003-08-10 21:39:31 +0000221endif
222
bellard0b0babc2005-01-03 23:38:40 +0000223ifeq ($(TARGET_ARCH), x86_64)
224LIBOBJS+=helper.o helper2.o
225endif
226
bellarda2458622005-07-23 22:39:53 +0000227ifeq ($(TARGET_BASE_ARCH), ppc)
bellard728c9fd2004-01-05 00:08:14 +0000228LIBOBJS+= op_helper.o helper.o
bellard67867302003-11-23 17:05:30 +0000229endif
230
bellard6af0bf92005-07-02 14:58:51 +0000231ifeq ($(TARGET_ARCH), mips)
232LIBOBJS+= op_helper.o helper.o
233endif
234
bellard64b3ab22005-01-30 22:43:42 +0000235ifeq ($(TARGET_BASE_ARCH), sparc)
bellarde95c8d52004-09-30 22:22:08 +0000236LIBOBJS+= op_helper.o helper.o
237endif
238
bellardb7bcbe92005-02-22 19:27:29 +0000239ifeq ($(TARGET_BASE_ARCH), arm)
bellardb5ff1b32005-11-26 10:38:39 +0000240LIBOBJS+= op_helper.o helper.o
bellardb7bcbe92005-02-22 19:27:29 +0000241endif
242
bellardfdf9b3e2006-04-27 21:07:38 +0000243ifeq ($(TARGET_BASE_ARCH), sh4)
244LIBOBJS+= op_helper.o helper.o
245endif
246
pbrooke6e59062006-10-22 00:18:54 +0000247ifeq ($(TARGET_BASE_ARCH), m68k)
248LIBOBJS+= helper.o
249endif
250
bellard626df762003-08-10 21:39:31 +0000251# NOTE: the disassembler code is only needed for debugging
252LIBOBJS+=disas.o
253ifeq ($(findstring i386, $(TARGET_ARCH) $(ARCH)),i386)
bellardbc51c5c2004-03-17 23:46:04 +0000254USE_I386_DIS=y
255endif
bellard0b0babc2005-01-03 23:38:40 +0000256ifeq ($(findstring x86_64, $(TARGET_ARCH) $(ARCH)),x86_64)
bellardbc51c5c2004-03-17 23:46:04 +0000257USE_I386_DIS=y
258endif
259ifdef USE_I386_DIS
bellard626df762003-08-10 21:39:31 +0000260LIBOBJS+=i386-dis.o
261endif
262ifeq ($(findstring alpha, $(TARGET_ARCH) $(ARCH)),alpha)
263LIBOBJS+=alpha-dis.o
264endif
bellarda2458622005-07-23 22:39:53 +0000265ifeq ($(findstring ppc, $(TARGET_BASE_ARCH) $(ARCH)),ppc)
bellard626df762003-08-10 21:39:31 +0000266LIBOBJS+=ppc-dis.o
267endif
bellard6af0bf92005-07-02 14:58:51 +0000268ifeq ($(findstring mips, $(TARGET_ARCH) $(ARCH)),mips)
269LIBOBJS+=mips-dis.o
270endif
bellard64b3ab22005-01-30 22:43:42 +0000271ifeq ($(findstring sparc, $(TARGET_BASE_ARCH) $(ARCH)),sparc)
bellard626df762003-08-10 21:39:31 +0000272LIBOBJS+=sparc-dis.o
273endif
274ifeq ($(findstring arm, $(TARGET_ARCH) $(ARCH)),arm)
275LIBOBJS+=arm-dis.o
276endif
bellard48024e42005-11-06 16:52:11 +0000277ifeq ($(findstring m68k, $(TARGET_ARCH) $(ARCH)),m68k)
278LIBOBJS+=m68k-dis.o
279endif
bellardfdf9b3e2006-04-27 21:07:38 +0000280ifeq ($(findstring sh4, $(TARGET_ARCH) $(ARCH)),sh4)
281LIBOBJS+=sh4-dis.o
282endif
bellard626df762003-08-10 21:39:31 +0000283
bellard1fddef42005-04-17 19:16:13 +0000284ifdef CONFIG_GDBSTUB
285OBJS+=gdbstub.o
286endif
bellard626df762003-08-10 21:39:31 +0000287
bellard1e43adf2003-09-30 20:54:24 +0000288all: $(PROGS)
bellard626df762003-08-10 21:39:31 +0000289
bellard1e43adf2003-09-30 20:54:24 +0000290$(QEMU_USER): $(OBJS)
bellard626df762003-08-10 21:39:31 +0000291 $(CC) $(LDFLAGS) -o $@ $^ $(LIBS)
292ifeq ($(ARCH),alpha)
293# Mark as 32 bit binary, i. e. it will be mapped into the low 31 bit of
294# the address space (31 bit so sign extending doesn't matter)
295 echo -ne '\001\000\000\000' | dd of=qemu bs=1 seek=48 count=4 conv=notrunc
296endif
297
298# must use static linking to avoid leaving stuff in virtual address space
pbrookaef445b2006-09-18 01:15:29 +0000299VL_OBJS=vl.o osdep.o readline.o monitor.o pci.o console.o loader.o isa_mmio.o
bellard83f64092006-08-01 16:21:11 +0000300VL_OBJS+=block.o block-raw.o
bellard42ca6382006-08-05 21:29:27 +0000301VL_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
bellard7fb843f2006-02-01 23:06:55 +0000302ifdef CONFIG_WIN32
303VL_OBJS+=tap-win32.o
304endif
bellarda541f292004-04-12 20:39:29 +0000305
bellard1d14ffa2005-10-30 18:58:22 +0000306SOUND_HW = sb16.o es1370.o
bellard7372f882004-11-11 16:55:09 +0000307AUDIODRV = audio.o noaudio.o wavaudio.o
bellardfb065182004-11-09 23:09:44 +0000308ifdef CONFIG_SDL
309AUDIODRV += sdlaudio.o
310endif
311ifdef CONFIG_OSS
312AUDIODRV += ossaudio.o
313endif
bellard1d14ffa2005-10-30 18:58:22 +0000314ifdef CONFIG_COREAUDIO
315AUDIODRV += coreaudio.o
bellard85571bc2004-11-07 18:04:02 +0000316endif
bellard1d14ffa2005-10-30 18:58:22 +0000317ifdef CONFIG_ALSA
318AUDIODRV += alsaaudio.o
319LIBS += -lasound
320endif
321ifdef CONFIG_DSOUND
322AUDIODRV += dsoundaudio.o
323LIBS += -lole32 -ldxguid
324endif
bellard102a52e2004-11-14 19:57:29 +0000325ifdef CONFIG_FMOD
bellard85571bc2004-11-07 18:04:02 +0000326AUDIODRV += fmodaudio.o
bellard102a52e2004-11-14 19:57:29 +0000327audio.o fmodaudio.o: DEFINES := -I$(CONFIG_FMOD_INC) $(DEFINES)
328LIBS += $(CONFIG_FMOD_LIB)
bellard85571bc2004-11-07 18:04:02 +0000329endif
bellard1d14ffa2005-10-30 18:58:22 +0000330ifdef CONFIG_ADLIB
331SOUND_HW += fmopl.o adlib.o
332endif
bellardec36b692006-07-16 18:57:03 +0000333AUDIODRV+= wavcapture.o
bellard85571bc2004-11-07 18:04:02 +0000334
pbrook2e5d83b2006-05-25 23:58:51 +0000335# SCSI layer
pbrook7d8406b2006-05-30 01:48:12 +0000336VL_OBJS+= scsi-disk.o cdrom.o lsi53c895a.o
pbrook2e5d83b2006-05-25 23:58:51 +0000337
bellarda594cfb2005-11-06 16:13:29 +0000338# USB layer
pbrook2e5d83b2006-05-25 23:58:51 +0000339VL_OBJS+= usb.o usb-hub.o usb-linux.o usb-hid.o usb-ohci.o usb-msd.o
bellarda594cfb2005-11-06 16:13:29 +0000340
pbrooka41b2ff2006-02-05 04:14:41 +0000341# PCI network cards
bellarde3c26132006-07-04 11:33:00 +0000342VL_OBJS+= ne2000.o rtl8139.o pcnet.o
pbrooka41b2ff2006-02-05 04:14:41 +0000343
bellard0b0babc2005-01-03 23:38:40 +0000344ifeq ($(TARGET_BASE_ARCH), i386)
bellarda541f292004-04-12 20:39:29 +0000345# Hardware support
pbrooka41b2ff2006-02-05 04:14:41 +0000346VL_OBJS+= ide.o pckbd.o ps2.o vga.o $(SOUND_HW) dma.o $(AUDIODRV)
bellardfd06c372006-04-24 21:58:30 +0000347VL_OBJS+= fdc.o mc146818rtc.o serial.o i8259.o i8254.o pcspk.o pc.o
pbrook502a5392006-05-13 16:11:23 +0000348VL_OBJS+= cirrus_vga.o mixeng.o apic.o parallel.o acpi.o piix_pci.o
349VL_OBJS+= usb-uhci.o
bellard1d14ffa2005-10-30 18:58:22 +0000350DEFINES += -DHAS_AUDIO
bellard67b915a2004-03-31 23:37:16 +0000351endif
bellarda2458622005-07-23 22:39:53 +0000352ifeq ($(TARGET_BASE_ARCH), ppc)
pbrooka41b2ff2006-02-05 04:14:41 +0000353VL_OBJS+= ppc.o ide.o pckbd.o ps2.o vga.o $(SOUND_HW) dma.o $(AUDIODRV)
bellard64201202004-05-26 22:55:16 +0000354VL_OBJS+= mc146818rtc.o serial.o i8259.o i8254.o fdc.o m48t59.o
bellarde68b9b22005-06-05 15:21:57 +0000355VL_OBJS+= ppc_prep.o ppc_chrp.o cuda.o adb.o openpic.o heathrow_pic.o mixeng.o
pbrook502a5392006-05-13 16:11:23 +0000356VL_OBJS+= grackle_pci.o prep_pci.o unin_pci.o
bellard1d14ffa2005-10-30 18:58:22 +0000357DEFINES += -DHAS_AUDIO
bellarda541f292004-04-12 20:39:29 +0000358endif
bellard6af0bf92005-07-02 14:58:51 +0000359ifeq ($(TARGET_ARCH), mips)
pbrooka41b2ff2006-02-05 04:14:41 +0000360VL_OBJS+= mips_r4k.o dma.o vga.o serial.o i8254.o i8259.o
bellard697584a2005-08-21 09:41:56 +0000361#VL_OBJS+= #ide.o pckbd.o fdc.o m48t59.o
bellard6af0bf92005-07-02 14:58:51 +0000362endif
bellard64b3ab22005-01-30 22:43:42 +0000363ifeq ($(TARGET_BASE_ARCH), sparc)
bellard34751872005-07-02 14:31:34 +0000364ifeq ($(TARGET_ARCH), sparc64)
pbrook502a5392006-05-13 16:11:23 +0000365VL_OBJS+= sun4u.o ide.o pckbd.o ps2.o vga.o apb_pci.o
bellard83469012005-07-23 14:27:54 +0000366VL_OBJS+= fdc.o mc146818rtc.o serial.o m48t59.o
367VL_OBJS+= cirrus_vga.o parallel.o
bellard34751872005-07-02 14:31:34 +0000368else
bellard67e999b2006-09-03 16:09:07 +0000369VL_OBJS+= sun4m.o tcx.o pcnet.o iommu.o m48t59.o slavio_intctl.o
370VL_OBJS+= slavio_timer.o slavio_serial.o slavio_misc.o fdc.o esp.o sparc32_dma.o
bellardb8174932006-09-10 19:25:12 +0000371VL_OBJS+= cs4231.o
bellard34751872005-07-02 14:31:34 +0000372endif
bellarde95c8d52004-09-30 22:22:08 +0000373endif
bellardb5ff1b32005-11-26 10:38:39 +0000374ifeq ($(TARGET_BASE_ARCH), arm)
pbrookcdbdb642006-04-09 01:32:52 +0000375VL_OBJS+= integratorcp.o versatilepb.o ps2.o smc91c111.o arm_pic.o arm_timer.o
pbrook16406952006-04-27 23:15:07 +0000376VL_OBJS+= arm_boot.o pl011.o pl050.o pl080.o pl110.o pl190.o
pbrook502a5392006-05-13 16:11:23 +0000377VL_OBJS+= versatile_pci.o
pbrooke69954b2006-09-23 17:40:58 +0000378VL_OBJS+= arm_gic.o realview.o arm_sysctl.o
bellardb5ff1b32005-11-26 10:38:39 +0000379endif
bellardfdf9b3e2006-04-27 21:07:38 +0000380ifeq ($(TARGET_BASE_ARCH), sh4)
381VL_OBJS+= shix.o sh7750.o sh7750_regnames.o tc58128.o
382endif
bellarda541f292004-04-12 20:39:29 +0000383ifdef CONFIG_GDBSTUB
384VL_OBJS+=gdbstub.o
bellard728c9fd2004-01-05 00:08:14 +0000385endif
bellard626df762003-08-10 21:39:31 +0000386ifdef CONFIG_SDL
387VL_OBJS+=sdl.o
bellardde5eaa62003-11-16 23:18:17 +0000388endif
bellard24236862006-04-30 21:28:36 +0000389VL_OBJS+=vnc.o
bellard5b0753e2005-03-01 21:37:28 +0000390ifdef CONFIG_COCOA
391VL_OBJS+=cocoa.o
bellard1d14ffa2005-10-30 18:58:22 +0000392COCOA_LIBS=-F/System/Library/Frameworks -framework Cocoa -framework IOKit
393ifdef CONFIG_COREAUDIO
394COCOA_LIBS+=-framework CoreAudio
395endif
bellard5b0753e2005-03-01 21:37:28 +0000396endif
bellard7c1f25b2004-04-22 00:02:08 +0000397ifdef CONFIG_SLIRP
398DEFINES+=-I$(SRC_PATH)/slirp
399SLIRP_OBJS=cksum.o if.o ip_icmp.o ip_input.o ip_output.o \
400slirp.o mbuf.o misc.o sbuf.o socket.o tcp_input.o tcp_output.o \
bellardc7f74642004-08-24 21:57:12 +0000401tcp_subr.o tcp_timer.o udp.o bootp.o debug.o tftp.o
bellard7c1f25b2004-04-22 00:02:08 +0000402VL_OBJS+=$(addprefix slirp/, $(SLIRP_OBJS))
bellard626df762003-08-10 21:39:31 +0000403endif
404
bellardc321f672003-10-30 01:18:42 +0000405VL_LDFLAGS=
406# specific flags are needed for non soft mmu emulator
bellardc321f672003-10-30 01:18:42 +0000407ifdef CONFIG_STATIC
408VL_LDFLAGS+=-static
409endif
bellardde5eaa62003-11-16 23:18:17 +0000410ifndef CONFIG_SOFTMMU
411VL_LDFLAGS+=-Wl,-T,$(SRC_PATH)/i386-vl.ld
412endif
bellard83fb7ad2004-07-05 21:25:26 +0000413ifndef CONFIG_DARWIN
bellard11d9f692004-04-02 20:55:59 +0000414ifndef CONFIG_WIN32
bellardec530c82006-04-25 22:36:06 +0000415ifndef CONFIG_SOLARIS
bellard9f909fe2006-07-13 23:00:26 +0000416VL_LIBS=-lutil -lrt
bellard11d9f692004-04-02 20:55:59 +0000417endif
bellard83fb7ad2004-07-05 21:25:26 +0000418endif
bellardec530c82006-04-25 22:36:06 +0000419endif
bellarde3086fb2005-02-10 21:48:51 +0000420ifdef TARGET_GPROF
421vl.o: CFLAGS+=-p
422VL_LDFLAGS+=-p
423endif
bellardc321f672003-10-30 01:18:42 +0000424
bellardb8076a72005-04-07 22:20:31 +0000425ifeq ($(ARCH),ia64)
426VL_LDFLAGS+=-Wl,-G0 -Wl,-T,$(SRC_PATH)/ia64.ld
427endif
428
bellard74ccb342006-07-18 21:23:34 +0000429ifeq ($(ARCH),sparc64)
430VL_LDFLAGS+=-m64
431VL_LDFLAGS+=-Wl,-T,$(SRC_PATH)/sparc64.ld
432endif
433
bellard1d14ffa2005-10-30 18:58:22 +0000434ifdef CONFIG_WIN32
435SDL_LIBS := $(filter-out -mwindows, $(SDL_LIBS)) -mconsole
436endif
437
bellard1e43adf2003-09-30 20:54:24 +0000438$(QEMU_SYSTEM): $(VL_OBJS) libqemu.a
bellard5b0753e2005-03-01 21:37:28 +0000439 $(CC) $(VL_LDFLAGS) -o $@ $^ $(LIBS) $(SDL_LIBS) $(COCOA_LIBS) $(VL_LIBS)
440
441cocoa.o: cocoa.m
442 $(CC) $(CFLAGS) $(DEFINES) -c -o $@ $<
bellard626df762003-08-10 21:39:31 +0000443
bellard3d11d0e2004-12-12 16:56:30 +0000444sdl.o: sdl.c keymaps.c sdl_keysym.h
bellard626df762003-08-10 21:39:31 +0000445 $(CC) $(CFLAGS) $(DEFINES) $(SDL_CFLAGS) -c -o $@ $<
446
bellard24236862006-04-30 21:28:36 +0000447vnc.o: vnc.c keymaps.c sdl_keysym.h vnchextile.h
448 $(CC) $(CFLAGS) $(DEFINES) -c -o $@ $<
449
bellard9f059ec2004-11-14 18:59:52 +0000450sdlaudio.o: sdlaudio.c
451 $(CC) $(CFLAGS) $(DEFINES) $(SDL_CFLAGS) -c -o $@ $<
452
bellard626df762003-08-10 21:39:31 +0000453depend: $(SRCS)
bellard16e9b7d2003-10-27 21:09:52 +0000454 $(CC) -MM $(CFLAGS) $(DEFINES) $^ 1>.depend
bellard626df762003-08-10 21:39:31 +0000455
bellard1d14ffa2005-10-30 18:58:22 +0000456vldepend: $(VL_OBJS:.o=.c)
457 $(CC) -MM $(CFLAGS) $(DEFINES) $^ 1>.depend
458
bellard626df762003-08-10 21:39:31 +0000459# libqemu
460
461libqemu.a: $(LIBOBJS)
462 rm -f $@
463 $(AR) rcs $@ $(LIBOBJS)
464
bellard1e43adf2003-09-30 20:54:24 +0000465translate.o: translate.c gen-op.h opc.h cpu.h
bellard626df762003-08-10 21:39:31 +0000466
bellard158142c2005-03-13 16:54:06 +0000467translate-all.o: translate-all.c opc.h cpu.h
468
469translate-op.o: translate-all.c op.h opc.h cpu.h
bellard626df762003-08-10 21:39:31 +0000470
bellard1e43adf2003-09-30 20:54:24 +0000471op.h: op.o $(DYNGEN)
bellard626df762003-08-10 21:39:31 +0000472 $(DYNGEN) -o $@ $<
473
bellard1e43adf2003-09-30 20:54:24 +0000474opc.h: op.o $(DYNGEN)
bellard626df762003-08-10 21:39:31 +0000475 $(DYNGEN) -c -o $@ $<
476
bellard1e43adf2003-09-30 20:54:24 +0000477gen-op.h: op.o $(DYNGEN)
bellard626df762003-08-10 21:39:31 +0000478 $(DYNGEN) -g -o $@ $<
479
bellard1e43adf2003-09-30 20:54:24 +0000480op.o: op.c
bellard626df762003-08-10 21:39:31 +0000481 $(CC) $(OP_CFLAGS) $(DEFINES) -c -o $@ $<
482
bellard6e1b3e42006-08-17 17:41:26 +0000483# HELPER_CFLAGS is used for all the code compiled with static register
484# variables
485ifeq ($(TARGET_BASE_ARCH), i386)
486# XXX: rename helper.c to op_helper.c
bellard1e43adf2003-09-30 20:54:24 +0000487helper.o: helper.c
bellard626df762003-08-10 21:39:31 +0000488 $(CC) $(HELPER_CFLAGS) $(DEFINES) -c -o $@ $<
bellard6e1b3e42006-08-17 17:41:26 +0000489else
490op_helper.o: op_helper.c
491 $(CC) $(HELPER_CFLAGS) $(DEFINES) -c -o $@ $<
492endif
493
494cpu-exec.o: cpu-exec.c
495 $(CC) $(HELPER_CFLAGS) $(DEFINES) -c -o $@ $<
bellard626df762003-08-10 21:39:31 +0000496
bellard00a67ba2006-10-28 12:19:07 +0000497# Note: this is a workaround. The real fix is to avoid compiling
498# cpu_signal_handler() in cpu-exec.c.
499signal.o: signal.c
500 $(CC) $(HELPER_CFLAGS) $(DEFINES) -c -o $@ $<
501
bellard0b0babc2005-01-03 23:38:40 +0000502ifeq ($(TARGET_BASE_ARCH), i386)
bellard664e0f12005-01-08 18:58:29 +0000503op.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 +0000504endif
bellard626df762003-08-10 21:39:31 +0000505
bellard1e43adf2003-09-30 20:54:24 +0000506ifeq ($(TARGET_ARCH), arm)
507op.o: op.c op_template.h
pbrookbdd50032006-02-06 04:11:15 +0000508pl110.o: pl110_template.h
bellard1e43adf2003-09-30 20:54:24 +0000509endif
510
bellard64b3ab22005-01-30 22:43:42 +0000511ifeq ($(TARGET_BASE_ARCH), sparc)
bellard34751872005-07-02 14:31:34 +0000512op.o: op.c op_template.h op_mem.h fop_template.h fbranch_template.h
513magic_load.o: elf_op.h
bellard1e43adf2003-09-30 20:54:24 +0000514endif
bellard626df762003-08-10 21:39:31 +0000515
bellarda2458622005-07-23 22:39:53 +0000516ifeq ($(TARGET_BASE_ARCH), ppc)
bellard728c9fd2004-01-05 00:08:14 +0000517op.o: op.c op_template.h op_mem.h
518op_helper.o: op_helper_mem.h
bellard3fc6c082005-07-02 20:59:34 +0000519translate.o: translate.c translate_init.c
bellard728c9fd2004-01-05 00:08:14 +0000520endif
521
bellard6af0bf92005-07-02 14:58:51 +0000522ifeq ($(TARGET_ARCH), mips)
523op.o: op.c op_template.c op_mem.c
524op_helper.o: op_helper_mem.c
525endif
526
bellard5fe141f2006-04-23 17:12:42 +0000527loader.o: loader.c elf_ops.h
528
bellardfdf9b3e2006-04-27 21:07:38 +0000529ifeq ($(TARGET_ARCH), sh4)
530op.o: op.c op_mem.c cpu.h
531op_helper.o: op_helper.c exec.h cpu.h
532helper.o: helper.c exec.h cpu.h
bellard27c7ca72006-04-27 21:32:09 +0000533sh7750.o: sh7750.c sh7750_regs.h sh7750_regnames.h cpu.h
534shix.o: shix.c sh7750_regs.h sh7750_regnames.h
bellardfdf9b3e2006-04-27 21:07:38 +0000535sh7750_regnames.o: sh7750_regnames.c sh7750_regnames.h sh7750_regs.h
bellard27c7ca72006-04-27 21:32:09 +0000536tc58128.o: tc58128.c
bellardfdf9b3e2006-04-27 21:07:38 +0000537endif
538
pbrook214feb52006-05-13 16:30:17 +0000539$(OBJS) $(LIBOBJS) $(VL_OBJS): config.h ../config-host.h
540
bellard626df762003-08-10 21:39:31 +0000541%.o: %.c
542 $(CC) $(CFLAGS) $(DEFINES) -c -o $@ $<
543
bellardf72b5192004-02-16 21:55:35 +0000544%.o: %.S
545 $(CC) $(DEFINES) -c -o $@ $<
546
bellard626df762003-08-10 21:39:31 +0000547clean:
bellarde362b552005-04-26 20:34:26 +0000548 rm -f *.o *.a *~ $(PROGS) gen-op.h opc.h op.h nwfpe/*.o slirp/*.o fpu/*.o
bellard1e43adf2003-09-30 20:54:24 +0000549
550install: all
bellard9b14bb02004-03-26 22:43:34 +0000551ifneq ($(PROGS),)
pbrook6a882642006-04-17 13:57:12 +0000552 $(INSTALL) -m 755 -s $(PROGS) "$(DESTDIR)$(bindir)"
bellard9b14bb02004-03-26 22:43:34 +0000553endif
bellard626df762003-08-10 21:39:31 +0000554
555ifneq ($(wildcard .depend),)
556include .depend
557endif
bellard1d14ffa2005-10-30 18:58:22 +0000558
bellardc0fe3822005-11-05 18:55:28 +0000559ifeq (1, 0)
bellard1d14ffa2005-10-30 18:58:22 +0000560audio.o sdlaudio.o dsoundaudio.o ossaudio.o wavaudio.o noaudio.o \
bellardc0fe3822005-11-05 18:55:28 +0000561fmodaudio.o alsaaudio.o mixeng.o sb16.o es1370.o gus.o adlib.o: \
bellard1d14ffa2005-10-30 18:58:22 +0000562CFLAGS := $(CFLAGS) -Wall -Werror -W -Wsign-compare
563endif