add filestructure for hardware documentation
[openwrt.git] / toolchain / uClibc / uclibc.mk
1 #############################################################
2 #
3 # uClibc (the C library)
4 #
5 #############################################################
6
7 ifeq ($(BR2_UCLIBC_VERSION_SNAPSHOT),y)
8 # Be aware that this changes daily....
9 UCLIBC_DIR:=$(TOOL_BUILD_DIR)/uClibc
10 UCLIBC_SOURCE:=uClibc-$(strip $(subst ",, $(BR2_USE_UCLIBC_SNAPSHOT))).tar.bz2
11 #"
12 UCLIBC_SITE:=http://www.uclibc.org/downloads/snapshots
13 else
14 # Note: 0.9.26 has known problems. So best use a snapshot until .27 is out.
15 # Anticipate the change.
16 UCLIBC_DIR:=$(TOOL_BUILD_DIR)/uClibc-0.9.27
17 UCLIBC_SOURCE:=uClibc-0.9.27.tar.bz2
18 UCLIBC_SITE:=http://www.uclibc.org/downloads
19 endif
20
21 UCLIBC_TARGET_ARCH:=$(shell echo $(ARCH) | sed -e s'/-.*//' \
22 -e 's/i.86/i386/' \
23 -e 's/sparc.*/sparc/' \
24 -e 's/arm.*/arm/g' \
25 -e 's/m68k.*/m68k/' \
26 -e 's/ppc/powerpc/g' \
27 -e 's/v850.*/v850/g' \
28 -e 's/sh64/sh/' \
29 -e 's/sh[234].*/sh/' \
30 -e 's/mips.*/mips/' \
31 -e 's/mipsel.*/mips/' \
32 -e 's/cris.*/cris/' \
33 )
34
35
36 $(DL_DIR)/$(UCLIBC_SOURCE):
37 mkdir -p $(DL_DIR)
38 $(WGET) -P $(DL_DIR) $(UCLIBC_SITE)/$(UCLIBC_SOURCE)
39
40 $(UCLIBC_DIR)/.unpacked: $(DL_DIR)/$(UCLIBC_SOURCE)
41 mkdir -p $(TOOL_BUILD_DIR)
42 bzcat $(DL_DIR)/$(UCLIBC_SOURCE) | tar -C $(TOOL_BUILD_DIR) $(TAR_OPTIONS) -
43 touch $(UCLIBC_DIR)/.unpacked
44
45 $(UCLIBC_DIR)/.configured: $(UCLIBC_DIR)/.unpacked
46 $(SED) 's,^CROSS=.*,CROSS=$(TARGET_CROSS),g' $(UCLIBC_DIR)/Rules.mak
47 ifeq ($(BR2_ENABLE_LOCALE),y)
48 cp toolchain/uClibc/uClibc.config-locale $(UCLIBC_DIR)/.config
49 else
50 cp toolchain/uClibc/uClibc.config $(UCLIBC_DIR)/.config
51 endif
52 $(SED) 's,^.*TARGET_$(UCLIBC_TARGET_ARCH).*,TARGET_$(UCLIBC_TARGET_ARCH)=y,g' \
53 $(UCLIBC_DIR)/.config
54 $(SED) 's,^TARGET_ARCH.*,TARGET_ARCH=\"$(UCLIBC_TARGET_ARCH)\",g' $(UCLIBC_DIR)/.config
55 $(SED) 's,^KERNEL_SOURCE=.*,KERNEL_SOURCE=\"$(LINUX_HEADERS_DIR)\",g' \
56 $(UCLIBC_DIR)/.config
57 $(SED) 's,^RUNTIME_PREFIX=.*,RUNTIME_PREFIX=\"/\",g' \
58 $(UCLIBC_DIR)/.config
59 $(SED) 's,^DEVEL_PREFIX=.*,DEVEL_PREFIX=\"/usr/\",g' \
60 $(UCLIBC_DIR)/.config
61 $(SED) 's,^SHARED_LIB_LOADER_PREFIX=.*,SHARED_LIB_LOADER_PREFIX=\"/lib\",g' \
62 $(UCLIBC_DIR)/.config
63 ifeq ($(BR2_LARGEFILE),y)
64 $(SED) 's,^.*UCLIBC_HAS_LFS.*,UCLIBC_HAS_LFS=y,g' $(UCLIBC_DIR)/.config
65 else
66 $(SED) 's,^.*UCLIBC_HAS_LFS.*,UCLIBC_HAS_LFS=n,g' $(UCLIBC_DIR)/.config
67 endif
68 $(SED) 's,.*UCLIBC_HAS_WCHAR.*,UCLIBC_HAS_WCHAR=y,g' $(UCLIBC_DIR)/.config
69 ifeq ($(BR2_SOFT_FLOAT),y)
70 $(SED) 's,.*HAS_FPU.*,HAS_FPU=n\nUCLIBC_HAS_FLOATS=y\nUCLIBC_HAS_SOFT_FLOAT=y,g' $(UCLIBC_DIR)/.config
71 endif
72 mkdir -p $(TOOL_BUILD_DIR)/uClibc_dev/usr/include
73 mkdir -p $(TOOL_BUILD_DIR)/uClibc_dev/usr/lib
74 mkdir -p $(TOOL_BUILD_DIR)/uClibc_dev/lib
75 $(MAKE1) -C $(UCLIBC_DIR) \
76 PREFIX=$(TOOL_BUILD_DIR)/uClibc_dev/ \
77 DEVEL_PREFIX=/usr/ \
78 RUNTIME_PREFIX=$(TOOL_BUILD_DIR)/uClibc_dev/ \
79 HOSTCC="$(HOSTCC)" \
80 pregen install_dev;
81 touch $(UCLIBC_DIR)/.configured
82
83 $(UCLIBC_DIR)/lib/libc.a: $(UCLIBC_DIR)/.configured $(LIBFLOAT_TARGET)
84 $(MAKE1) -C $(UCLIBC_DIR) \
85 PREFIX= \
86 DEVEL_PREFIX=/ \
87 RUNTIME_PREFIX=/ \
88 HOSTCC="$(HOSTCC)" \
89 all
90 touch -c $(UCLIBC_DIR)/lib/libc.a
91
92 $(STAGING_DIR)/lib/libc.a: $(UCLIBC_DIR)/lib/libc.a
93 $(MAKE1) -C $(UCLIBC_DIR) \
94 PREFIX=$(STAGING_DIR)/ \
95 DEVEL_PREFIX=/ \
96 RUNTIME_PREFIX=/ \
97 install_runtime
98 $(MAKE1) -C $(UCLIBC_DIR) \
99 PREFIX=$(STAGING_DIR)/ \
100 DEVEL_PREFIX=/ \
101 RUNTIME_PREFIX=/ \
102 install_dev
103 # Build the host utils. Need to add an install target...
104 $(MAKE1) -C $(UCLIBC_DIR)/utils \
105 PREFIX=$(STAGING_DIR) \
106 HOSTCC="$(HOSTCC)" \
107 hostutils
108 touch -c $(STAGING_DIR)/lib/libc.a
109
110 ifneq ($(TARGET_DIR),)
111 $(TARGET_DIR)/lib/libc.so.0: $(STAGING_DIR)/lib/libc.a
112 $(MAKE1) -C $(UCLIBC_DIR) \
113 PREFIX=$(TARGET_DIR) \
114 DEVEL_PREFIX=/usr/ \
115 RUNTIME_PREFIX=/ \
116 install_runtime
117 touch -c $(TARGET_DIR)/lib/libc.so.0
118
119 $(TARGET_DIR)/usr/bin/ldd:
120 $(MAKE1) -C $(UCLIBC_DIR) $(TARGET_CONFIGURE_OPTS) \
121 PREFIX=$(TARGET_DIR) utils install_utils
122 touch -c $(TARGET_DIR)/usr/bin/ldd
123
124 UCLIBC_TARGETS=$(TARGET_DIR)/lib/libc.so.0
125 endif
126
127 uclibc-configured: $(UCLIBC_DIR)/.configured
128
129 uclibc: $(STAGING_DIR)/bin/$(REAL_GNU_TARGET_NAME)-gcc $(STAGING_DIR)/lib/libc.a \
130 $(UCLIBC_TARGETS)
131
132 uclibc-source: $(DL_DIR)/$(UCLIBC_SOURCE)
133
134 uclibc-configured-source: uclibc-source
135
136 uclibc-clean:
137 -$(MAKE1) -C $(UCLIBC_DIR) clean
138 rm -f $(UCLIBC_DIR)/.config
139
140 uclibc-dirclean:
141 rm -rf $(UCLIBC_DIR)
142
143 uclibc-target-utils: $(TARGET_DIR)/usr/bin/ldd
144
145 #############################################################
146 #
147 # uClibc for the target just needs its header files
148 # and whatnot installed.
149 #
150 #############################################################
151
152 $(TARGET_DIR)/usr/lib/libc.a: $(STAGING_DIR)/$(REAL_GNU_TARGET_NAME)/lib/libc.a
153 $(MAKE1) -C $(UCLIBC_DIR) \
154 PREFIX=$(TARGET_DIR) \
155 DEVEL_PREFIX=/usr/ \
156 RUNTIME_PREFIX=/ \
157 install_dev
158 touch -c $(TARGET_DIR)/usr/lib/libc.a
159
160 uclibc_target: gcc uclibc $(TARGET_DIR)/usr/lib/libc.a $(TARGET_DIR)/usr/bin/ldd
161
162 uclibc_target-clean:
163 rm -f $(TARGET_DIR)/include
164
165 uclibc_target-dirclean:
166 rm -f $(TARGET_DIR)/include
167
This page took 0.055172 seconds and 5 git commands to generate.