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)
31 # the system emulator using soft mmu is portable
37 endif # TARGET_ARCH = i386
39 ifeq ($(TARGET_ARCH), ppc)
51 endif # TARGET_ARCH = ppc
52 endif # !CONFIG_USER_ONLY
59 CFLAGS+=-fomit-frame-pointer
60 OP_CFLAGS=$(CFLAGS) -mpreferred-stack-boundary=2
61 ifeq ($(HAVE_GCC3_OPTIONS),yes)
62 OP_CFLAGS+= -falign-functions=0
64 OP_CFLAGS+= -malign-functions=0
74 LDFLAGS+=-Wl,-T,$(SRC_PATH)/i386.ld
76 # WARNING: this LDFLAGS is _very_ tricky : qemu is an ELF shared object
77 # that the kernel ELF loader considers as an executable. I think this
78 # is the simplest way to make it self virtualizable!
85 LDFLAGS+=-Wl,-T,$(SRC_PATH)/ppc.ld
90 LDFLAGS+=-Wl,-T,$(SRC_PATH)/s390.ld
94 CFLAGS+=-m32 -ffixed-g1 -ffixed-g2 -ffixed-g3 -ffixed-g6
96 OP_CFLAGS=$(CFLAGS) -fno-delayed-branch -ffixed-i0
97 HELPER_CFLAGS=$(CFLAGS) -ffixed-i0 -mflat
98 # -static is used to avoid g1/g3 usage by the dynamic linker
99 LDFLAGS+=-Wl,-T,$(SRC_PATH)/sparc.ld -static
102 ifeq ($(ARCH),sparc64)
103 CFLAGS+=-m64 -ffixed-g1 -ffixed-g2 -ffixed-g3 -ffixed-g6
105 OP_CFLAGS=$(CFLAGS) -fno-delayed-branch -ffixed-i0
109 # -msmall-data is not used because we want two-instruction relocations
110 # for the constant constructions
111 OP_CFLAGS=-Wall -O2 -g
112 # Ensure there's only a single GP
113 CFLAGS += -msmall-data
114 LDFLAGS+=-Wl,-T,$(SRC_PATH)/alpha.ld
122 OP_CFLAGS=$(CFLAGS) -mno-sched-prolog
123 LDFLAGS+=-Wl,-T,$(SRC_PATH)/arm.ld
127 OP_CFLAGS=$(CFLAGS) -fomit-frame-pointer
128 LDFLAGS+=-Wl,-T,m68k.ld
131 ifeq ($(HAVE_GCC3_OPTIONS),yes)
132 # very important to generate a return at the end of every operation
133 OP_CFLAGS+=-fno-reorder-blocks -fno-optimize-sibling-calls
136 #########################################################
138 DEFINES+=-D_GNU_SOURCE
147 OBJS= elfload.o main.o syscall.o mmap.o signal.o path.o osdep.o
148 ifeq ($(TARGET_ARCH), i386)
151 ifeq ($(TARGET_ARCH), arm)
152 OBJS+=nwfpe/softfloat.o nwfpe/fpa11.o nwfpe/fpa11_cpdo.o \
153 nwfpe/fpa11_cpdt.o nwfpe/fpa11_cprt.o nwfpe/fpopcode.o nwfpe/single_cpdo.o \
154 nwfpe/double_cpdo.o nwfpe/extended_cpdo.o
159 # cpu emulator library
160 LIBOBJS=thunk.o exec.o translate-all.o cpu-exec.o gdbstub.o \
163 ifeq ($(TARGET_ARCH), i386)
164 LIBOBJS+=helper.o helper2.o
166 LIBOBJS+=translate-copy.o
170 ifeq ($(TARGET_ARCH), ppc)
171 LIBOBJS+= op_helper.o helper.o
174 # NOTE: the disassembler code is only needed for debugging
176 ifeq ($(findstring i386, $(TARGET_ARCH) $(ARCH)),i386)
179 ifeq ($(findstring alpha, $(TARGET_ARCH) $(ARCH)),alpha)
182 ifeq ($(findstring ppc, $(TARGET_ARCH) $(ARCH)),ppc)
185 ifeq ($(findstring sparc, $(TARGET_ARCH) $(ARCH)),sparc)
188 ifeq ($(findstring arm, $(TARGET_ARCH) $(ARCH)),arm)
193 OBJS += ia64-syscall.o
198 $(QEMU_USER): $(OBJS)
199 $(CC) $(LDFLAGS) -o $@ $^ $(LIBS)
201 # Mark as 32 bit binary, i. e. it will be mapped into the low 31 bit of
202 # the address space (31 bit so sign extending doesn't matter)
203 echo -ne '\001\000\000\000' | dd of=qemu bs=1 seek=48 count=4 conv=notrunc
206 # must use static linking to avoid leaving stuff in virtual address space
207 VL_OBJS=vl.o block.o ide.o vga.o sb16.o dma.o oss.o fdc.o osdep.o
208 ifeq ($(TARGET_ARCH), ppc)
214 SDL_LIBS:=$(SDL_STATIC_LIBS)
219 # specific flags are needed for non soft mmu emulator
223 ifndef CONFIG_SOFTMMU
224 VL_LDFLAGS+=-Wl,-T,$(SRC_PATH)/i386-vl.ld
227 $(QEMU_SYSTEM): $(VL_OBJS) libqemu.a
228 $(CC) $(VL_LDFLAGS) -o $@ $^ $(LIBS) $(SDL_LIBS)
231 $(CC) $(CFLAGS) $(DEFINES) $(SDL_CFLAGS) -c -o $@ $<
234 $(CC) -MM $(CFLAGS) $(DEFINES) $^ 1>.depend
238 libqemu.a: $(LIBOBJS)
240 $(AR) rcs $@ $(LIBOBJS)
242 translate.o: translate.c gen-op.h opc.h cpu.h
244 translate-all.o: translate-all.c op.h opc.h cpu.h
249 opc.h: op.o $(DYNGEN)
250 $(DYNGEN) -c -o $@ $<
252 gen-op.h: op.o $(DYNGEN)
253 $(DYNGEN) -g -o $@ $<
256 $(CC) $(OP_CFLAGS) $(DEFINES) -c -o $@ $<
259 $(CC) $(HELPER_CFLAGS) $(DEFINES) -c -o $@ $<
261 ifeq ($(TARGET_ARCH), i386)
262 op.o: op.c opreg_template.h ops_template.h ops_template_mem.h ops_mem.h
265 ifeq ($(TARGET_ARCH), arm)
266 op.o: op.c op_template.h
269 ifeq ($(TARGET_ARCH), sparc)
270 op.o: op.c op_template.h
273 ifeq ($(TARGET_ARCH), ppc)
274 op.o: op.c op_template.h op_mem.h
275 op_helper.o: op_helper_mem.h
279 $(CC) $(CFLAGS) $(DEFINES) -c -o $@ $<
282 $(CC) $(DEFINES) -c -o $@ $<
285 rm -f *.o *.a *~ $(PROGS) gen-op.h opc.h op.h nwfpe/*.o
288 install -m 755 -s $(PROGS) $(prefix)/bin
290 ifneq ($(wildcard .depend),)