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