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