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