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