3 # Copyright (C) 2000, 2001 by Lineo, inc.
6 # This program is free software; you can redistribute it and/or modify it under
7 # the terms of the GNU Library General Public License as published by the Free
8 # Software Foundation; either version 2 of the License, or (at your option) any
11 # This program is distributed in the hope that it will be useful, but WITHOUT
12 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
13 # FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more
16 # You should have received a copy of the GNU Library General Public License
17 # along with this program; if not, write to the Free Software Foundation, Inc.,
18 # 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 # Derived in part from the Linux-8086 C library, the GNU C Library, and several
21 # other sundry sources. Files within this library are copyright by their
22 # respective copyright holders.
24 #--------------------------------------------------------
26 #There are a number of configurable options in "Config"
28 #--------------------------------------------------------
33 DIRS = extra ldso libc libcrypt libresolv libutil libm
35 all: headers uClibc_config.h subdirs shared done
39 @echo "You didn't read the README, did you... =)"
40 @echo "Choose a configuration file in extras/Config/ and copy it to ./Config."
45 ifeq ($(strip $(HAVE_SHARED)),true)
46 @$(MAKE) -C libc shared
47 @$(MAKE) -C ldso shared
48 @$(MAKE) -C libcrypt shared
49 @$(MAKE) -C libutil shared
50 @$(MAKE) -C libm shared
51 @$(MAKE) -C libresolv shared
54 @echo Not building shared libraries...
60 @echo Finally finished compiling...
64 @rm -f include/asm include/linux include/bits
65 @if [ $(TARGET_ARCH) = "powerpc" ];then \
66 ln -fs $(KERNEL_SOURCE)/include/asm-ppc include/asm; \
68 if [ $(HAS_MMU) != "true" ]; then \
69 ln -fs $(KERNEL_SOURCE)/include/asm-$(TARGET_ARCH)nommu include/asm;\
71 ln -fs $(KERNEL_SOURCE)/include/asm-$(TARGET_ARCH) include/asm; \
74 @if [ ! -f include/asm/unistd.h ] ; then \
76 echo "The path '$(KERNEL_SOURCE)/include/asm' doesn't exist."; \
77 echo "I bet you didn't set KERNEL_SOURCE, TARGET_ARCH or HAS_MMU in \`Config'"; \
78 echo "correctly. Please edit \`Config' and fix these settings."; \
82 @if [ $(HAS_MMU) != "true" ] && [ $(TARGET_ARCH) = "i386" ] ; then \
83 echo "WARNING: I bet your x86 system really has an MMU, right?"; \
84 echo " malloc and friends won't work unless you fix \`Config'"; \
88 @ln -fs $(KERNEL_SOURCE)/include/linux include/linux
89 @ln -fs ../libc/sysdeps/linux/$(TARGET_ARCH)/bits include/bits
90 (cd include/bits; ln -sf ../../../../../uClibc_config.h uClibc_config.h)
91 $(MAKE) -C libc/sysdeps/linux/$(TARGET_ARCH) headers
93 uClibc_config.h: Makefile Config
94 @echo "/* WARNING!!! AUTO-GENERATED FILE!!! DO NOT EDIT!!! */" > uClibc_config.h
95 @echo "#if !defined __FEATURES_H && !defined __need_uClibc_config_h" >> uClibc_config.h
96 @echo "#error Never include <bits/uClibc_config.h> directly; use <features.h> instead." >> uClibc_config.h
97 @echo "#endif" >> uClibc_config.h
98 @echo "#define linux 1" >> uClibc_config.h
99 @echo "#define __linux__ 1" >> uClibc_config.h
100 @if [ "$(INCLUDE_IPV6)" = "true" ] ; then \
101 echo "#define __UCLIBC_HAS_IPV6__ 1" >> uClibc_config.h ; \
103 echo "#undef __UCLIBC_HAS_IPV6__" >> uClibc_config.h ; \
105 @if [ "$(HAS_MMU)" = "true" ] ; then \
106 echo "#define __UCLIBC_HAS_MMU__ 1" >> uClibc_config.h ; \
108 echo "#undef __UCLIBC_HAS_MMU__" >> uClibc_config.h ; \
110 @if [ "$(HAS_FLOATING_POINT)" = "true" ] ; then \
111 echo "#define __UCLIBC_HAS_FLOATS__ 1" >> uClibc_config.h ; \
113 echo "#undef __UCLIBC_HAS_FLOATS__" >> uClibc_config.h ; \
115 @if [ "$(HAS_LIBM_FLOAT)" = "true" ] ; then \
116 echo "#define __UCLIBC_HAS_LIBM_FLOAT__ 1" >> uClibc_config.h ; \
118 echo "#undef __UCLIBC_HAS_LIBM_FLOAT__" >> uClibc_config.h ; \
120 @if [ "$(HAS_LIBM_DOUBLE)" = "true" ] ; then \
121 echo "#define __UCLIBC_HAS_LIBM_DOUBLE__ 1" >> uClibc_config.h ; \
123 echo "#undef __UCLIBC_HAS_LIBM_DOUBLE__" >> uClibc_config.h ; \
125 @if [ "$(HAS_LIBM_LONG_DOUBLE)" = "true" ] ; then \
126 echo "#define __UCLIBC_HAS_LIBM_LONG_DOUBLE__ 1" >> uClibc_config.h ; \
128 echo "#undef __UCLIBC_HAS_LIBM_LONG_DOUBLE__" >> uClibc_config.h ; \
130 @if [ "$(HAS_LONG_LONG)" = "true" ] ; then \
131 echo "#define __UCLIBC_HAS_LONG_LONG__ 1" >> uClibc_config.h ; \
133 echo "#undef __UCLIBC_HAS_LONG_LONG__" >> uClibc_config.h ; \
135 @if [ "$(HAS_LOCALE)" = "true" ] ; then \
136 echo "#define __UCLIBC_HAS_LOCALE__ 1" >> uClibc_config.h ; \
137 echo "#define __UCLIBC_LOCALE_DIR \""$(LOCALE_DIR)"\"" >> uClibc_config.h ; \
139 echo "#undef __UCLIBC_HAS_LOCALE__" >> uClibc_config.h ; \
141 @if [ "$(HAVE_ELF)" = "false" ] ; then \
142 echo "#undef HAVE_ELF" >> uClibc_config.h ; \
144 echo "#define HAVE_ELF 1" >> uClibc_config.h ; \
146 @if [ "$(HAVE_SHARED)" = "false" ] ; then \
147 echo "#undef HAVE_SHARED" >> uClibc_config.h ; \
149 echo "#define HAVE_SHARED 1" >> uClibc_config.h ; \
151 @if [ "$(TARGET_ARCH)" = "sh" ] ; then \
152 echo "#define NO_UNDERSCORES 1" >> uClibc_config.h ; \
154 echo "#undef NO_UNDERSCORES" >> uClibc_config.h ; \
156 @if [ "$(INCLUDE_RPC)" = "true" ] ; then \
157 echo "#define __UCLIBC_HAS_RPC__ 1" >> uClibc_config.h ; \
159 echo "#undef __UCLIBC_HAS_RPC__" >> uClibc_config.h ; \
161 @if [ "$(UNIFIED_SYSCALL)" = "true" ] ; then \
162 echo "#define __UCLIBC_USE_UNIFIED_SYSCALL__ 1" >> uClibc_config.h ; \
164 echo "#undef __UCLIBC_USE_UNIFIED_SYSCALL__" >> uClibc_config.h ; \
167 subdirs: $(patsubst %, _dir_%, $(DIRS))
169 $(patsubst %, _dir_%, $(DIRS)) : dummy
170 $(MAKE) -C $(patsubst _dir_%, %, $@)
175 install: install_dev install_runtime install_gcc
178 # Installs header files and development library links.
180 install -d $(PREFIX)$(DEVEL_PREFIX)/lib
181 install -m 644 lib/*.[ao] $(PREFIX)$(DEVEL_PREFIX)/lib/
182 install -d $(PREFIX)$(DEVEL_PREFIX)/include
183 install -d $(PREFIX)$(DEVEL_PREFIX)/usr/lib
184 find include/ -name '*.h' -depth -follow -exec install \
185 -D -m 644 {} $(PREFIX)$(DEVEL_PREFIX)/'{}' ';'
186 ifeq ($(strip $(HAVE_SHARED)),true)
187 find lib/ -type l -name '*.so' -exec cp -a {} $(PREFIX)$(DEVEL_PREFIX)/lib ';'
191 # Installs run-time libraries and helper apps onto the host system
192 # allowing cross development. If you want to deploy to a target
193 # system, use the "install_target" target instead...
195 ifeq ($(strip $(HAVE_SHARED)),true)
196 install -d $(PREFIX)$(DEVEL_PREFIX)/lib
197 install -d $(PREFIX)$(DEVEL_PREFIX)/bin
198 install -m 644 lib/lib*-$(MAJOR_VERSION).$(MINOR_VERSION).so $(PREFIX)$(DEVEL_PREFIX)/lib
199 cp -a lib/*.so.* $(PREFIX)$(DEVEL_PREFIX)/lib
200 install -m 755 ldso/util/ldd $(PREFIX)$(DEVEL_PREFIX)/bin
201 install -m 755 ldso/util/readelf $(PREFIX)$(DEVEL_PREFIX)/bin
202 install -d $(PREFIX)$(DEVEL_PREFIX)/bin
203 install -d $(PREFIX)$(DEVEL_PREFIX)/usr/bin
204 ln -fs $(DEVEL_PREFIX)/bin/ldd $(PREFIX)$(SYSTEM_DEVEL_PREFIX)/usr/bin/$(TARGET_ARCH)-uclibc-ldd
205 ln -fs $(DEVEL_PREFIX)/bin/readelf $(PREFIX)$(SYSTEM_DEVEL_PREFIX)/usr/bin/$(TARGET_ARCH)-uclibc-readelf
206 if [ -x lib/ld-uClibc-$(MAJOR_VERSION).$(MINOR_VERSION).so ] ; then \
207 install -m 755 lib/ld-uClibc-$(MAJOR_VERSION).$(MINOR_VERSION).so $(PREFIX)$(DEVEL_PREFIX)/lib; \
208 ln -s $(PREFIX)$(DEVEL_PREFIX)/lib/ld-uClibc-$(MAJOR_VERSION).$(MINOR_VERSION).so \
209 $(SHARED_LIB_LOADER_PATH)/$(UCLIBC_LDSO) || true; \
211 if [ -x ldso/util/ldconfig ] ; then \
212 install -d $(PREFIX)$(DEVEL_PREFIX)/etc; \
213 install -m 755 ldso/util/ldconfig $(PREFIX)$(DEVEL_PREFIX)/bin; \
214 ln -fs $(DEVEL_PREFIX)/sbin/ldconfig $(PREFIX)$(SYSTEM_DEVEL_PREFIX)/usr/bin/$(TARGET_ARCH)-uclibc-ldconfig; \
219 $(MAKE) -C extra/gcc-uClibc install
222 # Installs run-time libraries and helper apps in preparation for
223 # deploying onto a target system, but installed below wherever
224 # $PREFIX is set to, allowing you to package up the result for
225 # deployment onto your target system.
227 ifeq ($(strip $(HAVE_SHARED)),true)
228 install -d $(PREFIX)/lib
229 install -d $(PREFIX)/sbin
230 install -d $(PREFIX)/usr/bin
231 install -m 644 lib/lib*-$(MAJOR_VERSION).$(MINOR_VERSION).so $(PREFIX)/lib
232 cp -a lib/*.so.* $(PREFIX)/lib
233 install -m 755 ldso/util/ldd $(PREFIX)/usr/bin
234 install -m 755 ldso/util/readelf $(PREFIX)/usr/bin
235 if [ -x lib/ld-uClibc-$(MAJOR_VERSION).$(MINOR_VERSION).so ] ; then \
236 install -m 755 lib/ld-uClibc-$(MAJOR_VERSION).$(MINOR_VERSION).so $(PREFIX)/lib; \
237 ln -s $(PREFIX)/lib/ld-uClibc-$(MAJOR_VERSION).$(MINOR_VERSION).so \
238 $(SHARED_LIB_LOADER_PATH)/$(UCLIBC_LDSO) || true; \
240 if [ -x ldso/util/ldconfig ] ; then \
241 install -d $(PREFIX)/etc; \
242 install -m 755 ldso/util/ldconfig $(PREFIX)/sbin; \
247 @rm -rf tmp lib include/bits/uClibc_config.h uClibc_config.h
248 - find include -type l -exec rm -f {} \;
249 - find . \( -name \*.o -o -name \*.a -o -name \*.so -o -name core -o -name .\#\* \) -exec rm -f {} \;
250 $(MAKE) -C ldso clean
251 $(MAKE) -C libc/unistd clean
252 $(MAKE) -C libc/sysdeps/linux/common clean
253 $(MAKE) -C libc/sysdeps/linux/$(TARGET_ARCH) clean
254 $(MAKE) -C extra/gcc-uClibc clean
256 .PHONY: dummy subdirs