blob: 0ef7ab70e9fcf96579b1887dda96bda148067c4e (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
|
# Makefile for building a fake gcc/binutils toolchain
# that simply spoofs the location of the C library
#
# Copyright (C) 2000,2001 Erik Andersen <andersen@uclibc.org>
#
TOPDIR = ../../
include $(TOPDIR)Rules.mak
UCLIBC_DIR = $(shell (cd ../.. ; /bin/pwd))
GCC_BIN = $(shell which $(CC))
LD_BIN = $(shell which $(LD))
GCC_LIB = $(shell $(CC) -print-libgcc-file-name )
GCC_LIB_DIR = $(dir $(shell $(CC) -print-libgcc-file-name ))
#GCCINCDIR inherited from Rules.mak
all: gcc-uClibc ld-uClibc
gcc-uClibc.h: $(TOPDIR)/Config
@echo "/* this file was autogenerated by make */" > gcc-uClibc.h
@echo "#define UCLIBC_TARGET_PREFIX " \"$(TARGET_PREFIX)\" >> gcc-uClibc.h
@echo "#define UCLIBC_DEVEL_PREFIX " \"$(DEVEL_PREFIX)\" >> gcc-uClibc.h
@echo "#define UCLIBC_BUILD_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_LIB_DIR " \"$(GCC_LIB_DIR)\" >> gcc-uClibc.h
@echo "#define GCC_INCDIR " \"$(GCCINCDIR)\" >> gcc-uClibc.h
@echo "#define TARGET_ARCH " \"$(TARGET_ARCH)\" >> gcc-uClibc.h
@echo "#define DYNAMIC_LINKER " \"$(DYNAMIC_LINKER)\" >> gcc-uClibc.h
@echo "#define BUILD_DYNAMIC_LINKER " \"$(UCLIBC_DIR)/lib/$(UCLIBC_LDSO)\" >> gcc-uClibc.h
gcc-uClibc: gcc-uClibc.h gcc-uClibc.c
gcc -Wall -O2 -s gcc-uClibc.c -o $(TARGET_ARCH)-uclibc-gcc
ld-uClibc:
@echo "#!/bin/sh" > $(TARGET_ARCH)-uclibc-ld
@echo "# This file was autogenerated by make" >> $(TARGET_ARCH)-uclibc-ld
@echo "$(LD_BIN) -nostdlib -L$(DEVEL_PREFIX)/usr/lib -L$(DEVEL_PREFIX)/lib "\
"-L$(UCLIBC_DIR) \$$@" >> $(TARGET_ARCH)-uclibc-ld
chmod a+x $(TARGET_ARCH)-uclibc-ld
install: all
install -d $(PREFIX)$(DEVEL_PREFIX)/bin;
install -d $(PREFIX)$(SYSTEM_DEVEL_PREFIX)/bin;
install -m 755 $(TARGET_ARCH)-uclibc-gcc $(PREFIX)$(SYSTEM_DEVEL_PREFIX)/bin/
install -m 755 $(TARGET_ARCH)-uclibc-ld $(PREFIX)$(SYSTEM_DEVEL_PREFIX)/bin/
ln -fs $(TARGET_ARCH)-uclibc-gcc $(PREFIX)$(SYSTEM_DEVEL_PREFIX)/bin/$(TARGET_ARCH)-uclibc-cc
ln -fs $(SYSTEM_DEVEL_PREFIX)/bin/$(TARGET_ARCH)-uclibc-gcc $(PREFIX)$(DEVEL_PREFIX)/bin/gcc
ln -fs $(SYSTEM_DEVEL_PREFIX)/bin/$(TARGET_ARCH)-uclibc-gcc $(PREFIX)$(DEVEL_PREFIX)/bin/cc
ln -fs $(SYSTEM_DEVEL_PREFIX)/bin/$(TARGET_ARCH)-uclibc-ld $(PREFIX)$(DEVEL_PREFIX)/bin/ld
for app in addr2line ar as cpp gasp nm objcopy \
objdump ranlib size strings strip; do \
ln -fs `which $(CROSS)$${app}` $(PREFIX)$(DEVEL_PREFIX)/bin/$${app}; \
ln -fs `which $(CROSS)$${app}` $(PREFIX)$(SYSTEM_DEVEL_PREFIX)/bin/$(TARGET_ARCH)-uclibc-$${app}; \
done
clean:
rm -f gcc-uClibc.h *-uclibc-gcc *-uclibc-ld core
|