qemu Makefile 分析


本文的分析在 ./configure --target-list=i386-softmmu --enable-kvm的配置下编译

1. 根目录下的Makefiel

all: build-all


build-all: $(DOCS) $(TOOLS) recurse-all


recurse-all: $(SUBDIR_RULES) $(ROMSUBDIR_RULES)


SUBDIR_RULES=$(patsubst %,subdir-%, $(TARGET_DIRS))

其中这个 TARGET_DIRS 在 config-host.mak中定义,这个是./configure时候生成的。

TARGET_DIRS=i386-softmmu


ROMSUBDIR_RULES=$(patsubst %,romsubdir-%, $(ROMS))

这个ROMS也是在config-host.mak中定义的, 在./configure中生成。

ROMS=optionrom


下面是subdir和romsubdir的隐式规则。

subdir-%: $(GENERATED_HEADERS)
$(call quiet-command,$(MAKE) $(SUBDIR_MAKEFLAGS) -C $* V="$(V)" TARGET_DIR="$*/" all,)

romsubdir-%:
$(call quiet-command,$(MAKE) $(SUBDIR_MAKEFLAGS) -C pc-bios/$* V="$(V)" TARGET_DIR="$*/",)


那就表示了,主要是这两个目录的内容。

打开相应的quiet-command, 结果如下,比我想的要多一些。

# @make --no-print-directory BUILD_DIR=/home/richard/git/qemu -C libhw64 V="" TARGET_DIR="libhw64/" all
make --no-print-directory BUILD_DIR=/home/richard/git/qemu -C libhw64 V="" TARGET_DIR="libhw64/" all
# @make --no-print-directory BUILD_DIR=/home/richard/git/qemu -C libdis V="" TARGET_DIR="libdis/" all
make --no-print-directory BUILD_DIR=/home/richard/git/qemu -C libdis V="" TARGET_DIR="libdis/" all
# @make --no-print-directory BUILD_DIR=/home/richard/git/qemu -C i386-softmmu V="" TARGET_DIR="i386-softmmu/" all
make --no-print-directory BUILD_DIR=/home/richard/git/qemu -C i386-softmmu V="" TARGET_DIR="i386-softmmu/" all
# @make --no-print-directory BUILD_DIR=/home/richard/git/qemu -C pc-bios/optionrom V="" TARGET_DIR="optionrom/"
make --no-print-directory BUILD_DIR=/home/richard/git/qemu -C pc-bios/optionrom V="" TARGET_DIR="optionrom/"


2. i386-softmmu下的Makefile


其中最后链接的命令是,这样就显示了所有相关的模块。

$(QEMU_PROG): $(obj-y) $(obj-$(TARGET_BASE_ARCH)-y)
@echo $(obj-y)
@echo "target objs---------------"
@echo $(obj-$(TARGET_BASE_ARCH)-y)
$(call LINK,$^)

修改后make的输出结果是:

------------------------------------

$ make --no-print-directory BUILD_DIR=/home/richard/git/qemu-new -C i386-softmmu V="" TARGET_DIR="i386-softmmu/" all
arch_init.o cpus.o monitor.o machine.o gdbstub.o balloon.o ioport.o virtio.o virtio-blk.o virtio-balloon.o virtio-net.o virtio-serial-bus.o vhost_net.o vhost.o 9pfs/virtio-9p-device.o kvm.o kvm-all.o memory.o savevm.o xen-stub.o ivshmem.o device-hotplug.o ../cutils.o ../cache-utils.o ../qemu-option.o ../module.o ../async.o ../nbd.o ../block.o ../aio.o ../aes.o ../qemu-config.o ../qemu-progress.o ../qemu-sockets.o ../qemu-coroutine.o ../qemu-coroutine-lock.o ../qemu-coroutine-io.o ../coroutine-ucontext.o ../qint.o ../qstring.o ../qdict.o ../qlist.o ../qfloat.o ../qbool.o ../qjson.o ../json-lexer.o ../json-streamer.o ../json-parser.o ../qerror.o ../error.o ../qemu-error.o ../posix-aio-compat.o ../block/raw.o ../block/cow.o ../block/qcow.o ../block/vdi.o ../block/vmdk.o ../block/cloop.o ../block/dmg.o ../block/bochs.o ../block/vpc.o ../block/vvfat.o ../block/qcow2.o ../block/qcow2-refcount.o ../block/qcow2-cluster.o ../block/qcow2-snapshot.o ../block/qcow2-cache.o ../block/qed.o ../block/qed-gencb.o ../block/qed-l2-cache.o ../block/qed-table.o ../block/qed-cluster.o ../block/qed-check.o ../block/parallels.o ../block/nbd.o ../block/blkdebug.o ../block/sheepdog.o ../block/blkverify.o ../block/raw-posix.o ../blockdev.o ../net.o ../net/queue.o ../net/checksum.o ../net/util.o ../net/socket.o ../net/dump.o ../net/tap.o ../net/tap-linux.o ../net/slirp.o ../qint.o ../qstring.o ../qdict.o ../qlist.o ../qfloat.o ../qbool.o ../qjson.o ../json-lexer.o ../json-streamer.o ../json-parser.o ../qerror.o ../error.o ../qemu-error.o ../fsdev/qemu-fsdev.o ../fsdev/virtio-9p-marshal.o ../readline.o ../console.o ../cursor.o ../osdep.o ../oslib-posix.o ../qemu-thread-posix.o ../os-posix.o ../tcg-runtime.o ../host-utils.o ../main-loop.o ../irq.o ../input.o ../i2c.o ../smbus.o ../smbus_eeprom.o ../eeprom93xx.o ../scsi-disk.o ../cdrom.o ../scsi-generic.o ../scsi-bus.o ../hid.o ../usb.o ../usb-hub.o ../usb-linux.o ../usb-hid.o ../usb-msd.o ../usb-wacom.o ../usb-serial.o ../usb-net.o ../usb-bus.o ../usb-desc.o ../bt.o ../bt-host.o ../bt-vhci.o ../bt-l2cap.o ../bt-sdp.o ../bt-hci.o ../bt-hid.o ../usb-bt.o ../bt-hci-csr.o ../buffered_file.o ../migration.o ../migration-tcp.o ../qemu-char.o ../msmouse.o ../ps2.o ../qdev.o ../qdev-properties.o ../block-migration.o ../iohandler.o ../pflib.o ../bitmap.o ../bitops.o ../migration-exec.o ../migration-unix.o ../migration-fd.o ../audio/audio.o ../audio/noaudio.o ../audio/wavaudio.o ../audio/mixeng.o ../audio/ossaudio.o ../audio/wavcapture.o ../ui/keymaps.o ../ui/curses.o ../ui/vnc.o ../ui/d3des.o ../ui/vnc-enc-zlib.o ../ui/vnc-enc-hextile.o ../ui/vnc-enc-tight.o ../ui/vnc-palette.o ../ui/vnc-enc-zrle.o ../ui/vnc-jobs-sync.o ../iov.o ../acl.o ../compatfd.o ../notify.o ../event_notifier.o ../qemu-timer.o ../qemu-timer-common.o ../slirp/cksum.o ../slirp/if.o ../slirp/ip_icmp.o ../slirp/ip_input.o ../slirp/ip_output.o ../slirp/slirp.o ../slirp/mbuf.o ../slirp/misc.o ../slirp/sbuf.o ../slirp/socket.o ../slirp/tcp_input.o ../slirp/tcp_output.o ../slirp/tcp_subr.o ../slirp/tcp_timer.o ../slirp/udp.o ../slirp/bootp.o ../slirp/tftp.o ../slirp/arp_table.o ../qmp-marshal.o ../qapi-visit.o ../qapi-types.o ../qapi/qapi-visit-core.o ../qapi/qmp-input-visitor.o ../qapi/qmp-output-visitor.o ../qapi/qapi-dealloc-visitor.o ../qapi/qmp-registry.o ../qapi/qmp-dispatch.o ../qmp.o ../hmp.o ../libdis/i386-dis.o exec.o translate-all.o cpu-exec.o translate.o tcg/tcg.o tcg/optimize.o fpu/softfloat.o op_helper.o helper.o cpuid.o disas.o ../libhw64/vl.o ../libhw64/loader.o ../libhw64/virtio-console.o ../libhw64/usb-libhw.o ../libhw64/virtio-pci.o ../libhw64/fw_cfg.o ../libhw64/pci.o ../libhw64/pci_bridge.o ../libhw64/msix.o ../libhw64/msi.o ../libhw64/pci_host.o ../libhw64/pcie_host.o ../libhw64/ioh3420.o ../libhw64/xio3130_upstream.o ../libhw64/xio3130_downstream.o ../libhw64/watchdog.o ../libhw64/serial.o ../libhw64/parallel.o ../libhw64/i8254.o ../libhw64/pcspk.o ../libhw64/pckbd.o ../libhw64/usb-uhci.o ../libhw64/usb-ohci.o ../libhw64/usb-ehci.o ../libhw64/fdc.o ../libhw64/acpi.o ../libhw64/acpi_piix4.o ../libhw64/pm_smbus.o ../libhw64/apm.o ../libhw64/dma.o ../libhw64/hpet.o ../libhw64/applesmc.o ../libhw64/usb-ccid.o ../libhw64/ccid-card-passthru.o ../libhw64/i8259.o ../libhw64/wdt_i6300esb.o ../libhw64/pcie.o ../libhw64/pcie_aer.o ../libhw64/pcie_port.o ../libhw64/ne2000.o ../libhw64/eepro100.o ../libhw64/pcnet-pci.o ../libhw64/pcnet.o ../libhw64/e1000.o ../libhw64/rtl8139.o ../libhw64/ne2000-isa.o ../libhw64/ide/core.o ../libhw64/ide/atapi.o ../libhw64/ide/qdev.o ../libhw64/ide/pci.o ../libhw64/ide/isa.o ../libhw64/ide/piix.o ../libhw64/ide/ahci.o ../libhw64/ide/ich.o ../libhw64/lsi53c895a.o ../libhw64/dma-helpers.o ../libhw64/sysbus.o ../libhw64/isa-bus.o ../libhw64/qdev-addr.o ../libhw64/container.o ../libhw64/vga-pci.o ../libhw64/vga-isa.o ../libhw64/vmware_vga.o ../libhw64/vmmouse.o ../libhw64/sb16.o ../libhw64/es1370.o ../libhw64/ac97.o ../libhw64/intel-hda.o ../libhw64/hda-audio.o ../libhw64/9pfs/virtio-9p.o ../libhw64/9pfs/virtio-9p-local.o ../libhw64/9pfs/virtio-9p-xattr.o ../libhw64/9pfs/virtio-9p-xattr-user.o ../libhw64/9pfs/virtio-9p-posix-acl.o ../libhw64/9pfs/virtio-9p-coth.o ../libhw64/9pfs/cofs.o ../libhw64/9pfs/codir.o ../libhw64/9pfs/cofile.o ../libhw64/9pfs/coxattr.o ../libhw64/9pfs/virtio-9p-synth.o ../libhw64/9pfs/virtio-9p-proxy.o ../trace.o ../trace/default.o ../trace/control.o
target objs---------------
vga.o mc146818rtc.o pc.o cirrus_vga.o sga.o apic.o ioapic.o piix_pci.o vmport.o pci-hotplug.o smbios.o wdt_ib700.o debugcon.o multiboot.o pc_piix.o kvmclock.o
LINK i386-softmmu/qemu-system-i386



你可能感兴趣的:(qemu Makefile 分析)