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