Statistics
| Branch: | Revision:

root / Makefile.target @ 8f40c388

History | View | Annotate | Download (13 kB)

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