3 TARGET_PATH=$(SRC_PATH)/target-$(TARGET_ARCH)
4 VPATH=$(SRC_PATH):$(TARGET_PATH):$(SRC_PATH)/hw
5 DEFINES=-I. -I$(TARGET_PATH) -I$(SRC_PATH)
7 VPATH+=:$(SRC_PATH)/linux-user
8 DEFINES+=-I$(SRC_PATH)/linux-user -I$(SRC_PATH)/linux-user/$(TARGET_ARCH)
10 CFLAGS=-Wall -O2 -g -fno-strict-aliasing
13 HELPER_CFLAGS=$(CFLAGS)
14 DYNGEN=../dyngen$(EXESUF)
16 QEMU_USER=qemu-$(TARGET_ARCH)
17 # system emulator name
19 ifeq ($(TARGET_ARCH), i386)
20 QEMU_SYSTEM=qemu$(EXESUF)
22 QEMU_SYSTEM=qemu-system-$(TARGET_ARCH)$(EXESUF)
28 ifdef CONFIG_USER_ONLY
31 ifeq ($(TARGET_ARCH), i386)
39 # the system emulator using soft mmu is portable
45 endif # TARGET_ARCH = i386
47 ifeq ($(TARGET_ARCH), ppc)
65 endif # TARGET_ARCH = ppc
66 endif # !CONFIG_USER_ONLY
73 CFLAGS+=-fomit-frame-pointer
74 OP_CFLAGS=$(CFLAGS) -mpreferred-stack-boundary=2
75 ifeq ($(HAVE_GCC3_OPTIONS),yes)
76 OP_CFLAGS+= -falign-functions=0
78 OP_CFLAGS+= -malign-functions=0
88 LDFLAGS+=-Wl,-T,$(SRC_PATH)/i386.ld
90 # WARNING: this LDFLAGS is _very_ tricky : qemu is an ELF shared object
91 # that the kernel ELF loader considers as an executable. I think this
92 # is the simplest way to make it self virtualizable!
98 OP_CFLAGS=$(CFLAGS) -falign-functions=0
99 LDFLAGS+=-Wl,-T,$(SRC_PATH)/amd64.ld
104 LDFLAGS+=-Wl,-T,$(SRC_PATH)/ppc.ld
109 LDFLAGS+=-Wl,-T,$(SRC_PATH)/s390.ld
113 CFLAGS+=-m32 -ffixed-g1 -ffixed-g2 -ffixed-g3 -ffixed-g6
115 OP_CFLAGS=$(CFLAGS) -fno-delayed-branch -ffixed-i0
116 HELPER_CFLAGS=$(CFLAGS) -ffixed-i0 -mflat
117 # -static is used to avoid g1/g3 usage by the dynamic linker
118 LDFLAGS+=-Wl,-T,$(SRC_PATH)/sparc.ld -static
121 ifeq ($(ARCH),sparc64)
122 CFLAGS+=-m64 -ffixed-g1 -ffixed-g2 -ffixed-g3 -ffixed-g6
124 OP_CFLAGS=$(CFLAGS) -fno-delayed-branch -ffixed-i0
128 # -msmall-data is not used because we want two-instruction relocations
129 # for the constant constructions
130 OP_CFLAGS=-Wall -O2 -g
131 # Ensure there's only a single GP
132 CFLAGS += -msmall-data
133 LDFLAGS+=-Wl,-T,$(SRC_PATH)/alpha.ld
141 OP_CFLAGS=$(CFLAGS) -mno-sched-prolog
142 LDFLAGS+=-Wl,-T,$(SRC_PATH)/arm.ld
146 OP_CFLAGS=$(CFLAGS) -fomit-frame-pointer
147 LDFLAGS+=-Wl,-T,m68k.ld
150 ifeq ($(HAVE_GCC3_OPTIONS),yes)
151 # very important to generate a return at the end of every operation
152 OP_CFLAGS+=-fno-reorder-blocks -fno-optimize-sibling-calls
155 #########################################################
157 DEFINES+=-D_GNU_SOURCE
169 OBJS= elfload.o main.o syscall.o mmap.o signal.o path.o osdep.o thunk.o
170 ifeq ($(TARGET_ARCH), i386)
173 ifeq ($(TARGET_ARCH), arm)
174 OBJS+=nwfpe/softfloat.o nwfpe/fpa11.o nwfpe/fpa11_cpdo.o \
175 nwfpe/fpa11_cpdt.o nwfpe/fpa11_cprt.o nwfpe/fpopcode.o nwfpe/single_cpdo.o \
176 nwfpe/double_cpdo.o nwfpe/extended_cpdo.o
181 # cpu emulator library
182 LIBOBJS=exec.o translate-all.o cpu-exec.o\
185 ifeq ($(TARGET_ARCH), i386)
186 LIBOBJS+=helper.o helper2.o
188 LIBOBJS+=translate-copy.o
192 ifeq ($(TARGET_ARCH), ppc)
193 LIBOBJS+= op_helper.o helper.o
196 # NOTE: the disassembler code is only needed for debugging
198 ifeq ($(findstring i386, $(TARGET_ARCH) $(ARCH)),i386)
201 ifeq ($(findstring amd64, $(TARGET_ARCH) $(ARCH)),amd64)
207 ifeq ($(findstring alpha, $(TARGET_ARCH) $(ARCH)),alpha)
210 ifeq ($(findstring ppc, $(TARGET_ARCH) $(ARCH)),ppc)
213 ifeq ($(findstring sparc, $(TARGET_ARCH) $(ARCH)),sparc)
216 ifeq ($(findstring arm, $(TARGET_ARCH) $(ARCH)),arm)
221 OBJS += ia64-syscall.o
226 $(QEMU_USER): $(OBJS)
227 $(CC) $(LDFLAGS) -o $@ $^ $(LIBS)
229 # Mark as 32 bit binary, i. e. it will be mapped into the low 31 bit of
230 # the address space (31 bit so sign extending doesn't matter)
231 echo -ne '\001\000\000\000' | dd of=qemu bs=1 seek=48 count=4 conv=notrunc
234 # must use static linking to avoid leaving stuff in virtual address space
235 VL_OBJS=vl.o osdep.o block.o monitor.o pci.o
237 ifeq ($(TARGET_ARCH), i386)
239 VL_OBJS+= ide.o ne2000.o pckbd.o vga.o sb16.o dma.o oss.o
240 VL_OBJS+= fdc.o mc146818rtc.o serial.o i8259.o i8254.o pc.o
242 ifeq ($(TARGET_ARCH), ppc)
243 # Generic PPC support
245 # PREP hardware support
246 VL_OBJS+= ide.o ne2000.o pckbd.o vga.o sb16.o dma.o oss.o
247 VL_OBJS+= mc146818rtc.o serial.o i8259.o i8254.o fdc.o m48t59.o
248 VL_OBJS+= ppc_prep.o ppc_chrp.o cuda.o adb.o
257 DEFINES+=-I$(SRC_PATH)/slirp
258 SLIRP_OBJS=cksum.o if.o ip_icmp.o ip_input.o ip_output.o \
259 slirp.o mbuf.o misc.o sbuf.o socket.o tcp_input.o tcp_output.o \
260 tcp_subr.o tcp_timer.o udp.o bootp.o debug.o
261 VL_OBJS+=$(addprefix slirp/, $(SLIRP_OBJS))
265 # specific flags are needed for non soft mmu emulator
269 ifndef CONFIG_SOFTMMU
270 VL_LDFLAGS+=-Wl,-T,$(SRC_PATH)/i386-vl.ld
276 $(QEMU_SYSTEM): $(VL_OBJS) libqemu.a
277 $(CC) $(VL_LDFLAGS) -o $@ $^ $(LIBS) $(SDL_LIBS) $(VL_LIBS)
280 $(CC) $(CFLAGS) $(DEFINES) $(SDL_CFLAGS) -c -o $@ $<
283 $(CC) -MM $(CFLAGS) $(DEFINES) $^ 1>.depend
287 libqemu.a: $(LIBOBJS)
289 $(AR) rcs $@ $(LIBOBJS)
291 translate.o: translate.c gen-op.h opc.h cpu.h
293 translate-all.o: translate-all.c op.h opc.h cpu.h
298 opc.h: op.o $(DYNGEN)
299 $(DYNGEN) -c -o $@ $<
301 gen-op.h: op.o $(DYNGEN)
302 $(DYNGEN) -g -o $@ $<
305 $(CC) $(OP_CFLAGS) $(DEFINES) -c -o $@ $<
308 $(CC) $(HELPER_CFLAGS) $(DEFINES) -c -o $@ $<
310 ifeq ($(TARGET_ARCH), i386)
311 op.o: op.c opreg_template.h ops_template.h ops_template_mem.h ops_mem.h
314 ifeq ($(TARGET_ARCH), arm)
315 op.o: op.c op_template.h
318 ifeq ($(TARGET_ARCH), sparc)
319 op.o: op.c op_template.h
322 ifeq ($(TARGET_ARCH), ppc)
323 op.o: op.c op_template.h op_mem.h
324 op_helper.o: op_helper_mem.h
328 $(CC) $(CFLAGS) $(DEFINES) -c -o $@ $<
331 $(CC) $(DEFINES) -c -o $@ $<
334 rm -f *.o *.a *~ $(PROGS) gen-op.h opc.h op.h nwfpe/*.o slirp/*.o
338 install -m 755 -s $(PROGS) "$(bindir)"
341 ifneq ($(wildcard .depend),)