make clean should remove openwrt-images
[openwrt.git] / obsolete-buildroot / make / uclibc.mk
1 #############################################################
2 #
3 # uClibc (the C library)
4 #
5 #############################################################
6 ifneq ($(strip $(USE_UCLIBC_SNAPSHOT)),)
7 # Be aware that this changes daily....
8 UCLIBC_DIR:=$(BUILD_DIR)/uClibc
9 UCLIBC_SOURCE:=uClibc-$(strip $(USE_UCLIBC_SNAPSHOT)).tar.bz2
10 UCLIBC_SITE:=http://www.uclibc.org/downloads/snapshots
11 else
12 UCLIBC_DIR:=$(BUILD_DIR)/uClibc-0.9.27
13 UCLIBC_SOURCE:=uClibc-0.9.27.tar.bz2
14 UCLIBC_SITE:=http://www.uclibc.org/downloads
15 endif
16
17 UCLIBC_TARGET_ARCH:=$(shell echo $(ARCH) | sed -e s'/-.*//' \
18 -e 's/i.86/i386/' \
19 -e 's/sparc.*/sparc/' \
20 -e 's/arm.*/arm/g' \
21 -e 's/m68k.*/m68k/' \
22 -e 's/ppc/powerpc/g' \
23 -e 's/v850.*/v850/g' \
24 -e 's/sh64/sh/' \
25 -e 's/sh[234]/sh/' \
26 -e 's/mips.*/mips/' \
27 -e 's/mipsel.*/mips/' \
28 -e 's/cris.*/cris/' \
29 )
30
31
32 $(DL_DIR)/$(UCLIBC_SOURCE):
33 $(WGET) -P $(DL_DIR) $(UCLIBC_SITE)/$(UCLIBC_SOURCE)
34
35 $(UCLIBC_DIR)/.unpacked: $(DL_DIR)/$(UCLIBC_SOURCE)
36 ifeq ($(SOFT_FLOAT),true)
37 # Make sure we have a soft float specs file for this arch
38 if [ ! -f $(SOURCE_DIR)/specs-$(ARCH)-soft-float ] ; then \
39 echo soft float configured but no specs file for this arch ; \
40 /bin/false ; \
41 fi;
42 endif
43 bzcat $(DL_DIR)/$(UCLIBC_SOURCE) | tar -C $(BUILD_DIR) -xvf -
44 #(cd $(BUILD_DIR) ; ln -s $(DL_DIR)/uClibc)
45 #-mkdir $(UCLIBC_DIR)
46 #(cd $(DL_DIR)/uClibc && tar cf - .) | (cd $(UCLIBC_DIR) && tar xvfp - )
47 ifeq ($(strip $(USE_UCLIBC_LDSO_0_9_24)),true)
48 $(SOURCE_DIR)/patch-kernel.sh $(UCLIBC_DIR) $(SOURCE_DIR) uClibc-ldso-0.9.24.patch
49 endif
50 touch $(UCLIBC_DIR)/.unpacked
51
52 $(UCLIBC_DIR)/.configured: $(UCLIBC_DIR)/.unpacked $(LINUX_DIR)/.configured
53 $(SED) 's,^CROSS=.*,CROSS=$(TARGET_CROSS),g' $(UCLIBC_DIR)/Rules.mak
54 ifeq ($(ENABLE_LOCALE),true)
55 cp $(SOURCE_DIR)/uClibc.config-locale $(UCLIBC_DIR)/.config
56 else
57 cp $(SOURCE_DIR)/uClibc.config $(UCLIBC_DIR)/.config
58 endif
59 $(SED) 's,^.*TARGET_$(UCLIBC_TARGET_ARCH).*,TARGET_$(UCLIBC_TARGET_ARCH)=y,g' \
60 $(UCLIBC_DIR)/.config
61 $(SED) 's,^TARGET_ARCH.*,TARGET_ARCH=\"$(UCLIBC_TARGET_ARCH)\",g' $(UCLIBC_DIR)/.config
62 $(SED) 's,^KERNEL_SOURCE=.*,KERNEL_SOURCE=\"$(LINUX_DIR)\",g' \
63 $(UCLIBC_DIR)/.config
64 $(SED) 's,^RUNTIME_PREFIX=.*,RUNTIME_PREFIX=\"/\",g' \
65 $(UCLIBC_DIR)/.config
66 $(SED) 's,^DEVEL_PREFIX=.*,DEVEL_PREFIX=\"/usr/\",g' \
67 $(UCLIBC_DIR)/.config
68 $(SED) 's,^SHARED_LIB_LOADER_PREFIX=.*,SHARED_LIB_LOADER_PREFIX=\"/lib\",g' \
69 $(UCLIBC_DIR)/.config
70 ifeq ($(strip $(BUILD_WITH_LARGEFILE)),true)
71 $(SED) 's,^.*UCLIBC_HAS_LFS.*,UCLIBC_HAS_LFS=y,g' $(UCLIBC_DIR)/.config
72 else
73 $(SED) 's,^.*UCLIBC_HAS_LFS.*,UCLIBC_HAS_LFS=n,g' $(UCLIBC_DIR)/.config
74 endif
75 $(SED) 's,.*UCLIBC_HAS_WCHAR.*,UCLIBC_HAS_WCHAR=y,g' $(UCLIBC_DIR)/.config
76 ifeq ($(strip $(SOFT_FLOAT)),true)
77 $(SED) 's,.*HAS_FPU.*,HAS_FPU=n\nUCLIBC_HAS_FLOATS=y\nUCLIBC_HAS_SOFT_FLOAT=y,g' $(UCLIBC_DIR)/.config
78 endif
79 mkdir -p $(TOOL_BUILD_DIR)/uClibc_dev/usr/include
80 mkdir -p $(TOOL_BUILD_DIR)/uClibc_dev/usr/lib
81 mkdir -p $(TOOL_BUILD_DIR)/uClibc_dev/lib
82 $(MAKE) -C $(UCLIBC_DIR) \
83 PREFIX=$(TOOL_BUILD_DIR)/uClibc_dev/ \
84 DEVEL_PREFIX=/usr/ \
85 RUNTIME_PREFIX=$(TOOL_BUILD_DIR)/uClibc_dev/ \
86 HOSTCC="$(HOSTCC)" \
87 pregen install_dev;
88 touch $(UCLIBC_DIR)/.configured
89
90 $(UCLIBC_DIR)/lib/libc.a: $(UCLIBC_DIR)/.configured $(LIBFLOAT_TARGET)
91 $(MAKE) -C $(UCLIBC_DIR) \
92 PREFIX= \
93 DEVEL_PREFIX=$(REAL_GNU_TARGET_NAME)/ \
94 RUNTIME_PREFIX=/ \
95 HOSTCC="$(HOSTCC)" \
96 all
97 ifeq ($(strip $(USE_UCLIBC_LDSO_0_9_24)),true)
98 #rm -rf $(UCLIBC_DIR)/ld-uClibc* $(UCLIBC_DIR)/libdl*
99 $(MAKE) -C $(UCLIBC_DIR)/ldso-0.9.24 \
100 PREFIX= \
101 DEVEL_PREFIX=$(REAL_GNU_TARGET_NAME)/ \
102 RUNTIME_PREFIX=/ \
103 HOSTCC="$(HOSTCC)" \
104 all shared
105 endif
106
107 $(STAGING_DIR)/$(REAL_GNU_TARGET_NAME)/lib/libc.a: $(UCLIBC_DIR)/lib/libc.a
108 $(MAKE) -C $(UCLIBC_DIR) \
109 PREFIX=$(STAGING_DIR)/ \
110 DEVEL_PREFIX=$(REAL_GNU_TARGET_NAME)/ \
111 RUNTIME_PREFIX=$(REAL_GNU_TARGET_NAME)/ \
112 install_runtime
113 $(MAKE) -C $(UCLIBC_DIR) \
114 PREFIX=$(STAGING_DIR)/ \
115 DEVEL_PREFIX=$(REAL_GNU_TARGET_NAME)/ \
116 RUNTIME_PREFIX=$(STAGING_DIR)/$(REAL_GNU_TARGET_NAME)/ \
117 install_dev
118 $(MAKE) -C $(UCLIBC_DIR) \
119 PREFIX=$(STAGING_DIR) \
120 HOSTCC="$(HOSTCC)" \
121 utils install_utils
122 # Clean up the host compiled utils...
123 $(MAKE) -C $(UCLIBC_DIR)/utils clean
124
125 ifneq ($(TARGET_DIR),)
126 $(TARGET_DIR)/lib/libc.so.0: $(STAGING_DIR)/$(REAL_GNU_TARGET_NAME)/lib/libc.a
127 $(MAKE) -C $(UCLIBC_DIR) \
128 PREFIX=$(TARGET_DIR) \
129 DEVEL_PREFIX=/usr/ \
130 RUNTIME_PREFIX=/ \
131 install_runtime
132
133 $(TARGET_DIR)/usr/bin/ldd: $(TARGET_DIR)/lib/libc.so.0
134 $(MAKE) -C $(UCLIBC_DIR) $(TARGET_CONFIGURE_OPTS) \
135 PREFIX=$(TARGET_DIR) utils install_utils
136
137 UCLIBC_TARGETS=$(TARGET_DIR)/lib/libc.so.0 $(TARGET_DIR)/usr/bin/ldd
138 endif
139
140 uclibc-configured: $(UCLIBC_DIR)/.configured
141
142 uclibc: $(STAGING_DIR)/bin/$(REAL_GNU_TARGET_NAME)-gcc $(STAGING_DIR)/$(REAL_GNU_TARGET_NAME)/lib/libc.a \
143 $(UCLIBC_TARGETS)
144
145 uclibc-source: $(DL_DIR)/$(UCLIBC_SOURCE)
146
147 uclibc-configured-source: uclibc-source
148
149 uclibc-clean:
150 -$(MAKE) -C $(UCLIBC_DIR) clean
151 rm -f $(UCLIBC_DIR)/.config
152
153 uclibc-dirclean:
154 rm -rf $(UCLIBC_DIR)
155
156
157
158
159 #############################################################
160 #
161 # uClibc for the target just needs its header files
162 # and whatnot installed.
163 #
164 #############################################################
165
166 $(TARGET_DIR)/usr/lib/libc.a: $(STAGING_DIR)/$(REAL_GNU_TARGET_NAME)/lib/libc.a
167 $(MAKE) -C $(UCLIBC_DIR) \
168 PREFIX=$(TARGET_DIR) \
169 DEVEL_PREFIX=/usr/ \
170 RUNTIME_PREFIX=/ \
171 install_dev
172
173 ifeq ($(GCC_2_95_TOOLCHAIN),true)
174 uclibc_target: gcc2_95 uclibc $(TARGET_DIR)/usr/lib/libc.a
175 else
176 uclibc_target: gcc3_3 uclibc $(TARGET_DIR)/usr/lib/libc.a
177 endif
178
179 uclibc_target-clean:
180 rm -f $(TARGET_DIR)/include
181
182 uclibc_target-dirclean:
183 rm -f $(TARGET_DIR)/include
184
This page took 0.051366 seconds and 5 git commands to generate.