[U-Boot] [PATCH] Makefile: fix parallel build

Daniel Hobi daniel.hobi at schmid-telecom.ch
Tue Dec 15 10:21:02 CET 2009


On 11.12.2009 20:25, Mike Frysinger wrote:
> On Thursday 10 December 2009 08:41:07 Daniel Hobi wrote:
>> During parallel build, the top Makefile spawns multiple sub-makes
>> for targets in cpu/$(CPU). If cpu/$(CPU)/.depend is not present, the
>> sub-makes may end up generating this file simultaneously which leads
>> to corrupted content.
>>
>> A typical error message is:
>>
>> .depend:39: *** multiple target patterns.  Stop.
>>
>> This patch serializes the creation of cpu/$(CPU)/.depend by adding
>> cpu/$(CPU) to the depend target in the top Makefile.
> 
> seems to happen in lib_$(ARCH)/ too, but in reviewing my logs from the last 
> few months, most parallel .depend failures have indeed been in cpu/$(CPU)/.  
> maybe this is just coincidence though ... perhaps the depend target should 
> walk all subdirs instead of a just random few ones (use LIBS).

The problem with cpu/$(CPU)/ is that the top Makefile builds multiple
targets within this directory in parallel - at least start.o and
lib$(CPU).a. For all other directories, parallel build should work,
since there is only one target per directory.

Can you provide any commit ID where building lib_$(ARCH)/ failed?

Thus, adding all LIBS to the depend target should not make any
difference. In order to properly track such dependencies we should
switch to non-recursive Makefiles (as seen in Linux) since Recursive
Make [is] Considered Harmful[1].

[1] http://miller.emu.id.au/pmiller/books/rmch/

Best regards,
Daniel



More information about the U-Boot mailing list