Statistics
| Branch: | Revision:

root / Makefile.target @ 70ead434

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