Skip to contentSkip to conversation

build cleanups

PATCH In review Paolo Bonzini 2 participants 12 messages Sep 17, 2012 – Sep 25, 2012 Kbuild

lore
Share & tools
lore
#0 lore raw

cover build cleanups

Here are some cleanups to the build system, removing some unused files from some of the products or fixing some strange behavior that bit me while looking at the tree reorganization.

Paolo

Paolo Bonzini (9):
tools: split monitor-dummy.c, clean up qemu-tool.c
block: move QEMUIOVector functions to iov.c
build: avoid duplicate appearance of files
qemu-ga: do not include the QEMU main loop and dependencies
build: add object directory to QEMU_INCLUDES
build: add $(TARGET_DIR) to "GEN config-target.h" lines
build: use nesting magic for tools-obj-y
libcacard: add include/ to CFLAGS
libcacard: remove dependency on QEMU main loop

 Makefile           |   9 ++---
 Makefile.objs      |  19 +++++++---
 cutils.c           | 103 ----------------------------------------------------
 iov.c              | 104 +++++++++++++++++++++++++++++++++++++++++++++++++++++
 libcacard/Makefile |   2 +-
 monitor-dummy.c    |  64 +++++++++++++++++++++++++++++++++
 qemu-tool.c        |  54 ----------------------------
 rules.mak          |   5 ++-
 8 file modificati, 189 inserzioni(+), 171 rimozioni(-)
 create mode 100644 monitor-dummy.c
Signature · 1 line
1.7.12
#1 lore raw

PATCH 1/9 tools: split monitor-dummy.c, clean up qemu-tool.c

qemu-ga uses glib mostly, so it does not need a large part of the dummy functions in qemu-tool.o (which are more related to the main loop and/or the block layer). Split the functions required by QAPI out into monitor-dummy.c.

---
 Makefile        |  2 +-
 Makefile.objs   |  2 +-
 monitor-dummy.c | 64 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 qemu-tool.c     | 54 ------------------------------------------------
 4 file modificati, 66 inserzioni(+), 56 rimozioni(-)
 create mode 100644 monitor-dummy.c
Makefile +1 -1
index 1cd5bc8..6426d85 100644
@@ -153,7 +153,7 @@ endif
 qemu-img.o: qemu-img-cmds.h
 
 tools-obj-y = $(oslib-obj-y) $(trace-obj-y) qemu-tool.o qemu-timer.o \
-	qemu-timer-common.o main-loop.o notify.o \
+	qemu-timer-common.o main-loop.o notify.o monitor-dummy.o \
 	iohandler.o cutils.o iov.o async.o
 tools-obj-$(CONFIG_POSIX) += compatfd.o
 
Makefile.objs +1 -1
index 4412757..5c622d6 100644
@@ -228,7 +228,7 @@ universal-obj-y += $(qapi-obj-y)
 ######################################################################
 # guest agent
 
-qga-obj-y = qga/ qemu-ga.o module.o
+qga-obj-y = qga/ qemu-ga.o module.o monitor-dummy.o
 qga-obj-$(CONFIG_WIN32) += oslib-win32.o
 qga-obj-$(CONFIG_POSIX) += oslib-posix.o qemu-sockets.o qemu-option.o
 
monitor-dummy.c new file +64 -0

64 lines not on this page · raw message

qemu-tool.c +0 -54

71 lines not on this page · raw message

Signature · 1 line
1.7.12
#2 lore raw

PATCH 2/9 block: move QEMUIOVector functions to iov.c

In reply to Paolo Bonzini

They do not really belong in cutils.c, and this way we can remove iov.c from user-mode emulation.

---
 Makefile.objs |   2 +-
 cutils.c      | 103 ---------------------------------------------------------
 iov.c         | 104 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

3 file modificati, 105 inserzioni(+), 104 rimozioni(-)

Makefile.objs +1 -1
index 5c622d6..abb7d0f 100644
@@ -108,7 +108,7 @@ endif
 user-obj-y =
 user-obj-y += envlist.o path.o
 user-obj-y += tcg-runtime.o host-utils.o
-user-obj-y += cutils.o iov.o cache-utils.o
+user-obj-y += cutils.o cache-utils.o
 user-obj-y += module.o
 user-obj-y += qemu-user.o
 user-obj-y += $(trace-obj-y)
cutils.c +0 -103

109 lines not on this page · raw message

iov.c +104 -0

107 lines not on this page · raw message

Signature · 1 line
1.7.12
#3 lore raw

PATCH 3/9 build: avoid duplicate appearance of files

In reply to Paolo Bonzini

cutils.c and iov.c appeared in the Makefile in multiple spots. Clean this up by moving them respectively to oslib-obj-y and block-obj-y. Notably, qemu-ga and user-mode emulation both need cutils.c but not iov.c.

async.o was linked in tools via both tools-obj-y and block-obj-y. Remove the former, which is unnecessary.

---
 Makefile      | 2 +-
 Makefile.objs | 8 ++++----

2 file modificati, 5 inserzioni(+), 5 rimozioni(-)

Makefile +1 -1
index 6426d85..5240834 100644
@@ -154,7 +154,7 @@ qemu-img.o: qemu-img-cmds.h
 
 tools-obj-y = $(oslib-obj-y) $(trace-obj-y) qemu-tool.o qemu-timer.o \
 	qemu-timer-common.o main-loop.o notify.o monitor-dummy.o \
-	iohandler.o cutils.o iov.o async.o
+	iohandler.o
 tools-obj-$(CONFIG_POSIX) += compatfd.o
 
 qemu-img$(EXESUF): qemu-img.o $(tools-obj-y) $(block-obj-y)
Makefile.objs +4 -4
index abb7d0f..cf00fd5 100644
@@ -19,7 +19,7 @@ universal-obj-y += $(qom-obj-y)
 
 #######################################################################
 # oslib-obj-y is code depending on the OS (win32 vs posix)
-oslib-obj-y = osdep.o
+oslib-obj-y = osdep.o cutils.o
 oslib-obj-$(CONFIG_WIN32) += oslib-win32.o qemu-thread-win32.o
 oslib-obj-$(CONFIG_POSIX) += oslib-posix.o qemu-thread-posix.o
 
@@ -41,7 +41,7 @@ coroutine-obj-$(CONFIG_WIN32) += coroutine-win32.o
 #######################################################################
 # block-obj-y is code used by both qemu system emulation and qemu-img
 
-block-obj-y = cutils.o iov.o cache-utils.o qemu-option.o module.o async.o
+block-obj-y = iov.o cache-utils.o qemu-option.o module.o async.o
 block-obj-y += nbd.o block.o aio.o aes.o qemu-config.o qemu-progress.o qemu-sockets.o
 block-obj-y += $(coroutine-obj-y) $(qobject-obj-y) $(version-obj-y)
 block-obj-$(CONFIG_POSIX) += posix-aio-compat.o
@@ -89,7 +89,7 @@ common-obj-y += hw/
 common-obj-y += ui/
 common-obj-y += bt-host.o bt-vhci.o
 
-common-obj-y += iov.o acl.o
+common-obj-y += acl.o
 common-obj-$(CONFIG_POSIX) += compatfd.o
 common-obj-y += notify.o event_notifier.o
 common-obj-y += qemu-timer.o qemu-timer-common.o
@@ -108,7 +108,7 @@ endif
 user-obj-y =
 user-obj-y += envlist.o path.o
 user-obj-y += tcg-runtime.o host-utils.o
-user-obj-y += cutils.o cache-utils.o
+user-obj-y += cache-utils.o
 user-obj-y += module.o
 user-obj-y += qemu-user.o
 user-obj-y += $(trace-obj-y)
Signature · 1 line
1.7.12
#4 lore raw

PATCH 4/9 qemu-ga: do not include the QEMU main loop and dependencies

In reply to Paolo Bonzini
---
 Makefile | 2 +-

1 file modificato, 1 inserzione(+). 1 rimozione(-)

Makefile +1 -1
index 5240834..fffbbb8 100644
@@ -206,7 +206,7 @@ $(SRC_PATH)/qapi-schema.json $(SRC_PATH)/scripts/qapi-commands.py $(qapi-py)
 QGALIB_GEN=$(addprefix qga/qapi-generated/, qga-qapi-types.h qga-qapi-visit.h qga-qmp-commands.h)
 $(qga-obj-y) qemu-ga.o: $(QGALIB_GEN)
 
-qemu-ga$(EXESUF): qemu-ga.o $(qga-obj-y) $(tools-obj-y) $(qapi-obj-y) $(qobject-obj-y) $(version-obj-y)
+qemu-ga$(EXESUF): qemu-ga.o $(qga-obj-y) $(trace-obj-y) $(oslib-obj-y) $(qapi-obj-y) $(qobject-obj-y) $(version-obj-y)
 
 QEMULIBS=libhw32 libhw64 libuser libdis libdis-user
 
Signature · 1 line
1.7.12
#5 lore raw

PATCH 5/9 build: add object directory to QEMU_INCLUDES

In reply to Paolo Bonzini

When using a recursive make, -I. will automatically let you include generated files from a nested directory. This doesn't work for nonrecursive make such as the one used by QEMU. Add a rule that fixes this.

---
 rules.mak | 3 +++

1 file modificato, 3 inserzioni(+)

rules.mak +3 -0
index 1b173aa..0327426 100644
@@ -14,6 +14,9 @@ MAKEFLAGS += -rR
 # Flags for dependency generation
 QEMU_DGFLAGS += -MMD -MP -MT $@ -MF $(*D)/$(*F).d
 
+# Same as -I., but for the object directory
+QEMU_CFLAGS += -I$(@D)
+
 %.o: %.c
 	$(call quiet-command,$(CC) $(QEMU_INCLUDES) $(QEMU_CFLAGS) $(QEMU_DGFLAGS) $(CFLAGS) -c -o $@ $<,"  CC    $(TARGET_DIR)$@")
 
Signature · 1 line
1.7.12
#6 lore raw

PATCH 6/9 build: add $(TARGET_DIR) to "GEN config-target.h" lines

In reply to Paolo Bonzini
---
 rules.mak | 2 +-

1 file modificato, 1 inserzione(+). 1 rimozione(-)

rules.mak +1 -1
index 0327426..13ba62b 100644
@@ -71,7 +71,7 @@ TRACETOOL=$(PYTHON) $(SRC_PATH)/scripts/tracetool.py
 	@test -f $@ || cp $< $@
 
 %.h-timestamp: %.mak
-	$(call quiet-command, sh $(SRC_PATH)/scripts/create_config < $< > $@, "  GEN   $*.h")
+	$(call quiet-command, sh $(SRC_PATH)/scripts/create_config < $< > $@, "  GEN   $(TARGET_DIR)$*.h")
 	@cmp $@ $*.h >/dev/null 2>&1 || cp $@ $*.h
 
 # will delete the target of a rule if commands exit with a nonzero exit status
Signature · 1 line
1.7.12
#7 lore raw

PATCH 7/9 build: use nesting magic for tools-obj-y

In reply to Paolo Bonzini

Move this variable to Makefile.objs, together with all the other lists of object files.

---
 Makefile      | 5 -----
 Makefile.objs | 9 +++++++++

2 file modificati, 9 inserzioni(+), 5 rimozioni(-)

Makefile +0 -5
index fffbbb8..a8078ec 100644
@@ -152,11 +152,6 @@ endif
 
 qemu-img.o: qemu-img-cmds.h
 
-tools-obj-y = $(oslib-obj-y) $(trace-obj-y) qemu-tool.o qemu-timer.o \
-	qemu-timer-common.o main-loop.o notify.o monitor-dummy.o \
-	iohandler.o
-tools-obj-$(CONFIG_POSIX) += compatfd.o
-
 qemu-img$(EXESUF): qemu-img.o $(tools-obj-y) $(block-obj-y)
 qemu-nbd$(EXESUF): qemu-nbd.o $(tools-obj-y) $(block-obj-y)
 qemu-io$(EXESUF): qemu-io.o cmd.o $(tools-obj-y) $(block-obj-y)
Makefile.objs +9 -0
index cf00fd5..85bd70b 100644
@@ -226,6 +226,14 @@ common-obj-y += qmp.o hmp.o
 universal-obj-y += $(qapi-obj-y)
 
 ######################################################################
+# tools-obj-y is shared by qemu-img, qemu-io, qemu-nbd
+
+tools-obj-y = $(oslib-obj-y) $(trace-obj-y) qemu-tool.o qemu-timer.o
+tools-obj-y += qemu-timer-common.o main-loop.o notify.o monitor-dummy.o
+tools-obj-y += iohandler.o
+tools-obj-$(CONFIG_POSIX) += compatfd.o
+
+######################################################################
 # guest agent
 
 qga-obj-y = qga/ qemu-ga.o module.o monitor-dummy.o
@@ -246,5 +254,6 @@ nested-vars += \
 	qapi-obj-y \
 	user-obj-y \
 	common-obj-y \
+	tools-obj-y \
 	extra-obj-y
 dummy := $(call unnest-vars)
Signature · 1 line
1.7.12
#8 lore raw

PATCH 8/9 libcacard: add include/ to CFLAGS

In reply to Paolo Bonzini
---
 libcacard/Makefile | 2 +-

1 file modificato, 1 inserzione(+). 1 rimozione(-)

libcacard/Makefile +1 -1
index 63990b7..c2c0212 100644
@@ -10,7 +10,7 @@ $(call set-vpath, $(SRC_PATH))
 QEMU_OBJS=$(oslib-obj-y) qemu-timer-common.o $(trace-obj-y)
 QEMU_OBJS_LIB=$(patsubst %.o,%.lo,$(QEMU_OBJS))
 
-QEMU_CFLAGS+=-I../
+QEMU_CFLAGS+=-I../ -I$(SRC_PATH)/include
 
 libcacard.lib-y=$(patsubst %.o,%.lo,$(libcacard-y))
 
Signature · 1 line
1.7.12
#9 lore raw

PATCH 9/9 libcacard: remove dependency on QEMU main loop

In reply to Paolo Bonzini

libcacard does not use the QEMU main loop, do not link it in.

---
 Makefile | 2 +-

1 file modificato, 1 inserzione(+). 1 rimozione(-)

Makefile +1 -1
index a8078ec..4cc4e3a 100644
@@ -158,7 +158,7 @@ qemu-io$(EXESUF): qemu-io.o cmd.o $(tools-obj-y) $(block-obj-y)
 
 qemu-bridge-helper$(EXESUF): qemu-bridge-helper.o
 
-vscclient$(EXESUF): $(libcacard-y) $(oslib-obj-y) $(trace-obj-y) $(tools-obj-y) qemu-timer-common.o libcacard/vscclient.o
+vscclient$(EXESUF): $(libcacard-y) $(oslib-obj-y) $(trace-obj-y) monitor-dummy.o qemu-timer-common.o libcacard/vscclient.o
 	$(call quiet-command,$(CC) $(LDFLAGS) -o $@ $^ $(libcacard_libs) $(LIBS),"  LINK  $@")
 
 fsdev/virtfs-proxy-helper$(EXESUF): fsdev/virtfs-proxy-helper.o fsdev/virtio-9p-marshal.o oslib-posix.o $(trace-obj-y)
Signature · 1 line
1.7.12
#10 lore raw
In reply to Paolo Bonzini

Il 17/09/2012 18:44, Paolo Bonzini ha scritto:

Quoted 17 lines

Here are some cleanups to the build system, removing some unused files from some of the products or fixing some strange behavior that bit me while looking at the tree reorganization.

Paolo

Paolo Bonzini (9):
tools: split monitor-dummy.c, clean up qemu-tool.c
block: move QEMUIOVector functions to iov.c
build: avoid duplicate appearance of files
qemu-ga: do not include the QEMU main loop and dependencies
build: add object directory to QEMU_INCLUDES
build: add $(TARGET_DIR) to "GEN config-target.h" lines
build: use nesting magic for tools-obj-y
libcacard: add include/ to CFLAGS
libcacard: remove dependency on QEMU main loop

Quoted 11 lines
 Makefile           |   9 ++---
 Makefile.objs      |  19 +++++++---
 cutils.c           | 103 ----------------------------------------------------
 iov.c              | 104 +++++++++++++++++++++++++++++++++++++++++++++++++++++
 libcacard/Makefile |   2 +-
 monitor-dummy.c    |  64 +++++++++++++++++++++++++++++++++
 qemu-tool.c        |  54 ----------------------------
 rules.mak          |   5 ++-
 8 file modificati, 189 inserzioni(+), 171 rimozioni(-)
 create mode 100644 monitor-dummy.c

Doesn't apply anymore. :(

Paolo

#11 lore raw
Quoted 30 lines · Paolo Bonzini

Il 17/09/2012 18:44, Paolo Bonzini ha scritto:

Quoted 17 lines

Here are some cleanups to the build system, removing some unused files from some of the products or fixing some strange behavior that bit me while looking at the tree reorganization.

Paolo

Paolo Bonzini (9):
tools: split monitor-dummy.c, clean up qemu-tool.c
block: move QEMUIOVector functions to iov.c
build: avoid duplicate appearance of files
qemu-ga: do not include the QEMU main loop and dependencies
build: add object directory to QEMU_INCLUDES
build: add $(TARGET_DIR) to "GEN config-target.h" lines
build: use nesting magic for tools-obj-y
libcacard: add include/ to CFLAGS
libcacard: remove dependency on QEMU main loop

Quoted 11 lines
 Makefile           |   9 ++---
 Makefile.objs      |  19 +++++++---
 cutils.c           | 103 ----------------------------------------------------
 iov.c              | 104 +++++++++++++++++++++++++++++++++++++++++++++++++++++
 libcacard/Makefile |   2 +-
 monitor-dummy.c    |  64 +++++++++++++++++++++++++++++++++
 qemu-tool.c        |  54 ----------------------------
 rules.mak          |   5 ++-
 8 file modificati, 189 inserzioni(+), 171 rimozioni(-)
 create mode 100644 monitor-dummy.c
Quoted 1 line

Doesn't apply anymore. :(

FWIW, it breaks make check too:

LINK tests/check-qdict
iohandler.o: In function `qemu_init_child_watch':
/home/anthony/git/qemu/iohandler.c:172: undefined reference to qemu_bh_new' iohandler.o: In function sigchld_handler':
/home/anthony/git/qemu/iohandler.c:154: undefined reference to qemu_bh_schedule' main-loop.o: In function main_loop_wait':
/home/anthony/git/qemu/main-loop.c:506: undefined reference to qemu_bh_poll' /home/anthony/git/qemu/main-loop.c:481: undefined reference to qemu_bh_update_timeout'
collect2: ld returned 1 exit status
make: *** [tests/check-qdict] Error 1

Regards,

Anthony Liguori

Quoted 2 lines

Paolo