This problem shows up with parallel builds only; it results in
somewhat cryptic error messages like

        $ JOBS=-j6 MAKEALL netstar
        Configuring for netstar board...
        arm-linux-ld: cannot find -lgeneric
        make[1]: *** [eeprom.srec] Error 1

A few boards (like netstar and voiceblue) need some libraries for
building; however, the board Makefile does not contain any such
dependencies which may cause problems with parallel builds. Adding
such dependencies is difficult as we would also have to provide build
rules, which already exist in the respective library Makefiles.

To solve this, we make sure that all libraries get built before the
board code.

Signed-off-by: Wolfgang Denk <[EMAIL PROTECTED]>
---
 Makefile |   14 ++++++++++----
 1 files changed, 10 insertions(+), 4 deletions(-)

diff --git a/Makefile b/Makefile
index 10324d2..ac0a17f 100644
--- a/Makefile
+++ b/Makefile
@@ -201,7 +201,6 @@ OBJS := $(addprefix $(obj),$(OBJS))
 LIBS  = lib_generic/libgeneric.a
 LIBS += $(shell if [ -f board/$(VENDOR)/common/Makefile ]; then echo \
        "board/$(VENDOR)/common/lib$(VENDOR).a"; fi)
-LIBS += board/$(BOARDDIR)/lib$(BOARD).a
 LIBS += cpu/$(CPU)/lib$(CPU).a
 ifdef SOC
 LIBS += cpu/$(CPU)/$(SOC)/lib$(SOC).a
@@ -248,6 +247,9 @@ LIBS += post/libpost.a
 LIBS := $(addprefix $(obj),$(LIBS))
 .PHONY : $(LIBS) $(VERSION_FILE)
 
+LIBBOARD = board/$(BOARDDIR)/lib$(BOARD).a
+LIBBOARD := $(addprefix $(obj),$(LIBBOARD))
+
 # Add GCC lib
 PLATFORM_LIBS += -L $(shell dirname `$(CC) $(CFLAGS) -print-libgcc-file-name`) 
-lgcc
 
@@ -270,7 +272,7 @@ U_BOOT_ONENAND = $(obj)u-boot-onenand.bin
 endif
 
 __OBJS := $(subst $(obj),,$(OBJS))
-__LIBS := $(subst $(obj),,$(LIBS))
+__LIBS := $(subst $(obj),,$(LIBS)) $(subst $(obj),,$(LIBBOARD))
 
 #########################################################################
 #########################################################################
@@ -313,8 +315,9 @@ $(obj)u-boot.sha1:  $(obj)u-boot.bin
 $(obj)u-boot.dis:      $(obj)u-boot
                $(OBJDUMP) -d $< > $@
 
-$(obj)u-boot:          depend $(SUBDIRS) $(OBJS) $(LIBS) $(LDSCRIPT)
-               UNDEF_SYM=`$(OBJDUMP) -x $(LIBS) |sed  -n -e 
's/.*\($(SYM_PREFIX)__u_boot_cmd_.*\)/-u\1/p'|sort|uniq`;\
+$(obj)u-boot:          depend $(SUBDIRS) $(OBJS) $(LIBBOARD) $(LIBS) 
$(LDSCRIPT)
+               UNDEF_SYM=`$(OBJDUMP) -x $(LIBBOARD) $(LIBS) | \
+               sed  -n -e 
's/.*\($(SYM_PREFIX)__u_boot_cmd_.*\)/-u\1/p'|sort|uniq`;\
                cd $(LNDIR) && $(LD) $(LDFLAGS) $$UNDEF_SYM $(__OBJS) \
                        --start-group $(__LIBS) --end-group $(PLATFORM_LIBS) \
                        -Map u-boot.map -o u-boot
@@ -325,6 +328,9 @@ $(OBJS):    depend $(obj)include/autoconf.mk
 $(LIBS):       depend $(obj)include/autoconf.mk
                $(MAKE) -C $(dir $(subst $(obj),,$@))
 
+$(LIBBOARD):   depend $(LIBS) $(obj)include/autoconf.mk
+               $(MAKE) -C $(dir $(subst $(obj),,$@))
+
 $(SUBDIRS):    depend $(obj)include/autoconf.mk
                $(MAKE) -C $@ all
 
-- 
1.5.4.2


-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference 
Don't miss this year's exciting event. There's still time to save $100. 
Use priority code J8TL2D2. 
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
_______________________________________________
U-Boot-Users mailing list
U-Boot-Users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/u-boot-users

Reply via email to