diff mbox

[Tracing] Fix for make parallelization.

Message ID 20100628180237.5ff42ab4@zephyr
State New
Headers show

Commit Message

Prerna Saxena June 28, 2010, 12:32 p.m. UTC
[PATCH] Restore parallel building
This is based on :
http://repo.or.cz/w/qemu/stefanha.git/shortlog/refs/heads/tracing

Signed-off-by: Prerna Saxena <prerna@linux.vnet.ibm.com>
---
 Makefile |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

Comments

Stefan Hajnoczi June 28, 2010, 1:46 p.m. UTC | #1
On Mon, Jun 28, 2010 at 06:02:37PM +0530, Prerna Saxena wrote:
> [PATCH] Restore parallel building
> This is based on :
> http://repo.or.cz/w/qemu/stefanha.git/shortlog/refs/heads/tracing
> 
> Signed-off-by: Prerna Saxena <prerna@linux.vnet.ibm.com>

Dependencies are not quite right yet:

$ make distclean
$ ./configure --trace-backend=simple
$ make V=1 trace.o
sh /home/stefanha/qemu/tracetool --simple -c < /home/stefanha/qemu/trace-events > trace.c
sh /home/stefanha/qemu/tracetool --simple -h < /home/stefanha/qemu/trace-events > trace.h
gcc -I/home/stefanha/qemu/slirp -Werror -m64 -fstack-protector-all -Wold-style-definition -Wold-style-declaration -I. -I/home/stefanha/qemu -D_FORTIFY_SOURCE=2 -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -Wstrict-prototypes -Wredundant-decls -Wall -Wundef -Wendif-labels -Wwrite-strings -Wmissing-prototypes -fno-strict-aliasing   -MMD -MP -MT trace.o -MF ./trace.d -O2 -g  -c -o trace.o trace.c
In file included from trace.h:6,
                 from trace.c:2:
qemu-common.h:5:25: error: config-host.h: No such file or directory
In file included from trace.h:6,
                 from trace.c:2:
qemu-common.h:61: error: redefinition of ‘struct iovec’
make: *** [trace.o] Error 1

I have applied it for now, however, because the implicit dependencies issue affects all of QEMU and was not caused by tracing code:

http://repo.or.cz/w/qemu/stefanha.git/commitdiff/e47a997579086dd585534da610e76f23f9c04b87

Stefan
Stefan Hajnoczi June 28, 2010, 2 p.m. UTC | #2
On Mon, Jun 28, 2010 at 2:46 PM, Stefan Hajnoczi
<stefanha@linux.vnet.ibm.com> wrote:
> On Mon, Jun 28, 2010 at 06:02:37PM +0530, Prerna Saxena wrote:
>> [PATCH] Restore parallel building
>> This is based on :
>> http://repo.or.cz/w/qemu/stefanha.git/shortlog/refs/heads/tracing
>>
>> Signed-off-by: Prerna Saxena <prerna@linux.vnet.ibm.com>
>
> Dependencies are not quite right yet:
>
> $ make distclean
> $ ./configure --trace-backend=simple
> $ make V=1 trace.o
> sh /home/stefanha/qemu/tracetool --simple -c < /home/stefanha/qemu/trace-events > trace.c
> sh /home/stefanha/qemu/tracetool --simple -h < /home/stefanha/qemu/trace-events > trace.h
> gcc -I/home/stefanha/qemu/slirp -Werror -m64 -fstack-protector-all -Wold-style-definition -Wold-style-declaration -I. -I/home/stefanha/qemu -D_FORTIFY_SOURCE=2 -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -Wstrict-prototypes -Wredundant-decls -Wall -Wundef -Wendif-labels -Wwrite-strings -Wmissing-prototypes -fno-strict-aliasing   -MMD -MP -MT trace.o -MF ./trace.d -O2 -g  -c -o trace.o trace.c
> In file included from trace.h:6,
>                 from trace.c:2:
> qemu-common.h:5:25: error: config-host.h: No such file or directory
> In file included from trace.h:6,
>                 from trace.c:2:
> qemu-common.h:61: error: redefinition of ‘struct iovec’
> make: *** [trace.o] Error 1
>
> I have applied it for now, however, because the implicit dependencies issue affects all of QEMU and was not caused by tracing code:

Can someone explain how the build system uses dependency rules?  From
what I can tell the dependencies are generated during compilation.  In
rules.mak:

# Flags for dependency generation
QEMU_DGFLAGS += -MMD -MP -MT $@ -MF $(*D)/$(*F).d

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

I would have expected one pass to build dependencies, then the
dependency rules are sourced into make, then the code is built.  Isn't
it too late to generate dependencies when compiling the object file?

It looks like GENERATED_HEADERS is used to add explicit dependencies
on config-host.h and config-target.h.  trace.o should depend on
$(GENERATED_HEADERS).

Stefan
diff mbox

Patch

diff --git a/Makefile b/Makefile
index e64e397..de9b175 100644
--- a/Makefile
+++ b/Makefile
@@ -138,7 +138,9 @@  trace.h: $(SRC_PATH)/trace-events
 trace.c: $(SRC_PATH)/trace-events
 	$(call quiet-command,sh $(SRC_PATH)/tracetool --$(TRACE_BACKEND) -c < $< > $@,"  GEN   $@")
 
-trace.o: trace.c
+trace.o: trace.c trace.h
+
+simpletrace.o: simpletrace.c trace.h
 
 ######################################################################