ia64/xen-unstable

view tools/ioemu/target-i386-dm/Makefile @ 5238:f85f27fa69ff

bitkeeper revision 1.1615.1.2 (429c8826fS2FuIKb-STmuvL0Hl6awQ)

ioemu fixes: do not install into /usr/share/qemu as it conflicts with
real qemu installations. Also, do not link x86/64 with a special linker
script -- breaks on SLES9 and ought to be unnecessary.
The linker scripts and configuration/Makefile environment all need
stripping out at some point.
Signed-off-by: Keir Fraser <keir@xensource.com>
author kaf24@firebug.cl.cam.ac.uk
date Tue May 31 15:52:06 2005 +0000 (2005-05-31)
parents f5f2c67044b5
children fbb531d2ff13
line source
1 XEN_ROOT=../../..
2 include $(XEN_ROOT)/tools/Rules.mk
3 include config.mak
4 override TARGET_ARCH=i386
6 #assume we directly put qemu code in tools/, same level as bochs dm(ioemu)
7 XEN_PATH=../../..
8 TARGET_PATH=$(SRC_PATH)/target-$(TARGET_ARCH)
9 VPATH=$(SRC_PATH):$(TARGET_PATH):$(SRC_PATH)/hw:$(SRC_PATH)/audio
10 DEFINES=-I. -I$(TARGET_PATH) -I$(SRC_PATH) -I$(XEN_PATH)/xen/include/public
11 DEFINES+= -I$(XEN_PATH)/tools/libxc
12 ifdef CONFIG_USER_ONLY
13 VPATH+=:$(SRC_PATH)/linux-user
14 DEFINES+=-I$(SRC_PATH)/linux-user -I$(SRC_PATH)/linux-user/$(TARGET_ARCH)
15 endif
16 CFLAGS=-Wall -O2 -g -fno-strict-aliasing
17 LDFLAGS=-g
18 LIBS=
19 HELPER_CFLAGS=$(CFLAGS)
20 DYNGEN=../dyngen$(EXESUF)
21 # user emulator name
22 QEMU_USER=qemu-$(TARGET_ARCH)
23 # system emulator name
24 ifdef CONFIG_SOFTMMU
25 ifeq ($(TARGET_ARCH), i386)
26 QEMU_SYSTEM=qemu$(EXESUF)
27 else
28 QEMU_SYSTEM=qemu-system-$(TARGET_ARCH)$(EXESUF)
29 endif
30 else
31 QEMU_SYSTEM=qemu-fast
32 endif
34 QEMU_SYSTEM=qemu-dm
35 PROGS=$(QEMU_SYSTEM)
37 ifdef CONFIG_USER_ONLY
38 PROGS=$(QEMU_USER)
39 else
40 ifeq ($(TARGET_ARCH), i386)
42 ifeq ($(ARCH), i386)
43 PROGS+=$(QEMU_SYSTEM)
44 ifndef CONFIG_SOFTMMU
45 CONFIG_STATIC=y
46 endif
47 else
48 # the system emulator using soft mmu is portable
49 ifdef CONFIG_SOFTMMU
50 PROGS+=$(QEMU_SYSTEM)
51 endif
52 endif # ARCH != i386
54 endif # TARGET_ARCH = i386
56 ifeq ($(TARGET_ARCH), ppc)
58 ifeq ($(ARCH), ppc)
59 PROGS+=$(QEMU_SYSTEM)
60 endif
62 ifeq ($(ARCH), i386)
63 ifdef CONFIG_SOFTMMU
64 PROGS+=$(QEMU_SYSTEM)
65 endif
66 endif # ARCH = i386
68 ifeq ($(ARCH), amd64)
69 ifdef CONFIG_SOFTMMU
70 PROGS+=$(QEMU_SYSTEM)
71 endif
72 endif # ARCH = amd64
74 endif # TARGET_ARCH = ppc
76 ifeq ($(TARGET_ARCH), sparc)
78 ifeq ($(ARCH), ppc)
79 PROGS+=$(QEMU_SYSTEM)
80 endif
82 ifeq ($(ARCH), i386)
83 ifdef CONFIG_SOFTMMU
84 PROGS+=$(QEMU_SYSTEM)
85 endif
86 endif # ARCH = i386
88 ifeq ($(ARCH), amd64)
89 ifdef CONFIG_SOFTMMU
90 PROGS+=$(QEMU_SYSTEM)
91 endif
92 endif # ARCH = amd64
94 endif # TARGET_ARCH = sparc
95 endif # !CONFIG_USER_ONLY
97 ifdef CONFIG_STATIC
98 LDFLAGS+=-static
99 endif
101 ifeq ($(ARCH),i386)
102 CFLAGS+=-fomit-frame-pointer
103 OP_CFLAGS=$(CFLAGS) -mpreferred-stack-boundary=2
104 ifeq ($(HAVE_GCC3_OPTIONS),yes)
105 OP_CFLAGS+= -falign-functions=0 -fno-gcse
106 else
107 OP_CFLAGS+= -malign-functions=0
108 endif
110 ifdef TARGET_GPROF
111 USE_I386_LD=y
112 endif
113 ifdef CONFIG_STATIC
114 USE_I386_LD=y
115 endif
116 ifdef USE_I386_LD
117 LDFLAGS+=-Wl,-T,$(SRC_PATH)/i386.ld
118 else
119 # WARNING: this LDFLAGS is _very_ tricky : qemu is an ELF shared object
120 # that the kernel ELF loader considers as an executable. I think this
121 # is the simplest way to make it self virtualizable!
122 LDFLAGS+=-Wl,-shared
123 endif
124 endif
126 ifeq ($(ARCH),amd64)
127 OP_CFLAGS=$(CFLAGS) -falign-functions=0
128 LDFLAGS+=-Wl,-T,$(SRC_PATH)/amd64.ld
129 endif
131 ifeq ($(ARCH),ppc)
132 CFLAGS+= -D__powerpc__
133 OP_CFLAGS=$(CFLAGS)
134 LDFLAGS+=-Wl,-T,$(SRC_PATH)/ppc.ld
135 endif
137 ifeq ($(ARCH),s390)
138 OP_CFLAGS=$(CFLAGS)
139 LDFLAGS+=-Wl,-T,$(SRC_PATH)/s390.ld
140 endif
142 ifeq ($(ARCH),sparc)
143 CFLAGS+=-m32 -ffixed-g1 -ffixed-g2 -ffixed-g3 -ffixed-g6
144 LDFLAGS+=-m32
145 OP_CFLAGS=$(CFLAGS) -fno-delayed-branch -ffixed-i0
146 HELPER_CFLAGS=$(CFLAGS) -ffixed-i0 -mflat
147 # -static is used to avoid g1/g3 usage by the dynamic linker
148 LDFLAGS+=-Wl,-T,$(SRC_PATH)/sparc.ld -static
149 endif
151 ifeq ($(ARCH),sparc64)
152 CFLAGS+=-m64 -ffixed-g1 -ffixed-g2 -ffixed-g3 -ffixed-g6
153 LDFLAGS+=-m64
154 OP_CFLAGS=$(CFLAGS) -fno-delayed-branch -ffixed-i0
155 endif
157 ifeq ($(ARCH),alpha)
158 # -msmall-data is not used because we want two-instruction relocations
159 # for the constant constructions
160 OP_CFLAGS=-Wall -O2 -g
161 # Ensure there's only a single GP
162 CFLAGS += -msmall-data
163 LDFLAGS+=-Wl,-T,$(SRC_PATH)/alpha.ld
164 endif
166 ifeq ($(ARCH),ia64)
167 OP_CFLAGS=$(CFLAGS)
168 endif
170 ifeq ($(ARCH),arm)
171 OP_CFLAGS=$(CFLAGS) -mno-sched-prolog
172 LDFLAGS+=-Wl,-T,$(SRC_PATH)/arm.ld
173 endif
175 ifeq ($(ARCH),m68k)
176 OP_CFLAGS=$(CFLAGS) -fomit-frame-pointer
177 LDFLAGS+=-Wl,-T,m68k.ld
178 endif
180 ifeq ($(HAVE_GCC3_OPTIONS),yes)
181 # very important to generate a return at the end of every operation
182 OP_CFLAGS+=-fno-reorder-blocks -fno-optimize-sibling-calls
183 endif
185 ifeq ($(CONFIG_DARWIN),yes)
186 OP_CFLAGS+= -mdynamic-no-pic
187 endif
189 #########################################################
191 DEFINES+=-D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE
192 LIBS+=-lm -L../../libxc -lxc
193 ifndef CONFIG_USER_ONLY
194 LIBS+=-lz
195 endif
196 ifdef CONFIG_WIN32
197 LIBS+=-lwinmm -lws2_32 -liphlpapi
198 endif
200 # profiling code
201 ifdef TARGET_GPROF
202 LDFLAGS+=-p
203 main.o: CFLAGS+=-p
204 endif
206 OBJS= elfload.o main.o syscall.o mmap.o signal.o path.o osdep.o thunk.o
207 ifeq ($(TARGET_ARCH), i386)
208 OBJS+= vm86.o
209 endif
210 ifeq ($(TARGET_ARCH), arm)
211 OBJS+=nwfpe/softfloat.o nwfpe/fpa11.o nwfpe/fpa11_cpdo.o \
212 nwfpe/fpa11_cpdt.o nwfpe/fpa11_cprt.o nwfpe/fpopcode.o nwfpe/single_cpdo.o \
213 nwfpe/double_cpdo.o nwfpe/extended_cpdo.o
214 endif
215 SRCS:= $(OBJS:.o=.c)
216 OBJS+= libqemu.a
218 # cpu emulator library
219 LIBOBJS=
221 ifeq ($(TARGET_ARCH), i386)
222 LIBOBJS+= helper2.o
223 ifeq ($(ARCH), i386)
224 LIBOBJS+=translate-copy.o
225 endif
226 endif
228 ifeq ($(TARGET_ARCH), ppc)
229 LIBOBJS+= op_helper.o helper.o
230 endif
232 ifeq ($(TARGET_ARCH), sparc)
233 LIBOBJS+= op_helper.o helper.o
234 endif
236 all: $(PROGS)
238 $(QEMU_USER): $(OBJS)
239 $(CC) $(LDFLAGS) -o $@ $^ $(LIBS)
240 ifeq ($(ARCH),alpha)
241 # Mark as 32 bit binary, i. e. it will be mapped into the low 31 bit of
242 # the address space (31 bit so sign extending doesn't matter)
243 echo -ne '\001\000\000\000' | dd of=qemu bs=1 seek=48 count=4 conv=notrunc
244 endif
246 # must use static linking to avoid leaving stuff in virtual address space
247 VL_OBJS=vl.o exec.o monitor.o osdep.o block.o readline.o pci.o console.o
248 #VL_OBJS+=block-cow.o block-qcow.o block-vmdk.o block-cloop.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 ifeq ($(XEN_TARGET_ARCH),x86_32)
308 VL_LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(XEN_TARGET_ARCH).ld
309 endif
310 ifndef CONFIG_DARWIN
311 ifndef CONFIG_WIN32
312 VL_LIBS=-lutil
313 endif
314 endif
316 $(QEMU_SYSTEM): $(VL_OBJS) libqemu.a
317 $(CC) $(VL_LDFLAGS) -o $@ $^ $(LIBS) $(SDL_LIBS) $(VNC_LIBS) $(VL_LIBS)
319 vnc.o: vnc.c keyboard_rdesktop.c
320 $(CC) $(CFLAGS) $(DEFINES) $(VNC_CFLAGS) -c -o $@ $<
322 sdl.o: sdl.c keyboard_rdesktop.c
323 $(CC) $(CFLAGS) $(DEFINES) $(SDL_CFLAGS) -c -o $@ $<
325 sdlaudio.o: sdlaudio.c
326 $(CC) $(CFLAGS) $(DEFINES) $(SDL_CFLAGS) -c -o $@ $<
328 depend: $(SRCS)
329 $(CC) -MM $(CFLAGS) $(DEFINES) $^ 1>.depend
331 # libqemu
333 libqemu.a: $(LIBOBJS)
334 rm -f $@
335 $(AR) rcs $@ $(LIBOBJS)
337 translate.o: translate.c gen-op.h opc.h cpu.h
339 translate-all.o: translate-all.c op.h opc.h cpu.h
341 op.h: op.o $(DYNGEN)
342 $(DYNGEN) -o $@ $<
344 opc.h: op.o $(DYNGEN)
345 $(DYNGEN) -c -o $@ $<
347 gen-op.h: op.o $(DYNGEN)
348 $(DYNGEN) -g -o $@ $<
350 op.o: op.c
351 $(CC) $(OP_CFLAGS) $(DEFINES) -c -o $@ $<
353 helper.o: helper.c
354 $(CC) $(HELPER_CFLAGS) $(DEFINES) -c -o $@ $<
356 ifeq ($(TARGET_ARCH), i386)
357 op.o: op.c opreg_template.h ops_template.h ops_template_mem.h ops_mem.h
358 endif
360 ifeq ($(TARGET_ARCH), arm)
361 op.o: op.c op_template.h
362 endif
364 ifeq ($(TARGET_ARCH), sparc)
365 op.o: op.c op_template.h op_mem.h
366 endif
368 ifeq ($(TARGET_ARCH), ppc)
369 op.o: op.c op_template.h op_mem.h
370 op_helper.o: op_helper_mem.h
371 endif
373 mixeng.o: mixeng.c mixeng.h mixeng_template.h
375 %.o: %.c
376 $(CC) $(CFLAGS) $(DEFINES) -c -o $@ $<
378 %.o: %.S
379 $(CC) $(DEFINES) -c -o $@ $<
381 clean:
382 rm -rf *.o *.a *~ $(PROGS) gen-op.h opc.h op.h nwfpe slirp qemu-vgaram-bin
384 distclean:
385 rm -rf *.o *.a *~ $(PROGS) gen-op.h opc.h op.h nwfpe slirp qemu-vgaram-bin
387 install: all
388 if [ ! -d $(DESTDIR)$(bindir) ];then mkdir -p $(DESTDIR)$(bindir);fi
389 if [ ! -d $(DESTDIR)$(configdir) ];then mkdir -p $(DESTDIR)$(configdir);fi
390 ifneq ($(PROGS),)
391 install -m 755 -s $(PROGS) "$(DESTDIR)$(bindir)"
392 endif
393 install -m 755 device-model "$(DESTDIR)$(bindir)"
394 install -m 755 qemu-ifup "$(DESTDIR)$(configdir)"
395 gunzip -c qemu-vgaram-bin.gz >qemu-vgaram-bin
396 install -m 755 qemu-vgaram-bin "$(DESTDIR)$(configdir)"
397 ifneq ($(wildcard .depend),)
398 include .depend
399 endif