]> git.kernelconcepts.de Git - karo-tx-uboot.git/blobdiff - arch/powerpc/lib/Makefile
powerpc: Minimal private libgcc to build on Debian
[karo-tx-uboot.git] / arch / powerpc / lib / Makefile
index 724d8ee7f74d05b098c882e7312c708d12b5c1a6..cdd62a2061f848dcc2fea75ce373e37e00856e8d 100644 (file)
 
 include $(TOPDIR)/config.mk
 
+## 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
@@ -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 \
@@ -65,6 +83,9 @@ $(LIB):       $(obj).depend $(OBJS)
        fi;
        $(call cmd_link_o_target, $(OBJS))
 
+$(LIBGCC): $(obj).depend $(LGOBJS)
+       $(call cmd_link_o_target, $(LGOBJS))
+
 #########################################################################
 
 # defines $(obj).depend target