]> git.proxmox.com Git - qemu.git/blame - Makefile
added IDE WIN_READ_NATIVE_MAX command (2.5.xx fix) - added support for proper system...
[qemu.git] / Makefile
CommitLineData
7d13299d 1include config.mak
766a487a 2
7d13299d 3CFLAGS=-Wall -O2 -g
31e31b8a 4LDFLAGS=-g
766a487a 5LIBS=
766a487a 6DEFINES=-DHAVE_BYTESWAP_H
9c5d1246 7HELPER_CFLAGS=$(CFLAGS)
6b1534cc 8PROGS=qemu
7d13299d 9
43ce4dfe
FB
10ifdef CONFIG_STATIC
11LDFLAGS+=-static
12endif
13
7d13299d
FB
14ifeq ($(ARCH),i386)
15CFLAGS+=-fomit-frame-pointer
ca735206 16OP_CFLAGS=$(CFLAGS) -mpreferred-stack-boundary=2
6b1534cc 17ifeq ($(HAVE_GCC3_OPTIONS),yes)
ca735206
FB
18OP_CFLAGS+= -falign-functions=0
19else
20OP_CFLAGS+= -malign-functions=0
21endif
2d92f0b8
FB
22ifdef TARGET_GPROF
23LDFLAGS+=-Wl,-T,i386.ld
24else
27c75a9a
FB
25# WARNING: this LDFLAGS is _very_ tricky : qemu is an ELF shared object
26# that the kernel ELF loader considers as an executable. I think this
27# is the simplest way to make it self virtualizable!
28LDFLAGS+=-Wl,-shared
766a487a 29endif
6b1534cc
FB
30ifeq ($(TARGET_ARCH), i386)
31PROGS+=vl
32endif
2d92f0b8 33endif
766a487a
FB
34
35ifeq ($(ARCH),ppc)
927f621e 36OP_CFLAGS=$(CFLAGS)
27c75a9a 37LDFLAGS+=-Wl,-T,ppc.ld
766a487a
FB
38endif
39
fd429f2f
FB
40ifeq ($(ARCH),s390)
41OP_CFLAGS=$(CFLAGS)
27c75a9a 42LDFLAGS+=-Wl,-T,s390.ld
fd429f2f
FB
43endif
44
ae228531
FB
45ifeq ($(ARCH),sparc)
46CFLAGS+=-m32 -ffixed-g1 -ffixed-g2 -ffixed-g3 -ffixed-g6
47LDFLAGS+=-m32
48OP_CFLAGS=$(CFLAGS) -fno-delayed-branch -ffixed-i0
9c5d1246
FB
49HELPER_CFLAGS=$(CFLAGS) -ffixed-i0 -mflat
50LDFLAGS+=-Wl,-T,sparc.ld
ae228531
FB
51endif
52
53ifeq ($(ARCH),sparc64)
54CFLAGS+=-m64 -ffixed-g1 -ffixed-g2 -ffixed-g3 -ffixed-g6
55LDFLAGS+=-m64
56OP_CFLAGS=$(CFLAGS) -fno-delayed-branch -ffixed-i0
57endif
58
d6cdca95 59ifeq ($(ARCH),alpha)
a993ba85
FB
60# -msmall-data is not used because we want two-instruction relocations
61# for the constant constructions
62OP_CFLAGS=-Wall -O2 -g
d6cdca95 63# Ensure there's only a single GP
82d19daf 64CFLAGS += -msmall-data
d6cdca95
FB
65LDFLAGS+=-Wl,-T,alpha.ld
66endif
67
68ifeq ($(ARCH),ia64)
69OP_CFLAGS=$(CFLAGS)
70endif
71
9c5d1246
FB
72ifeq ($(ARCH),arm)
73OP_CFLAGS=$(CFLAGS) -mno-sched-prolog
74LDFLAGS+=-Wl,-T,arm.ld
75endif
76
6b1534cc 77ifeq ($(HAVE_GCC3_OPTIONS),yes)
ca735206
FB
78# very important to generate a return at the end of every operation
79OP_CFLAGS+=-fno-reorder-blocks -fno-optimize-sibling-calls
80endif
81
766a487a
FB
82#########################################################
83
0ecfa993 84DEFINES+=-D_GNU_SOURCE
3ef693a0 85LIBS+=-lm
7d13299d
FB
86
87# profiling code
88ifdef TARGET_GPROF
89LDFLAGS+=-p
dc99065b 90main.o: CFLAGS+=-p
7d13299d 91endif
31e31b8a 92
de83cd02
FB
93OBJS= elfload.o main.o syscall.o mmap.o signal.o path.o
94ifeq ($(TARGET_ARCH), i386)
95OBJS+= vm86.o
96endif
3ef693a0
FB
97SRCS:= $(OBJS:.o=.c)
98OBJS+= libqemu.a
612384d7 99
de83cd02 100# cpu emulator library
b4608c04 101LIBOBJS=thunk.o exec.o translate.o cpu-exec.o gdbstub.o
de83cd02
FB
102
103ifeq ($(TARGET_ARCH), i386)
104LIBOBJS+=translate-i386.o op-i386.o helper-i386.o
105endif
106ifeq ($(TARGET_ARCH), arm)
107LIBOBJS+=translate-arm.o op-arm.o
108endif
aa05ae6f 109
0ecfa993 110# NOTE: the disassembler code is only needed for debugging
de83cd02
FB
111LIBOBJS+=disas.o
112ifeq ($(findstring i386, $(TARGET_ARCH) $(ARCH)),i386)
113LIBOBJS+=i386-dis.o
114endif
115ifeq ($(findstring alpha, $(TARGET_ARCH) $(ARCH)),alpha)
aa05ae6f
FB
116LIBOBJS+=alpha-dis.o
117endif
de83cd02 118ifeq ($(findstring ppc, $(TARGET_ARCH) $(ARCH)),ppc)
aa05ae6f
FB
119LIBOBJS+=ppc-dis.o
120endif
de83cd02 121ifeq ($(findstring sparc, $(TARGET_ARCH) $(ARCH)),sparc)
9c5d1246
FB
122LIBOBJS+=sparc-dis.o
123endif
de83cd02 124ifeq ($(findstring arm, $(TARGET_ARCH) $(ARCH)),arm)
9c5d1246
FB
125LIBOBJS+=arm-dis.o
126endif
31e31b8a 127
d6cdca95
FB
128ifeq ($(ARCH),ia64)
129OBJS += ia64-syscall.o
130endif
131
6b1534cc 132all: $(PROGS) qemu-doc.html
31e31b8a 133
3ef693a0 134qemu: $(OBJS)
27c75a9a 135 $(CC) $(LDFLAGS) -o $@ $^ $(LIBS)
a993ba85
FB
136ifeq ($(ARCH),alpha)
137# Mark as 32 bit binary, i. e. it will be mapped into the low 31 bit of
138# the address space (31 bit so sign extending doesn't matter)
139 echo -ne '\001\000\000\000' | dd of=qemu bs=1 seek=48 count=4 conv=notrunc
140endif
31e31b8a 141
0824d6fc 142# must use static linking to avoid leaving stuff in virtual address space
8c9b861e 143vl: vl.o block.o libqemu.a
0824d6fc
FB
144 $(CC) -static -Wl,-T,i386-vl.ld -o $@ $^ $(LIBS)
145
31e31b8a
FB
146depend: $(SRCS)
147 $(CC) -MM $(CFLAGS) $^ 1>.depend
148
3ef693a0 149# libqemu
612384d7 150
3ef693a0 151libqemu.a: $(LIBOBJS)
612384d7
FB
152 rm -f $@
153 $(AR) rcs $@ $(LIBOBJS)
154
367e86e8
FB
155dyngen: dyngen.c
156 $(HOST_CC) -O2 -Wall -g $< -o $@
157
de83cd02
FB
158translate-$(TARGET_ARCH).o: translate-$(TARGET_ARCH).c gen-op-$(TARGET_ARCH).h opc-$(TARGET_ARCH).h cpu-$(TARGET_ARCH).h
159
160translate.o: translate.c op-$(TARGET_ARCH).h opc-$(TARGET_ARCH).h cpu-$(TARGET_ARCH).h
367e86e8 161
de83cd02 162op-$(TARGET_ARCH).h: op-$(TARGET_ARCH).o dyngen
367e86e8
FB
163 ./dyngen -o $@ $<
164
de83cd02 165opc-$(TARGET_ARCH).h: op-$(TARGET_ARCH).o dyngen
2d92f0b8
FB
166 ./dyngen -c -o $@ $<
167
de83cd02
FB
168gen-op-$(TARGET_ARCH).h: op-$(TARGET_ARCH).o dyngen
169 ./dyngen -g -o $@ $<
170
171op-$(TARGET_ARCH).o: op-$(TARGET_ARCH).c
927f621e 172 $(CC) $(OP_CFLAGS) $(DEFINES) -c -o $@ $<
367e86e8 173
de83cd02 174helper-$(TARGET_ARCH).o: helper-$(TARGET_ARCH).c
9c5d1246
FB
175 $(CC) $(HELPER_CFLAGS) $(DEFINES) -c -o $@ $<
176
e477b8b8 177op-i386.o: op-i386.c opreg_template.h ops_template.h ops_template_mem.h
de83cd02
FB
178
179op-arm.o: op-arm.c op-arm-template.h
180
31e31b8a
FB
181%.o: %.c
182 $(CC) $(CFLAGS) $(DEFINES) -c -o $@ $<
183
184clean:
7d13299d 185 $(MAKE) -C tests clean
3ef693a0 186 rm -f *.o *.a *~ qemu dyngen TAGS
31e31b8a 187
7d13299d
FB
188distclean: clean
189 rm -f config.mak config.h
190
6b1534cc 191install: $(PROGS)
d5a0b50c 192 mkdir -p $(prefix)/bin
6b1534cc 193 install -m 755 -s $(PROGS) $(prefix)/bin
612384d7 194
367e86e8 195# various test targets
3ef693a0 196test speed: qemu
367e86e8 197 make -C tests $@
31e31b8a 198
367e86e8 199TAGS:
b9adb4a6 200 etags *.[ch] tests/*.[ch]
31e31b8a 201
3ef693a0
FB
202# documentation
203qemu-doc.html: qemu-doc.texi
204 texi2html -monolithic -number $<
205
586314f2 206FILES= \
fd429f2f 207README README.distrib COPYING COPYING.LIB TODO Changelog VERSION \
de83cd02
FB
208configure \
209dyngen.c dyngen.h dyngen-exec.h ioctls.h syscall_types.h \
210Makefile elf.h elfload.c main.c signal.c qemu.h \
211syscall.c syscall_defs.h vm86.c path.c mmap.c \
6b1534cc 212i386.ld ppc.ld alpha.ld s390.ld sparc.ld arm.ld\
8c9b861e 213vl.c i386-vl.ld vl.h block.c\
de83cd02
FB
214thunk.c cpu-exec.c translate.c cpu-all.h thunk.h exec.h\
215exec.c cpu-exec.c\
216cpu-i386.h op-i386.c helper-i386.c syscall-i386.h translate-i386.c \
217exec-i386.h ops_template.h op_string.h opreg_template.h \
218cpu-arm.h syscall-arm.h exec-arm.h op-arm.c translate-arm.c op-arm-template.h \
219dis-asm.h disas.c disas.h alpha-dis.c ppc-dis.c i386-dis.c sparc-dis.c \
220arm-dis.c \
221tests/Makefile \
222tests/test-i386.c tests/test-i386-shift.h tests/test-i386.h \
223tests/test-i386-muldiv.h tests/test-i386-code16.S tests/test-i386-vm86.S \
322d0c66 224tests/hello-i386.c tests/hello-i386 \
de83cd02
FB
225tests/hello-arm.c tests/hello-arm \
226tests/sha1.c \
3ef693a0 227tests/testsig.c tests/testclone.c tests/testthread.c \
fd429f2f 228tests/runcom.c tests/pi_10.com \
1eb87257 229tests/test_path.c \
3ef693a0 230qemu-doc.texi qemu-doc.html
586314f2 231
3ef693a0 232FILE=qemu-$(VERSION)
586314f2
FB
233
234tar:
235 rm -rf /tmp/$(FILE)
236 mkdir -p /tmp/$(FILE)
237 cp -P $(FILES) /tmp/$(FILE)
238 ( cd /tmp ; tar zcvf ~/$(FILE).tar.gz $(FILE) )
239 rm -rf /tmp/$(FILE)
240
d691f669
FB
241# generate a binary distribution including the test binary environnment
242BINPATH=/usr/local/qemu-i386
243
244tarbin:
1eb87257
FB
245 tar zcvf /tmp/qemu-$(VERSION)-i386-glibc21.tar.gz \
246 $(BINPATH)/etc $(BINPATH)/lib $(BINPATH)/bin $(BINPATH)/usr
247 tar zcvf /tmp/qemu-$(VERSION)-i386-wine.tar.gz \
248 $(BINPATH)/wine
d691f669 249
31e31b8a
FB
250ifneq ($(wildcard .depend),)
251include .depend
252endif