Statistics
| Branch: | Revision:

root / Makefile.target @ 0d92ed30

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