summaryrefslogtreecommitdiff
path: root/extra/gcc-uClibc/Makefile
diff options
context:
space:
mode:
Diffstat (limited to 'extra/gcc-uClibc/Makefile')
-rw-r--r--extra/gcc-uClibc/Makefile47
1 files changed, 30 insertions, 17 deletions
diff --git a/extra/gcc-uClibc/Makefile b/extra/gcc-uClibc/Makefile
index 2e5793979..75c823086 100644
--- a/extra/gcc-uClibc/Makefile
+++ b/extra/gcc-uClibc/Makefile
@@ -5,14 +5,15 @@ include $(TOPDIR)Rules.mak
DYNAMIC_LINKER = $(INSTALL_DIR)/lib/ld-linux-uclibc.so.$(MAJOR_VERSION)
UCLIBC_DIR = $(shell (cd ../.. ; /bin/pwd))
-GCC_BIN = $(CC)
+GCC_BIN = $(shell which $(CC))
+LD_BIN = $(shell which $(LD))
GCC_LIB = $(shell $(CC) -print-libgcc-file-name )
#GCCINCDIR inherited from Rules.mak
-all: gcc-uClibc
+all: gcc-uClibc ld-uClibc
gcc-uClibc.h: clean
- @echo "/* this file is created by make */" > gcc-uClibc.h
+ @echo "/* this file was autogenerated by make */" > gcc-uClibc.h
@echo "#define UCLIBC_INSTALL_DIR " \"$(INSTALL_DIR)/\" >> gcc-uClibc.h
@echo "#define UCLIBC_BUILD_DIR " \"$(UCLIBC_DIR)/\" >> gcc-uClibc.h
@echo "#define GCC_BIN " \"$(GCC_BIN)\" >> gcc-uClibc.h
@@ -24,22 +25,34 @@ gcc-uClibc.h: clean
gcc-uClibc: gcc-uClibc.h gcc-uClibc.c
gcc -Wall -O2 -s gcc-uClibc.c -o $(TARGET_ARCH)-uclibc-gcc
-install:
- @if [ -f $(TARGET_ARCH)-uclibc-gcc ] ; then \
- mkdir -p $(INSTALL_DIR)/usr/bin ; \
+ld-uClibc:
+ @echo "#!/bin/sh" > $(TARGET_ARCH)-uclibc-ld
+ @echo "# This file was autogenerated by make" >> $(TARGET_ARCH)-uclibc-ld
+ @echo "$(LD_BIN) -L- -L $(INSTALL_DIR)/lib -L$(UCLIBC_DIR) \$$@" >> $(TARGET_ARCH)-uclibc-ld
+ chmod a+x $(TARGET_ARCH)-uclibc-ld
+
+install: all
+ install -d $(INSTALL_DIR)/bin;
+ install -d $(INSTALL_DIR)/usr/bin;
+ if [ -x ./$(TARGET_ARCH)-uclibc-gcc ] ; then \
install -m 755 $(TARGET_ARCH)-uclibc-gcc $(INSTALL_DIR)/usr/bin/ ; \
- fi
- $(shell (for app in addr2line ar as gasp ld nm objcopy objdump \
- ranlib size strings strip; do \
- ln -fs `which $(CROSS)$${app}` $(INSTALL_DIR)/bin/$${app}; \
- done)\
- )
- $(shell (for app in cc1 cc1plus; do \
- ln -fs $(CC1DIR)$${app} $(INSTALL_DIR)/bin/$${app}; \
- done)\
- )
+ install -m 755 $(TARGET_ARCH)-uclibc-ld $(INSTALL_DIR)/usr/bin/ ; \
+ ln -fs ../usr/bin/$(TARGET_ARCH)-uclibc-gcc $(INSTALL_DIR)/bin/cc; \
+ ln -fs ../usr/bin/$(TARGET_ARCH)-uclibc-gcc $(INSTALL_DIR)/bin/gcc; \
+ ln -fs ../usr/bin/$(TARGET_ARCH)-uclibc-ld $(INSTALL_DIR)/bin/ld; \
+ ln -fs $(TARGET_ARCH)-uclibc-gcc $(INSTALL_DIR)/usr/bin/$(TARGET_ARCH)-uclibc-cc; \
+ fi;
+ for app in addr2line ar as cpp gasp nm objcopy \
+ objdump ranlib readelf size strings strip; do \
+ ln -fs `which $(CROSS)$${app}` $(INSTALL_DIR)/bin/$${app}; \
+ done;
+ for app in addr2line ar as cpp gasp nm objcopy \
+ objdump ranlib readelf size strings strip; do \
+ ln -fs `which $(CROSS)$${app}` $(INSTALL_DIR)/usr/bin/$(TARGET_ARCH)-uclibc-$${app}; \
+ done;
+
clean:
- rm -f gcc-uClibc.h *-uclibc-gcc core
+ rm -f gcc-uClibc.h *-uclibc-gcc *-uclibc-ld core