Patchwork [1/2] fix parallel build

login
register
mail settings
Submitter Juan Quintela
Date Nov. 5, 2009, 1:42 p.m.
Message ID <7e084e942b3d74c4f5ec6f2628be8dc141119e5a.1257428255.git.quintela@redhat.com>
Download mbox | patch
Permalink /patch/37757/
State New
Headers show

Comments

Juan Quintela - Nov. 5, 2009, 1:42 p.m.
Based on a ideas of Daniel Jacobowitz + Stefan Weil

Signed-off-by: Juan Quintela <quintela@redhat.com>
---
 Makefile        |    9 ++++++---
 Makefile.target |    6 +++---
 rules.mak       |    2 +-
 3 files changed, 10 insertions(+), 7 deletions(-)

Patch

diff --git a/Makefile b/Makefile
index c783aa4..ce165b2 100644
--- a/Makefile
+++ b/Makefile
@@ -40,8 +40,9 @@  config-all-devices.mak: $(SUBDIR_DEVICES_MAK)

 -include config-all-devices.mak

-build-all: config-host.h config-all-devices.h $(DOCS) $(TOOLS)
-	$(call quiet-command, $(MAKE) $(SUBDIR_MAKEFLAGS) recurse-all,)
+GENERATED_HEADERS = config-host.h config-all-devices.h
+
+build-all: $(DOCS) $(TOOLS) recurse-all

 config-host.h: config-host.h-timestamp
 config-host.h-timestamp: config-host.mak
@@ -67,7 +68,7 @@  romsubdir-%:

 ALL_SUBDIRS=$(TARGET_DIRS) $(patsubst %,pc-bios/%, $(ROMS))

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

 #######################################################################
 # block-obj-y is code used by both qemu system emulation and qemu-img
@@ -211,6 +212,8 @@  libqemu_common.a: $(obj-y)

 qemu-img.o: qemu-img-cmds.h

+qemu-img.o qemu-nbd.o qemu-io.o: $(GENERATED_HEADERS)
+
 qemu-img$(EXESUF): qemu-img.o qemu-tool.o $(block-obj-y)

 qemu-nbd$(EXESUF):  qemu-nbd.o qemu-tool.o $(block-obj-y)
diff --git a/Makefile.target b/Makefile.target
index fefd7ac..0673c55 100644
--- a/Makefile.target
+++ b/Makefile.target
@@ -22,6 +22,7 @@  endif
 endif

 PROGS=$(QEMU_PROG)
+GENERATED_HEADERS = config-target.h config-devices.h

 LIBS+=-lm

@@ -33,8 +34,7 @@  config-target.h-timestamp: config-target.mak
 config-devices.h: config-devices.h-timestamp
 config-devices.h-timestamp: config-devices.mak

-all: config-target.h config-devices.h
-	$(call quiet-command, $(MAKE) $(PROGS),)
+all: $(PROGS)

 # Dummy command so that make thinks it has done something
 	@true
@@ -308,7 +308,7 @@  endif # CONFIG_SOFTMMU

 obj-$(CONFIG_GDBSTUB_XML) += gdbstub-xml.o

-$(QEMU_PROG): $(obj-y) $(obj-$(TARGET_BASE_ARCH)-y) $(ARLIBS)
+$(QEMU_PROG): $(GENERATED_HEADERS) $(obj-y) $(obj-$(TARGET_BASE_ARCH)-y) $(ARLIBS)
 	$(call LINK,$(obj-y) $(obj-$(TARGET_BASE_ARCH)-y))


diff --git a/rules.mak b/rules.mak
index 5d7e8bb..4eb1f90 100644
--- a/rules.mak
+++ b/rules.mak
@@ -13,7 +13,7 @@  MAKEFLAGS += -rR

 QEMU_CFLAGS += -MMD -MP -MT $@

-%.o: %.c
+%.o: %.c $(GENERATED_HEADERS)
 	$(call quiet-command,$(CC) $(QEMU_CFLAGS) $(CFLAGS) -c -o $@ $<,"  CC    $(TARGET_DIR)$@")

 %.o: %.S