ia64/xen-unstable

view tools/ioemu/target-i386-dm/Makefile @ 6433:0610add7c3fe

merge?
author cl349@firebug.cl.cam.ac.uk
date Thu Aug 25 16:27:04 2005 +0000 (2005-08-25)
parents b54144915ae6 6e899a3840b2
children b4b3f6be5226
line source
1 XEN_ROOT=../../..
2 include $(XEN_ROOT)/tools/Rules.mk
3 include config.mak
4 override TARGET_ARCH=i386
6 INSTALL_DIR := $(DESTDIR)/usr/lib/xen/bin
7 TARGET_PATH=$(SRC_PATH)/target-$(TARGET_ARCH)
8 VPATH=$(SRC_PATH):$(TARGET_PATH):$(SRC_PATH)/hw:$(SRC_PATH)/audio
9 DEFINES=-I. -I$(TARGET_PATH) -I$(SRC_PATH) -I$(XEN_ROOT)/xen/include/public
10 DEFINES+= -I$(XEN_ROOT)/tools/libxc
11 ifdef CONFIG_USER_ONLY
12 VPATH+=:$(SRC_PATH)/linux-user
13 DEFINES+=-I$(SRC_PATH)/linux-user -I$(SRC_PATH)/linux-user/$(TARGET_ARCH)
14 endif
15 CFLAGS=-Wall -O2 -g -fno-strict-aliasing
16 LDFLAGS=-g
17 LIBS=
18 HELPER_CFLAGS=$(CFLAGS)
19 DYNGEN=../dyngen$(EXESUF)
20 # user emulator name
21 QEMU_USER=qemu-$(TARGET_ARCH)
22 # system emulator name
23 ifdef CONFIG_SOFTMMU
24 ifeq ($(TARGET_ARCH), i386)
25 QEMU_SYSTEM=qemu$(EXESUF)
26 else
27 QEMU_SYSTEM=qemu-system-$(TARGET_ARCH)$(EXESUF)
28 endif
29 else
30 QEMU_SYSTEM=qemu-fast
31 endif
33 QEMU_SYSTEM=qemu-dm
34 PROGS=$(QEMU_SYSTEM)
36 ifdef CONFIG_USER_ONLY
37 PROGS=$(QEMU_USER)
38 else
39 ifeq ($(TARGET_ARCH), i386)
41 ifeq ($(ARCH), i386)
42 PROGS+=$(QEMU_SYSTEM)
43 ifndef CONFIG_SOFTMMU
44 CONFIG_STATIC=y
45 endif
46 else
47 # the system emulator using soft mmu is portable
48 ifdef CONFIG_SOFTMMU
49 PROGS+=$(QEMU_SYSTEM)
50 endif
51 endif # ARCH != i386
53 endif # TARGET_ARCH = i386
55 ifeq ($(TARGET_ARCH), ppc)
57 ifeq ($(ARCH), ppc)
58 PROGS+=$(QEMU_SYSTEM)
59 endif
61 ifeq ($(ARCH), i386)
62 ifdef CONFIG_SOFTMMU
63 PROGS+=$(QEMU_SYSTEM)
64 endif
65 endif # ARCH = i386
67 ifeq ($(ARCH), amd64)
68 ifdef CONFIG_SOFTMMU
69 PROGS+=$(QEMU_SYSTEM)
70 endif
71 endif # ARCH = amd64
73 endif # TARGET_ARCH = ppc
75 ifeq ($(TARGET_ARCH), sparc)
77 ifeq ($(ARCH), ppc)
78 PROGS+=$(QEMU_SYSTEM)
79 endif
81 ifeq ($(ARCH), i386)
82 ifdef CONFIG_SOFTMMU
83 PROGS+=$(QEMU_SYSTEM)
84 endif
85 endif # ARCH = i386
87 ifeq ($(ARCH), amd64)
88 ifdef CONFIG_SOFTMMU
89 PROGS+=$(QEMU_SYSTEM)
90 endif
91 endif # ARCH = amd64
93 endif # TARGET_ARCH = sparc
94 endif # !CONFIG_USER_ONLY
96 ifdef CONFIG_STATIC
97 LDFLAGS+=-static
98 endif
100 ifeq ($(ARCH),i386)
101 CFLAGS+=-fomit-frame-pointer
102 OP_CFLAGS=$(CFLAGS) -mpreferred-stack-boundary=2
103 ifeq ($(HAVE_GCC3_OPTIONS),yes)
104 OP_CFLAGS+= -falign-functions=0 -fno-gcse
105 else
106 OP_CFLAGS+= -malign-functions=0
107 endif
109 ifdef TARGET_GPROF
110 USE_I386_LD=y
111 endif
112 ifdef CONFIG_STATIC
113 USE_I386_LD=y
114 endif
115 ifdef USE_I386_LD
116 LDFLAGS+=-Wl,-T,$(SRC_PATH)/i386.ld
117 else
118 # WARNING: this LDFLAGS is _very_ tricky : qemu is an ELF shared object
119 # that the kernel ELF loader considers as an executable. I think this
120 # is the simplest way to make it self virtualizable!
121 LDFLAGS+=-Wl,-shared
122 endif
123 endif
125 ifeq ($(ARCH),amd64)
126 OP_CFLAGS=$(CFLAGS) -falign-functions=0
127 LDFLAGS+=-Wl,-T,$(SRC_PATH)/amd64.ld
128 endif
130 ifeq ($(ARCH),ppc)
131 CFLAGS+= -D__powerpc__
132 OP_CFLAGS=$(CFLAGS)
133 LDFLAGS+=-Wl,-T,$(SRC_PATH)/ppc.ld
134 endif
136 ifeq ($(ARCH),s390)
137 OP_CFLAGS=$(CFLAGS)
138 LDFLAGS+=-Wl,-T,$(SRC_PATH)/s390.ld
139 endif
141 ifeq ($(ARCH),sparc)
142 CFLAGS+=-m32 -ffixed-g1 -ffixed-g2 -ffixed-g3 -ffixed-g6
143 LDFLAGS+=-m32
144 OP_CFLAGS=$(CFLAGS) -fno-delayed-branch -ffixed-i0
145 HELPER_CFLAGS=$(CFLAGS) -ffixed-i0 -mflat
146 # -static is used to avoid g1/g3 usage by the dynamic linker
147 LDFLAGS+=-Wl,-T,$(SRC_PATH)/sparc.ld -static
148 endif
150 ifeq ($(ARCH),sparc64)
151 CFLAGS+=-m64 -ffixed-g1 -ffixed-g2 -ffixed-g3 -ffixed-g6
152 LDFLAGS+=-m64
153 OP_CFLAGS=$(CFLAGS) -fno-delayed-branch -ffixed-i0
154 endif
156 ifeq ($(ARCH),alpha)
157 # -msmall-data is not used because we want two-instruction relocations
158 # for the constant constructions
159 OP_CFLAGS=-Wall -O2 -g
160 # Ensure there's only a single GP
161 CFLAGS += -msmall-data
162 LDFLAGS+=-Wl,-T,$(SRC_PATH)/alpha.ld
163 endif
165 ifeq ($(ARCH),ia64)
166 OP_CFLAGS=$(CFLAGS)
167 endif
169 ifeq ($(ARCH),arm)
170 OP_CFLAGS=$(CFLAGS) -mno-sched-prolog
171 LDFLAGS+=-Wl,-T,$(SRC_PATH)/arm.ld
172 endif
174 ifeq ($(ARCH),m68k)
175 OP_CFLAGS=$(CFLAGS) -fomit-frame-pointer
176 LDFLAGS+=-Wl,-T,m68k.ld
177 endif
179 ifeq ($(HAVE_GCC3_OPTIONS),yes)
180 # very important to generate a return at the end of every operation
181 OP_CFLAGS+=-fno-reorder-blocks -fno-optimize-sibling-calls
182 endif
184 ifeq ($(CONFIG_DARWIN),yes)
185 OP_CFLAGS+= -mdynamic-no-pic
186 endif
188 #########################################################
190 DEFINES+=-D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -DAPIC_SUPPORT
191 LIBS+=-lm -L../../libxc -lxenctrl
192 ifndef CONFIG_USER_ONLY
193 LIBS+=-lz
194 endif
195 ifdef CONFIG_WIN32
196 LIBS+=-lwinmm -lws2_32 -liphlpapi
197 endif
199 # profiling code
200 ifdef TARGET_GPROF
201 LDFLAGS+=-p
202 main.o: CFLAGS+=-p
203 endif
205 OBJS= elfload.o main.o syscall.o mmap.o signal.o path.o osdep.o thunk.o
206 ifeq ($(TARGET_ARCH), i386)
207 OBJS+= vm86.o
208 endif
209 ifeq ($(TARGET_ARCH), arm)
210 OBJS+=nwfpe/softfloat.o nwfpe/fpa11.o nwfpe/fpa11_cpdo.o \
211 nwfpe/fpa11_cpdt.o nwfpe/fpa11_cprt.o nwfpe/fpopcode.o nwfpe/single_cpdo.o \
212 nwfpe/double_cpdo.o nwfpe/extended_cpdo.o
213 endif
214 SRCS:= $(OBJS:.o=.c)
215 OBJS+= libqemu.a
217 # cpu emulator library
218 LIBOBJS=
220 ifeq ($(TARGET_ARCH), i386)
221 LIBOBJS+= helper2.o
222 ifeq ($(ARCH), i386)
223 LIBOBJS+=translate-copy.o
224 endif
225 endif
227 ifeq ($(TARGET_ARCH), ppc)
228 LIBOBJS+= op_helper.o helper.o
229 endif
231 ifeq ($(TARGET_ARCH), sparc)
232 LIBOBJS+= op_helper.o helper.o
233 endif
235 all: $(PROGS)
237 $(QEMU_USER): $(OBJS)
238 $(CC) $(LDFLAGS) -o $@ $^ $(LIBS)
239 ifeq ($(ARCH),alpha)
240 # Mark as 32 bit binary, i. e. it will be mapped into the low 31 bit of
241 # the address space (31 bit so sign extending doesn't matter)
242 echo -ne '\001\000\000\000' | dd of=qemu bs=1 seek=48 count=4 conv=notrunc
243 endif
245 # must use static linking to avoid leaving stuff in virtual address space
246 VL_OBJS=vl.o exec.o monitor.o osdep.o block.o readline.o pci.o console.o
247 VL_OBJS+=block-cow.o block-qcow.o block-vmdk.o block-cloop.o aes.o
248 VL_OBJS+=ioapic.o
249 #VL_OBJS+= block-cloop.o
251 SOUND_HW = sb16.o
252 AUDIODRV = audio.o noaudio.o wavaudio.o
253 ifdef CONFIG_SDL
254 AUDIODRV += sdlaudio.o
255 endif
256 ifdef CONFIG_OSS
257 AUDIODRV += ossaudio.o
258 endif
260 pc.o: DEFINES := -DUSE_SB16 $(DEFINES)
262 ifdef CONFIG_ADLIB
263 SOUND_HW += fmopl.o adlib.o
264 endif
266 ifdef CONFIG_FMOD
267 AUDIODRV += fmodaudio.o
268 audio.o fmodaudio.o: DEFINES := -I$(CONFIG_FMOD_INC) $(DEFINES)
269 LIBS += $(CONFIG_FMOD_LIB)
270 endif
272 # Hardware support
273 VL_OBJS+= ide.o ne2000.o pckbd.o vga.o dma.o
274 VL_OBJS+= fdc.o mc146818rtc.o serial.o i8259.o i8254.o pc.o port-e9.o
275 VL_OBJS+= cirrus_vga.o
277 ifeq ($(TARGET_ARCH), ppc)
278 VL_OBJS+= ppc.o ide.o ne2000.o pckbd.o vga.o $(SOUND_HW) dma.o $(AUDIODRV)
279 VL_OBJS+= mc146818rtc.o serial.o i8259.o i8254.o fdc.o m48t59.o
280 VL_OBJS+= ppc_prep.o ppc_chrp.o cuda.o adb.o openpic.o mixeng.o
281 endif
282 ifeq ($(TARGET_ARCH), sparc)
283 VL_OBJS+= sun4m.o tcx.o lance.o iommu.o sched.o m48t08.o magic-load.o timer.o
284 endif
285 ifdef CONFIG_GDBSTUB
286 VL_OBJS+=gdbstub.o
287 endif
288 ifdef CONFIG_VNC
289 VL_OBJS+=vnc.o
290 endif
291 ifdef CONFIG_SDL
292 VL_OBJS+=sdl.o
293 endif
294 ifdef CONFIG_SLIRP
295 DEFINES+=-I$(SRC_PATH)/slirp
296 SLIRP_OBJS=cksum.o if.o ip_icmp.o ip_input.o ip_output.o \
297 slirp.o mbuf.o misc.o sbuf.o socket.o tcp_input.o tcp_output.o \
298 tcp_subr.o tcp_timer.o udp.o bootp.o debug.o tftp.o
299 VL_OBJS+=$(addprefix slirp/, $(SLIRP_OBJS))
300 endif
302 VL_LDFLAGS=
303 # specific flags are needed for non soft mmu emulator
304 ifdef CONFIG_STATIC
305 VL_LDFLAGS+=-static
306 endif
307 ifndef CONFIG_DARWIN
308 ifndef CONFIG_WIN32
309 VL_LIBS=-lutil
310 endif
311 endif
313 $(QEMU_SYSTEM): $(VL_OBJS) libqemu.a
314 $(CC) $(VL_LDFLAGS) -o $@ $^ $(LIBS) $(SDL_LIBS) $(VNC_LIBS) $(VL_LIBS)
316 vnc.o: vnc.c keyboard_rdesktop.c
317 $(CC) $(CFLAGS) $(DEFINES) $(VNC_CFLAGS) -c -o $@ $<
319 sdl.o: sdl.c keyboard_rdesktop.c
320 $(CC) $(CFLAGS) $(DEFINES) $(SDL_CFLAGS) -c -o $@ $<
322 sdlaudio.o: sdlaudio.c
323 $(CC) $(CFLAGS) $(DEFINES) $(SDL_CFLAGS) -c -o $@ $<
325 depend: $(SRCS)
326 $(CC) -MM $(CFLAGS) $(DEFINES) $^ 1>.depend
328 # libqemu
330 libqemu.a: $(LIBOBJS)
331 rm -f $@
332 $(AR) rcs $@ $(LIBOBJS)
334 translate.o: translate.c gen-op.h opc.h cpu.h
336 translate-all.o: translate-all.c op.h opc.h cpu.h
338 op.h: op.o $(DYNGEN)
339 $(DYNGEN) -o $@ $<
341 opc.h: op.o $(DYNGEN)
342 $(DYNGEN) -c -o $@ $<
344 gen-op.h: op.o $(DYNGEN)
345 $(DYNGEN) -g -o $@ $<
347 op.o: op.c
348 $(CC) $(OP_CFLAGS) $(DEFINES) -c -o $@ $<
350 helper.o: helper.c
351 $(CC) $(HELPER_CFLAGS) $(DEFINES) -c -o $@ $<
353 ifeq ($(TARGET_ARCH), i386)
354 op.o: op.c opreg_template.h ops_template.h ops_template_mem.h ops_mem.h
355 endif
357 ifeq ($(TARGET_ARCH), arm)
358 op.o: op.c op_template.h
359 endif
361 ifeq ($(TARGET_ARCH), sparc)
362 op.o: op.c op_template.h op_mem.h
363 endif
365 ifeq ($(TARGET_ARCH), ppc)
366 op.o: op.c op_template.h op_mem.h
367 op_helper.o: op_helper_mem.h
368 endif
370 mixeng.o: mixeng.c mixeng.h mixeng_template.h
372 %.o: %.c
373 $(CC) $(CFLAGS) $(DEFINES) -c -o $@ $<
375 %.o: %.S
376 $(CC) $(DEFINES) -c -o $@ $<
378 clean:
379 rm -rf *.o *.a *~ $(PROGS) gen-op.h opc.h op.h nwfpe slirp
381 distclean:
382 rm -rf *.o *.a *~ $(PROGS) gen-op.h opc.h op.h nwfpe slirp
384 install: all
385 if [ ! -d $(INSTALL_DIR) ];then mkdir -p $(INSTALL_DIR);fi
386 if [ ! -d $(DESTDIR)$(configdir) ];then mkdir -p $(DESTDIR)$(configdir);fi
387 install -m 755 -s $(PROGS) "$(INSTALL_DIR)"
388 install -m 755 qemu-dm.debug "$(INSTALL_DIR)"
389 install -m 755 qemu-ifup "$(DESTDIR)$(configdir)"
390 ifneq ($(wildcard .depend),)
391 include .depend
392 endif