]> git.proxmox.com Git - qemu.git/blame - Makefile
convert mmap flags (alpha fix)
[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
7d13299d
FB
7
8ifeq ($(ARCH),i386)
9CFLAGS+=-fomit-frame-pointer
ca735206
FB
10OP_CFLAGS=$(CFLAGS) -mpreferred-stack-boundary=2
11ifeq ($(GCC_MAJOR),3)
12OP_CFLAGS+= -falign-functions=0
13else
14OP_CFLAGS+= -malign-functions=0
15endif
2d92f0b8
FB
16ifdef TARGET_GPROF
17LDFLAGS+=-Wl,-T,i386.ld
18else
27c75a9a
FB
19# WARNING: this LDFLAGS is _very_ tricky : qemu is an ELF shared object
20# that the kernel ELF loader considers as an executable. I think this
21# is the simplest way to make it self virtualizable!
22LDFLAGS+=-Wl,-shared
766a487a 23endif
2d92f0b8 24endif
766a487a
FB
25
26ifeq ($(ARCH),ppc)
927f621e 27OP_CFLAGS=$(CFLAGS)
27c75a9a 28LDFLAGS+=-Wl,-T,ppc.ld
766a487a
FB
29endif
30
fd429f2f
FB
31ifeq ($(ARCH),s390)
32OP_CFLAGS=$(CFLAGS)
27c75a9a 33LDFLAGS+=-Wl,-T,s390.ld
fd429f2f
FB
34endif
35
ae228531
FB
36ifeq ($(ARCH),sparc)
37CFLAGS+=-m32 -ffixed-g1 -ffixed-g2 -ffixed-g3 -ffixed-g6
38LDFLAGS+=-m32
39OP_CFLAGS=$(CFLAGS) -fno-delayed-branch -ffixed-i0
40endif
41
42ifeq ($(ARCH),sparc64)
43CFLAGS+=-m64 -ffixed-g1 -ffixed-g2 -ffixed-g3 -ffixed-g6
44LDFLAGS+=-m64
45OP_CFLAGS=$(CFLAGS) -fno-delayed-branch -ffixed-i0
46endif
47
d6cdca95 48ifeq ($(ARCH),alpha)
a993ba85
FB
49# -msmall-data is not used because we want two-instruction relocations
50# for the constant constructions
51OP_CFLAGS=-Wall -O2 -g
d6cdca95
FB
52# Ensure there's only a single GP
53CFLAGS += -msmall-data -msmall-text
d6cdca95
FB
54LDFLAGS+=-Wl,-T,alpha.ld
55endif
56
57ifeq ($(ARCH),ia64)
58OP_CFLAGS=$(CFLAGS)
59endif
60
ca735206
FB
61ifeq ($(GCC_MAJOR),3)
62# very important to generate a return at the end of every operation
63OP_CFLAGS+=-fno-reorder-blocks -fno-optimize-sibling-calls
64endif
65
766a487a
FB
66#########################################################
67
0ecfa993 68DEFINES+=-D_GNU_SOURCE
3ef693a0 69LIBS+=-lm
7d13299d
FB
70
71# profiling code
72ifdef TARGET_GPROF
73LDFLAGS+=-p
dc99065b 74main.o: CFLAGS+=-p
7d13299d 75endif
31e31b8a 76
54936004 77OBJS= elfload.o main.o syscall.o mmap.o signal.o vm86.o path.o
3ef693a0
FB
78SRCS:= $(OBJS:.o=.c)
79OBJS+= libqemu.a
612384d7 80
54936004 81LIBOBJS+=thunk.o translate-i386.o op-i386.o exec-i386.o exec.o
aa05ae6f 82
0ecfa993 83# NOTE: the disassembler code is only needed for debugging
aa05ae6f
FB
84LIBOBJS+=disas.o i386-dis.o dis-buf.o
85ifeq ($(ARCH),alpha)
86LIBOBJS+=alpha-dis.o
87endif
88ifeq ($(ARCH),ppc)
89LIBOBJS+=ppc-dis.o
90endif
31e31b8a 91
d6cdca95
FB
92ifeq ($(ARCH),ia64)
93OBJS += ia64-syscall.o
94endif
95
3ef693a0 96all: qemu qemu-doc.html
31e31b8a 97
3ef693a0 98qemu: $(OBJS)
27c75a9a 99 $(CC) $(LDFLAGS) -o $@ $^ $(LIBS)
a993ba85
FB
100ifeq ($(ARCH),alpha)
101# Mark as 32 bit binary, i. e. it will be mapped into the low 31 bit of
102# the address space (31 bit so sign extending doesn't matter)
103 echo -ne '\001\000\000\000' | dd of=qemu bs=1 seek=48 count=4 conv=notrunc
104endif
31e31b8a
FB
105
106depend: $(SRCS)
107 $(CC) -MM $(CFLAGS) $^ 1>.depend
108
3ef693a0 109# libqemu
612384d7 110
3ef693a0 111libqemu.a: $(LIBOBJS)
612384d7
FB
112 rm -f $@
113 $(AR) rcs $@ $(LIBOBJS)
114
367e86e8
FB
115dyngen: dyngen.c
116 $(HOST_CC) -O2 -Wall -g $< -o $@
117
2d92f0b8 118translate-i386.o: translate-i386.c op-i386.h opc-i386.h cpu-i386.h
367e86e8
FB
119
120op-i386.h: op-i386.o dyngen
121 ./dyngen -o $@ $<
122
2d92f0b8
FB
123opc-i386.h: op-i386.o dyngen
124 ./dyngen -c -o $@ $<
125
367e86e8 126op-i386.o: op-i386.c opreg_template.h ops_template.h
927f621e 127 $(CC) $(OP_CFLAGS) $(DEFINES) -c -o $@ $<
367e86e8 128
31e31b8a
FB
129%.o: %.c
130 $(CC) $(CFLAGS) $(DEFINES) -c -o $@ $<
131
132clean:
7d13299d 133 $(MAKE) -C tests clean
3ef693a0 134 rm -f *.o *.a *~ qemu dyngen TAGS
31e31b8a 135
7d13299d
FB
136distclean: clean
137 rm -f config.mak config.h
138
3ef693a0
FB
139install: qemu
140 install -m 755 -s qemu $(prefix)/bin
612384d7 141
367e86e8 142# various test targets
3ef693a0 143test speed: qemu
367e86e8 144 make -C tests $@
31e31b8a 145
367e86e8 146TAGS:
b9adb4a6 147 etags *.[ch] tests/*.[ch]
31e31b8a 148
3ef693a0
FB
149# documentation
150qemu-doc.html: qemu-doc.texi
151 texi2html -monolithic -number $<
152
586314f2 153FILES= \
fd429f2f
FB
154README README.distrib COPYING COPYING.LIB TODO Changelog VERSION \
155dyngen.c ioctls.h ops_template.h op_string.h syscall_types.h\
09bfb054 156Makefile elf.h thunk.c\
aa05ae6f 157elfload.c main.c signal.c thunk.h exec.h\
2d92f0b8 158cpu-i386.h qemu.h op-i386.c syscall-i386.h translate-i386.c\
76c8b771
FB
159syscall.c opreg_template.h syscall_defs.h vm86.c\
160dis-asm.h dis-buf.c disas.c disas.h alpha-dis.c ppc-dis.c i386-dis.c\
161ppc.ld s390.ld exec-i386.h exec-i386.c path.c exec.c mmap.c configure \
77f8dd5a 162tests/Makefile\
586314f2 163tests/test-i386.c tests/test-i386-shift.h tests/test-i386.h\
612384d7
FB
164tests/test-i386-muldiv.h tests/test-i386-code16.S\
165tests/hello.c tests/hello tests/sha1.c \
3ef693a0 166tests/testsig.c tests/testclone.c tests/testthread.c \
fd429f2f 167tests/runcom.c tests/pi_10.com \
1eb87257 168tests/test_path.c \
3ef693a0 169qemu-doc.texi qemu-doc.html
586314f2 170
3ef693a0 171FILE=qemu-$(VERSION)
586314f2
FB
172
173tar:
174 rm -rf /tmp/$(FILE)
175 mkdir -p /tmp/$(FILE)
176 cp -P $(FILES) /tmp/$(FILE)
177 ( cd /tmp ; tar zcvf ~/$(FILE).tar.gz $(FILE) )
178 rm -rf /tmp/$(FILE)
179
d691f669
FB
180# generate a binary distribution including the test binary environnment
181BINPATH=/usr/local/qemu-i386
182
183tarbin:
1eb87257
FB
184 tar zcvf /tmp/qemu-$(VERSION)-i386-glibc21.tar.gz \
185 $(BINPATH)/etc $(BINPATH)/lib $(BINPATH)/bin $(BINPATH)/usr
186 tar zcvf /tmp/qemu-$(VERSION)-i386-wine.tar.gz \
187 $(BINPATH)/wine
d691f669 188
31e31b8a
FB
189ifneq ($(wildcard .depend),)
190include .depend
191endif