root / Makefile.target @ 85571bc7
History | View | Annotate | Download (8.8 kB)
1 |
include config.mak |
---|---|
2 |
|
3 |
#After enabling Adlib and/or FMOD rebuild QEMU from scratch |
4 |
#Uncomment following for adlib support |
5 |
#USE_ADLIB=1 |
6 |
|
7 |
#Uncomment following and specify proper paths/names for FMOD support |
8 |
#USE_FMOD=1 |
9 |
#FMOD_INCLUDE=/net/include/fmod |
10 |
#FMOD_LIBPATH=/net/lib |
11 |
#FMOD_VERSION=3.74 |
12 |
|
13 |
TARGET_PATH=$(SRC_PATH)/target-$(TARGET_ARCH) |
14 |
VPATH=$(SRC_PATH):$(TARGET_PATH):$(SRC_PATH)/hw:$(SRC_PATH)/audio |
15 |
DEFINES=-I. -I$(TARGET_PATH) -I$(SRC_PATH) |
16 |
ifdef CONFIG_USER_ONLY |
17 |
VPATH+=:$(SRC_PATH)/linux-user |
18 |
DEFINES+=-I$(SRC_PATH)/linux-user -I$(SRC_PATH)/linux-user/$(TARGET_ARCH) |
19 |
endif |
20 |
CFLAGS=-Wall -O2 -g -fno-strict-aliasing |
21 |
LDFLAGS=-g |
22 |
LIBS= |
23 |
HELPER_CFLAGS=$(CFLAGS) |
24 |
DYNGEN=../dyngen$(EXESUF) |
25 |
# user emulator name |
26 |
QEMU_USER=qemu-$(TARGET_ARCH) |
27 |
# system emulator name |
28 |
ifdef CONFIG_SOFTMMU |
29 |
ifeq ($(TARGET_ARCH), i386) |
30 |
QEMU_SYSTEM=qemu$(EXESUF) |
31 |
else |
32 |
QEMU_SYSTEM=qemu-system-$(TARGET_ARCH)$(EXESUF) |
33 |
endif |
34 |
else |
35 |
QEMU_SYSTEM=qemu-fast |
36 |
endif |
37 |
|
38 |
ifdef CONFIG_USER_ONLY |
39 |
PROGS=$(QEMU_USER) |
40 |
else |
41 |
ifeq ($(TARGET_ARCH), i386) |
42 |
|
43 |
ifeq ($(ARCH), i386) |
44 |
PROGS+=$(QEMU_SYSTEM) |
45 |
ifndef CONFIG_SOFTMMU |
46 |
CONFIG_STATIC=y |
47 |
endif |
48 |
else |
49 |
# the system emulator using soft mmu is portable |
50 |
ifdef CONFIG_SOFTMMU |
51 |
PROGS+=$(QEMU_SYSTEM) |
52 |
endif |
53 |
endif # ARCH != i386 |
54 |
|
55 |
endif # TARGET_ARCH = i386 |
56 |
|
57 |
ifeq ($(TARGET_ARCH), ppc) |
58 |
|
59 |
ifeq ($(ARCH), ppc) |
60 |
PROGS+=$(QEMU_SYSTEM) |
61 |
endif |
62 |
|
63 |
ifeq ($(ARCH), i386) |
64 |
ifdef CONFIG_SOFTMMU |
65 |
PROGS+=$(QEMU_SYSTEM) |
66 |
endif |
67 |
endif # ARCH = i386 |
68 |
|
69 |
ifeq ($(ARCH), amd64) |
70 |
ifdef CONFIG_SOFTMMU |
71 |
PROGS+=$(QEMU_SYSTEM) |
72 |
endif |
73 |
endif # ARCH = amd64 |
74 |
|
75 |
endif # TARGET_ARCH = ppc |
76 |
|
77 |
ifeq ($(TARGET_ARCH), sparc) |
78 |
|
79 |
ifeq ($(ARCH), ppc) |
80 |
PROGS+=$(QEMU_SYSTEM) |
81 |
endif |
82 |
|
83 |
ifeq ($(ARCH), i386) |
84 |
ifdef CONFIG_SOFTMMU |
85 |
PROGS+=$(QEMU_SYSTEM) |
86 |
endif |
87 |
endif # ARCH = i386 |
88 |
|
89 |
ifeq ($(ARCH), amd64) |
90 |
ifdef CONFIG_SOFTMMU |
91 |
PROGS+=$(QEMU_SYSTEM) |
92 |
endif |
93 |
endif # ARCH = amd64 |
94 |
|
95 |
endif # TARGET_ARCH = sparc |
96 |
endif # !CONFIG_USER_ONLY |
97 |
|
98 |
ifdef CONFIG_STATIC |
99 |
LDFLAGS+=-static |
100 |
endif |
101 |
|
102 |
ifeq ($(ARCH),i386) |
103 |
CFLAGS+=-fomit-frame-pointer |
104 |
OP_CFLAGS=$(CFLAGS) -mpreferred-stack-boundary=2 |
105 |
ifeq ($(HAVE_GCC3_OPTIONS),yes) |
106 |
OP_CFLAGS+= -falign-functions=0 -fno-gcse |
107 |
else |
108 |
OP_CFLAGS+= -malign-functions=0 |
109 |
endif |
110 |
|
111 |
ifdef TARGET_GPROF |
112 |
USE_I386_LD=y |
113 |
endif |
114 |
ifdef CONFIG_STATIC |
115 |
USE_I386_LD=y |
116 |
endif |
117 |
ifdef USE_I386_LD |
118 |
LDFLAGS+=-Wl,-T,$(SRC_PATH)/i386.ld |
119 |
else |
120 |
# WARNING: this LDFLAGS is _very_ tricky : qemu is an ELF shared object |
121 |
# that the kernel ELF loader considers as an executable. I think this |
122 |
# is the simplest way to make it self virtualizable! |
123 |
LDFLAGS+=-Wl,-shared |
124 |
endif |
125 |
endif |
126 |
|
127 |
ifeq ($(ARCH),amd64) |
128 |
OP_CFLAGS=$(CFLAGS) -falign-functions=0 |
129 |
LDFLAGS+=-Wl,-T,$(SRC_PATH)/amd64.ld |
130 |
endif |
131 |
|
132 |
ifeq ($(ARCH),ppc) |
133 |
CFLAGS+= -D__powerpc__ |
134 |
OP_CFLAGS=$(CFLAGS) |
135 |
LDFLAGS+=-Wl,-T,$(SRC_PATH)/ppc.ld |
136 |
endif |
137 |
|
138 |
ifeq ($(ARCH),s390) |
139 |
OP_CFLAGS=$(CFLAGS) |
140 |
LDFLAGS+=-Wl,-T,$(SRC_PATH)/s390.ld |
141 |
endif |
142 |
|
143 |
ifeq ($(ARCH),sparc) |
144 |
CFLAGS+=-m32 -ffixed-g1 -ffixed-g2 -ffixed-g3 -ffixed-g6 |
145 |
LDFLAGS+=-m32 |
146 |
OP_CFLAGS=$(CFLAGS) -fno-delayed-branch -ffixed-i0 |
147 |
HELPER_CFLAGS=$(CFLAGS) -ffixed-i0 -mflat |
148 |
# -static is used to avoid g1/g3 usage by the dynamic linker |
149 |
LDFLAGS+=-Wl,-T,$(SRC_PATH)/sparc.ld -static |
150 |
endif |
151 |
|
152 |
ifeq ($(ARCH),sparc64) |
153 |
CFLAGS+=-m64 -ffixed-g1 -ffixed-g2 -ffixed-g3 -ffixed-g6 |
154 |
LDFLAGS+=-m64 |
155 |
OP_CFLAGS=$(CFLAGS) -fno-delayed-branch -ffixed-i0 |
156 |
endif |
157 |
|
158 |
ifeq ($(ARCH),alpha) |
159 |
# -msmall-data is not used because we want two-instruction relocations |
160 |
# for the constant constructions |
161 |
OP_CFLAGS=-Wall -O2 -g |
162 |
# Ensure there's only a single GP |
163 |
CFLAGS += -msmall-data |
164 |
LDFLAGS+=-Wl,-T,$(SRC_PATH)/alpha.ld |
165 |
endif |
166 |
|
167 |
ifeq ($(ARCH),ia64) |
168 |
OP_CFLAGS=$(CFLAGS) |
169 |
endif |
170 |
|
171 |
ifeq ($(ARCH),arm) |
172 |
OP_CFLAGS=$(CFLAGS) -mno-sched-prolog |
173 |
LDFLAGS+=-Wl,-T,$(SRC_PATH)/arm.ld |
174 |
endif |
175 |
|
176 |
ifeq ($(ARCH),m68k) |
177 |
OP_CFLAGS=$(CFLAGS) -fomit-frame-pointer |
178 |
LDFLAGS+=-Wl,-T,m68k.ld |
179 |
endif |
180 |
|
181 |
ifeq ($(HAVE_GCC3_OPTIONS),yes) |
182 |
# very important to generate a return at the end of every operation |
183 |
OP_CFLAGS+=-fno-reorder-blocks -fno-optimize-sibling-calls |
184 |
endif |
185 |
|
186 |
ifeq ($(CONFIG_DARWIN),yes) |
187 |
OP_CFLAGS+= -mdynamic-no-pic |
188 |
endif |
189 |
|
190 |
######################################################### |
191 |
|
192 |
DEFINES+=-D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE |
193 |
LIBS+=-lm |
194 |
ifndef CONFIG_USER_ONLY |
195 |
LIBS+=-lz |
196 |
endif |
197 |
ifdef CONFIG_WIN32 |
198 |
LIBS+=-lwinmm -lws2_32 -liphlpapi |
199 |
endif |
200 |
|
201 |
# profiling code |
202 |
ifdef TARGET_GPROF |
203 |
LDFLAGS+=-p |
204 |
main.o: CFLAGS+=-p |
205 |
endif |
206 |
|
207 |
OBJS= elfload.o main.o syscall.o mmap.o signal.o path.o osdep.o thunk.o |
208 |
ifeq ($(TARGET_ARCH), i386) |
209 |
OBJS+= vm86.o |
210 |
endif |
211 |
ifeq ($(TARGET_ARCH), arm) |
212 |
OBJS+=nwfpe/softfloat.o nwfpe/fpa11.o nwfpe/fpa11_cpdo.o \ |
213 |
nwfpe/fpa11_cpdt.o nwfpe/fpa11_cprt.o nwfpe/fpopcode.o nwfpe/single_cpdo.o \ |
214 |
nwfpe/double_cpdo.o nwfpe/extended_cpdo.o |
215 |
endif |
216 |
SRCS:= $(OBJS:.o=.c) |
217 |
OBJS+= libqemu.a |
218 |
|
219 |
# cpu emulator library |
220 |
LIBOBJS=exec.o translate-all.o cpu-exec.o\ |
221 |
translate.o op.o |
222 |
|
223 |
ifeq ($(TARGET_ARCH), i386) |
224 |
LIBOBJS+=helper.o helper2.o |
225 |
ifeq ($(ARCH), i386) |
226 |
LIBOBJS+=translate-copy.o |
227 |
endif |
228 |
endif |
229 |
|
230 |
ifeq ($(TARGET_ARCH), ppc) |
231 |
LIBOBJS+= op_helper.o helper.o |
232 |
endif |
233 |
|
234 |
ifeq ($(TARGET_ARCH), sparc) |
235 |
LIBOBJS+= op_helper.o helper.o |
236 |
endif |
237 |
|
238 |
# NOTE: the disassembler code is only needed for debugging |
239 |
LIBOBJS+=disas.o |
240 |
ifeq ($(findstring i386, $(TARGET_ARCH) $(ARCH)),i386) |
241 |
USE_I386_DIS=y |
242 |
endif |
243 |
ifeq ($(findstring amd64, $(TARGET_ARCH) $(ARCH)),amd64) |
244 |
USE_I386_DIS=y |
245 |
endif |
246 |
ifdef USE_I386_DIS |
247 |
LIBOBJS+=i386-dis.o |
248 |
endif |
249 |
ifeq ($(findstring alpha, $(TARGET_ARCH) $(ARCH)),alpha) |
250 |
LIBOBJS+=alpha-dis.o |
251 |
endif |
252 |
ifeq ($(findstring ppc, $(TARGET_ARCH) $(ARCH)),ppc) |
253 |
LIBOBJS+=ppc-dis.o |
254 |
endif |
255 |
ifeq ($(findstring sparc, $(TARGET_ARCH) $(ARCH)),sparc) |
256 |
LIBOBJS+=sparc-dis.o |
257 |
endif |
258 |
ifeq ($(findstring arm, $(TARGET_ARCH) $(ARCH)),arm) |
259 |
LIBOBJS+=arm-dis.o |
260 |
endif |
261 |
|
262 |
ifeq ($(ARCH),ia64) |
263 |
OBJS += ia64-syscall.o |
264 |
endif |
265 |
|
266 |
all: $(PROGS) |
267 |
|
268 |
$(QEMU_USER): $(OBJS) |
269 |
$(CC) $(LDFLAGS) -o $@ $^ $(LIBS) |
270 |
ifeq ($(ARCH),alpha) |
271 |
# Mark as 32 bit binary, i. e. it will be mapped into the low 31 bit of |
272 |
# the address space (31 bit so sign extending doesn't matter) |
273 |
echo -ne '\001\000\000\000' | dd of=qemu bs=1 seek=48 count=4 conv=notrunc |
274 |
endif |
275 |
|
276 |
# must use static linking to avoid leaving stuff in virtual address space |
277 |
VL_OBJS=vl.o osdep.o block.o readline.o monitor.o pci.o console.o |
278 |
VL_OBJS+=block-cow.o block-qcow.o aes.o block-vmdk.o block-cloop.o |
279 |
|
280 |
SOUND_HW = sb16.o |
281 |
AUDIODRV = audio.o ossaudio.o sdlaudio.o wavaudio.o |
282 |
|
283 |
ifeq ($(USE_ADLIB),1) |
284 |
SOUND_HW += fmopl.o adlib.o |
285 |
audio.o: DEFINES := -DUSE_ADLIB $(DEFINES) |
286 |
endif |
287 |
|
288 |
ifeq ($(USE_FMOD),1) |
289 |
AUDIODRV += fmodaudio.o |
290 |
audio.o fmodaudio.o: DEFINES := -DUSE_FMOD_AUDIO -I$(FMOD_INCLUDE) $(DEFINES) |
291 |
LDFLAGS += -L$(FMOD_LIBPATH) -Wl,-rpath,$(FMOD_LIBPATH) |
292 |
LIBS += -lfmod-$(FMOD_VERSION) |
293 |
endif |
294 |
|
295 |
ifeq ($(TARGET_ARCH), i386) |
296 |
# Hardware support |
297 |
VL_OBJS+= ide.o ne2000.o pckbd.o vga.o $(SOUND_HW) dma.o $(AUDIODRV) |
298 |
VL_OBJS+= fdc.o mc146818rtc.o serial.o i8259.o i8254.o pc.o |
299 |
VL_OBJS+= cirrus_vga.o mixeng.o |
300 |
endif |
301 |
ifeq ($(TARGET_ARCH), ppc) |
302 |
VL_OBJS+= ppc.o ide.o ne2000.o pckbd.o vga.o $(SOUND_HW) dma.o $(AUDIODRV) |
303 |
VL_OBJS+= mc146818rtc.o serial.o i8259.o i8254.o fdc.o m48t59.o |
304 |
VL_OBJS+= ppc_prep.o ppc_chrp.o cuda.o adb.o openpic.o mixeng.o |
305 |
endif |
306 |
ifeq ($(TARGET_ARCH), sparc) |
307 |
VL_OBJS+= sun4m.o tcx.o lance.o iommu.o sched.o m48t08.o magic-load.o timer.o |
308 |
endif |
309 |
ifdef CONFIG_GDBSTUB |
310 |
VL_OBJS+=gdbstub.o |
311 |
endif |
312 |
ifdef CONFIG_SDL |
313 |
VL_OBJS+=sdl.o |
314 |
endif |
315 |
ifdef CONFIG_SLIRP |
316 |
DEFINES+=-I$(SRC_PATH)/slirp |
317 |
SLIRP_OBJS=cksum.o if.o ip_icmp.o ip_input.o ip_output.o \ |
318 |
slirp.o mbuf.o misc.o sbuf.o socket.o tcp_input.o tcp_output.o \ |
319 |
tcp_subr.o tcp_timer.o udp.o bootp.o debug.o tftp.o |
320 |
VL_OBJS+=$(addprefix slirp/, $(SLIRP_OBJS)) |
321 |
endif |
322 |
|
323 |
VL_LDFLAGS= |
324 |
# specific flags are needed for non soft mmu emulator |
325 |
ifdef CONFIG_STATIC |
326 |
VL_LDFLAGS+=-static |
327 |
endif |
328 |
ifndef CONFIG_SOFTMMU |
329 |
VL_LDFLAGS+=-Wl,-T,$(SRC_PATH)/i386-vl.ld |
330 |
endif |
331 |
ifndef CONFIG_DARWIN |
332 |
ifndef CONFIG_WIN32 |
333 |
VL_LIBS=-lutil |
334 |
endif |
335 |
endif |
336 |
|
337 |
$(QEMU_SYSTEM): $(VL_OBJS) libqemu.a |
338 |
$(CC) $(VL_LDFLAGS) -o $@ $^ $(LIBS) $(SDL_LIBS) $(VL_LIBS) |
339 |
|
340 |
sdl.o: sdl.c |
341 |
$(CC) $(CFLAGS) $(DEFINES) $(SDL_CFLAGS) -c -o $@ $< |
342 |
|
343 |
depend: $(SRCS) |
344 |
$(CC) -MM $(CFLAGS) $(DEFINES) $^ 1>.depend |
345 |
|
346 |
# libqemu |
347 |
|
348 |
libqemu.a: $(LIBOBJS) |
349 |
rm -f $@ |
350 |
$(AR) rcs $@ $(LIBOBJS) |
351 |
|
352 |
translate.o: translate.c gen-op.h opc.h cpu.h |
353 |
|
354 |
translate-all.o: translate-all.c op.h opc.h cpu.h |
355 |
|
356 |
op.h: op.o $(DYNGEN) |
357 |
$(DYNGEN) -o $@ $< |
358 |
|
359 |
opc.h: op.o $(DYNGEN) |
360 |
$(DYNGEN) -c -o $@ $< |
361 |
|
362 |
gen-op.h: op.o $(DYNGEN) |
363 |
$(DYNGEN) -g -o $@ $< |
364 |
|
365 |
op.o: op.c |
366 |
$(CC) $(OP_CFLAGS) $(DEFINES) -c -o $@ $< |
367 |
|
368 |
helper.o: helper.c |
369 |
$(CC) $(HELPER_CFLAGS) $(DEFINES) -c -o $@ $< |
370 |
|
371 |
ifeq ($(TARGET_ARCH), i386) |
372 |
op.o: op.c opreg_template.h ops_template.h ops_template_mem.h ops_mem.h |
373 |
endif |
374 |
|
375 |
ifeq ($(TARGET_ARCH), arm) |
376 |
op.o: op.c op_template.h |
377 |
endif |
378 |
|
379 |
ifeq ($(TARGET_ARCH), sparc) |
380 |
op.o: op.c op_template.h op_mem.h |
381 |
endif |
382 |
|
383 |
ifeq ($(TARGET_ARCH), ppc) |
384 |
op.o: op.c op_template.h op_mem.h |
385 |
op_helper.o: op_helper_mem.h |
386 |
endif |
387 |
|
388 |
mixeng.o: mixeng.c mixeng.h mixeng_template.h |
389 |
|
390 |
%.o: %.c |
391 |
$(CC) $(CFLAGS) $(DEFINES) -c -o $@ $< |
392 |
|
393 |
%.o: %.S |
394 |
$(CC) $(DEFINES) -c -o $@ $< |
395 |
|
396 |
clean: |
397 |
rm -f *.o *.a *~ $(PROGS) gen-op.h opc.h op.h nwfpe/*.o slirp/*.o |
398 |
|
399 |
install: all |
400 |
ifneq ($(PROGS),) |
401 |
install -m 755 -s $(PROGS) "$(bindir)" |
402 |
endif |
403 |
|
404 |
ifneq ($(wildcard .depend),) |
405 |
include .depend |
406 |
endif |