Skip to contentSkip to conversation

Fix for make parallelization.

PATCH In review Prerna Saxena 3 participants 3 messages Jun 28, 2010 Kbuild

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Fix for make parallelization.

[PATCH] Restore parallel building
This is based on :
http://repo.or.cz/w/qemu/stefanha.git/shortlog/refs/heads/tracing

---
 Makefile |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)
Makefile +3 -1
index e64e397..de9b175 100644
@@ -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
 
 ######################################################################
 
Signature · 10 lines
1.6.2.5



-- 
Prerna Saxena

Linux Technology Centre,
IBM Systems and Technology Lab,
Bangalore, India
#1 lore raw
Quoted 5 lines · Prerna Saxena

[PATCH] Restore parallel building
This is based on :
http://repo.or.cz/w/qemu/stefanha.git/shortlog/refs/heads/tracing

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

#2 lore raw
Quoted 23 lines · Stefan Hajnoczi
Quoted 5 lines · Prerna Saxena

[PATCH] Restore parallel building
This is based on :
http://repo.or.cz/w/qemu/stefanha.git/shortlog/refs/heads/tracing

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
Quoted 1 line

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