]>
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 | |
540635ba TS |
7 | ifeq ($(TARGET_ARCH), mipsn32) |
8 | TARGET_BASE_ARCH:=mips | |
9 | endif | |
fbe4f65b TS |
10 | ifeq ($(TARGET_ARCH), mips64) |
11 | TARGET_BASE_ARCH:=mips | |
12 | endif | |
a2458627 FB |
13 | ifeq ($(TARGET_ARCH), ppc64) |
14 | TARGET_BASE_ARCH:=ppc | |
15 | endif | |
22f8a8b3 JM |
16 | ifeq ($(TARGET_ARCH), ppc64h) |
17 | TARGET_BASE_ARCH:=ppc | |
18 | endif | |
d4082e95 JM |
19 | ifeq ($(TARGET_ARCH), ppcemb) |
20 | TARGET_BASE_ARCH:=ppc | |
21 | endif | |
64b3ab24 FB |
22 | ifeq ($(TARGET_ARCH), sparc64) |
23 | TARGET_BASE_ARCH:=sparc | |
24 | endif | |
0b0babc6 | 25 | TARGET_PATH=$(SRC_PATH)/target-$(TARGET_BASE_ARCH) |
4fb240a4 | 26 | VPATH=$(SRC_PATH):$(TARGET_PATH):$(SRC_PATH)/hw |
46dc3881 | 27 | CPPFLAGS=-I. -I.. -I$(TARGET_PATH) -I$(SRC_PATH) -MMD -MT $@ -MP -DNEED_CPU_H |
0b0babc6 | 28 | #CFLAGS+=-Werror |
626df76a | 29 | LIBS= |
1e43adfc | 30 | # user emulator name |
0c64b9cd | 31 | ifndef TARGET_ARCH2 |
c91fde65 | 32 | TARGET_ARCH2=$(TARGET_ARCH) |
0c64b9cd | 33 | endif |
808c4954 FB |
34 | ifeq ($(TARGET_ARCH),arm) |
35 | ifeq ($(TARGET_WORDS_BIGENDIAN),yes) | |
c91fde65 | 36 | TARGET_ARCH2=armeb |
808c4954 | 37 | endif |
c91fde65 | 38 | endif |
908f52b0 PB |
39 | ifeq ($(TARGET_ARCH),sh4) |
40 | ifeq ($(TARGET_WORDS_BIGENDIAN),yes) | |
41 | TARGET_ARCH2=sh4eb | |
42 | endif | |
43 | endif | |
01f5e596 | 44 | ifeq ($(TARGET_ARCH),mips) |
c91fde65 FB |
45 | ifneq ($(TARGET_WORDS_BIGENDIAN),yes) |
46 | TARGET_ARCH2=mipsel | |
01f5e596 | 47 | endif |
01f5e596 | 48 | endif |
540635ba TS |
49 | ifeq ($(TARGET_ARCH),mipsn32) |
50 | ifneq ($(TARGET_WORDS_BIGENDIAN),yes) | |
51 | TARGET_ARCH2=mipsn32el | |
52 | endif | |
53 | endif | |
fbe4f65b TS |
54 | ifeq ($(TARGET_ARCH),mips64) |
55 | ifneq ($(TARGET_WORDS_BIGENDIAN),yes) | |
56 | TARGET_ARCH2=mips64el | |
57 | endif | |
58 | endif | |
40293e58 FB |
59 | |
60 | ifdef CONFIG_USER_ONLY | |
61 | # user emulator name | |
62 | QEMU_PROG=qemu-$(TARGET_ARCH2) | |
63 | else | |
1e43adfc | 64 | # system emulator name |
a541f297 | 65 | ifeq ($(TARGET_ARCH), i386) |
40293e58 | 66 | QEMU_PROG=qemu$(EXESUF) |
0db63474 | 67 | else |
40293e58 | 68 | QEMU_PROG=qemu-system-$(TARGET_ARCH2)$(EXESUF) |
a541f297 | 69 | endif |
de5eaa64 | 70 | endif |
626df76a | 71 | |
40293e58 | 72 | PROGS=$(QEMU_PROG) |
626df76a | 73 | |
6c041c54 | 74 | # cc-option |
c7328801 | 75 | # Usage: CFLAGS+=$(call cc-option, $(CFLAGS), -falign-functions=0, -malign-functions=0) |
6c041c54 | 76 | |
c7328801 AL |
77 | cc-option = $(shell if $(CC) $(1) $(2) -S -o /dev/null -xc /dev/null \ |
78 | > /dev/null 2>&1; then echo "$(2)"; else echo "$(3)"; fi ;) | |
6f30fa85 | 79 | |
40293e58 FB |
80 | HELPER_CFLAGS= |
81 | ||
626df76a | 82 | ifeq ($(ARCH),i386) |
6f30fa85 | 83 | HELPER_CFLAGS+=-fomit-frame-pointer |
bc51c5c9 FB |
84 | endif |
85 | ||
626df76a | 86 | ifeq ($(ARCH),sparc) |
40293e58 | 87 | CFLAGS+=-ffixed-g2 -ffixed-g3 |
c7328801 | 88 | ifneq ($(CONFIG_SOLARIS),yes) |
40293e58 FB |
89 | CFLAGS+=-ffixed-g1 -ffixed-g6 |
90 | HELPER_CFLAGS+=-ffixed-i0 | |
3142255c | 91 | endif |
fdbb4691 | 92 | endif |
626df76a FB |
93 | |
94 | ifeq ($(ARCH),sparc64) | |
3142255c | 95 | ifneq ($(CONFIG_SOLARIS),yes) |
e97b640d | 96 | CFLAGS+=-ffixed-g5 -ffixed-g6 -ffixed-g7 |
e97b640d BS |
97 | else |
98 | CFLAGS+=-ffixed-g1 -ffixed-g4 -ffixed-g5 -ffixed-g7 | |
3142255c | 99 | endif |
626df76a FB |
100 | endif |
101 | ||
102 | ifeq ($(ARCH),alpha) | |
626df76a | 103 | # Ensure there's only a single GP |
40293e58 | 104 | CFLAGS+=-msmall-data |
626df76a FB |
105 | endif |
106 | ||
f54b3f92 | 107 | ifeq ($(ARCH),hppa) |
f54b3f92 AJ |
108 | BASE_LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld |
109 | endif | |
110 | ||
626df76a | 111 | ifeq ($(ARCH),ia64) |
40293e58 | 112 | CFLAGS+=-mno-sdata |
83fb7adf FB |
113 | endif |
114 | ||
40293e58 FB |
115 | CFLAGS+=$(OS_CFLAGS) $(ARCH_CFLAGS) |
116 | LDFLAGS+=$(OS_LDFLAGS) $(ARCH_LDFLAGS) | |
626df76a | 117 | |
6f30fa85 | 118 | CPPFLAGS+=-D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE |
626df76a | 119 | LIBS+=-lm |
67b915a5 | 120 | ifdef CONFIG_WIN32 |
3db38e87 | 121 | LIBS+=-lwinmm -lws2_32 -liphlpapi |
67b915a5 | 122 | endif |
ec530c81 FB |
123 | ifdef CONFIG_SOLARIS |
124 | LIBS+=-lsocket -lnsl -lresolv | |
0475a5ca TS |
125 | ifdef NEEDS_LIBSUNMATH |
126 | LIBS+=-lsunmath | |
127 | LDFLAGS+=-L/opt/SUNWspro/prod/lib -R/opt/SUNWspro/prod/lib | |
40293e58 | 128 | CFLAGS+=-I/opt/SUNWspro/prod/include/cc |
f72b519c | 129 | endif |
831b7825 TS |
130 | endif |
131 | ||
7ba1e619 AL |
132 | kvm.o: CFLAGS+=$(KVM_CFLAGS) |
133 | kvm-all.o: CFLAGS+=$(KVM_CFLAGS) | |
134 | ||
40293e58 | 135 | all: $(PROGS) |
626df76a | 136 | |
40293e58 | 137 | ######################################################### |
626df76a | 138 | # cpu emulator library |
57fec1fe | 139 | LIBOBJS=exec.o kqemu.o translate-all.o cpu-exec.o\ |
cf2be984 | 140 | translate.o host-utils.o |
57fec1fe | 141 | # TCG code generator |
49516bc0 | 142 | LIBOBJS+= tcg/tcg.o tcg/tcg-runtime.o |
57fec1fe | 143 | CPPFLAGS+=-I$(SRC_PATH)/tcg -I$(SRC_PATH)/tcg/$(ARCH) |
8289b279 BS |
144 | ifeq ($(ARCH),sparc64) |
145 | CPPFLAGS+=-I$(SRC_PATH)/tcg/sparc | |
146 | endif | |
158142c2 FB |
147 | ifdef CONFIG_SOFTFLOAT |
148 | LIBOBJS+=fpu/softfloat.o | |
149 | else | |
150 | LIBOBJS+=fpu/softfloat-native.o | |
151 | endif | |
6f30fa85 | 152 | CPPFLAGS+=-I$(SRC_PATH)/fpu |
e95c8d51 | 153 | LIBOBJS+= op_helper.o helper.o |
e95c8d51 | 154 | |
b7bcbe95 | 155 | ifeq ($(TARGET_BASE_ARCH), arm) |
eaa728ee | 156 | LIBOBJS+= neon_helper.o iwmmxt_helper.o |
e6e5906b PB |
157 | endif |
158 | ||
cf6c1b16 | 159 | ifeq ($(TARGET_BASE_ARCH), alpha) |
eaa728ee | 160 | LIBOBJS+= alpha_palcode.o |
cf6c1b16 JM |
161 | endif |
162 | ||
e7daa605 | 163 | ifeq ($(TARGET_BASE_ARCH), cris) |
e7daa605 TS |
164 | LIBOBJS+= cris-dis.o |
165 | ||
166 | ifndef CONFIG_USER_ONLY | |
167 | LIBOBJS+= mmu.o | |
168 | endif | |
169 | endif | |
170 | ||
626df76a | 171 | # NOTE: the disassembler code is only needed for debugging |
5fafdf24 | 172 | LIBOBJS+=disas.o |
626df76a | 173 | ifeq ($(findstring i386, $(TARGET_ARCH) $(ARCH)),i386) |
bc51c5c9 FB |
174 | USE_I386_DIS=y |
175 | endif | |
0b0babc6 | 176 | ifeq ($(findstring x86_64, $(TARGET_ARCH) $(ARCH)),x86_64) |
bc51c5c9 FB |
177 | USE_I386_DIS=y |
178 | endif | |
179 | ifdef USE_I386_DIS | |
626df76a FB |
180 | LIBOBJS+=i386-dis.o |
181 | endif | |
182 | ifeq ($(findstring alpha, $(TARGET_ARCH) $(ARCH)),alpha) | |
183 | LIBOBJS+=alpha-dis.o | |
184 | endif | |
a2458627 | 185 | ifeq ($(findstring ppc, $(TARGET_BASE_ARCH) $(ARCH)),ppc) |
626df76a FB |
186 | LIBOBJS+=ppc-dis.o |
187 | endif | |
fbe4f65b | 188 | ifeq ($(findstring mips, $(TARGET_BASE_ARCH) $(ARCH)),mips) |
6af0bf9c FB |
189 | LIBOBJS+=mips-dis.o |
190 | endif | |
64b3ab24 | 191 | ifeq ($(findstring sparc, $(TARGET_BASE_ARCH) $(ARCH)),sparc) |
626df76a FB |
192 | LIBOBJS+=sparc-dis.o |
193 | endif | |
194 | ifeq ($(findstring arm, $(TARGET_ARCH) $(ARCH)),arm) | |
195 | LIBOBJS+=arm-dis.o | |
196 | endif | |
48024e4a FB |
197 | ifeq ($(findstring m68k, $(TARGET_ARCH) $(ARCH)),m68k) |
198 | LIBOBJS+=m68k-dis.o | |
199 | endif | |
fdf9b3e8 FB |
200 | ifeq ($(findstring sh4, $(TARGET_ARCH) $(ARCH)),sh4) |
201 | LIBOBJS+=sh4-dis.o | |
202 | endif | |
f54b3f92 AJ |
203 | ifeq ($(findstring hppa, $(TARGET_BASE_ARCH) $(ARCH)),hppa) |
204 | LIBOBJS+=hppa-dis.o | |
205 | endif | |
8f860bb8 TS |
206 | ifeq ($(findstring s390, $(TARGET_ARCH) $(ARCH)),s390) |
207 | LIBOBJS+=s390-dis.o | |
208 | endif | |
626df76a | 209 | |
40293e58 FB |
210 | # libqemu |
211 | ||
212 | libqemu.a: $(LIBOBJS) | |
213 | rm -f $@ | |
214 | $(AR) rcs $@ $(LIBOBJS) | |
215 | ||
86e840ee | 216 | translate.o: translate.c cpu.h |
40293e58 | 217 | |
86e840ee | 218 | translate-all.o: translate-all.c cpu.h |
40293e58 | 219 | |
86e840ee | 220 | tcg/tcg.o: cpu.h |
40293e58 FB |
221 | |
222 | # HELPER_CFLAGS is used for all the code compiled with static register | |
223 | # variables | |
807544e2 | 224 | op_helper.o: CFLAGS += $(HELPER_CFLAGS) $(I386_CFLAGS) |
40293e58 | 225 | |
807544e2 | 226 | cpu-exec.o: CFLAGS += $(HELPER_CFLAGS) |
40293e58 FB |
227 | |
228 | ######################################################### | |
229 | # Linux user emulator target | |
230 | ||
231 | ifdef CONFIG_LINUX_USER | |
232 | ||
40293e58 FB |
233 | ifndef TARGET_ABI_DIR |
234 | TARGET_ABI_DIR=$(TARGET_ARCH) | |
235 | endif | |
3ebdd119 | 236 | VPATH+=:$(SRC_PATH)/linux-user:$(SRC_PATH)/linux-user/$(TARGET_ABI_DIR) |
40293e58 FB |
237 | CPPFLAGS+=-I$(SRC_PATH)/linux-user -I$(SRC_PATH)/linux-user/$(TARGET_ABI_DIR) |
238 | ||
239 | ifdef CONFIG_STATIC | |
240 | LDFLAGS+=-static | |
241 | endif | |
242 | ||
243 | ifeq ($(ARCH),i386) | |
244 | ifdef TARGET_GPROF | |
245 | USE_I386_LD=y | |
246 | endif | |
247 | ifdef CONFIG_STATIC | |
248 | USE_I386_LD=y | |
249 | endif | |
250 | ifdef USE_I386_LD | |
251 | LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld | |
252 | else | |
253 | # WARNING: this LDFLAGS is _very_ tricky : qemu is an ELF shared object | |
254 | # that the kernel ELF loader considers as an executable. I think this | |
255 | # is the simplest way to make it self virtualizable! | |
256 | LDFLAGS+=-Wl,-shared | |
257 | endif | |
258 | endif | |
259 | ||
260 | ifeq ($(ARCH),x86_64) | |
261 | LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld | |
262 | endif | |
263 | ||
264 | ifeq ($(ARCH),ppc) | |
265 | LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld | |
266 | endif | |
267 | ||
810260a8 | 268 | ifeq ($(ARCH),ppc64) |
269 | LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld | |
270 | endif | |
271 | ||
40293e58 FB |
272 | ifeq ($(ARCH),s390) |
273 | LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld | |
274 | endif | |
275 | ||
276 | ifeq ($(ARCH),sparc) | |
277 | # -static is used to avoid g1/g3 usage by the dynamic linker | |
278 | LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld -static | |
279 | endif | |
280 | ||
281 | ifeq ($(ARCH),sparc64) | |
282 | LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld | |
283 | endif | |
284 | ||
285 | ifeq ($(ARCH),alpha) | |
286 | LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld | |
287 | endif | |
288 | ||
289 | ifeq ($(ARCH),ia64) | |
290 | LDFLAGS+=-Wl,-G0 -Wl,-T,$(SRC_PATH)/$(ARCH).ld | |
291 | endif | |
292 | ||
293 | ifeq ($(ARCH),arm) | |
294 | LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld | |
295 | endif | |
296 | ||
297 | ifeq ($(ARCH),m68k) | |
298 | LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld | |
299 | endif | |
300 | ||
301 | ifeq ($(ARCH),mips) | |
302 | ifeq ($(WORDS_BIGENDIAN),yes) | |
303 | LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld | |
304 | else | |
305 | LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH)el.ld | |
306 | endif | |
307 | endif | |
308 | ||
309 | ifeq ($(ARCH),mips64) | |
310 | ifeq ($(WORDS_BIGENDIAN),yes) | |
311 | LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld | |
312 | else | |
313 | LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH)el.ld | |
314 | endif | |
315 | endif | |
316 | ||
6d946cda AJ |
317 | # profiling code |
318 | ifdef TARGET_GPROF | |
319 | LDFLAGS+=-p | |
320 | CFLAGS+=-p | |
321 | endif | |
322 | ||
17e2377a | 323 | OBJS= main.o syscall.o strace.o mmap.o signal.o path.o thunk.o \ |
40293e58 FB |
324 | elfload.o linuxload.o uaccess.o |
325 | LIBS+= $(AIOLIBS) | |
326 | ifdef TARGET_HAS_BFLT | |
327 | OBJS+= flatload.o | |
328 | endif | |
329 | ifdef TARGET_HAS_ELFLOAD32 | |
330 | OBJS+= elfload32.o | |
331 | elfload32.o: elfload.c | |
332 | endif | |
333 | ||
334 | ifeq ($(TARGET_ARCH), i386) | |
335 | OBJS+= vm86.o | |
336 | endif | |
337 | ifeq ($(TARGET_ARCH), arm) | |
338 | OBJS+=nwfpe/fpa11.o nwfpe/fpa11_cpdo.o \ | |
339 | nwfpe/fpa11_cpdt.o nwfpe/fpa11_cprt.o nwfpe/fpopcode.o nwfpe/single_cpdo.o \ | |
340 | nwfpe/double_cpdo.o nwfpe/extended_cpdo.o arm-semi.o | |
341 | endif | |
342 | ifeq ($(TARGET_ARCH), m68k) | |
343 | OBJS+= m68k-sim.o m68k-semi.o | |
344 | endif | |
345 | ||
1fddef4b | 346 | ifdef CONFIG_GDBSTUB |
56aebc89 | 347 | OBJS+=gdbstub.o gdbstub-xml.o |
1fddef4b | 348 | endif |
626df76a | 349 | |
40293e58 FB |
350 | OBJS+= libqemu.a |
351 | ||
352 | # Note: this is a workaround. The real fix is to avoid compiling | |
353 | # cpu_signal_handler() in cpu-exec.c. | |
807544e2 | 354 | signal.o: CFLAGS += $(HELPER_CFLAGS) |
626df76a | 355 | |
cec7d0b6 | 356 | $(QEMU_PROG): $(OBJS) ../libqemu_user.a |
40293e58 | 357 | $(CC) $(LDFLAGS) -o $@ $^ $(LIBS) |
626df76a FB |
358 | ifeq ($(ARCH),alpha) |
359 | # Mark as 32 bit binary, i. e. it will be mapped into the low 31 bit of | |
360 | # the address space (31 bit so sign extending doesn't matter) | |
361 | echo -ne '\001\000\000\000' | dd of=qemu bs=1 seek=48 count=4 conv=notrunc | |
362 | endif | |
363 | ||
40293e58 FB |
364 | endif #CONFIG_LINUX_USER |
365 | ||
366 | ######################################################### | |
367 | # Darwin user emulator target | |
368 | ||
369 | ifdef CONFIG_DARWIN_USER | |
370 | ||
371 | VPATH+=:$(SRC_PATH)/darwin-user | |
372 | CPPFLAGS+=-I$(SRC_PATH)/darwin-user -I$(SRC_PATH)/darwin-user/$(TARGET_ARCH) | |
373 | ||
374 | # Leave some space for the regular program loading zone | |
375 | LDFLAGS+=-Wl,-segaddr,__STD_PROG_ZONE,0x1000 -image_base 0x0e000000 | |
376 | ||
377 | LIBS+=-lmx | |
378 | ||
17e2377a | 379 | OBJS= main.o commpage.o machload.o mmap.o signal.o syscall.o thunk.o |
40293e58 FB |
380 | |
381 | OBJS+= libqemu.a | |
382 | ||
383 | ifdef CONFIG_GDBSTUB | |
56aebc89 | 384 | OBJS+=gdbstub.o gdbstub-xml.o |
40293e58 FB |
385 | endif |
386 | ||
387 | # Note: this is a workaround. The real fix is to avoid compiling | |
388 | # cpu_signal_handler() in cpu-exec.c. | |
807544e2 | 389 | signal.o: CFLAGS += $(HELPER_CFLAGS) |
40293e58 FB |
390 | |
391 | $(QEMU_PROG): $(OBJS) | |
392 | $(CC) $(LDFLAGS) -o $@ $^ $(LIBS) | |
393 | ||
394 | endif #CONFIG_DARWIN_USER | |
395 | ||
84778508 BS |
396 | ######################################################### |
397 | # BSD user emulator target | |
398 | ||
399 | ifdef CONFIG_BSD_USER | |
400 | ||
401 | VPATH+=:$(SRC_PATH)/bsd-user | |
402 | CPPFLAGS+=-I$(SRC_PATH)/bsd-user -I$(SRC_PATH)/bsd-user/$(TARGET_ARCH) | |
403 | ||
404 | ifdef CONFIG_STATIC | |
405 | LDFLAGS+=-static | |
406 | endif | |
407 | ||
408 | ifeq ($(ARCH),i386) | |
409 | ifdef TARGET_GPROF | |
410 | USE_I386_LD=y | |
411 | endif | |
412 | ifdef CONFIG_STATIC | |
413 | USE_I386_LD=y | |
414 | endif | |
415 | ifdef USE_I386_LD | |
416 | LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld | |
417 | else | |
418 | # WARNING: this LDFLAGS is _very_ tricky : qemu is an ELF shared object | |
419 | # that the kernel ELF loader considers as an executable. I think this | |
420 | # is the simplest way to make it self virtualizable! | |
421 | LDFLAGS+=-Wl,-shared | |
422 | endif | |
423 | endif | |
424 | ||
425 | ifeq ($(ARCH),x86_64) | |
426 | LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld | |
427 | endif | |
428 | ||
429 | ifeq ($(ARCH),ppc) | |
430 | LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld | |
431 | endif | |
432 | ||
433 | ifeq ($(ARCH),ppc64) | |
434 | LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld | |
435 | endif | |
436 | ||
437 | ifeq ($(ARCH),s390) | |
438 | LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld | |
439 | endif | |
440 | ||
441 | ifeq ($(ARCH),sparc) | |
442 | # -static is used to avoid g1/g3 usage by the dynamic linker | |
443 | LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld -static | |
444 | endif | |
445 | ||
446 | ifeq ($(ARCH),sparc64) | |
447 | LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld | |
448 | endif | |
449 | ||
450 | ifeq ($(ARCH),alpha) | |
451 | LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld | |
452 | endif | |
453 | ||
454 | ifeq ($(ARCH),ia64) | |
455 | LDFLAGS+=-Wl,-G0 -Wl,-T,$(SRC_PATH)/$(ARCH).ld | |
456 | endif | |
457 | ||
458 | ifeq ($(ARCH),arm) | |
459 | LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld | |
460 | endif | |
461 | ||
462 | ifeq ($(ARCH),m68k) | |
463 | LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld | |
464 | endif | |
465 | ||
466 | ifeq ($(ARCH),mips) | |
467 | ifeq ($(WORDS_BIGENDIAN),yes) | |
468 | LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld | |
469 | else | |
470 | LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH)el.ld | |
471 | endif | |
472 | endif | |
473 | ||
474 | ifeq ($(ARCH),mips64) | |
475 | ifeq ($(WORDS_BIGENDIAN),yes) | |
476 | LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld | |
477 | else | |
478 | LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH)el.ld | |
479 | endif | |
480 | endif | |
481 | ||
482 | OBJS= main.o bsdload.o elfload.o mmap.o path.o signal.o strace.o syscall.o | |
483 | OBJS+= uaccess.o | |
484 | ||
485 | OBJS+= libqemu.a | |
486 | ||
487 | ifdef CONFIG_GDBSTUB | |
488 | OBJS+=gdbstub.o | |
489 | endif | |
490 | ||
491 | # Note: this is a workaround. The real fix is to avoid compiling | |
492 | # cpu_signal_handler() in cpu-exec.c. | |
807544e2 | 493 | signal.o: CFLAGS += $(HELPER_CFLAGS) |
84778508 BS |
494 | |
495 | $(QEMU_PROG): $(OBJS) ../libqemu_user.a | |
496 | $(CC) $(LDFLAGS) -o $@ $^ $(LIBS) | |
497 | ||
498 | endif #CONFIG_BSD_USER | |
499 | ||
40293e58 FB |
500 | ######################################################### |
501 | # System emulator target | |
502 | ifndef CONFIG_USER_ONLY | |
503 | ||
559b90fb | 504 | OBJS=vl.o osdep.o monitor.o pci.o loader.o isa_mmio.o machine.o |
1fd31ad7 AL |
505 | # virtio has to be here due to weird dependency between PCI and virtio-net. |
506 | # need to fix this properly | |
9ede2fde | 507 | OBJS+=virtio.o virtio-blk.o virtio-balloon.o virtio-net.o virtio-console.o |
559b90fb | 508 | OBJS+=fw_cfg.o |
7ba1e619 AL |
509 | ifdef CONFIG_KVM |
510 | OBJS+=kvm.o kvm-all.o | |
511 | endif | |
223d4670 | 512 | ifdef CONFIG_WIN32 |
40293e58 | 513 | OBJS+=block-raw-win32.o |
223d4670 | 514 | else |
3c529d93 AL |
515 | ifdef CONFIG_AIO |
516 | OBJS+=posix-aio-compat.o | |
517 | endif | |
559b90fb | 518 | OBJS+=block-raw-posix.o |
a3392f9b AL |
519 | endif |
520 | ||
40293e58 | 521 | LIBS+=-lz |
1d14ffa9 | 522 | ifdef CONFIG_ALSA |
1d14ffa9 FB |
523 | LIBS += -lasound |
524 | endif | |
ca9cc28c AZ |
525 | ifdef CONFIG_ESD |
526 | LIBS += -lesd | |
527 | endif | |
b8e59f18 | 528 | ifdef CONFIG_PA |
529 | LIBS += -lpulse-simple | |
530 | endif | |
1d14ffa9 | 531 | ifdef CONFIG_DSOUND |
1d14ffa9 | 532 | LIBS += -lole32 -ldxguid |
85571bc7 | 533 | endif |
102a52e4 | 534 | ifdef CONFIG_FMOD |
102a52e4 | 535 | LIBS += $(CONFIG_FMOD_LIB) |
85571bc7 | 536 | endif |
2f6a1ab0 BS |
537 | ifdef CONFIG_OSS |
538 | LIBS += $(CONFIG_OSS_LIB) | |
539 | endif | |
4fb240a4 | 540 | |
b0f3b8fa | 541 | SOUND_HW = sb16.o es1370.o ac97.o |
1d14ffa9 FB |
542 | ifdef CONFIG_ADLIB |
543 | SOUND_HW += fmopl.o adlib.o | |
c40e866f | 544 | adlib.o fmopl.o: CFLAGS := ${CFLAGS} -DBUILD_Y8950=0 |
1d14ffa9 | 545 | endif |
423d65f4 AZ |
546 | ifdef CONFIG_GUS |
547 | SOUND_HW += gus.o gusemu_hal.o gusemu_mixer.o | |
548 | endif | |
cc53d26d | 549 | ifdef CONFIG_CS4231A |
550 | SOUND_HW += cs4231a.o | |
551 | endif | |
85571bc7 | 552 | |
8d5d2d4c TS |
553 | ifdef CONFIG_VNC_TLS |
554 | CPPFLAGS += $(CONFIG_VNC_TLS_CFLAGS) | |
555 | LIBS += $(CONFIG_VNC_TLS_LIBS) | |
556 | endif | |
557 | ||
fb599c9a AZ |
558 | ifdef CONFIG_BLUEZ |
559 | LIBS += $(CONFIG_BLUEZ_LIBS) | |
560 | endif | |
561 | ||
2e5d83bb | 562 | # SCSI layer |
8b17de88 | 563 | OBJS+= lsi53c895a.o esp.o |
2e5d83bb | 564 | |
a594cfbf | 565 | # USB layer |
40293e58 | 566 | OBJS+= usb-ohci.o |
a594cfbf | 567 | |
663e8e51 | 568 | # EEPROM emulation |
40293e58 | 569 | OBJS += eeprom93xx.o |
663e8e51 | 570 | |
a41b2ff2 | 571 | # PCI network cards |
40293e58 FB |
572 | OBJS += eepro100.o |
573 | OBJS += ne2000.o | |
574 | OBJS += pcnet.o | |
575 | OBJS += rtl8139.o | |
7c23b892 | 576 | OBJS += e1000.o |
a41b2ff2 | 577 | |
0b0babc6 | 578 | ifeq ($(TARGET_BASE_ARCH), i386) |
a541f297 | 579 | # Hardware support |
40293e58 FB |
580 | OBJS+= ide.o pckbd.o ps2.o vga.o $(SOUND_HW) dma.o |
581 | OBJS+= fdc.o mc146818rtc.o serial.o i8259.o i8254.o pcspk.o pc.o | |
582 | OBJS+= cirrus_vga.o apic.o parallel.o acpi.o piix_pci.o | |
16b29ae1 | 583 | OBJS+= usb-uhci.o vmmouse.o vmport.o vmware_vga.o hpet.o |
b00052e4 | 584 | CPPFLAGS += -DHAS_AUDIO -DHAS_AUDIO_CHOICE |
67b915a5 | 585 | endif |
a2458627 | 586 | ifeq ($(TARGET_BASE_ARCH), ppc) |
70ad3dec | 587 | CPPFLAGS += -DHAS_AUDIO -DHAS_AUDIO_CHOICE |
3cbee15b | 588 | # shared objects |
40293e58 | 589 | OBJS+= ppc.o ide.o vga.o $(SOUND_HW) dma.o openpic.o |
3cbee15b | 590 | # PREP target |
40293e58 FB |
591 | OBJS+= pckbd.o ps2.o serial.o i8259.o i8254.o fdc.o m48t59.o mc146818rtc.o |
592 | OBJS+= prep_pci.o ppc_prep.o | |
3cbee15b | 593 | # Mac shared devices |
7fa9ae1a | 594 | OBJS+= macio.o cuda.o adb.o mac_nvram.o mac_dbdma.o escc.o |
3cbee15b | 595 | # OldWorld PowerMac |
40293e58 | 596 | OBJS+= heathrow_pic.o grackle_pci.o ppc_oldworld.o |
3cbee15b | 597 | # NewWorld PowerMac |
40293e58 | 598 | OBJS+= unin_pci.o ppc_chrp.o |
3cbee15b | 599 | # PowerPC 4xx boards |
825bb581 | 600 | OBJS+= pflash_cfi02.o ppc4xx_devs.o ppc4xx_pci.o ppc405_uc.o ppc405_boards.o |
2c9fade2 | 601 | OBJS+= ppc440.o ppc440_bamboo.o |
f652e6af AJ |
602 | ifdef FDT_LIBS |
603 | OBJS+= device_tree.o | |
604 | LIBS+= $(FDT_LIBS) | |
605 | endif | |
d76d1650 AJ |
606 | ifdef CONFIG_KVM |
607 | OBJS+= kvm_ppc.o | |
608 | endif | |
a541f297 | 609 | endif |
fbe4f65b | 610 | ifeq ($(TARGET_BASE_ARCH), mips) |
c171148c | 611 | OBJS+= mips_r4k.o mips_jazz.o mips_malta.o mips_mipssim.o |
4ce7ff6e AJ |
612 | OBJS+= mips_timer.o mips_int.o dma.o vga.o serial.o i8254.o i8259.o rc4030.o |
613 | OBJS+= g364fb.o jazz_led.o | |
40293e58 | 614 | OBJS+= ide.o gt64xxx.o pckbd.o ps2.o fdc.o mc146818rtc.o usb-uhci.o acpi.o ds1225y.o |
4ce7ff6e | 615 | OBJS+= piix_pci.o parallel.o cirrus_vga.o pcspk.o $(SOUND_HW) |
40293e58 FB |
616 | OBJS+= mipsnet.o |
617 | OBJS+= pflash_cfi01.o | |
4ce7ff6e | 618 | CPPFLAGS += -DHAS_AUDIO -DHAS_AUDIO_CHOICE |
6af0bf9c | 619 | endif |
e7daa605 | 620 | ifeq ($(TARGET_BASE_ARCH), cris) |
10c144e2 EI |
621 | # Boards |
622 | OBJS+= etraxfs.o axis_dev88.o | |
623 | ||
624 | # IO blocks | |
48318011 | 625 | OBJS+= etraxfs_dma.o |
e62b5b13 | 626 | OBJS+= etraxfs_pic.o |
48318011 | 627 | OBJS+= etraxfs_eth.o |
40293e58 FB |
628 | OBJS+= etraxfs_timer.o |
629 | OBJS+= etraxfs_ser.o | |
e62b5b13 EI |
630 | |
631 | OBJS+= ptimer.o | |
10c144e2 | 632 | OBJS+= pflash_cfi02.o nand.o |
e7daa605 | 633 | endif |
64b3ab24 | 634 | ifeq ($(TARGET_BASE_ARCH), sparc) |
3475187d | 635 | ifeq ($(TARGET_ARCH), sparc64) |
40293e58 FB |
636 | OBJS+= sun4u.o ide.o pckbd.o ps2.o vga.o apb_pci.o |
637 | OBJS+= fdc.o mc146818rtc.o serial.o m48t59.o | |
638 | OBJS+= cirrus_vga.o parallel.o ptimer.o | |
3475187d | 639 | else |
40293e58 | 640 | OBJS+= sun4m.o tcx.o pcnet.o iommu.o m48t59.o slavio_intctl.o |
2aa2ab3a | 641 | OBJS+= slavio_timer.o escc.o slavio_misc.o fdc.o sparc32_dma.o |
40293e58 | 642 | OBJS+= cs4231.o ptimer.o eccmemctl.o sbi.o sun4c_intctl.o |
3475187d | 643 | endif |
e95c8d51 | 644 | endif |
b5ff1b31 | 645 | ifeq ($(TARGET_BASE_ARCH), arm) |
40293e58 FB |
646 | OBJS+= integratorcp.o versatilepb.o ps2.o smc91c111.o arm_pic.o arm_timer.o |
647 | OBJS+= arm_boot.o pl011.o pl031.o pl050.o pl080.o pl110.o pl181.o pl190.o | |
648 | OBJS+= versatile_pci.o ptimer.o | |
649 | OBJS+= realview_gic.o realview.o arm_sysctl.o mpcore.o | |
650 | OBJS+= armv7m.o armv7m_nvic.o stellaris.o pl022.o stellaris_enet.o | |
651 | OBJS+= pl061.o | |
652 | OBJS+= arm-semi.o | |
653 | OBJS+= pxa2xx.o pxa2xx_pic.o pxa2xx_gpio.o pxa2xx_timer.o pxa2xx_dma.o | |
654 | OBJS+= pxa2xx_lcd.o pxa2xx_mmci.o pxa2xx_pcmcia.o pxa2xx_keypad.o | |
655 | OBJS+= pflash_cfi01.o gumstix.o | |
88d2c950 | 656 | OBJS+= zaurus.o ide.o serial.o nand.o ecc.o spitz.o tosa.o tc6393xb.o |
b4e3104b | 657 | OBJS+= omap1.o omap_lcdc.o omap_dma.o omap_clk.o omap_mmc.o omap_i2c.o |
afbb5194 | 658 | OBJS+= omap2.o omap_dss.o soc_dma.o |
997641a8 | 659 | OBJS+= omap_sx1.o palm.o tsc210x.o |
942ac052 | 660 | OBJS+= nseries.o blizzard.o onenand.o vga.o cbus.o tusb6010.o usb-musb.o |
58a26b47 | 661 | OBJS+= tsc2005.o bt-hci-csr.o |
40293e58 | 662 | OBJS+= mst_fpga.o mainstone.o |
24859b68 | 663 | OBJS+= musicpal.o pflash_cfi02.o |
5a1237c4 | 664 | CPPFLAGS += -DHAS_AUDIO |
b5ff1b31 | 665 | endif |
fdf9b3e8 | 666 | ifeq ($(TARGET_BASE_ARCH), sh4) |
40293e58 | 667 | OBJS+= shix.o r2d.o sh7750.o sh7750_regnames.o tc58128.o |
1e5459a3 | 668 | OBJS+= sh_timer.o ptimer.o sh_serial.o sh_intc.o sh_pci.o sm501.o serial.o |
a4a771c0 | 669 | OBJS+= ide.o |
fdf9b3e8 | 670 | endif |
0633879f | 671 | ifeq ($(TARGET_BASE_ARCH), m68k) |
40293e58 FB |
672 | OBJS+= an5206.o mcf5206.o ptimer.o mcf_uart.o mcf_intc.o mcf5208.o mcf_fec.o |
673 | OBJS+= m68k-semi.o dummy_m68k.o | |
0633879f | 674 | endif |
a541f297 | 675 | ifdef CONFIG_GDBSTUB |
56aebc89 | 676 | OBJS+=gdbstub.o gdbstub-xml.o |
728c9fd5 | 677 | endif |
5b0753e0 | 678 | ifdef CONFIG_COCOA |
1d14ffa9 FB |
679 | COCOA_LIBS=-F/System/Library/Frameworks -framework Cocoa -framework IOKit |
680 | ifdef CONFIG_COREAUDIO | |
681 | COCOA_LIBS+=-framework CoreAudio | |
682 | endif | |
5b0753e0 | 683 | endif |
7c1f25b4 | 684 | ifdef CONFIG_SLIRP |
6f30fa85 | 685 | CPPFLAGS+=-I$(SRC_PATH)/slirp |
626df76a FB |
686 | endif |
687 | ||
40293e58 | 688 | LIBS+=$(AIOLIBS) |
c321f673 | 689 | # specific flags are needed for non soft mmu emulator |
c321f673 | 690 | ifdef CONFIG_STATIC |
40293e58 | 691 | LDFLAGS+=-static |
de5eaa64 | 692 | endif |
83fb7adf | 693 | ifndef CONFIG_DARWIN |
11d9f695 | 694 | ifndef CONFIG_WIN32 |
ec530c81 | 695 | ifndef CONFIG_SOLARIS |
b29fe3ed | 696 | ifndef CONFIG_AIX |
40293e58 | 697 | LIBS+=-lutil |
11d9f695 | 698 | endif |
b29fe3ed | 699 | endif |
83fb7adf | 700 | endif |
ec530c81 | 701 | endif |
e3086fbf | 702 | ifdef TARGET_GPROF |
40293e58 FB |
703 | vl.o: CFLAGS+=-p |
704 | LDFLAGS+=-p | |
e3086fbf | 705 | endif |
c321f673 | 706 | |
b8076a74 | 707 | ifeq ($(ARCH),ia64) |
40293e58 | 708 | LDFLAGS+=-Wl,-G0 -Wl,-T,$(SRC_PATH)/ia64.ld |
74ccb34e FB |
709 | endif |
710 | ||
1d14ffa9 FB |
711 | ifdef CONFIG_WIN32 |
712 | SDL_LIBS := $(filter-out -mwindows, $(SDL_LIBS)) -mconsole | |
713 | endif | |
714 | ||
40293e58 FB |
715 | # profiling code |
716 | ifdef TARGET_GPROF | |
717 | LDFLAGS+=-p | |
718 | main.o: CFLAGS+=-p | |
6e1b3e4d FB |
719 | endif |
720 | ||
40293e58 | 721 | $(QEMU_PROG): $(OBJS) ../libqemu_common.a libqemu.a |
8a16d273 | 722 | $(CC) $(LDFLAGS) -o $@ $^ $(LIBS) $(SDL_LIBS) $(COCOA_LIBS) $(CURSES_LIBS) $(BRLAPI_LIBS) $(VDE_LIBS) |
626df76a | 723 | |
40293e58 | 724 | endif # !CONFIG_USER_ONLY |
00a67ba1 | 725 | |
56aebc89 PB |
726 | gdbstub-xml.c: $(TARGET_XML_FILES) feature_to_c.sh |
727 | rm -f $@ | |
728 | ifeq ($(TARGET_XML_FILES),) | |
729 | echo > $@ | |
730 | else | |
731 | $(SHELL) $(SRC_PATH)/feature_to_c.sh $@ $(TARGET_XML_FILES) | |
732 | endif | |
733 | ||
626df76a | 734 | %.o: %.c |
40293e58 | 735 | $(CC) $(CPPFLAGS) $(CFLAGS) -c -o $@ $< |
626df76a | 736 | |
f72b519c | 737 | %.o: %.S |
6f30fa85 | 738 | $(CC) $(CPPFLAGS) -c -o $@ $< |
f72b519c | 739 | |
626df76a | 740 | clean: |
86e840ee | 741 | rm -f *.o *.a *~ $(PROGS) nwfpe/*.o fpu/*.o |
57fec1fe | 742 | rm -f *.d */*.d tcg/*.o |
1e43adfc | 743 | |
5fafdf24 | 744 | install: all |
9b14bb04 | 745 | ifneq ($(PROGS),) |
6a882643 | 746 | $(INSTALL) -m 755 -s $(PROGS) "$(DESTDIR)$(bindir)" |
9b14bb04 | 747 | endif |
626df76a | 748 | |
2f96c28d JM |
749 | # Include automatically generated dependency files |
750 | -include $(wildcard *.d */*.d) |