]> git.proxmox.com Git - mirror_qemu.git/blame - Makefile.target
NE2000 fixes for windows (Renzo Davoli)
[mirror_qemu.git] / Makefile.target
CommitLineData
626df76a
FB
1include config.mak
2
1e43adfc 3TARGET_PATH=$(SRC_PATH)/target-$(TARGET_ARCH)
80cabfad 4VPATH=$(SRC_PATH):$(TARGET_PATH):$(SRC_PATH)/hw
3035f7ff
FB
5DEFINES=-I. -I$(TARGET_PATH) -I$(SRC_PATH)
6ifdef CONFIG_USER_ONLY
7VPATH+=:$(SRC_PATH)/linux-user
8DEFINES+=-I$(SRC_PATH)/linux-user -I$(SRC_PATH)/linux-user/$(TARGET_ARCH)
9endif
626df76a
FB
10CFLAGS=-Wall -O2 -g
11LDFLAGS=-g
12LIBS=
626df76a 13HELPER_CFLAGS=$(CFLAGS)
67b915a5 14DYNGEN=../dyngen$(EXESUF)
1e43adfc
FB
15# user emulator name
16QEMU_USER=qemu-$(TARGET_ARCH)
17# system emulator name
18ifdef CONFIG_SOFTMMU
a541f297 19ifeq ($(TARGET_ARCH), i386)
67b915a5 20QEMU_SYSTEM=qemu$(EXESUF)
0db63474 21else
a541f297
FB
22QEMU_SYSTEM=qemu-system-$(TARGET_ARCH)$(EXESUF)
23endif
24else
0db63474 25QEMU_SYSTEM=qemu-fast
1e43adfc
FB
26endif
27
16e9b7de 28ifdef CONFIG_USER_ONLY
1e43adfc 29PROGS=$(QEMU_USER)
16e9b7de 30else
16e9b7de 31ifeq ($(TARGET_ARCH), i386)
c321f673
FB
32
33ifeq ($(ARCH), i386)
34PROGS+=$(QEMU_SYSTEM)
de5eaa64
FB
35ifndef CONFIG_SOFTMMU
36CONFIG_STATIC=y
37endif
38ca2abc
FB
38else
39# the system emulator using soft mmu is portable
c321f673 40ifdef CONFIG_SOFTMMU
16e9b7de
FB
41PROGS+=$(QEMU_SYSTEM)
42endif
38ca2abc 43endif # ARCH != i386
c321f673 44
38ca2abc 45endif # TARGET_ARCH = i386
728c9fd5
FB
46
47ifeq ($(TARGET_ARCH), ppc)
48
49ifeq ($(ARCH), ppc)
50PROGS+=$(QEMU_SYSTEM)
51endif
52
53ifeq ($(ARCH), i386)
54ifdef CONFIG_SOFTMMU
55PROGS+=$(QEMU_SYSTEM)
626df76a 56endif
728c9fd5
FB
57endif # ARCH = i386
58
59endif # TARGET_ARCH = ppc
60endif # !CONFIG_USER_ONLY
626df76a
FB
61
62ifdef CONFIG_STATIC
63LDFLAGS+=-static
64endif
65
66ifeq ($(ARCH),i386)
67CFLAGS+=-fomit-frame-pointer
68OP_CFLAGS=$(CFLAGS) -mpreferred-stack-boundary=2
69ifeq ($(HAVE_GCC3_OPTIONS),yes)
70OP_CFLAGS+= -falign-functions=0
71else
72OP_CFLAGS+= -malign-functions=0
73endif
3a4739d6 74
626df76a 75ifdef TARGET_GPROF
3a4739d6
FB
76USE_I386_LD=y
77endif
78ifdef CONFIG_STATIC
79USE_I386_LD=y
80endif
81ifdef USE_I386_LD
626df76a
FB
82LDFLAGS+=-Wl,-T,$(SRC_PATH)/i386.ld
83else
84# WARNING: this LDFLAGS is _very_ tricky : qemu is an ELF shared object
85# that the kernel ELF loader considers as an executable. I think this
86# is the simplest way to make it self virtualizable!
87LDFLAGS+=-Wl,-shared
88endif
626df76a
FB
89endif
90
bc51c5c9
FB
91ifeq ($(ARCH),amd64)
92OP_CFLAGS=$(CFLAGS) -falign-functions=0
93LDFLAGS+=-Wl,-T,$(SRC_PATH)/amd64.ld
94endif
95
626df76a
FB
96ifeq ($(ARCH),ppc)
97OP_CFLAGS=$(CFLAGS)
98LDFLAGS+=-Wl,-T,$(SRC_PATH)/ppc.ld
99endif
100
101ifeq ($(ARCH),s390)
102OP_CFLAGS=$(CFLAGS)
103LDFLAGS+=-Wl,-T,$(SRC_PATH)/s390.ld
104endif
105
106ifeq ($(ARCH),sparc)
107CFLAGS+=-m32 -ffixed-g1 -ffixed-g2 -ffixed-g3 -ffixed-g6
108LDFLAGS+=-m32
109OP_CFLAGS=$(CFLAGS) -fno-delayed-branch -ffixed-i0
110HELPER_CFLAGS=$(CFLAGS) -ffixed-i0 -mflat
111# -static is used to avoid g1/g3 usage by the dynamic linker
112LDFLAGS+=-Wl,-T,$(SRC_PATH)/sparc.ld -static
113endif
114
115ifeq ($(ARCH),sparc64)
116CFLAGS+=-m64 -ffixed-g1 -ffixed-g2 -ffixed-g3 -ffixed-g6
117LDFLAGS+=-m64
118OP_CFLAGS=$(CFLAGS) -fno-delayed-branch -ffixed-i0
119endif
120
121ifeq ($(ARCH),alpha)
122# -msmall-data is not used because we want two-instruction relocations
123# for the constant constructions
124OP_CFLAGS=-Wall -O2 -g
125# Ensure there's only a single GP
126CFLAGS += -msmall-data
127LDFLAGS+=-Wl,-T,$(SRC_PATH)/alpha.ld
128endif
129
130ifeq ($(ARCH),ia64)
131OP_CFLAGS=$(CFLAGS)
132endif
133
134ifeq ($(ARCH),arm)
135OP_CFLAGS=$(CFLAGS) -mno-sched-prolog
136LDFLAGS+=-Wl,-T,$(SRC_PATH)/arm.ld
137endif
138
38e584a0
FB
139ifeq ($(ARCH),m68k)
140OP_CFLAGS=$(CFLAGS) -fomit-frame-pointer
141LDFLAGS+=-Wl,-T,m68k.ld
142endif
143
626df76a
FB
144ifeq ($(HAVE_GCC3_OPTIONS),yes)
145# very important to generate a return at the end of every operation
146OP_CFLAGS+=-fno-reorder-blocks -fno-optimize-sibling-calls
147endif
148
149#########################################################
150
151DEFINES+=-D_GNU_SOURCE
152LIBS+=-lm
67b915a5
FB
153ifdef CONFIG_WIN32
154LIBS+=-lwinmm
155endif
626df76a
FB
156
157# profiling code
158ifdef TARGET_GPROF
159LDFLAGS+=-p
160main.o: CFLAGS+=-p
161endif
162
3035f7ff 163OBJS= elfload.o main.o syscall.o mmap.o signal.o path.o osdep.o thunk.o
626df76a
FB
164ifeq ($(TARGET_ARCH), i386)
165OBJS+= vm86.o
166endif
f72b519c
FB
167ifeq ($(TARGET_ARCH), arm)
168OBJS+=nwfpe/softfloat.o nwfpe/fpa11.o nwfpe/fpa11_cpdo.o \
169nwfpe/fpa11_cpdt.o nwfpe/fpa11_cprt.o nwfpe/fpopcode.o nwfpe/single_cpdo.o \
170 nwfpe/double_cpdo.o nwfpe/extended_cpdo.o
171endif
626df76a
FB
172SRCS:= $(OBJS:.o=.c)
173OBJS+= libqemu.a
174
175# cpu emulator library
858693c6 176LIBOBJS=exec.o translate-all.o cpu-exec.o\
1e43adfc 177 translate.o op.o
626df76a
FB
178
179ifeq ($(TARGET_ARCH), i386)
1e43adfc 180LIBOBJS+=helper.o helper2.o
f72b519c
FB
181ifeq ($(ARCH), i386)
182LIBOBJS+=translate-copy.o
183endif
626df76a
FB
184endif
185
67867308 186ifeq ($(TARGET_ARCH), ppc)
728c9fd5 187LIBOBJS+= op_helper.o helper.o
67867308
FB
188endif
189
626df76a
FB
190# NOTE: the disassembler code is only needed for debugging
191LIBOBJS+=disas.o
192ifeq ($(findstring i386, $(TARGET_ARCH) $(ARCH)),i386)
bc51c5c9
FB
193USE_I386_DIS=y
194endif
195ifeq ($(findstring amd64, $(TARGET_ARCH) $(ARCH)),amd64)
196USE_I386_DIS=y
197endif
198ifdef USE_I386_DIS
626df76a
FB
199LIBOBJS+=i386-dis.o
200endif
201ifeq ($(findstring alpha, $(TARGET_ARCH) $(ARCH)),alpha)
202LIBOBJS+=alpha-dis.o
203endif
204ifeq ($(findstring ppc, $(TARGET_ARCH) $(ARCH)),ppc)
205LIBOBJS+=ppc-dis.o
206endif
207ifeq ($(findstring sparc, $(TARGET_ARCH) $(ARCH)),sparc)
208LIBOBJS+=sparc-dis.o
209endif
210ifeq ($(findstring arm, $(TARGET_ARCH) $(ARCH)),arm)
211LIBOBJS+=arm-dis.o
212endif
213
214ifeq ($(ARCH),ia64)
215OBJS += ia64-syscall.o
216endif
217
1e43adfc 218all: $(PROGS)
626df76a 219
1e43adfc 220$(QEMU_USER): $(OBJS)
626df76a
FB
221 $(CC) $(LDFLAGS) -o $@ $^ $(LIBS)
222ifeq ($(ARCH),alpha)
223# Mark as 32 bit binary, i. e. it will be mapped into the low 31 bit of
224# the address space (31 bit so sign extending doesn't matter)
225 echo -ne '\001\000\000\000' | dd of=qemu bs=1 seek=48 count=4 conv=notrunc
226endif
227
228# must use static linking to avoid leaving stuff in virtual address space
a541f297
FB
229VL_OBJS=vl.o osdep.o block.o monitor.o
230
231ifeq ($(TARGET_ARCH), i386)
232# Hardware support
233VL_OBJS+= ide.o ne2000.o pckbd.o vga.o sb16.o dma.o oss.o
234VL_OBJS+= fdc.o mc146818rtc.o serial.o i8259.o i8254.o pc.o
67b915a5 235endif
728c9fd5 236ifeq ($(TARGET_ARCH), ppc)
a541f297
FB
237# Generic PPC support
238VL_OBJS+= ppc.o
239# PREP hardware support
240VL_OBJS+= ide.o ne2000.o pckbd.o vga.o sb16.o dma.o oss.o
241VL_OBJS+= mc146818rtc.o serial.o i8259.o i8254.o fdc.o m48t59.o ppc_prep.o
242#VL_OBJS+= hw.o of.o setup.o
243endif
244ifdef CONFIG_GDBSTUB
245VL_OBJS+=gdbstub.o
728c9fd5 246endif
626df76a
FB
247ifdef CONFIG_SDL
248VL_OBJS+=sdl.o
de5eaa64
FB
249ifdef CONFIG_STATIC
250SDL_LIBS:=$(SDL_STATIC_LIBS)
251endif
626df76a
FB
252endif
253
c321f673
FB
254VL_LDFLAGS=
255# specific flags are needed for non soft mmu emulator
c321f673
FB
256ifdef CONFIG_STATIC
257VL_LDFLAGS+=-static
258endif
de5eaa64
FB
259ifndef CONFIG_SOFTMMU
260VL_LDFLAGS+=-Wl,-T,$(SRC_PATH)/i386-vl.ld
261endif
11d9f695
FB
262ifndef CONFIG_WIN32
263VL_LIBS=-lutil
264endif
c321f673 265
1e43adfc 266$(QEMU_SYSTEM): $(VL_OBJS) libqemu.a
11d9f695 267 $(CC) $(VL_LDFLAGS) -o $@ $^ $(LIBS) $(SDL_LIBS) $(VL_LIBS)
626df76a
FB
268
269sdl.o: sdl.c
270 $(CC) $(CFLAGS) $(DEFINES) $(SDL_CFLAGS) -c -o $@ $<
271
272depend: $(SRCS)
16e9b7de 273 $(CC) -MM $(CFLAGS) $(DEFINES) $^ 1>.depend
626df76a
FB
274
275# libqemu
276
277libqemu.a: $(LIBOBJS)
278 rm -f $@
279 $(AR) rcs $@ $(LIBOBJS)
280
1e43adfc 281translate.o: translate.c gen-op.h opc.h cpu.h
626df76a 282
1e43adfc 283translate-all.o: translate-all.c op.h opc.h cpu.h
626df76a 284
1e43adfc 285op.h: op.o $(DYNGEN)
626df76a
FB
286 $(DYNGEN) -o $@ $<
287
1e43adfc 288opc.h: op.o $(DYNGEN)
626df76a
FB
289 $(DYNGEN) -c -o $@ $<
290
1e43adfc 291gen-op.h: op.o $(DYNGEN)
626df76a
FB
292 $(DYNGEN) -g -o $@ $<
293
1e43adfc 294op.o: op.c
626df76a
FB
295 $(CC) $(OP_CFLAGS) $(DEFINES) -c -o $@ $<
296
1e43adfc 297helper.o: helper.c
626df76a
FB
298 $(CC) $(HELPER_CFLAGS) $(DEFINES) -c -o $@ $<
299
1e43adfc
FB
300ifeq ($(TARGET_ARCH), i386)
301op.o: op.c opreg_template.h ops_template.h ops_template_mem.h ops_mem.h
302endif
303
304ifeq ($(TARGET_ARCH), arm)
305op.o: op.c op_template.h
306endif
626df76a 307
1e43adfc
FB
308ifeq ($(TARGET_ARCH), sparc)
309op.o: op.c op_template.h
310endif
626df76a 311
728c9fd5
FB
312ifeq ($(TARGET_ARCH), ppc)
313op.o: op.c op_template.h op_mem.h
314op_helper.o: op_helper_mem.h
315endif
316
626df76a
FB
317%.o: %.c
318 $(CC) $(CFLAGS) $(DEFINES) -c -o $@ $<
319
f72b519c
FB
320%.o: %.S
321 $(CC) $(DEFINES) -c -o $@ $<
322
626df76a 323clean:
f72b519c 324 rm -f *.o *.a *~ $(PROGS) gen-op.h opc.h op.h nwfpe/*.o
1e43adfc
FB
325
326install: all
9b14bb04 327ifneq ($(PROGS),)
11d9f695 328 install -m 755 -s $(PROGS) "$(bindir)"
9b14bb04 329endif
626df76a
FB
330
331ifneq ($(wildcard .depend),)
332include .depend
333endif