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