diff --git a/Makefile b/Makefile index 28b08cade..bb5f574c0 100644 --- a/Makefile +++ b/Makefile @@ -4,14 +4,14 @@ CFLAGS=-Wall -O2 -g LDFLAGS=-g LIBS= DEFINES+=-D_GNU_SOURCE -TOOLS=vlmkcow +TOOLS=qemu-mkcow all: dyngen $(TOOLS) qemu-doc.html for d in $(TARGET_DIRS); do \ make -C $$d $@ || exit 1 ; \ done -vlmkcow: vlmkcow.o +qemu-mkcow: qemu-mkcow.o $(HOST_CC) -o $@ $^ $(LIBS) dyngen: dyngen.o @@ -52,39 +52,12 @@ TAGS: qemu-doc.html: qemu-doc.texi texi2html -monolithic -number $< -FILES= \ -README README.distrib COPYING COPYING.LIB TODO Changelog VERSION \ -configure Makefile Makefile.target \ -dyngen.c dyngen.h dyngen-exec.h ioctls.h syscall_types.h \ -elf.h elfload.c main.c signal.c qemu.h \ -syscall.c syscall_defs.h vm86.c path.c mmap.c \ -i386.ld ppc.ld alpha.ld s390.ld sparc.ld arm.ld m68k.ld \ -vl.c i386-vl.ld vl.h block.c vlmkcow.c vga.c vga_template.h sdl.c \ -thunk.c cpu-exec.c translate.c cpu-all.h cpu-defs.h thunk.h exec.h\ -exec.c cpu-exec.c gdbstub.c bswap.h \ -cpu-i386.h op-i386.c helper-i386.c helper2-i386.c syscall-i386.h translate-i386.c \ -exec-i386.h ops_template.h ops_template_mem.h opreg_template.h \ -ops_mem.h softmmu_template.h softmmu_header.h \ -cpu-arm.h syscall-arm.h exec-arm.h op-arm.c translate-arm.c op-arm-template.h \ -dis-asm.h disas.c disas.h alpha-dis.c ppc-dis.c i386-dis.c sparc-dis.c \ -arm-dis.c \ -tests/Makefile \ -tests/test-i386.c tests/test-i386-shift.h tests/test-i386.h \ -tests/test-i386-muldiv.h tests/test-i386-code16.S tests/test-i386-vm86.S \ -tests/hello-i386.c tests/hello-i386 \ -tests/hello-arm.c tests/hello-arm \ -tests/sha1.c \ -tests/testsig.c tests/testclone.c tests/testthread.c \ -tests/runcom.c tests/pi_10.com \ -tests/test_path.c \ -qemu-doc.texi qemu-doc.html - -FILE=qemu-$(VERSION) +FILE=qemu-$(shell cat VERSION) +# tar release (use 'make -k tar' on a checkouted tree) tar: rm -rf /tmp/$(FILE) - mkdir -p /tmp/$(FILE) - cp --parent $(FILES) /tmp/$(FILE) + cp -r . /tmp/$(FILE) ( cd /tmp ; tar zcvf ~/$(FILE).tar.gz $(FILE) ) rm -rf /tmp/$(FILE) diff --git a/Makefile.target b/Makefile.target index 712869351..ee5443867 100644 --- a/Makefile.target +++ b/Makefile.target @@ -1,14 +1,24 @@ include config.mak -VPATH=$(SRC_PATH) +TARGET_PATH=$(SRC_PATH)/target-$(TARGET_ARCH) +VPATH=$(SRC_PATH):$(TARGET_PATH) CFLAGS=-Wall -O2 -g LDFLAGS=-g LIBS= -DEFINES=-I. +DEFINES=-I. -I$(TARGET_PATH) -I$(SRC_PATH) HELPER_CFLAGS=$(CFLAGS) DYNGEN=../dyngen +# user emulator name +QEMU_USER=qemu-$(TARGET_ARCH) +# system emulator name +ifdef CONFIG_SOFTMMU +QEMU_SYSTEM=qemu-softmmu +else +QEMU_SYSTEM=qemu +endif + ifndef CONFIG_SOFTMMU -PROGS=qemu +PROGS=$(QEMU_USER) endif ifdef CONFIG_STATIC @@ -32,7 +42,7 @@ else LDFLAGS+=-Wl,-shared endif ifeq ($(TARGET_ARCH), i386) -PROGS+=vl +PROGS+=$(QEMU_SYSTEM) endif endif @@ -108,13 +118,11 @@ SRCS:= $(OBJS:.o=.c) OBJS+= libqemu.a # cpu emulator library -LIBOBJS=thunk.o exec.o translate.o cpu-exec.o gdbstub.o +LIBOBJS=thunk.o exec.o translate-all.o cpu-exec.o gdbstub.o \ + translate.o op.o ifeq ($(TARGET_ARCH), i386) -LIBOBJS+=translate-i386.o op-i386.o helper-i386.o helper2-i386.o -endif -ifeq ($(TARGET_ARCH), arm) -LIBOBJS+=translate-arm.o op-arm.o +LIBOBJS+=helper.o helper2.o endif # NOTE: the disassembler code is only needed for debugging @@ -139,9 +147,9 @@ ifeq ($(ARCH),ia64) OBJS += ia64-syscall.o endif -all: $(PROGS) qemu-doc.html +all: $(PROGS) -qemu: $(OBJS) +$(QEMU_USER): $(OBJS) $(CC) $(LDFLAGS) -o $@ $^ $(LIBS) ifeq ($(ARCH),alpha) # Mark as 32 bit binary, i. e. it will be mapped into the low 31 bit of @@ -156,7 +164,7 @@ VL_OBJS+=sdl.o SDL_LIBS+=-L/usr/X11R6/lib -lX11 -lXext -lXv -ldl -lm endif -vl: $(VL_OBJS) libqemu.a +$(QEMU_SYSTEM): $(VL_OBJS) libqemu.a $(CC) -static -Wl,-T,$(SRC_PATH)/i386-vl.ld -o $@ $^ $(LIBS) $(SDL_LIBS) sdl.o: sdl.c @@ -171,35 +179,45 @@ libqemu.a: $(LIBOBJS) rm -f $@ $(AR) rcs $@ $(LIBOBJS) -translate-$(TARGET_ARCH).o: translate-$(TARGET_ARCH).c gen-op-$(TARGET_ARCH).h opc-$(TARGET_ARCH).h cpu-$(TARGET_ARCH).h +translate.o: translate.c gen-op.h opc.h cpu.h -translate.o: translate.c op-$(TARGET_ARCH).h opc-$(TARGET_ARCH).h cpu-$(TARGET_ARCH).h +translate-all.o: translate-all.c op.h opc.h cpu.h -op-$(TARGET_ARCH).h: op-$(TARGET_ARCH).o $(DYNGEN) +op.h: op.o $(DYNGEN) $(DYNGEN) -o $@ $< -opc-$(TARGET_ARCH).h: op-$(TARGET_ARCH).o $(DYNGEN) +opc.h: op.o $(DYNGEN) $(DYNGEN) -c -o $@ $< -gen-op-$(TARGET_ARCH).h: op-$(TARGET_ARCH).o $(DYNGEN) +gen-op.h: op.o $(DYNGEN) $(DYNGEN) -g -o $@ $< -op-$(TARGET_ARCH).o: op-$(TARGET_ARCH).c +op.o: op.c $(CC) $(OP_CFLAGS) $(DEFINES) -c -o $@ $< -helper-$(TARGET_ARCH).o: helper-$(TARGET_ARCH).c +helper.o: helper.c $(CC) $(HELPER_CFLAGS) $(DEFINES) -c -o $@ $< -op-i386.o: op-i386.c opreg_template.h ops_template.h ops_template_mem.h ops_mem.h +ifeq ($(TARGET_ARCH), i386) +op.o: op.c opreg_template.h ops_template.h ops_template_mem.h ops_mem.h +endif + +ifeq ($(TARGET_ARCH), arm) +op.o: op.c op_template.h +endif -op-arm.o: op-arm.c op-arm-template.h +ifeq ($(TARGET_ARCH), sparc) +op.o: op.c op_template.h +endif %.o: %.c $(CC) $(CFLAGS) $(DEFINES) -c -o $@ $< clean: - rm -f *.o *.a *~ $(PROGS) \ - gen-op-$(TARGET_ARCH).h opc-$(TARGET_ARCH).h op-$(TARGET_ARCH).h + rm -f *.o *.a *~ $(PROGS) gen-op.h opc.h op.h + +install: all + install -m 755 -s $(PROGS) $(prefix)/bin ifneq ($(wildcard .depend),) include .depend diff --git a/configure b/configure index 51f8bcc74..f680b6945 100755 --- a/configure +++ b/configure @@ -18,7 +18,7 @@ TMPS="${TMPDIR1}/qemu-conf-${RANDOM}-$$-${RANDOM}.S" # default parameters prefix="/usr/local" -interp_prefix="/usr/gnemul/qemu-i386" +interp_prefix="/usr/gnemul/qemu-%M" static="no" cross_prefix="" cc="gcc" @@ -27,7 +27,7 @@ ar="ar" make="make" strip="strip" cpu=`uname -m` -target_list="i386 i386-softmmu arm" +target_list="i386 i386-softmmu arm sparc" case "$cpu" in i386|i486|i586|i686|i86pc|BePC) cpu="i386" @@ -193,7 +193,8 @@ EOF echo "Standard options:" echo " --help print this message" echo " --prefix=PREFIX install in PREFIX [$prefix]" -echo " --interp-prefix=PREFIX where to find shared libraries, etc. [$interp_prefix]" +echo " --interp-prefix=PREFIX where to find shared libraries, etc." +echo " use %M for cpu name [$interp_prefix]" echo " --target-list=LIST set target list [$target_list]" echo "" echo "Advanced options (experts only):" @@ -310,6 +311,7 @@ config_mak=$target_dir/config.mak config_h=$target_dir/config.h target_cpu=`echo $target | cut -d '-' -f 1` target_bigendian="no" +[ "$target_cpu" = "sparc" ] && target_bigendian=yes target_softmmu="no" if expr $target : '.*-softmmu' > /dev/null ; then target_softmmu="yes" @@ -326,7 +328,9 @@ echo "/* Automatically generated by configure - do not modify */" > $config_h echo "include ../config-host.mak" >> $config_mak echo "#include \"../config-host.h\"" >> $config_h -echo "#define CONFIG_QEMU_PREFIX \"$interp_prefix\"" >> $config_h + +interp_prefix1=`echo "$interp_prefix" | sed "s/%M/$target_cpu/g"` +echo "#define CONFIG_QEMU_PREFIX \"$interp_prefix1\"" >> $config_h if test "$target_cpu" = "i386" ; then echo "TARGET_ARCH=i386" >> $config_mak @@ -336,6 +340,10 @@ elif test "$target_cpu" = "arm" ; then echo "TARGET_ARCH=arm" >> $config_mak echo "#define TARGET_ARCH \"arm\"" >> $config_h echo "#define TARGET_ARM 1" >> $config_h +elif test "$target_cpu" = "sparc" ; then + echo "TARGET_ARCH=sparc" >> $config_mak + echo "#define TARGET_ARCH \"sparc\"" >> $config_h + echo "#define TARGET_SPARC 1" >> $config_h else echo "Unsupported target CPU" exit 1