[RFC] Makefile: fix parallel build after "make clean" execution

Message ID 1342812208-20138-1-git-send-email-i.mitsyanko@samsung.com
State New
Headers show

Commit Message

Mitsyanko Igor July 20, 2012, 7:23 p.m.
If you configure qemu, then run "make clean" and then execute "make -jx" command,
build will fail with error:
cc1: error: qapi-generated: No such file or directory [-Werror]

This happens because qemu guest agent build screws up its dependencies. This Makefile line:
qemu-ga$(EXESUF): QEMU_CFLAGS += -I qapi-generated
for some reason causes all qemu-ga dependencies (qemu-ga.o $(qga-obj-y) $(tools-obj-y)
$(qapi-obj-y) $(qobject-obj-y) $(version-obj-y) $(QGALIB_OBJ)) to be dependant on
"qapi-generated" directory. This directory is created by python qapi scripts, or by
configure script (this is why parallel build works fine after ./configure if you
havn't run "make clean").

Another reason to apply this fix is that CFLAGS are more related to object files (meaning
$(qga-obj-y)) then to executable file qemu-ga$(EXESUF).

Signed-off-by: Igor Mitsyanko <i.mitsyanko@samsung.com>
 Makefile |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)


diff --git a/Makefile b/Makefile
index ab82ef3..ff54843 100644
--- a/Makefile
+++ b/Makefile
@@ -173,7 +173,7 @@  qemu-img-cmds.h: $(SRC_PATH)/qemu-img-cmds.hx
 	$(call quiet-command,sh $(SRC_PATH)/scripts/hxtool -h < $< > $@,"  GEN   $@")
 qemu-ga$(EXESUF): LIBS = $(LIBS_QGA)
-qemu-ga$(EXESUF): QEMU_CFLAGS += -I qapi-generated
+$(qga-obj-y): QEMU_CFLAGS += -I qapi-generated
 gen-out-type = $(subst .,-,$(suffix $@))