3 # Copyright (C) 2000 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
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 then run"
42 @echo " ln -s ./extra/Configs/Config.<arch> ./Config"
47 ifeq ($(strip $(HAVE_SHARED)),true)
48 @$(MAKE) -C libc shared
49 @$(MAKE) -C ldso shared
50 @$(MAKE) -C libcrypt shared
51 @$(MAKE) -C libresolv shared
52 @$(MAKE) -C libutil shared
53 @$(MAKE) -C libm shared
54 #@$(MAKE) -C libpthread shared
57 @echo Not building shared libraries...
63 @echo Finally finished compiling...
67 @rm -f include/asm include/linux include/bits
68 @if [ $(TARGET_ARCH) = "powerpc" ];then \
69 ln -fs $(KERNEL_SOURCE)/include/asm-ppc include/asm; \
70 elif [ $(TARGET_ARCH) = "v850" ];then \
71 ln -fs $(KERNEL_SOURCE)/include/asm-v850 include/asm; \
73 if [ $(HAS_MMU) != "true" ]; then \
74 ln -fs $(KERNEL_SOURCE)/include/asm-$(TARGET_ARCH)nommu include/asm;\
76 ln -fs $(KERNEL_SOURCE)/include/asm-$(TARGET_ARCH) include/asm; \
79 @if [ ! -f include/asm/unistd.h ] ; then \
82 echo "The path '$(KERNEL_SOURCE)/include/asm' doesn't exist."; \
83 echo "I bet you didn't set KERNEL_SOURCE, TARGET_ARCH or HAS_MMU in \`Config'"; \
84 echo "correctly. Please edit \`Config' and fix these settings."; \
88 @if [ $(HAS_MMU) != "true" ] && [ $(TARGET_ARCH) = "i386" ] ; then \
90 echo "WARNING: I bet your x86 system really has an MMU, right?"; \
91 echo " malloc and friends won't work unless you fix \`Config'"; \
95 @ln -fs $(KERNEL_SOURCE)/include/linux include/linux
96 @ln -fs ../libc/sysdeps/linux/$(TARGET_ARCH)/bits include/bits
97 (cd include/bits && ln -sf ../../../../../uClibc_config.h uClibc_config.h)
98 $(MAKE) -C libc/sysdeps/linux/$(TARGET_ARCH) headers
100 uClibc_config.h: Makefile Config
101 @echo "/* WARNING!!! AUTO-GENERATED FILE!!! DO NOT EDIT!!! */" > uClibc_config.h
102 @echo "#if !defined __FEATURES_H && !defined __need_uClibc_config_h" >> uClibc_config.h
103 @echo "#error Never include <bits/uClibc_config.h> directly; use <features.h> instead." >> uClibc_config.h
104 @echo "#endif" >> uClibc_config.h
105 @echo "#define linux 1" >> uClibc_config.h
106 @echo "#define __linux__ 1" >> uClibc_config.h
107 @if [ "$(INCLUDE_IPV6)" = "true" ] ; then \
108 echo "#define __UCLIBC_HAS_IPV6__ 1" >> uClibc_config.h ; \
110 echo "#undef __UCLIBC_HAS_IPV6__" >> uClibc_config.h ; \
112 @if [ "$(HAS_MMU)" = "true" ] ; then \
113 echo "#define __UCLIBC_HAS_MMU__ 1" >> uClibc_config.h ; \
115 echo "#undef __UCLIBC_HAS_MMU__" >> uClibc_config.h ; \
117 @if [ "$(HAS_FLOATING_POINT)" = "true" ] ; then \
118 echo "#define __UCLIBC_HAS_FLOATS__ 1" >> uClibc_config.h ; \
120 echo "#undef __UCLIBC_HAS_FLOATS__" >> uClibc_config.h ; \
122 @if [ "$(HAS_LONG_LONG)" = "true" ] ; then \
123 echo "#define __UCLIBC_HAS_LONG_LONG__ 1" >> uClibc_config.h ; \
125 echo "#undef __UCLIBC_HAS_LONG_LONG__" >> uClibc_config.h ; \
127 @if [ "$(HAS_LOCALE)" = "true" ] ; then \
128 echo "#define __UCLIBC_HAS_LOCALE__ 1" >> uClibc_config.h ; \
129 echo "#define __UCLIBC_LOCALE_DIR \""$(LOCALE_DIR)"\"" >> uClibc_config.h ; \
131 echo "#undef __UCLIBC_HAS_LOCALE__" >> uClibc_config.h ; \
133 @if [ "$(HAVE_ELF)" = "false" ] ; then \
134 echo "#undef HAVE_ELF" >> uClibc_config.h ; \
136 echo "#define HAVE_ELF 1" >> uClibc_config.h ; \
138 @if [ "$(HAVE_SHARED)" = "false" ] ; then \
139 echo "#undef HAVE_SHARED" >> uClibc_config.h ; \
141 echo "#define HAVE_SHARED 1" >> uClibc_config.h ; \
143 @if [ "$(TARGET_ARCH)" = "sh" ] ; then \
144 echo "#define NO_UNDERSCORES 1" >> uClibc_config.h ; \
146 echo "#undef NO_UNDERSCORES" >> uClibc_config.h ; \
148 @if [ "$(INCLUDE_RPC)" = "true" ] ; then \
149 echo "#define __UCLIBC_HAS_RPC__ 1" >> uClibc_config.h ; \
151 echo "#undef __UCLIBC_HAS_RPC__" >> uClibc_config.h ; \
153 @if [ "$(UNIFIED_SYSCALL)" = "true" ] ; then \
154 echo "#define __UCLIBC_USE_UNIFIED_SYSCALL__ 1" >> uClibc_config.h ; \
156 echo "#undef __UCLIBC_USE_UNIFIED_SYSCALL__" >> uClibc_config.h ; \
158 @echo "#define C_SYMBOL_PREFIX "\""$(C_SYMBOL_PREFIX)"\" >> uClibc_config.h
159 @if [ "$(DOLFS)" = "true" ] ; then \
160 echo "#define __UCLIBC_HAVE_LFS__ 1" >> uClibc_config.h ; \
162 echo "#undef __UCLIBC_HAVE_LFS__" >> uClibc_config.h ; \
165 subdirs: $(patsubst %, _dir_%, $(DIRS))
167 $(patsubst %, _dir_%, $(DIRS)) : dummy
168 $(MAKE) -C $(patsubst _dir_%, %, $@)
173 install: install_dev install_runtime install_gcc
176 # Installs header files and development library links.
178 install -d $(PREFIX)$(DEVEL_PREFIX)/lib
179 install -m 644 lib/*.[ao] $(PREFIX)$(DEVEL_PREFIX)/lib/
180 install -d $(PREFIX)$(DEVEL_PREFIX)/usr/lib
181 install -d $(PREFIX)$(DEVEL_PREFIX)/include
182 tar -chO include | tar -xC $(PREFIX)$(DEVEL_PREFIX);
183 -@for i in `find $(PREFIX)$(DEVEL_PREFIX) -type d` ; do \
184 chmod -f 755 $$i; chmod -f 644 $$i/*.h; \
186 (NAME=`whoami`; chown -R $$NAME.$$NAME $(PREFIX)$(DEVEL_PREFIX))
187 ifeq ($(strip $(HAVE_SHARED)),true)
188 find lib/ -type l -name '*.so' -exec cp -a {} $(PREFIX)$(DEVEL_PREFIX)/lib ';'
192 # Installs run-time libraries and helper apps onto the host system
193 # allowing cross development. If you want to deploy to a target
194 # system, use the "install_target" target instead...
196 ifeq ($(strip $(HAVE_SHARED)),true)
197 install -d $(PREFIX)$(DEVEL_PREFIX)/lib
198 install -d $(PREFIX)$(DEVEL_PREFIX)/bin
199 install -m 644 lib/lib*-$(MAJOR_VERSION).$(MINOR_VERSION).so $(PREFIX)$(DEVEL_PREFIX)/lib
200 cp -a lib/*.so.* $(PREFIX)$(DEVEL_PREFIX)/lib
201 install -m 755 ldso/util/ldd $(PREFIX)$(DEVEL_PREFIX)/bin
202 install -m 755 ldso/util/readelf $(PREFIX)$(DEVEL_PREFIX)/bin
203 install -d $(PREFIX)$(SYSTEM_DEVEL_PREFIX)/bin
204 ln -fs $(DEVEL_PREFIX)/bin/ldd $(PREFIX)$(SYSTEM_DEVEL_PREFIX)/bin/$(TARGET_ARCH)-uclibc-ldd
205 ln -fs $(DEVEL_PREFIX)/bin/readelf $(PREFIX)$(SYSTEM_DEVEL_PREFIX)/bin/$(TARGET_ARCH)-uclibc-readelf
206 @if [ -x lib/ld-uClibc-$(MAJOR_VERSION).$(MINOR_VERSION).so ] ; then \
208 install -m 755 lib/ld-uClibc-$(MAJOR_VERSION).$(MINOR_VERSION).so $(PREFIX)$(DEVEL_PREFIX)/lib; \
209 mkdir -p $(PREFIX)$(SHARED_LIB_LOADER_PATH); \
210 ln -s $(DEVEL_PREFIX)/lib/ld-uClibc-$(MAJOR_VERSION).$(MINOR_VERSION).so \
211 $(PREFIX)$(SHARED_LIB_LOADER_PATH)/$(UCLIBC_LDSO) || true; \
213 @if [ -x ldso/util/ldconfig ] ; then \
215 install -d $(PREFIX)$(DEVEL_PREFIX)/etc; \
216 install -m 755 ldso/util/ldconfig $(PREFIX)$(DEVEL_PREFIX)/bin; \
217 ln -fs $(DEVEL_PREFIX)/sbin/ldconfig $(PREFIX)$(SYSTEM_DEVEL_PREFIX)/bin/$(TARGET_ARCH)-uclibc-ldconfig; \
222 $(MAKE) -C extra/gcc-uClibc install
225 # Installs run-time libraries and helper apps in preparation for
226 # deploying onto a target system, but installed below wherever
227 # $PREFIX is set to, allowing you to package up the result for
228 # deployment onto your target system.
230 ifeq ($(strip $(HAVE_SHARED)),true)
231 install -d $(PREFIX)$(TARGET_PREFIX)/lib
232 install -d $(PREFIX)$(TARGET_PREFIX)/sbin
233 install -d $(PREFIX)$(TARGET_PREFIX)/usr/bin
234 install -m 644 lib/lib*-$(MAJOR_VERSION).$(MINOR_VERSION).so $(PREFIX)$(TARGET_PREFIX)/lib
235 cp -a lib/*.so.* $(PREFIX)$(TARGET_PREFIX)/lib
236 install -m 755 ldso/util/ldd $(PREFIX)$(TARGET_PREFIX)/usr/bin
237 install -m 755 ldso/util/readelf $(PREFIX)$(TARGET_PREFIX)/usr/bin
238 @if [ -x lib/ld-uClibc-$(MAJOR_VERSION).$(MINOR_VERSION).so ] ; then \
240 install -m 755 lib/ld-uClibc-$(MAJOR_VERSION).$(MINOR_VERSION).so $(PREFIX)$(TARGET_PREFIX)/lib; \
241 mkdir -p $(PREFIX)$(SHARED_LIB_LOADER_PATH); \
242 ln -s $(TARGET_PREFIX)/lib/ld-uClibc-$(MAJOR_VERSION).$(MINOR_VERSION).so \
243 $(PREFIX)$(SHARED_LIB_LOADER_PATH)/$(UCLIBC_LDSO) || true; \
245 @if [ -x ldso/util/ldconfig ] ; then \
247 install -d $(PREFIX)$(TARGET_PREFIX)/etc; \
248 install -m 755 ldso/util/ldconfig $(PREFIX)$(TARGET_PREFIX)/sbin; \
253 @rm -rf tmp lib include/bits/uClibc_config.h uClibc_config.h
254 - find include -type l -exec rm -f {} \;
255 - find . \( -name \*.o -o -name \*.a -o -name \*.so -o -name core -o -name .\#\* \) -exec rm -f {} \;
256 $(MAKE) -C test clean
257 $(MAKE) -C ldso clean
258 $(MAKE) -C libc/unistd clean
259 $(MAKE) -C libc/sysdeps/linux/common clean
260 $(MAKE) -C libc/sysdeps/linux/$(TARGET_ARCH) clean
261 $(MAKE) -C extra/gcc-uClibc clean
263 dist release: distclean
265 rm -rf uClibc-$(VERSION); \
266 cp -a uClibc uClibc-$(VERSION); \
268 find uClibc-$(VERSION)/ -type d \
270 -exec rm -rf {} \; ; \
272 tar -cvzf uClibc-$(VERSION).tar.gz --exclude CVS uClibc-$(VERSION)/;
274 .PHONY: dummy subdirs