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