]> git.sur5r.net Git - u-boot/blobdiff - arch/powerpc/lib/Makefile
Merge branch 'master' of git://git.denx.de/u-boot-nios
[u-boot] / arch / powerpc / lib / Makefile
index cec7666b446c970119252b426b61623191c99ed6..cdd62a2061f848dcc2fea75ce373e37e00856e8d 100644 (file)
 
 include $(TOPDIR)/config.mk
 
-LIB    = $(obj)lib$(ARCH).a
+## Build a couple of necessary functions into a private libgcc
+LIBGCC = $(obj)libgcc.o
+GLSOBJS        += _ashldi3.o
+GLSOBJS        += _ashrdi3.o
+GLSOBJS        += _lshrdi3.o
+LGOBJS := $(addprefix $(obj),$(GLSOBJS)) \
+          $(addprefix $(obj),$(GLCOBJS))
+
+## But only build it if the user asked for it
+ifdef USE_PRIVATE_LIBGCC
+TARGETS        += $(LIBGCC)
+endif
+
+LIB    = $(obj)lib$(ARCH).o
 
 SOBJS-y        += ppccache.o
 SOBJS-y        += ppcstring.o
@@ -53,9 +66,14 @@ endif
 
 COBJS  += $(sort $(COBJS-y))
 
-SRCS   := $(SOBJS-y:.o=.S) $(COBJS-y:.o=.c)
+SRCS   := $(GLSOBJS:.o=.S) $(GLCOBJS:.o=.c) \
+          $(SOBJS-y:.o=.S) $(COBJS-y:.o=.c)
 OBJS   := $(addprefix $(obj),$(SOBJS-y) $(COBJS-y))
 
+TARGETS += $(LIB)
+
+all: $(TARGETS)
+
 $(LIB):        $(obj).depend $(OBJS)
        @if ! $(CROSS_COMPILE)readelf -S $(OBJS) | grep -q '\.fixup.*PROGBITS';\
        then \
@@ -63,7 +81,10 @@ $(LIB):      $(obj).depend $(OBJS)
                echo "       Upgrade to a recent toolchain."; \
                exit 1; \
        fi;
-       $(AR) $(ARFLAGS) $@ $(OBJS)
+       $(call cmd_link_o_target, $(OBJS))
+
+$(LIBGCC): $(obj).depend $(LGOBJS)
+       $(call cmd_link_o_target, $(LGOBJS))
 
 #########################################################################