Here is a light version of the source reorganization I proposed last September. While working on it I noticed that a useful part to start from was the utility routines, because this helps identifying missing unit tests and modularity problems. Also, this file are relatively rarely changed. Hence, moving them will not complicate backports to stable branches, and will make the "action" more visible to anyone casually observing the tree.
Hence, this is where this series starts from. After this series, the top directory has about 80 *.c and *.h files, down from over 250 in 1.3.0, which is already a fine improvement. Patch 1 makes qemu-config.c more modular: there is no need for tools to host the description of QEMU's command-line options. Patch 2 finishes the transition to libqemustub.a, removing qemu-tool.c and qemu-user.c. Patches 3 to 13 are a longish digression in libcacard, improving support for libtool in the build system and simplifying the integration between libcacard's build rules and the rest of the Makefiles. Also, vscclient is now linked to the dynamic library so that missing symbols (like the one fixed in patch 7) are caught early. (QEMU still duplicates the code; I'd fear for my physical integrity if I forced people to write "libtool --mode=execute gdb" instead of just "gdb"). Patches 14 to 22 create a new static library libqemuutil.a, whose component files all come from subdirectories of the top tree directory: qobject, util, qapi. Using a static library helps putting the number of *-obj-y variables on a diet, and limits the duplication in the Makefile rules. Patches 23 and 24 further limit the number and nesting of *-obj-y variables. Finally, patches 25 to 27 affect tracing, which is also moved to libqemuutil.a. Patch 25 is Lluis's already posted patch to introduce trace/Makefile.objs. Alon Levy (1): libcacard: fix missing symbol in libcacard.so LluĂs Vilanova (1): build: Use separate makefile for "trace/" Paolo Bonzini (25): qemu-option: move standard option definitions out of qemu-config.c stubs: fully replace qemu-tool.c and qemu-user.c build: make libtool verbose when making with V=1 build: support linking with libtool objects/libraries build: move dtrace rules to rules.mak build: remove CONFIG_SMARTCARD libcacard: require libtool to build it libcacard: prepare to use -y trick in the Makefile libcacard: use per-target variable definitions libcacard: add list of exported symbols libcacard: rewrite Makefile in non-recursive style libcacard: link vscclient to dynamic library libcacard: list oslib-obj-y file explicitly build: rename oslib-obj-y to util-obj-y build: move util-obj-y to libqemuutil.a build: move files away from tools-obj-y, common-obj-y, user-obj-y build: move libqemuutil.a components to util/ build: move qobject files to qobject/ and libqemuutil.a build: consolidate multiple variables into universal-obj-y build: move QAPI definitions for QEMU out of qapi-obj-y build: move base QAPI files to libqemuutil.a build: move version-obj-y to the generic LINK rule build: remove coroutine-obj-y build: fold trace-obj-y into libqemuutil.a build: improve quiet output for .stp rules .gitignore | 8 +- Makefile | 71 +- Makefile.objs | 172 +---- Makefile.target | 17 +- block/iscsi.c | 27 + blockdev.c | 118 +++ configure | 85 +-- exec.c | 2 +- fsdev/Makefile.objs | 1 + fsdev/qemu-fsdev-dummy.c | 7 - fsdev/qemu-fsdev-opts.c | 85 ++ fsdev/qemu-fsdev.c | 8 - hw/Makefile.objs | 2 +- hw/qdev-monitor.c | 51 ++ hw/usb/Makefile.objs | 2 +- include/qemu/config-file.h | 5 - include/sysemu/sysemu.h | 8 + include/trace.h | 6 + libcacard/Makefile | 62 +- libcacard/libcacard.syms | 77 ++ monitor.c | 22 + net/net.c | 26 + qapi/Makefile.objs | 8 +- qemu-char.c | 72 ++ qemu-config.c | 894 -------------------- qemu-tool.c | 115 --- qemu-user.c | 37 - qobject/Makefile.objs | 3 + json-lexer.c => qobject/json-lexer.c | 0 json-parser.c => qobject/json-parser.c | 0 json-streamer.c => qobject/json-streamer.c | 0 qbool.c => qobject/qbool.c | 0 qdict.c => qobject/qdict.c | 0 qerror.c => qobject/qerror.c | 0 qfloat.c => qobject/qfloat.c | 0 qint.c => qobject/qint.c | 0 qjson.c => qobject/qjson.c | 0 qlist.c => qobject/qlist.c | 0 qstring.c => qobject/qstring.c | 0 qom/Makefile.objs | 6 +- rules.mak | 20 +- scripts/tracetool/backend/dtrace.py | 2 +- scripts/tracetool/format/h.py | 6 +- stubs/Makefile.objs | 13 + stubs/clock-warp.c | 7 + stubs/cpu-get-clock.c | 7 + stubs/cpu-get-icount.c | 9 + stubs/get-vm-name.c | 7 + stubs/iothread-lock.c | 10 + stubs/migr-blocker.c | 10 + stubs/mon-is-qmp.c | 7 + stubs/mon-print-filename.c | 6 + stubs/mon-printf.c | 10 + stubs/mon-protocol-event.c | 6 + stubs/mon-set-error.c | 8 + stubs/slirp.c | 17 + stubs/vm-stop.c | 7 + tests/Makefile | 48 +- trace/Makefile.objs | 58 ++ ui/spice-core.c | 84 ++ util/Makefile.objs | 10 + acl.c => util/acl.c | 0 aes.c => util/aes.c | 0 bitmap.c => util/bitmap.c | 0 bitops.c => util/bitops.c | 0 cache-utils.c => util/cache-utils.c | 0 compatfd.c => util/compatfd.c | 0 cutils.c => util/cutils.c | 0 envlist.c => util/envlist.c | 0 error.c => util/error.c | 0 .../event_notifier-posix.c | 0 .../event_notifier-win32.c | 0 host-utils.c => util/host-utils.c | 0 iov.c => util/iov.c | 0 module.c => util/module.c | 0 notify.c => util/notify.c | 0 osdep.c => util/osdep.c | 0 oslib-posix.c => util/oslib-posix.c | 0 oslib-win32.c => util/oslib-win32.c | 0 path.c => util/path.c | 0 util/qemu-config.c | 215 +++++ qemu-error.c => util/qemu-error.c | 0 qemu-option.c => util/qemu-option.c | 0 qemu-progress.c => util/qemu-progress.c | 0 qemu-sockets.c => util/qemu-sockets.c | 0 qemu-thread-posix.c => util/qemu-thread-posix.c | 0 qemu-thread-win32.c => util/qemu-thread-win32.c | 0 qemu-timer-common.c => util/qemu-timer-common.c | 0 uri.c => util/uri.c | 0 vl.c | 205 +++++ 90 files changed, 1368 insertions(+), 1401 deletions(-) create mode 100644 fsdev/qemu-fsdev-opts.c create mode 100644 include/trace.h create mode 100644 libcacard/libcacard.syms delete mode 100644 qemu-config.c delete mode 100644 qemu-tool.c delete mode 100644 qemu-user.c create mode 100644 qobject/Makefile.objs rename json-lexer.c => qobject/json-lexer.c (100%) rename json-parser.c => qobject/json-parser.c (100%) rename json-streamer.c => qobject/json-streamer.c (100%) rename qbool.c => qobject/qbool.c (100%) rename qdict.c => qobject/qdict.c (100%) rename qerror.c => qobject/qerror.c (100%) rename qfloat.c => qobject/qfloat.c (100%) rename qint.c => qobject/qint.c (100%) rename qjson.c => qobject/qjson.c (100%) rename qlist.c => qobject/qlist.c (100%) rename qstring.c => qobject/qstring.c (100%) create mode 100644 stubs/clock-warp.c create mode 100644 stubs/cpu-get-clock.c create mode 100644 stubs/cpu-get-icount.c create mode 100644 stubs/get-vm-name.c create mode 100644 stubs/iothread-lock.c create mode 100644 stubs/migr-blocker.c create mode 100644 stubs/mon-is-qmp.c create mode 100644 stubs/mon-print-filename.c create mode 100644 stubs/mon-printf.c create mode 100644 stubs/mon-protocol-event.c create mode 100644 stubs/mon-set-error.c create mode 100644 stubs/slirp.c create mode 100644 stubs/vm-stop.c create mode 100644 trace/Makefile.objs create mode 100644 util/Makefile.objs rename acl.c => util/acl.c (100%) rename aes.c => util/aes.c (100%) rename bitmap.c => util/bitmap.c (100%) rename bitops.c => util/bitops.c (100%) rename cache-utils.c => util/cache-utils.c (100%) rename compatfd.c => util/compatfd.c (100%) rename cutils.c => util/cutils.c (100%) rename envlist.c => util/envlist.c (100%) rename error.c => util/error.c (100%) rename event_notifier-posix.c => util/event_notifier-posix.c (100%) rename event_notifier-win32.c => util/event_notifier-win32.c (100%) rename host-utils.c => util/host-utils.c (100%) rename iov.c => util/iov.c (100%) rename module.c => util/module.c (100%) rename notify.c => util/notify.c (100%) rename osdep.c => util/osdep.c (100%) rename oslib-posix.c => util/oslib-posix.c (100%) rename oslib-win32.c => util/oslib-win32.c (100%) rename path.c => util/path.c (100%) create mode 100644 util/qemu-config.c rename qemu-error.c => util/qemu-error.c (100%) rename qemu-option.c => util/qemu-option.c (100%) rename qemu-progress.c => util/qemu-progress.c (100%) rename qemu-sockets.c => util/qemu-sockets.c (100%) rename qemu-thread-posix.c => util/qemu-thread-posix.c (100%) rename qemu-thread-win32.c => util/qemu-thread-win32.c (100%) rename qemu-timer-common.c => util/qemu-timer-common.c (100%) rename uri.c => util/uri.c (100%)