Statistics
| Branch: | Revision:

root / Makefile.target @ 57be54bb

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