summaryrefslogtreecommitdiff
path: root/extra/gcc-uClibc/Makefile
diff options
context:
space:
mode:
authorEric Andersen <andersen@codepoet.org>2001-01-11 11:42:17 +0000
committerEric Andersen <andersen@codepoet.org>2001-01-11 11:42:17 +0000
commitae97a89e1a1a9833080dccc81f6cd26784e1b964 (patch)
tree6ff1ddc7e3980591c7fd0bbd5d9b8ac82da12886 /extra/gcc-uClibc/Makefile
parentabdc3e4d06db2b9d93c509774fc7c4fde918ec8e (diff)
A large update from Manuel Novoa III <mnovoa3@bellsouth.net>.
Diffstat (limited to 'extra/gcc-uClibc/Makefile')
-rw-r--r--extra/gcc-uClibc/Makefile40
1 files changed, 40 insertions, 0 deletions
diff --git a/extra/gcc-uClibc/Makefile b/extra/gcc-uClibc/Makefile
new file mode 100644
index 000000000..af9f836a1
--- /dev/null
+++ b/extra/gcc-uClibc/Makefile
@@ -0,0 +1,40 @@
+
+TOPDIR = ../../
+include $(TOPDIR)Rules.mak
+
+UCLIBC_DIR = $(shell (cd ../.. ; /bin/pwd))
+GCC_BIN = $(CC)
+GCC_LIB = $(shell $(CC) -print-libgcc-file-name )
+#GCCINCDIR inherited from Rules.mak
+
+NATIVE_ARCH = $(shell uname -m | sed -e 's/i.86/i386/' -e 's/sparc.*/sparc/' -e 's/arm.*/arm/g')
+GCC_UCLIBC = gcc-uClibc-cross
+ifeq ($(TARGET_ARCH), $(NATIVE_ARCH))
+ GCC_UCLIBC = gcc-uClibc-native
+endif
+
+all: $(GCC_UCLIBC)
+
+clean:
+ rm -f gcc-uClibc.h gcc-uClibc-*
+
+gcc-uClibc.h: clean
+ echo "/* this file is created by make */" > gcc-uClibc.h
+ echo "#define UCLIBC_DIR " \"$(UCLIBC_DIR)/\" >> gcc-uClibc.h
+ echo "#define GCC_BIN " \"$(GCC_BIN)\" >> gcc-uClibc.h
+ echo "#define GCC_LIB " \"$(GCC_LIB)\" >> gcc-uClibc.h
+ echo "#define GCC_INCDIR " \"-I$(GCCINCDIR)/\" >> gcc-uClibc.h
+ echo "#define TARGET_ARCH " \"$(TARGET_ARCH)\" >> gcc-uClibc.h
+
+gcc-uClibc-native: gcc-uClibc.h gcc-uClibc.c
+ # uClibc built for native environment, so why not use it ;-)
+ $(CC) $(CFLAGS) -nostdinc -I$(UCLIBC_DIR)/include -I$(GCC_INC) \
+ -Wl,-static gcc-uClibc.c \
+ $(UCLIBC_DIR)/sysdeps/linux/$(TARGET_ARCH)/_start.o \
+ -nostdlib $(GCC_LIB) $(UCLIBC_DIR)/libc.a \
+ -s -o gcc-uClibc-$(TARGET_ARCH) #-DDEBUG
+
+gcc-uClibc-cross: gcc-uClibc.h gcc-uClibc.c
+ # don't use CFLAGS since may not be appropriate
+ gcc -s gcc-uClibc.c -o gcc-uClibc-$(TARGET_ARCH)
+