standalone-examples: support custom GCC lib
authorJack Mitchell <jack.mitchell@dbbroadcast.co.uk>
Tue, 16 Jul 2013 13:44:23 +0000 (14:44 +0100)
committerTom Rini <trini@ti.com>
Fri, 6 Sep 2013 17:09:07 +0000 (13:09 -0400)
Add support for defining the gcc lib in standalone examples as is
done in the main u-boot Makefile

Signed-off-by: Jack Mitchell <jack.mitchell@dbbroadcast.co.uk>
examples/standalone/Makefile

index 4afedea065dd9e8da7c4bccfeaf4af109d1f7bc8..45b0fdc1615f4208e62ea7155b81998b62d2cfe2 100644 (file)
@@ -52,7 +52,18 @@ ELF  := $(addprefix $(obj),$(ELF))
 BIN    := $(addprefix $(obj),$(BIN))
 SREC   := $(addprefix $(obj),$(SREC))
 
-gcclibdir := $(shell dirname `$(CC) -print-libgcc-file-name`)
+# Add GCC lib
+ifdef USE_PRIVATE_LIBGCC
+ifeq ("$(USE_PRIVATE_LIBGCC)", "yes")
+PLATFORM_LIBGCC = $(OBJTREE)/arch/$(ARCH)/lib/libgcc.o
+else
+PLATFORM_LIBGCC = -L $(USE_PRIVATE_LIBGCC) -lgcc
+endif
+else
+PLATFORM_LIBGCC := -L $(shell dirname `$(CC) $(CFLAGS) -print-libgcc-file-name`) -lgcc
+endif
+PLATFORM_LIBS += $(PLATFORM_LIBGCC)
+export PLATFORM_LIBS
 
 CPPFLAGS += -I..
 
@@ -82,7 +93,7 @@ $(ELF):
 $(obj)%:       $(obj)%.o $(LIB)
                $(LD) $(LDFLAGS) -g -Ttext $(CONFIG_STANDALONE_LOAD_ADDR) \
                        -o $@ -e $(SYM_PREFIX)$(notdir $(<:.o=)) $< $(LIB) \
-                       -L$(gcclibdir) -lgcc
+                       $(PLATFORM_LIBS)
 
 $(SREC):
 $(obj)%.srec:  $(obj)%