3 # Copyright (C) 2000 by Lineo, inc.
4 # Copyright (C) 2000,2001 Erik Andersen <andersen@uclibc.org>
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
21 # Derived in part from the Linux-8086 C library, the GNU C Library, and several
22 # other sundry sources. Files within this library are copyright by their
23 # respective copyright holders.
25 #--------------------------------------------------------
27 #There are a number of configurable options in "Config"
29 #--------------------------------------------------------
34 DIRS = extra ldso libc libcrypt libresolv libutil libm #libpthread
36 all: headers uClibc_config.h subdirs shared done
40 @echo "You didn't read the README, did you... =)"
41 @echo "Choose a configuration file in extras/Config/ and copy it to ./Config"
46 ifeq ($(strip $(HAVE_SHARED)),true)
47 @$(MAKE) -C libc shared
48 @$(MAKE) -C ldso shared
49 @$(MAKE) -C libcrypt shared
50 @$(MAKE) -C libresolv shared
51 @$(MAKE) -C libutil shared
52 @$(MAKE) -C libm shared
53 #@$(MAKE) -C libpthread shared
56 @echo Not building shared libraries...
62 @echo Finally finished compiling...
66 @rm -f include/asm include/linux include/bits
67 @if [ $(TARGET_ARCH) = "powerpc" ];then \
68 ln -fs $(KERNEL_SOURCE)/include/asm-ppc include/asm; \
69 elif [ $(TARGET_ARCH) = "v850" ];then \
70 ln -fs $(KERNEL_SOURCE)/include/asm-v850 include/asm; \
72 if [ $(HAS_MMU) != "true" ]; then \
73 ln -fs $(KERNEL_SOURCE)/include/asm-$(TARGET_ARCH)nommu include/asm;\
75 ln -fs $(KERNEL_SOURCE)/include/asm-$(TARGET_ARCH) include/asm; \
78 @if [ ! -f include/asm/unistd.h ] ; then \
81 echo "The path '$(KERNEL_SOURCE)/include/asm' doesn't exist."; \
82 echo "I bet you didn't set KERNEL_SOURCE, TARGET_ARCH or HAS_MMU in \`Config'"; \
83 echo "correctly. Please edit \`Config' and fix these settings."; \
87 @if [ $(HAS_MMU) != "true" ] && [ $(TARGET_ARCH) = "i386" ] ; then \
89 echo "WARNING: I bet your x86 system really has an MMU, right?"; \
90 echo " malloc and friends won't work unless you fix \`Config'"; \
94 @ln -fs $(KERNEL_SOURCE)/include/linux include/linux
95 @ln -fs ../libc/sysdeps/linux/$(TARGET_ARCH)/bits include/bits
96 (cd include/bits && ln -sf ../../../../../uClibc_config.h uClibc_config.h)
97 $(MAKE) -C libc/sysdeps/linux/$(TARGET_ARCH) headers
99 uClibc_config.h: Makefile Config
100 @echo "/* WARNING!!! AUTO-GENERATED FILE!!! DO NOT EDIT!!! */" > uClibc_config.h
101 @echo "#if !defined __FEATURES_H && !defined __need_uClibc_config_h" >> uClibc_config.h
102 @echo "#error Never include <bits/uClibc_config.h> directly; use <features.h> instead." >> uClibc_config.h
103 @echo "#endif" >> uClibc_config.h
104 @echo "#define linux 1" >> uClibc_config.h
105 @echo "#define __linux__ 1" >> uClibc_config.h
106 @if [ "$(INCLUDE_IPV6)" = "true" ] ; then \
107 echo "#define __UCLIBC_HAS_IPV6__ 1" >> uClibc_config.h ; \
109 echo "#undef __UCLIBC_HAS_IPV6__" >> uClibc_config.h ; \
111 @if [ "$(HAS_MMU)" = "true" ] ; then \
112 echo "#define __UCLIBC_HAS_MMU__ 1" >> uClibc_config.h ; \
114 echo "#undef __UCLIBC_HAS_MMU__" >> uClibc_config.h ; \
116 @if [ "$(HAS_FLOATING_POINT)" = "true" ] ; then \
117 echo "#define __UCLIBC_HAS_FLOATS__ 1" >> uClibc_config.h ; \
119 echo "#undef __UCLIBC_HAS_FLOATS__" >> uClibc_config.h ; \
121 @if [ "$(HAS_LONG_LONG)" = "true" ] ; then \
122 echo "#define __UCLIBC_HAS_LONG_LONG__ 1" >> uClibc_config.h ; \
124 echo "#undef __UCLIBC_HAS_LONG_LONG__" >> uClibc_config.h ; \
126 @if [ "$(HAS_LOCALE)" = "true" ] ; then \
127 echo "#define __UCLIBC_HAS_LOCALE__ 1" >> uClibc_config.h ; \
128 echo "#define __UCLIBC_LOCALE_DIR \""$(LOCALE_DIR)"\"" >> uClibc_config.h ; \
130 echo "#undef __UCLIBC_HAS_LOCALE__" >> uClibc_config.h ; \
132 @if [ "$(HAVE_ELF)" = "false" ] ; then \
133 echo "#undef HAVE_ELF" >> uClibc_config.h ; \
135 echo "#define HAVE_ELF 1" >> uClibc_config.h ; \
137 @if [ "$(HAVE_SHARED)" = "false" ] ; then \
138 echo "#undef HAVE_SHARED" >> uClibc_config.h ; \
140 echo "#define HAVE_SHARED 1" >> uClibc_config.h ; \
142 @if [ "$(TARGET_ARCH)" = "sh" ] ; then \
143 echo "#define NO_UNDERSCORES 1" >> uClibc_config.h ; \
145 echo "#undef NO_UNDERSCORES" >> uClibc_config.h ; \
147 @if [ "$(INCLUDE_RPC)" = "true" ] ; then \
148 echo "#define __UCLIBC_HAS_RPC__ 1" >> uClibc_config.h ; \
150 echo "#undef __UCLIBC_HAS_RPC__" >> uClibc_config.h ; \
152 @if [ "$(UNIFIED_SYSCALL)" = "true" ] ; then \
153 echo "#define __UCLIBC_USE_UNIFIED_SYSCALL__ 1" >> uClibc_config.h ; \
155 echo "#undef __UCLIBC_USE_UNIFIED_SYSCALL__" >> uClibc_config.h ; \
157 @echo "#define C_SYMBOL_PREFIX "\""$(C_SYMBOL_PREFIX)"\" >> uClibc_config.h
158 @if [ "$(DOLFS)" = "true" ] ; then \
159 echo "#define __UCLIBC_HAVE_LFS__ 1" >> uClibc_config.h ; \
161 echo "#undef __UCLIBC_HAVE_LFS__" >> uClibc_config.h ; \
164 subdirs: $(patsubst %, _dir_%, $(DIRS))
166 $(patsubst %, _dir_%, $(DIRS)) : dummy
167 $(MAKE) -C $(patsubst _dir_%, %, $@)
172 install: install_dev install_runtime install_gcc
175 # Installs header files and development library links.
177 install -d $(PREFIX)$(DEVEL_PREFIX)/lib
178 install -m 644 lib/*.[ao] $(PREFIX)$(DEVEL_PREFIX)/lib/
179 install -d $(PREFIX)$(DEVEL_PREFIX)/usr/lib
180 install -d $(PREFIX)$(DEVEL_PREFIX)/include
181 tar -chO include | tar -xC $(PREFIX)$(DEVEL_PREFIX);
182 chmod 755 `find $(PREFIX)$(DEVEL_PREFIX) -type d`
183 chmod 644 `find $(PREFIX)$(DEVEL_PREFIX)/include -name '*.h'`
184 (NAME=`whoami`; chown -R $$NAME.$$NAME $(PREFIX)$(DEVEL_PREFIX))
185 ifeq ($(strip $(HAVE_SHARED)),true)
186 find lib/ -type l -name '*.so' -exec cp -a {} $(PREFIX)$(DEVEL_PREFIX)/lib ';'
190 # Installs run-time libraries and helper apps onto the host system
191 # allowing cross development. If you want to deploy to a target
192 # system, use the "install_target" target instead...
194 ifeq ($(strip $(HAVE_SHARED)),true)
195 install -d $(PREFIX)$(DEVEL_PREFIX)/lib
196 install -d $(PREFIX)$(DEVEL_PREFIX)/bin
197 install -m 644 lib/lib*-$(MAJOR_VERSION).$(MINOR_VERSION).so $(PREFIX)$(DEVEL_PREFIX)/lib
198 cp -a lib/*.so.* $(PREFIX)$(DEVEL_PREFIX)/lib
199 install -m 755 ldso/util/ldd $(PREFIX)$(DEVEL_PREFIX)/bin
200 install -m 755 ldso/util/readelf $(PREFIX)$(DEVEL_PREFIX)/bin
201 install -d $(PREFIX)$(SYSTEM_DEVEL_PREFIX)/bin
202 ln -fs $(DEVEL_PREFIX)/bin/ldd $(PREFIX)$(SYSTEM_DEVEL_PREFIX)/bin/$(TARGET_ARCH)-uclibc-ldd
203 ln -fs $(DEVEL_PREFIX)/bin/readelf $(PREFIX)$(SYSTEM_DEVEL_PREFIX)/bin/$(TARGET_ARCH)-uclibc-readelf
204 @if [ -x lib/ld-uClibc-$(MAJOR_VERSION).$(MINOR_VERSION).so ] ; then \
206 install -m 755 lib/ld-uClibc-$(MAJOR_VERSION).$(MINOR_VERSION).so $(PREFIX)$(DEVEL_PREFIX)/lib; \
207 mkdir -p $(PREFIX)$(SHARED_LIB_LOADER_PATH); \
208 ln -s $(DEVEL_PREFIX)/lib/ld-uClibc-$(MAJOR_VERSION).$(MINOR_VERSION).so \
209 $(PREFIX)$(SHARED_LIB_LOADER_PATH)/$(UCLIBC_LDSO) || true; \
211 @if [ -x ldso/util/ldconfig ] ; then \
213 install -d $(PREFIX)$(DEVEL_PREFIX)/etc; \
214 install -m 755 ldso/util/ldconfig $(PREFIX)$(DEVEL_PREFIX)/bin; \
215 ln -fs $(DEVEL_PREFIX)/sbin/ldconfig $(PREFIX)$(SYSTEM_DEVEL_PREFIX)/bin/$(TARGET_ARCH)-uclibc-ldconfig; \
220 $(MAKE) -C extra/gcc-uClibc install
223 # Installs run-time libraries and helper apps in preparation for
224 # deploying onto a target system, but installed below wherever
225 # $PREFIX is set to, allowing you to package up the result for
226 # deployment onto your target system.
228 ifeq ($(strip $(HAVE_SHARED)),true)
229 install -d $(PREFIX)$(TARGET_PREFIX)/lib
230 install -d $(PREFIX)$(TARGET_PREFIX)/sbin
231 install -d $(PREFIX)$(TARGET_PREFIX)/usr/bin
232 install -m 644 lib/lib*-$(MAJOR_VERSION).$(MINOR_VERSION).so $(PREFIX)$(TARGET_PREFIX)/lib
233 cp -a lib/*.so.* $(PREFIX)$(TARGET_PREFIX)/lib
234 install -m 755 ldso/util/ldd $(PREFIX)$(TARGET_PREFIX)/usr/bin
235 install -m 755 ldso/util/readelf $(PREFIX)$(TARGET_PREFIX)/usr/bin
236 @if [ -x lib/ld-uClibc-$(MAJOR_VERSION).$(MINOR_VERSION).so ] ; then \
238 install -m 755 lib/ld-uClibc-$(MAJOR_VERSION).$(MINOR_VERSION).so $(PREFIX)$(TARGET_PREFIX)/lib; \
239 mkdir -p $(PREFIX)$(SHARED_LIB_LOADER_PATH); \
240 ln -s $(TARGET_PREFIX)/lib/ld-uClibc-$(MAJOR_VERSION).$(MINOR_VERSION).so \
241 $(PREFIX)$(SHARED_LIB_LOADER_PATH)/$(UCLIBC_LDSO) || true; \
243 @if [ -x ldso/util/ldconfig ] ; then \
245 install -d $(PREFIX)$(TARGET_PREFIX)/etc; \
246 install -m 755 ldso/util/ldconfig $(PREFIX)$(TARGET_PREFIX)/sbin; \
251 @rm -rf tmp lib include/bits/uClibc_config.h uClibc_config.h
252 - find include -type l -exec rm -f {} \;
253 - find . \( -name \*.o -o -name \*.a -o -name \*.so -o -name core -o -name .\#\* \) -exec rm -f {} \;
254 $(MAKE) -C test clean
255 $(MAKE) -C ldso clean
256 $(MAKE) -C libc/unistd clean
257 $(MAKE) -C libc/sysdeps/linux/common clean
258 $(MAKE) -C libc/sysdeps/linux/$(TARGET_ARCH) clean
259 $(MAKE) -C extra/gcc-uClibc clean
261 dist release: distclean
263 rm -rf uClibc-$(VERSION); \
264 cp -a uClibc uClibc-$(VERSION); \
266 find uClibc-$(VERSION)/ -type d \
268 -exec rm -rf {} \; ; \
270 tar -cvzf uClibc-$(VERSION).tar.gz --exclude CVS uClibc-$(VERSION)/;
272 .PHONY: dummy subdirs