3 TARGET_PATH=$(SRC_PATH)/target-$(TARGET_ARCH)
4 VPATH=$(SRC_PATH):$(TARGET_PATH)
8 DEFINES=-I. -I$(TARGET_PATH) -I$(SRC_PATH)
9 HELPER_CFLAGS=$(CFLAGS)
12 QEMU_USER=qemu-$(TARGET_ARCH)
13 # system emulator name
20 ifdef CONFIG_USER_ONLY
23 ifeq ($(TARGET_ARCH), i386)
40 ifeq ($(TARGET_ARCH), ppc)
52 endif # TARGET_ARCH = ppc
53 endif # !CONFIG_USER_ONLY
60 CFLAGS+=-fomit-frame-pointer
61 OP_CFLAGS=$(CFLAGS) -mpreferred-stack-boundary=2
62 ifeq ($(HAVE_GCC3_OPTIONS),yes)
63 OP_CFLAGS+= -falign-functions=0
65 OP_CFLAGS+= -malign-functions=0
75 LDFLAGS+=-Wl,-T,$(SRC_PATH)/i386.ld
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!
86 LDFLAGS+=-Wl,-T,$(SRC_PATH)/ppc.ld
91 LDFLAGS+=-Wl,-T,$(SRC_PATH)/s390.ld
95 CFLAGS+=-m32 -ffixed-g1 -ffixed-g2 -ffixed-g3 -ffixed-g6
97 OP_CFLAGS=$(CFLAGS) -fno-delayed-branch -ffixed-i0
98 HELPER_CFLAGS=$(CFLAGS) -ffixed-i0 -mflat
99 # -static is used to avoid g1/g3 usage by the dynamic linker
100 LDFLAGS+=-Wl,-T,$(SRC_PATH)/sparc.ld -static
103 ifeq ($(ARCH),sparc64)
104 CFLAGS+=-m64 -ffixed-g1 -ffixed-g2 -ffixed-g3 -ffixed-g6
106 OP_CFLAGS=$(CFLAGS) -fno-delayed-branch -ffixed-i0
110 # -msmall-data is not used because we want two-instruction relocations
111 # for the constant constructions
112 OP_CFLAGS=-Wall -O2 -g
113 # Ensure there's only a single GP
114 CFLAGS += -msmall-data
115 LDFLAGS+=-Wl,-T,$(SRC_PATH)/alpha.ld
123 OP_CFLAGS=$(CFLAGS) -mno-sched-prolog
124 LDFLAGS+=-Wl,-T,$(SRC_PATH)/arm.ld
128 OP_CFLAGS=$(CFLAGS) -fomit-frame-pointer
129 LDFLAGS+=-Wl,-T,m68k.ld
132 ifeq ($(HAVE_GCC3_OPTIONS),yes)
133 # very important to generate a return at the end of every operation
134 OP_CFLAGS+=-fno-reorder-blocks -fno-optimize-sibling-calls
137 #########################################################
139 DEFINES+=-D_GNU_SOURCE
148 OBJS= elfload.o main.o syscall.o mmap.o signal.o path.o osdep.o
149 ifeq ($(TARGET_ARCH), i386)
152 ifeq ($(TARGET_ARCH), arm)
153 OBJS+=nwfpe/softfloat.o nwfpe/fpa11.o nwfpe/fpa11_cpdo.o \
154 nwfpe/fpa11_cpdt.o nwfpe/fpa11_cprt.o nwfpe/fpopcode.o nwfpe/single_cpdo.o \
155 nwfpe/double_cpdo.o nwfpe/extended_cpdo.o
160 # cpu emulator library
161 LIBOBJS=thunk.o exec.o translate-all.o cpu-exec.o gdbstub.o \
164 ifeq ($(TARGET_ARCH), i386)
165 LIBOBJS+=helper.o helper2.o
167 LIBOBJS+=translate-copy.o
171 ifeq ($(TARGET_ARCH), ppc)
172 LIBOBJS+= op_helper.o helper.o
175 # NOTE: the disassembler code is only needed for debugging
177 ifeq ($(findstring i386, $(TARGET_ARCH) $(ARCH)),i386)
180 ifeq ($(findstring alpha, $(TARGET_ARCH) $(ARCH)),alpha)
183 ifeq ($(findstring ppc, $(TARGET_ARCH) $(ARCH)),ppc)
186 ifeq ($(findstring sparc, $(TARGET_ARCH) $(ARCH)),sparc)
189 ifeq ($(findstring arm, $(TARGET_ARCH) $(ARCH)),arm)
194 OBJS += ia64-syscall.o
199 $(QEMU_USER): $(OBJS)
200 $(CC) $(LDFLAGS) -o $@ $^ $(LIBS)
202 # Mark as 32 bit binary, i. e. it will be mapped into the low 31 bit of
203 # the address space (31 bit so sign extending doesn't matter)
204 echo -ne '\001\000\000\000' | dd of=qemu bs=1 seek=48 count=4 conv=notrunc
207 # must use static linking to avoid leaving stuff in virtual address space
208 VL_OBJS=vl.o block.o ide.o vga.o sb16.o dma.o oss.o fdc.o osdep.o
209 ifeq ($(TARGET_ARCH), ppc)
215 SDL_LIBS:=$(SDL_STATIC_LIBS)
220 # specific flags are needed for non soft mmu emulator
224 ifndef CONFIG_SOFTMMU
225 VL_LDFLAGS+=-Wl,-T,$(SRC_PATH)/i386-vl.ld
228 $(QEMU_SYSTEM): $(VL_OBJS) libqemu.a
229 $(CC) $(VL_LDFLAGS) -o $@ $^ $(LIBS) $(SDL_LIBS)
232 $(CC) $(CFLAGS) $(DEFINES) $(SDL_CFLAGS) -c -o $@ $<
235 $(CC) -MM $(CFLAGS) $(DEFINES) $^ 1>.depend
239 libqemu.a: $(LIBOBJS)
241 $(AR) rcs $@ $(LIBOBJS)
243 translate.o: translate.c gen-op.h opc.h cpu.h
245 translate-all.o: translate-all.c op.h opc.h cpu.h
250 opc.h: op.o $(DYNGEN)
251 $(DYNGEN) -c -o $@ $<
253 gen-op.h: op.o $(DYNGEN)
254 $(DYNGEN) -g -o $@ $<
257 $(CC) $(OP_CFLAGS) $(DEFINES) -c -o $@ $<
260 $(CC) $(HELPER_CFLAGS) $(DEFINES) -c -o $@ $<
262 ifeq ($(TARGET_ARCH), i386)
263 op.o: op.c opreg_template.h ops_template.h ops_template_mem.h ops_mem.h
266 ifeq ($(TARGET_ARCH), arm)
267 op.o: op.c op_template.h
270 ifeq ($(TARGET_ARCH), sparc)
271 op.o: op.c op_template.h
274 ifeq ($(TARGET_ARCH), ppc)
275 op.o: op.c op_template.h op_mem.h
276 op_helper.o: op_helper_mem.h
280 $(CC) $(CFLAGS) $(DEFINES) -c -o $@ $<
283 $(CC) $(DEFINES) -c -o $@ $<
286 rm -f *.o *.a *~ $(PROGS) gen-op.h opc.h op.h nwfpe/*.o
289 install -m 755 -s $(PROGS) $(prefix)/bin
291 ifneq ($(wildcard .depend),)