Statistics
| Branch: | Revision:

root / Makefile.target @ 01feaa05

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