Statistics
| Branch: | Revision:

root / Makefile @ 5a91de8c

History | View | Annotate | Download (4.3 kB)

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