From 4d9045339a69ff11764476529b9121e0f219c2f9 Mon Sep 17 00:00:00 2001 From: Blue Swirl Date: Sun, 21 Mar 2010 08:28:47 +0000 Subject: [PATCH] Compile disassemblers only once Signed-off-by: Blue Swirl --- Makefile | 8 ++++---- Makefile.dis | 23 +++++++++++++++++++++++ Makefile.objs | 18 ++++++++++++++++++ Makefile.target | 17 ++++------------- configure | 25 +++++++++++++++++++++++++ 5 files changed, 74 insertions(+), 17 deletions(-) create mode 100644 Makefile.dis diff --git a/Makefile b/Makefile index 2066c12dee..57c354dde4 100644 --- a/Makefile +++ b/Makefile @@ -80,9 +80,9 @@ include $(SRC_PATH)/Makefile.objs endif $(common-obj-y): $(GENERATED_HEADERS) -$(filter %-softmmu,$(SUBDIR_RULES)): $(common-obj-y) +$(filter %-softmmu,$(SUBDIR_RULES)): $(common-obj-y) subdir-libdis -$(filter %-user,$(SUBDIR_RULES)): $(GENERATED_HEADERS) subdir-libuser +$(filter %-user,$(SUBDIR_RULES)): $(GENERATED_HEADERS) subdir-libdis-user subdir-libuser ROMSUBDIR_RULES=$(patsubst %,romsubdir-%, $(ROMS)) romsubdir-%: @@ -152,7 +152,7 @@ clean: rm -f slirp/*.o slirp/*.d audio/*.o audio/*.d block/*.o block/*.d net/*.o net/*.d rm -f qemu-img-cmds.h $(MAKE) -C tests clean - for d in $(ALL_SUBDIRS) libhw32 libhw64 libuser; do \ + for d in $(ALL_SUBDIRS) libhw32 libhw64 libuser libdis libdis-user; do \ if test -d $$d; then $(MAKE) -C $$d $@ || exit 1; fi; \ done @@ -161,7 +161,7 @@ distclean: clean rm -f config-all-devices.mak rm -f roms/seabios/config.mak roms/vgabios/config.mak rm -f qemu-{doc,tech}.{info,aux,cp,dvi,fn,info,ky,log,pdf,pg,toc,tp,vr} - for d in $(TARGET_DIRS) libhw32 libhw64 libuser; do \ + for d in $(TARGET_DIRS) libhw32 libhw64 libuser libdis libdis-user; do \ rm -rf $$d || exit 1 ; \ done diff --git a/Makefile.dis b/Makefile.dis new file mode 100644 index 0000000000..3e1fcaf4b7 --- /dev/null +++ b/Makefile.dis @@ -0,0 +1,23 @@ +# Makefile for disassemblers. + +include ../config-host.mak +include config.mak +include $(SRC_PATH)/rules.mak + +.PHONY: all + +$(call set-vpath, $(SRC_PATH)) + +QEMU_CFLAGS+=-I.. + +include $(SRC_PATH)/Makefile.objs + +all: $(libdis-y) +# Dummy command so that make thinks it has done something + @true + +clean: + rm -f *.o *.d *.a *~ + +# Include automatically generated dependency files +-include $(wildcard *.d */*.d) diff --git a/Makefile.objs b/Makefile.objs index dcb5a929a9..6594eda44d 100644 --- a/Makefile.objs +++ b/Makefile.objs @@ -154,3 +154,21 @@ hw-obj-$(CONFIG_ESP) += esp.o hw-obj-y += dma-helpers.o sysbus.o isa-bus.o hw-obj-$(CONFIG_QDEV_ADDR) += qdev-addr.o + +###################################################################### +# libdis +# NOTE: the disassembler code is only needed for debugging + +libdis-y = +libdis-$(CONFIG_ALPHA_DIS) += alpha-dis.o +libdis-$(CONFIG_ARM_DIS) += arm-dis.o +libdis-$(CONFIG_CRIS_DIS) += cris-dis.o +libdis-$(CONFIG_HPPA_DIS) += hppa-dis.o +libdis-$(CONFIG_I386_DIS) += i386-dis.o +libdis-$(CONFIG_M68K_DIS) += m68k-dis.o +libdis-$(CONFIG_MICROBLAZE_DIS) += microblaze-dis.o +libdis-$(CONFIG_MIPS_DIS) += mips-dis.o +libdis-$(CONFIG_PPC_DIS) += ppc-dis.o +libdis-$(CONFIG_S390_DIS) += s390-dis.o +libdis-$(CONFIG_SH4_DIS) += sh4-dis.o +libdis-$(CONFIG_SPARC_DIS) += sparc-dis.o diff --git a/Makefile.target b/Makefile.target index 0c282154d5..0d8a92770b 100644 --- a/Makefile.target +++ b/Makefile.target @@ -55,20 +55,7 @@ endif libobj-$(CONFIG_NEED_MMU) += mmu.o libobj-$(TARGET_ARM) += neon_helper.o iwmmxt_helper.o -# NOTE: the disassembler code is only needed for debugging libobj-y += disas.o -libobj-$(CONFIG_ALPHA_DIS) += alpha-dis.o -libobj-$(CONFIG_ARM_DIS) += arm-dis.o -libobj-$(CONFIG_CRIS_DIS) += cris-dis.o -libobj-$(CONFIG_HPPA_DIS) += hppa-dis.o -libobj-$(CONFIG_I386_DIS) += i386-dis.o -libobj-$(CONFIG_M68K_DIS) += m68k-dis.o -libobj-$(CONFIG_MICROBLAZE_DIS) += microblaze-dis.o -libobj-$(CONFIG_MIPS_DIS) += mips-dis.o -libobj-$(CONFIG_PPC_DIS) += ppc-dis.o -libobj-$(CONFIG_S390_DIS) += s390-dis.o -libobj-$(CONFIG_SH4_DIS) += sh4-dis.o -libobj-$(CONFIG_SPARC_DIS) += sparc-dis.o $(libobj-y): $(GENERATED_HEADERS) @@ -116,6 +103,7 @@ obj-m68k-y += m68k-sim.o m68k-semi.o $(obj-y) $(obj-$(TARGET_BASE_ARCH)-y): $(GENERATED_HEADERS) obj-y += $(addprefix ../libuser/, $(user-obj-y)) +obj-y += $(addprefix ../libdis-user/, $(libdis-y)) obj-y += $(libobj-y) endif #CONFIG_LINUX_USER @@ -142,6 +130,7 @@ obj-i386-y += ioport-user.o $(obj-y) $(obj-$(TARGET_BASE_ARCH)-y): $(GENERATED_HEADERS) obj-y += $(addprefix ../libuser/, $(user-obj-y)) +obj-y += $(addprefix ../libdis-user/, $(libdis-y)) obj-y += $(libobj-y) endif #CONFIG_DARWIN_USER @@ -163,6 +152,7 @@ obj-i386-y += ioport-user.o $(obj-y) $(obj-$(TARGET_BASE_ARCH)-y): $(GENERATED_HEADERS) obj-y += $(addprefix ../libuser/, $(user-obj-y)) +obj-y += $(addprefix ../libdis-user/, $(libdis-y)) obj-y += $(libobj-y) endif #CONFIG_BSD_USER @@ -329,6 +319,7 @@ monitor.o: qemu-monitor.h $(obj-y) $(obj-$(TARGET_BASE_ARCH)-y): $(GENERATED_HEADERS) obj-y += $(addprefix ../, $(common-obj-y)) +obj-y += $(addprefix ../libdis/, $(libdis-y)) obj-y += $(libobj-y) obj-y += $(addprefix $(HWDIR)/, $(hw-obj-y)) diff --git a/configure b/configure index d728799d8b..0182b95a6d 100755 --- a/configure +++ b/configure @@ -2273,6 +2273,13 @@ if test -f ${config_host_ld}~ ; then fi fi +for d in libdis libdis-user; do + mkdir -p $d + rm -f $d/Makefile + ln -s $source_path/Makefile.dis $d/Makefile + echo > $d/config.mak +done + for target in $target_list; do target_dir="$target" config_target_mak=$target_dir/config-target.mak @@ -2563,43 +2570,61 @@ fi cflags="-I\$(SRC_PATH)/tcg $cflags" cflags="-I\$(SRC_PATH)/fpu $cflags" +if test "$target_user_only" = "yes" ; then + libdis_config_mak=libdis-user/config.mak +else + libdis_config_mak=libdis/config.mak +fi + for i in $ARCH $TARGET_BASE_ARCH ; do case "$i" in alpha) echo "CONFIG_ALPHA_DIS=y" >> $config_target_mak + echo "CONFIG_ALPHA_DIS=y" >> $libdis_config_mak ;; arm) echo "CONFIG_ARM_DIS=y" >> $config_target_mak + echo "CONFIG_ARM_DIS=y" >> $libdis_config_mak ;; cris) echo "CONFIG_CRIS_DIS=y" >> $config_target_mak + echo "CONFIG_CRIS_DIS=y" >> $libdis_config_mak ;; hppa) echo "CONFIG_HPPA_DIS=y" >> $config_target_mak + echo "CONFIG_HPPA_DIS=y" >> $libdis_config_mak ;; i386|x86_64) echo "CONFIG_I386_DIS=y" >> $config_target_mak + echo "CONFIG_I386_DIS=y" >> $libdis_config_mak ;; m68k) echo "CONFIG_M68K_DIS=y" >> $config_target_mak + echo "CONFIG_M68K_DIS=y" >> $libdis_config_mak ;; microblaze) echo "CONFIG_MICROBLAZE_DIS=y" >> $config_target_mak + echo "CONFIG_MICROBLAZE_DIS=y" >> $libdis_config_mak ;; mips*) echo "CONFIG_MIPS_DIS=y" >> $config_target_mak + echo "CONFIG_MIPS_DIS=y" >> $libdis_config_mak ;; ppc*) echo "CONFIG_PPC_DIS=y" >> $config_target_mak + echo "CONFIG_PPC_DIS=y" >> $libdis_config_mak ;; s390*) echo "CONFIG_S390_DIS=y" >> $config_target_mak + echo "CONFIG_S390_DIS=y" >> $libdis_config_mak ;; sh4) echo "CONFIG_SH4_DIS=y" >> $config_target_mak + echo "CONFIG_SH4_DIS=y" >> $libdis_config_mak ;; sparc*) echo "CONFIG_SPARC_DIS=y" >> $config_target_mak + echo "CONFIG_SPARC_DIS=y" >> $libdis_config_mak ;; esac done