Statistics
| Branch: | Revision:

root / Makefile.target @ 33d68b5f

History | View | Annotate | Download (14.5 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 ea785922 ths
BASE_CFLAGS+=$(OS_CFLAGS)
181 6f30fa85 ths
OP_CFLAGS+=$(OS_CFLAGS)
182 6f30fa85 ths
183 626df76a bellard
#########################################################
184 626df76a bellard
185 6f30fa85 ths
CPPFLAGS+=-D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE
186 626df76a bellard
LIBS+=-lm
187 b932caba bellard
ifndef CONFIG_USER_ONLY
188 b932caba bellard
LIBS+=-lz
189 b932caba bellard
endif
190 67b915a5 bellard
ifdef CONFIG_WIN32
191 3db38e87 bellard
LIBS+=-lwinmm -lws2_32 -liphlpapi
192 67b915a5 bellard
endif
193 ec530c81 bellard
ifdef CONFIG_SOLARIS
194 ec530c81 bellard
LIBS+=-lsocket -lnsl -lresolv
195 ec530c81 bellard
endif
196 626df76a bellard
197 626df76a bellard
# profiling code
198 626df76a bellard
ifdef TARGET_GPROF
199 6f30fa85 ths
BASE_LDFLAGS+=-p
200 6f30fa85 ths
main.o: BASE_CFLAGS+=-p
201 626df76a bellard
endif
202 626df76a bellard
203 831b7825 ths
ifdef CONFIG_LINUX_USER
204 e5fe0c52 pbrook
OBJS= main.o syscall.o mmap.o signal.o path.o osdep.o thunk.o \
205 e5fe0c52 pbrook
      elfload.o linuxload.o
206 e5fe0c52 pbrook
ifdef TARGET_HAS_BFLT
207 e5fe0c52 pbrook
OBJS+= flatload.o
208 e5fe0c52 pbrook
endif
209 e5fe0c52 pbrook
210 626df76a bellard
ifeq ($(TARGET_ARCH), i386)
211 626df76a bellard
OBJS+= vm86.o
212 626df76a bellard
endif
213 f72b519c bellard
ifeq ($(TARGET_ARCH), arm)
214 158142c2 bellard
OBJS+=nwfpe/fpa11.o nwfpe/fpa11_cpdo.o \
215 f72b519c bellard
nwfpe/fpa11_cpdt.o nwfpe/fpa11_cprt.o nwfpe/fpopcode.o nwfpe/single_cpdo.o \
216 a4f81979 bellard
 nwfpe/double_cpdo.o nwfpe/extended_cpdo.o arm-semi.o
217 f72b519c bellard
endif
218 e6e5906b pbrook
ifeq ($(TARGET_ARCH), m68k)
219 e6e5906b pbrook
OBJS+= m68k-sim.o m68k-semi.o
220 e6e5906b pbrook
endif
221 831b7825 ths
endif #CONFIG_LINUX_USER
222 831b7825 ths
223 831b7825 ths
ifdef CONFIG_DARWIN_USER
224 831b7825 ths
OBJS= main.o commpage.o machload.o mmap.o osdep.o signal.o syscall.o thunk.o
225 831b7825 ths
endif
226 831b7825 ths
227 626df76a bellard
SRCS:= $(OBJS:.o=.c)
228 626df76a bellard
OBJS+= libqemu.a
229 626df76a bellard
230 626df76a bellard
# cpu emulator library
231 158142c2 bellard
LIBOBJS=exec.o kqemu.o translate-op.o translate-all.o cpu-exec.o\
232 e3086fbf bellard
        translate.o op.o 
233 158142c2 bellard
ifdef CONFIG_SOFTFLOAT
234 158142c2 bellard
LIBOBJS+=fpu/softfloat.o
235 158142c2 bellard
else
236 158142c2 bellard
LIBOBJS+=fpu/softfloat-native.o
237 158142c2 bellard
endif
238 6f30fa85 ths
CPPFLAGS+=-I$(SRC_PATH)/fpu
239 626df76a bellard
240 626df76a bellard
ifeq ($(TARGET_ARCH), i386)
241 1e43adfc bellard
LIBOBJS+=helper.o helper2.o
242 f72b519c bellard
ifeq ($(ARCH), i386)
243 f72b519c bellard
LIBOBJS+=translate-copy.o
244 f72b519c bellard
endif
245 626df76a bellard
endif
246 626df76a bellard
247 0b0babc6 bellard
ifeq ($(TARGET_ARCH), x86_64)
248 0b0babc6 bellard
LIBOBJS+=helper.o helper2.o
249 0b0babc6 bellard
endif
250 0b0babc6 bellard
251 a2458627 bellard
ifeq ($(TARGET_BASE_ARCH), ppc)
252 728c9fd5 bellard
LIBOBJS+= op_helper.o helper.o
253 67867308 bellard
endif
254 67867308 bellard
255 6af0bf9c bellard
ifeq ($(TARGET_ARCH), mips)
256 6af0bf9c bellard
LIBOBJS+= op_helper.o helper.o
257 6af0bf9c bellard
endif
258 6af0bf9c bellard
259 64b3ab24 bellard
ifeq ($(TARGET_BASE_ARCH), sparc)
260 e95c8d51 bellard
LIBOBJS+= op_helper.o helper.o
261 e95c8d51 bellard
endif
262 e95c8d51 bellard
263 b7bcbe95 bellard
ifeq ($(TARGET_BASE_ARCH), arm)
264 b5ff1b31 bellard
LIBOBJS+= op_helper.o helper.o
265 b7bcbe95 bellard
endif
266 b7bcbe95 bellard
267 fdf9b3e8 bellard
ifeq ($(TARGET_BASE_ARCH), sh4)
268 fdf9b3e8 bellard
LIBOBJS+= op_helper.o helper.o
269 fdf9b3e8 bellard
endif
270 fdf9b3e8 bellard
271 e6e5906b pbrook
ifeq ($(TARGET_BASE_ARCH), m68k)
272 e6e5906b pbrook
LIBOBJS+= helper.o
273 e6e5906b pbrook
endif
274 e6e5906b pbrook
275 626df76a bellard
# NOTE: the disassembler code is only needed for debugging
276 626df76a bellard
LIBOBJS+=disas.o 
277 626df76a bellard
ifeq ($(findstring i386, $(TARGET_ARCH) $(ARCH)),i386)
278 bc51c5c9 bellard
USE_I386_DIS=y
279 bc51c5c9 bellard
endif
280 0b0babc6 bellard
ifeq ($(findstring x86_64, $(TARGET_ARCH) $(ARCH)),x86_64)
281 bc51c5c9 bellard
USE_I386_DIS=y
282 bc51c5c9 bellard
endif
283 bc51c5c9 bellard
ifdef USE_I386_DIS
284 626df76a bellard
LIBOBJS+=i386-dis.o
285 626df76a bellard
endif
286 626df76a bellard
ifeq ($(findstring alpha, $(TARGET_ARCH) $(ARCH)),alpha)
287 626df76a bellard
LIBOBJS+=alpha-dis.o
288 626df76a bellard
endif
289 a2458627 bellard
ifeq ($(findstring ppc, $(TARGET_BASE_ARCH) $(ARCH)),ppc)
290 626df76a bellard
LIBOBJS+=ppc-dis.o
291 626df76a bellard
endif
292 6af0bf9c bellard
ifeq ($(findstring mips, $(TARGET_ARCH) $(ARCH)),mips)
293 6af0bf9c bellard
LIBOBJS+=mips-dis.o
294 6af0bf9c bellard
endif
295 64b3ab24 bellard
ifeq ($(findstring sparc, $(TARGET_BASE_ARCH) $(ARCH)),sparc)
296 626df76a bellard
LIBOBJS+=sparc-dis.o
297 626df76a bellard
endif
298 626df76a bellard
ifeq ($(findstring arm, $(TARGET_ARCH) $(ARCH)),arm)
299 626df76a bellard
LIBOBJS+=arm-dis.o
300 626df76a bellard
endif
301 48024e4a bellard
ifeq ($(findstring m68k, $(TARGET_ARCH) $(ARCH)),m68k)
302 48024e4a bellard
LIBOBJS+=m68k-dis.o
303 48024e4a bellard
endif
304 fdf9b3e8 bellard
ifeq ($(findstring sh4, $(TARGET_ARCH) $(ARCH)),sh4)
305 fdf9b3e8 bellard
LIBOBJS+=sh4-dis.o
306 fdf9b3e8 bellard
endif
307 626df76a bellard
308 1fddef4b bellard
ifdef CONFIG_GDBSTUB
309 1fddef4b bellard
OBJS+=gdbstub.o
310 1fddef4b bellard
endif
311 626df76a bellard
312 1e43adfc bellard
all: $(PROGS)
313 626df76a bellard
314 1e43adfc bellard
$(QEMU_USER): $(OBJS)
315 6f30fa85 ths
	$(CC) $(LDFLAGS) $(BASE_LDFLAGS) -o $@ $^  $(LIBS)
316 626df76a bellard
ifeq ($(ARCH),alpha)
317 626df76a bellard
# Mark as 32 bit binary, i. e. it will be mapped into the low 31 bit of
318 626df76a bellard
# the address space (31 bit so sign extending doesn't matter)
319 626df76a bellard
	echo -ne '\001\000\000\000' | dd of=qemu bs=1 seek=48 count=4 conv=notrunc
320 626df76a bellard
endif
321 626df76a bellard
322 626df76a bellard
# must use static linking to avoid leaving stuff in virtual address space
323 aef445bd pbrook
VL_OBJS=vl.o osdep.o readline.o monitor.o pci.o console.o loader.o isa_mmio.o
324 18607dcb bellard
VL_OBJS+=cutils.o
325 83f64091 bellard
VL_OBJS+=block.o block-raw.o
326 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
327 7fb843f8 bellard
ifdef CONFIG_WIN32
328 7fb843f8 bellard
VL_OBJS+=tap-win32.o
329 7fb843f8 bellard
endif
330 a541f297 bellard
331 1d14ffa9 bellard
SOUND_HW = sb16.o es1370.o
332 7372f88d bellard
AUDIODRV = audio.o noaudio.o wavaudio.o
333 fb065187 bellard
ifdef CONFIG_SDL
334 fb065187 bellard
AUDIODRV += sdlaudio.o
335 fb065187 bellard
endif
336 fb065187 bellard
ifdef CONFIG_OSS
337 fb065187 bellard
AUDIODRV += ossaudio.o
338 fb065187 bellard
endif
339 1d14ffa9 bellard
ifdef CONFIG_COREAUDIO
340 1d14ffa9 bellard
AUDIODRV += coreaudio.o
341 1d14ffa9 bellard
endif
342 1d14ffa9 bellard
ifdef CONFIG_ALSA
343 1d14ffa9 bellard
AUDIODRV += alsaaudio.o
344 1d14ffa9 bellard
LIBS += -lasound
345 1d14ffa9 bellard
endif
346 1d14ffa9 bellard
ifdef CONFIG_DSOUND
347 1d14ffa9 bellard
AUDIODRV += dsoundaudio.o
348 1d14ffa9 bellard
LIBS += -lole32 -ldxguid
349 85571bc7 bellard
endif
350 102a52e4 bellard
ifdef CONFIG_FMOD
351 85571bc7 bellard
AUDIODRV += fmodaudio.o
352 6f30fa85 ths
audio.o fmodaudio.o: CPPFLAGS := -I$(CONFIG_FMOD_INC) $(CPPFLAGS)
353 102a52e4 bellard
LIBS += $(CONFIG_FMOD_LIB)
354 85571bc7 bellard
endif
355 1d14ffa9 bellard
ifdef CONFIG_ADLIB
356 1d14ffa9 bellard
SOUND_HW += fmopl.o adlib.o
357 1d14ffa9 bellard
endif
358 ec36b695 bellard
AUDIODRV+= wavcapture.o
359 85571bc7 bellard
360 2e5d83bb pbrook
# SCSI layer
361 7d8406be pbrook
VL_OBJS+= scsi-disk.o cdrom.o lsi53c895a.o
362 2e5d83bb pbrook
363 a594cfbf bellard
# USB layer
364 2e5d83bb pbrook
VL_OBJS+= usb.o usb-hub.o usb-linux.o usb-hid.o usb-ohci.o usb-msd.o
365 a594cfbf bellard
366 a41b2ff2 pbrook
# PCI network cards
367 e3c2613f bellard
VL_OBJS+= ne2000.o rtl8139.o pcnet.o
368 a41b2ff2 pbrook
369 0b0babc6 bellard
ifeq ($(TARGET_BASE_ARCH), i386)
370 a541f297 bellard
# Hardware support
371 a41b2ff2 pbrook
VL_OBJS+= ide.o pckbd.o ps2.o vga.o $(SOUND_HW) dma.o $(AUDIODRV)
372 fd06c375 bellard
VL_OBJS+= fdc.o mc146818rtc.o serial.o i8259.o i8254.o pcspk.o pc.o
373 502a5395 pbrook
VL_OBJS+= cirrus_vga.o mixeng.o apic.o parallel.o acpi.o piix_pci.o
374 3fffc223 ths
VL_OBJS+= usb-uhci.o smbus_eeprom.o
375 6f30fa85 ths
CPPFLAGS += -DHAS_AUDIO
376 67b915a5 bellard
endif
377 a2458627 bellard
ifeq ($(TARGET_BASE_ARCH), ppc)
378 a41b2ff2 pbrook
VL_OBJS+= ppc.o ide.o pckbd.o ps2.o vga.o $(SOUND_HW) dma.o $(AUDIODRV)
379 64201201 bellard
VL_OBJS+= mc146818rtc.o serial.o i8259.o i8254.o fdc.o m48t59.o
380 e68b9b2b bellard
VL_OBJS+= ppc_prep.o ppc_chrp.o cuda.o adb.o openpic.o heathrow_pic.o mixeng.o
381 502a5395 pbrook
VL_OBJS+= grackle_pci.o prep_pci.o unin_pci.o
382 6f30fa85 ths
CPPFLAGS += -DHAS_AUDIO
383 a541f297 bellard
endif
384 6af0bf9c bellard
ifeq ($(TARGET_ARCH), mips)
385 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
386 9542611a ths
VL_OBJS+= ide.o gt64xxx.o pckbd.o ps2.o fdc.o mc146818rtc.o usb-uhci.o acpi.o ds1225y.o
387 5856de80 ths
VL_OBJS+= piix_pci.o parallel.o mixeng.o cirrus_vga.o $(SOUND_HW) $(AUDIODRV)
388 5856de80 ths
DEFINES += -DHAS_AUDIO
389 6af0bf9c bellard
endif
390 64b3ab24 bellard
ifeq ($(TARGET_BASE_ARCH), sparc)
391 3475187d bellard
ifeq ($(TARGET_ARCH), sparc64)
392 502a5395 pbrook
VL_OBJS+= sun4u.o ide.o pckbd.o ps2.o vga.o apb_pci.o
393 83469015 bellard
VL_OBJS+= fdc.o mc146818rtc.o serial.o m48t59.o
394 83469015 bellard
VL_OBJS+= cirrus_vga.o parallel.o
395 3475187d bellard
else
396 67e999be bellard
VL_OBJS+= sun4m.o tcx.o pcnet.o iommu.o m48t59.o slavio_intctl.o
397 67e999be bellard
VL_OBJS+= slavio_timer.o slavio_serial.o slavio_misc.o fdc.o esp.o sparc32_dma.o
398 b8174937 bellard
VL_OBJS+= cs4231.o
399 3475187d bellard
endif
400 e95c8d51 bellard
endif
401 b5ff1b31 bellard
ifeq ($(TARGET_BASE_ARCH), arm)
402 cdbdb648 pbrook
VL_OBJS+= integratorcp.o versatilepb.o ps2.o smc91c111.o arm_pic.o arm_timer.o
403 16406950 pbrook
VL_OBJS+= arm_boot.o pl011.o pl050.o pl080.o pl110.o pl190.o
404 502a5395 pbrook
VL_OBJS+= versatile_pci.o
405 e69954b9 pbrook
VL_OBJS+= arm_gic.o realview.o arm_sysctl.o
406 8e71621f pbrook
VL_OBJS+= arm-semi.o
407 b5ff1b31 bellard
endif
408 fdf9b3e8 bellard
ifeq ($(TARGET_BASE_ARCH), sh4)
409 fdf9b3e8 bellard
VL_OBJS+= shix.o sh7750.o sh7750_regnames.o tc58128.o
410 fdf9b3e8 bellard
endif
411 a541f297 bellard
ifdef CONFIG_GDBSTUB
412 a541f297 bellard
VL_OBJS+=gdbstub.o 
413 728c9fd5 bellard
endif
414 626df76a bellard
ifdef CONFIG_SDL
415 6070dd07 ths
VL_OBJS+=sdl.o x_keymap.o
416 de5eaa64 bellard
endif
417 24236869 bellard
VL_OBJS+=vnc.o
418 5b0753e0 bellard
ifdef CONFIG_COCOA
419 5b0753e0 bellard
VL_OBJS+=cocoa.o
420 1d14ffa9 bellard
COCOA_LIBS=-F/System/Library/Frameworks -framework Cocoa -framework IOKit
421 1d14ffa9 bellard
ifdef CONFIG_COREAUDIO
422 1d14ffa9 bellard
COCOA_LIBS+=-framework CoreAudio
423 1d14ffa9 bellard
endif
424 5b0753e0 bellard
endif
425 7c1f25b4 bellard
ifdef CONFIG_SLIRP
426 6f30fa85 ths
CPPFLAGS+=-I$(SRC_PATH)/slirp
427 7c1f25b4 bellard
SLIRP_OBJS=cksum.o if.o ip_icmp.o ip_input.o ip_output.o \
428 7c1f25b4 bellard
slirp.o mbuf.o misc.o sbuf.o socket.o tcp_input.o tcp_output.o \
429 c7f74643 bellard
tcp_subr.o tcp_timer.o udp.o bootp.o debug.o tftp.o
430 7c1f25b4 bellard
VL_OBJS+=$(addprefix slirp/, $(SLIRP_OBJS))
431 626df76a bellard
endif
432 626df76a bellard
433 c321f673 bellard
VL_LDFLAGS=
434 70956b77 ths
VL_LIBS=$(AIOLIBS)
435 c321f673 bellard
# specific flags are needed for non soft mmu emulator
436 c321f673 bellard
ifdef CONFIG_STATIC
437 c321f673 bellard
VL_LDFLAGS+=-static
438 c321f673 bellard
endif
439 de5eaa64 bellard
ifndef CONFIG_SOFTMMU
440 de5eaa64 bellard
VL_LDFLAGS+=-Wl,-T,$(SRC_PATH)/i386-vl.ld 
441 de5eaa64 bellard
endif
442 83fb7adf bellard
ifndef CONFIG_DARWIN
443 11d9f695 bellard
ifndef CONFIG_WIN32
444 ec530c81 bellard
ifndef CONFIG_SOLARIS
445 70956b77 ths
VL_LIBS+=-lutil
446 11d9f695 bellard
endif
447 83fb7adf bellard
endif
448 ec530c81 bellard
endif
449 e3086fbf bellard
ifdef TARGET_GPROF
450 6f30fa85 ths
vl.o: BASE_CFLAGS+=-p
451 e3086fbf bellard
VL_LDFLAGS+=-p
452 e3086fbf bellard
endif
453 c321f673 bellard
454 b8076a74 bellard
ifeq ($(ARCH),ia64)
455 b8076a74 bellard
VL_LDFLAGS+=-Wl,-G0 -Wl,-T,$(SRC_PATH)/ia64.ld
456 b8076a74 bellard
endif
457 b8076a74 bellard
458 74ccb34e bellard
ifeq ($(ARCH),sparc64)
459 74ccb34e bellard
VL_LDFLAGS+=-m64
460 74ccb34e bellard
VL_LDFLAGS+=-Wl,-T,$(SRC_PATH)/sparc64.ld
461 74ccb34e bellard
endif
462 74ccb34e bellard
463 1d14ffa9 bellard
ifdef CONFIG_WIN32
464 1d14ffa9 bellard
SDL_LIBS := $(filter-out -mwindows, $(SDL_LIBS)) -mconsole
465 1d14ffa9 bellard
endif
466 1d14ffa9 bellard
467 1e43adfc bellard
$(QEMU_SYSTEM): $(VL_OBJS) libqemu.a
468 3a11702b pbrook
	$(CC) $(VL_LDFLAGS) $(LDFLAGS) -o $@ $^ $(LIBS) $(SDL_LIBS) $(COCOA_LIBS) $(VL_LIBS)
469 5b0753e0 bellard
470 5b0753e0 bellard
cocoa.o: cocoa.m
471 6f30fa85 ths
	$(CC) $(CFLAGS) $(CPPFLAGS) $(BASE_CFLAGS) -c -o $@ $<
472 626df76a bellard
473 3d11d0eb bellard
sdl.o: sdl.c keymaps.c sdl_keysym.h
474 6f30fa85 ths
	$(CC) $(CFLAGS) $(CPPFLAGS) $(SDL_CFLAGS) $(BASE_CFLAGS) -c -o $@ $<
475 626df76a bellard
476 24236869 bellard
vnc.o: vnc.c keymaps.c sdl_keysym.h vnchextile.h
477 6f30fa85 ths
	$(CC) $(CFLAGS) $(CPPFLAGS) $(BASE_CFLAGS) -c -o $@ $<
478 24236869 bellard
479 9f059eca bellard
sdlaudio.o: sdlaudio.c
480 6f30fa85 ths
	$(CC) $(CFLAGS) $(CPPFLAGS) $(SDL_CFLAGS) $(BASE_CFLAGS) -c -o $@ $<
481 9f059eca bellard
482 626df76a bellard
depend: $(SRCS)
483 6f30fa85 ths
	$(CC) -MM $(CFLAGS) $(CPPFLAGS) $(BASE_CFLAGS) $^ 1>.depend
484 626df76a bellard
485 1d14ffa9 bellard
vldepend: $(VL_OBJS:.o=.c)
486 6f30fa85 ths
	$(CC) -MM $(CFLAGS) $(CPPFLAGS) $(BASE_CFLAGS) $^ 1>.depend
487 1d14ffa9 bellard
488 626df76a bellard
# libqemu 
489 626df76a bellard
490 626df76a bellard
libqemu.a: $(LIBOBJS)
491 626df76a bellard
	rm -f $@
492 626df76a bellard
	$(AR) rcs $@ $(LIBOBJS)
493 626df76a bellard
494 1e43adfc bellard
translate.o: translate.c gen-op.h opc.h cpu.h
495 626df76a bellard
496 158142c2 bellard
translate-all.o: translate-all.c opc.h cpu.h
497 158142c2 bellard
498 158142c2 bellard
translate-op.o: translate-all.c op.h opc.h cpu.h
499 626df76a bellard
500 1e43adfc bellard
op.h: op.o $(DYNGEN)
501 626df76a bellard
	$(DYNGEN) -o $@ $<
502 626df76a bellard
503 1e43adfc bellard
opc.h: op.o $(DYNGEN)
504 626df76a bellard
	$(DYNGEN) -c -o $@ $<
505 626df76a bellard
506 1e43adfc bellard
gen-op.h: op.o $(DYNGEN)
507 626df76a bellard
	$(DYNGEN) -g -o $@ $<
508 626df76a bellard
509 1e43adfc bellard
op.o: op.c
510 6f30fa85 ths
	$(CC) $(OP_CFLAGS) $(CPPFLAGS) -c -o $@ $<
511 626df76a bellard
512 6e1b3e4d bellard
# HELPER_CFLAGS is used for all the code compiled with static register
513 6e1b3e4d bellard
# variables
514 6e1b3e4d bellard
ifeq ($(TARGET_BASE_ARCH), i386)
515 6e1b3e4d bellard
# XXX: rename helper.c to op_helper.c
516 1e43adfc bellard
helper.o: helper.c
517 6f30fa85 ths
	$(CC) $(HELPER_CFLAGS) $(CPPFLAGS) $(BASE_CFLAGS) -c -o $@ $<
518 6e1b3e4d bellard
else
519 6e1b3e4d bellard
op_helper.o: op_helper.c
520 6f30fa85 ths
	$(CC) $(HELPER_CFLAGS) $(CPPFLAGS) $(BASE_CFLAGS) -c -o $@ $<
521 6e1b3e4d bellard
endif
522 6e1b3e4d bellard
523 6e1b3e4d bellard
cpu-exec.o: cpu-exec.c
524 6f30fa85 ths
	$(CC) $(HELPER_CFLAGS) $(CPPFLAGS) $(BASE_CFLAGS) -c -o $@ $<
525 626df76a bellard
526 00a67ba1 bellard
# Note: this is a workaround. The real fix is to avoid compiling
527 00a67ba1 bellard
# cpu_signal_handler() in cpu-exec.c.
528 00a67ba1 bellard
signal.o: signal.c
529 6f30fa85 ths
	$(CC) $(HELPER_CFLAGS) $(CPPFLAGS) $(BASE_CFLAGS) -c -o $@ $<
530 00a67ba1 bellard
531 0b0babc6 bellard
ifeq ($(TARGET_BASE_ARCH), i386)
532 664e0f19 bellard
op.o: op.c opreg_template.h ops_template.h ops_template_mem.h ops_mem.h ops_sse.h
533 1e43adfc bellard
endif
534 1e43adfc bellard
535 1e43adfc bellard
ifeq ($(TARGET_ARCH), arm)
536 1e43adfc bellard
op.o: op.c op_template.h
537 bdd5003a pbrook
pl110.o: pl110_template.h
538 1e43adfc bellard
endif
539 626df76a bellard
540 64b3ab24 bellard
ifeq ($(TARGET_BASE_ARCH), sparc)
541 3475187d bellard
op.o: op.c op_template.h op_mem.h fop_template.h fbranch_template.h
542 3475187d bellard
magic_load.o: elf_op.h
543 1e43adfc bellard
endif
544 626df76a bellard
545 a2458627 bellard
ifeq ($(TARGET_BASE_ARCH), ppc)
546 728c9fd5 bellard
op.o: op.c op_template.h op_mem.h
547 728c9fd5 bellard
op_helper.o: op_helper_mem.h
548 3fc6c082 bellard
translate.o: translate.c translate_init.c
549 728c9fd5 bellard
endif
550 728c9fd5 bellard
551 6af0bf9c bellard
ifeq ($(TARGET_ARCH), mips)
552 c281868e ths
op.o: op.c op_template.c fop_template.c op_mem.c
553 6af0bf9c bellard
op_helper.o: op_helper_mem.c
554 33d68b5f ths
translate.o: translate.c translate_init.c
555 6af0bf9c bellard
endif
556 6af0bf9c bellard
557 5fe141fd bellard
loader.o: loader.c elf_ops.h
558 5fe141fd bellard
559 fdf9b3e8 bellard
ifeq ($(TARGET_ARCH), sh4)
560 fdf9b3e8 bellard
op.o: op.c op_mem.c cpu.h
561 fdf9b3e8 bellard
op_helper.o: op_helper.c exec.h cpu.h
562 fdf9b3e8 bellard
helper.o: helper.c exec.h cpu.h
563 27c7ca7e bellard
sh7750.o: sh7750.c sh7750_regs.h sh7750_regnames.h cpu.h
564 27c7ca7e bellard
shix.o: shix.c sh7750_regs.h sh7750_regnames.h
565 fdf9b3e8 bellard
sh7750_regnames.o: sh7750_regnames.c sh7750_regnames.h sh7750_regs.h
566 27c7ca7e bellard
tc58128.o: tc58128.c
567 fdf9b3e8 bellard
endif
568 fdf9b3e8 bellard
569 214feb51 pbrook
$(OBJS) $(LIBOBJS) $(VL_OBJS): config.h ../config-host.h
570 214feb51 pbrook
571 626df76a bellard
%.o: %.c
572 6f30fa85 ths
	$(CC) $(CFLAGS) $(CPPFLAGS) $(BASE_CFLAGS) -c -o $@ $<
573 626df76a bellard
574 f72b519c bellard
%.o: %.S
575 6f30fa85 ths
	$(CC) $(CPPFLAGS) -c -o $@ $<
576 f72b519c bellard
577 626df76a bellard
clean:
578 e362b55a bellard
	rm -f *.o  *.a *~ $(PROGS) gen-op.h opc.h op.h nwfpe/*.o slirp/*.o fpu/*.o
579 1e43adfc bellard
580 1e43adfc bellard
install: all 
581 9b14bb04 bellard
ifneq ($(PROGS),)
582 6a882643 pbrook
	$(INSTALL) -m 755 -s $(PROGS) "$(DESTDIR)$(bindir)"
583 9b14bb04 bellard
endif
584 626df76a bellard
585 626df76a bellard
ifneq ($(wildcard .depend),)
586 626df76a bellard
include .depend
587 626df76a bellard
endif
588 1d14ffa9 bellard
589 c0fe3827 bellard
ifeq (1, 0)
590 1d14ffa9 bellard
audio.o sdlaudio.o dsoundaudio.o ossaudio.o wavaudio.o noaudio.o \
591 c0fe3827 bellard
fmodaudio.o alsaaudio.o mixeng.o sb16.o es1370.o gus.o adlib.o: \
592 1d14ffa9 bellard
CFLAGS := $(CFLAGS) -Wall -Werror -W -Wsign-compare
593 1d14ffa9 bellard
endif