3 # Copyright (C) 2000 by Lineo, inc.
4 # Copyright (C) 2000,2001,2002 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 finished
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; \
72 elif [ $(TARGET_ARCH) = "mipsel" ];then \
73 ln -fs $(KERNEL_SOURCE)/include/asm-mips include/asm; \
75 if [ $(HAS_MMU) != "true" ]; then \
76 ln -fs $(KERNEL_SOURCE)/include/asm-$(TARGET_ARCH)nommu include/asm;\
78 ln -fs $(KERNEL_SOURCE)/include/asm-$(TARGET_ARCH) include/asm; \
81 @if [ ! -f include/asm/unistd.h ] ; then \
84 echo "The path '$(KERNEL_SOURCE)/include/asm' doesn't exist."; \
85 echo "I bet you didn't set KERNEL_SOURCE, TARGET_ARCH or HAS_MMU in \`Config'"; \
86 echo "correctly. Please edit \`Config' and fix these settings."; \
90 @if [ $(HAS_MMU) != "true" ] && [ $(TARGET_ARCH) = "i386" ] ; then \
92 echo "WARNING: I bet your x86 system really has an MMU, right?"; \
93 echo " malloc and friends won't work unless you fix \`Config'"; \
97 @ln -fs $(KERNEL_SOURCE)/include/linux include/linux
98 @ln -fs ../libc/sysdeps/linux/$(TARGET_ARCH)/bits include/bits
99 (cd include/bits && ln -sf ../../../../../uClibc_config.h uClibc_config.h)
100 $(MAKE) -C libc/sysdeps/linux/$(TARGET_ARCH) headers
102 uClibc_config.h: Makefile Config
103 @echo "/* WARNING!!! AUTO-GENERATED FILE!!! DO NOT EDIT!!! */" > uClibc_config.h
104 @echo "#if !defined __FEATURES_H && !defined __need_uClibc_config_h" >> uClibc_config.h
105 @echo "#error Never include <bits/uClibc_config.h> directly; use <features.h> instead." >> uClibc_config.h
106 @echo "#endif" >> uClibc_config.h
107 @echo "#define linux 1" >> uClibc_config.h
108 @echo "#define __linux__ 1" >> uClibc_config.h
109 @if [ "$(INCLUDE_IPV6)" = "true" ] ; then \
110 echo "#define __UCLIBC_HAS_IPV6__ 1" >> uClibc_config.h ; \
112 echo "#undef __UCLIBC_HAS_IPV6__" >> uClibc_config.h ; \
114 @if [ "$(HAS_MMU)" = "true" ] ; then \
115 echo "#define __UCLIBC_HAS_MMU__ 1" >> uClibc_config.h ; \
117 echo "#undef __UCLIBC_HAS_MMU__" >> uClibc_config.h ; \
119 @if [ "$(HAS_FLOATING_POINT)" = "true" ] ; then \
120 echo "#define __UCLIBC_HAS_FLOATS__ 1" >> uClibc_config.h ; \
122 echo "#undef __UCLIBC_HAS_FLOATS__" >> uClibc_config.h ; \
124 @if [ "$(HAS_LONG_LONG)" = "true" ] ; then \
125 echo "#define __UCLIBC_HAS_LONG_LONG__ 1" >> uClibc_config.h ; \
127 echo "#undef __UCLIBC_HAS_LONG_LONG__" >> uClibc_config.h ; \
129 @if [ "$(HAS_LOCALE)" = "true" ] ; then \
130 echo "#define __UCLIBC_HAS_LOCALE__ 1" >> uClibc_config.h ; \
131 echo "#define __UCLIBC_LOCALE_DIR \""$(LOCALE_DIR)"\"" >> uClibc_config.h ; \
133 echo "#undef __UCLIBC_HAS_LOCALE__" >> uClibc_config.h ; \
135 @if [ "$(HAVE_ELF)" = "false" ] ; then \
136 echo "#undef HAVE_ELF" >> uClibc_config.h ; \
138 echo "#define HAVE_ELF 1" >> uClibc_config.h ; \
140 @if [ "$(HAVE_SHARED)" = "false" ] ; then \
141 echo "#undef HAVE_SHARED" >> uClibc_config.h ; \
143 echo "#define HAVE_SHARED 1" >> uClibc_config.h ; \
145 @if [ "$(TARGET_ARCH)" = "sh" ] ; then \
146 echo "#define NO_UNDERSCORES 1" >> uClibc_config.h ; \
148 echo "#undef NO_UNDERSCORES" >> uClibc_config.h ; \
150 @if [ "$(INCLUDE_RPC)" = "true" ] ; then \
151 echo "#define __UCLIBC_HAS_RPC__ 1" >> uClibc_config.h ; \
153 echo "#undef __UCLIBC_HAS_RPC__" >> uClibc_config.h ; \
155 @if [ "$(UNIFIED_SYSCALL)" = "true" ] ; then \
156 echo "#define __UCLIBC_USE_UNIFIED_SYSCALL__ 1" >> uClibc_config.h ; \
158 echo "#undef __UCLIBC_USE_UNIFIED_SYSCALL__" >> uClibc_config.h ; \
160 @echo "#define C_SYMBOL_PREFIX "\""$(C_SYMBOL_PREFIX)"\" >> uClibc_config.h
161 @if [ "$(DOLFS)" = "true" ] ; then \
162 echo "#define __UCLIBC_HAVE_LFS__ 1" >> uClibc_config.h ; \
164 echo "#undef __UCLIBC_HAVE_LFS__" >> uClibc_config.h ; \
166 @if [ "$(UNIX98PTY_ONLY)" = "true" ] ; then \
167 echo "#define UNIX98PTY_ONLY 1" >> uClibc_config.h ; \
169 echo "#undef UNIX98PTY_ONLY" >> uClibc_config.h ; \
171 @if [ "$(ASSUME_DEVPTS)" = "true" ] ; then \
172 echo "#define ASSUME_DEVPTS 1" >> uClibc_config.h ; \
174 echo "#undef ASSUME_DEVPTS" >> uClibc_config.h ; \
177 subdirs: $(patsubst %, _dir_%, $(DIRS))
179 $(patsubst %, _dir_%, $(DIRS)) : dummy
180 $(MAKE) -C $(patsubst _dir_%, %, $@)
185 install: install_dev install_runtime install_toolchain install_utils finished2
188 # Installs header files and development library links.
190 install -d $(PREFIX)$(DEVEL_PREFIX)/lib
191 install -d $(PREFIX)$(DEVEL_PREFIX)/usr/lib
192 install -d $(PREFIX)$(DEVEL_PREFIX)/include
193 install -m 644 lib/*.[ao] $(PREFIX)$(DEVEL_PREFIX)/lib/
194 tar -chO include | tar -xf - -C $(PREFIX)$(DEVEL_PREFIX);
195 -@for i in `find $(PREFIX)$(DEVEL_PREFIX) -type d` ; do \
196 chmod -f 755 $$i; chmod -f 644 $$i/*.h; \
198 (NAME=`id -u`; GROUP=`id -g`; chown -R $$NAME.$$GROUP $(PREFIX)$(DEVEL_PREFIX))
199 ifeq ($(strip $(HAVE_SHARED)),true)
200 find lib/ -type l -name '*.so' -exec cp -a {} $(PREFIX)$(DEVEL_PREFIX)/lib ';'
204 # Installs run-time libraries and helper apps onto the host system
205 # allowing cross development. If you want to deploy to a target
206 # system, use the "install_target" target instead...
208 ifeq ($(strip $(HAVE_SHARED)),true)
209 install -d $(PREFIX)$(DEVEL_PREFIX)/lib
210 install -d $(PREFIX)$(DEVEL_PREFIX)/bin
211 install -m 644 lib/lib*-$(MAJOR_VERSION).$(MINOR_VERSION).so $(PREFIX)$(DEVEL_PREFIX)/lib
212 cp -a lib/*.so.* $(PREFIX)$(DEVEL_PREFIX)/lib
213 @if [ -x lib/ld-uClibc-$(MAJOR_VERSION).$(MINOR_VERSION).so ] ; then \
215 install -m 755 lib/ld-uClibc-$(MAJOR_VERSION).$(MINOR_VERSION).so $(PREFIX)$(DEVEL_PREFIX)/lib; \
216 mkdir -p $(PREFIX)$(SHARED_LIB_LOADER_PATH); \
217 ln -s $(DEVEL_PREFIX)/lib/ld-uClibc-$(MAJOR_VERSION).$(MINOR_VERSION).so \
218 $(PREFIX)$(SHARED_LIB_LOADER_PATH)/$(UCLIBC_LDSO) || true; \
223 install -d $(PREFIX)$(DEVEL_PREFIX)/lib
224 install -d $(PREFIX)$(DEVEL_PREFIX)/bin
225 install -d $(PREFIX)$(SYSTEM_DEVEL_PREFIX)/bin
226 $(MAKE) -C extra/gcc-uClibc install
229 ifeq ($(strip $(HAVE_SHARED)),true)
230 @$(MAKE) -C ldso utils
231 install -m 755 ldso/util/ldd $(PREFIX)$(DEVEL_PREFIX)/bin
232 ln -fs $(DEVEL_PREFIX)/bin/ldd $(PREFIX)$(SYSTEM_DEVEL_PREFIX)/bin/$(TARGET_ARCH)-uclibc-ldd
233 # For now, don't bother with readelf since surely the host
234 # system has binutils, or we couldn't have gotten this far...
235 #install -m 755 ldso/util/readelf $(PREFIX)$(DEVEL_PREFIX)/bin
236 #ln -fs $(DEVEL_PREFIX)/bin/readelf $(PREFIX)$(SYSTEM_DEVEL_PREFIX)/bin/$(TARGET_ARCH)-uclibc-readelf
237 @if [ -x ldso/util/ldconfig ] ; then \
239 install -d $(PREFIX)$(DEVEL_PREFIX)/etc; \
240 install -m 755 ldso/util/ldconfig $(PREFIX)$(DEVEL_PREFIX)/bin; \
241 ln -fs $(DEVEL_PREFIX)/sbin/ldconfig $(PREFIX)$(SYSTEM_DEVEL_PREFIX)/bin/$(TARGET_ARCH)-uclibc-ldconfig; \
245 # Installs run-time libraries and helper apps in preparation for
246 # deploying onto a target system, but installed below wherever
247 # $PREFIX is set to, allowing you to package up the result for
248 # deployment onto your target system.
250 ifeq ($(strip $(HAVE_SHARED)),true)
251 install -d $(PREFIX)$(TARGET_PREFIX)/lib
252 install -d $(PREFIX)$(TARGET_PREFIX)/sbin
253 install -d $(PREFIX)$(TARGET_PREFIX)/usr/bin
254 install -m 644 lib/lib*-$(MAJOR_VERSION).$(MINOR_VERSION).so $(PREFIX)$(TARGET_PREFIX)/lib
255 cp -a lib/*.so.* $(PREFIX)$(TARGET_PREFIX)/lib
256 @if [ -x lib/ld-uClibc-$(MAJOR_VERSION).$(MINOR_VERSION).so ] ; then \
258 install -m 755 lib/ld-uClibc-$(MAJOR_VERSION).$(MINOR_VERSION).so $(PREFIX)$(TARGET_PREFIX)/lib; \
259 mkdir -p $(PREFIX)$(SHARED_LIB_LOADER_PATH); \
260 ln -s $(TARGET_PREFIX)/lib/ld-uClibc-$(MAJOR_VERSION).$(MINOR_VERSION).so \
261 $(PREFIX)$(SHARED_LIB_LOADER_PATH)/$(UCLIBC_LDSO) || true; \
265 install_target_utils:
266 ifeq ($(strip $(HAVE_SHARED)),true)
267 install -m 755 ldso/util/ldd.target $(PREFIX)$(TARGET_PREFIX)/usr/bin/ldd
268 install -m 755 ldso/util/readelf.target $(PREFIX)$(TARGET_PREFIX)/usr/bin/readelf
269 @if [ -x ldso/util/ldconfig.target ] ; then \
271 install -d $(PREFIX)$(TARGET_PREFIX)/etc; \
272 install -m 755 ldso/util/ldconfig.target $(PREFIX)$(TARGET_PREFIX)/sbin/ldconfig; \
278 @echo Finished installing...
283 @rm -rf tmp lib include/bits/uClibc_config.h uClibc_config.h
284 - find include -type l -exec rm -f {} \;
285 - find . \( -name \*.o -o -name \*.a -o -name \*.so -o -name core -o -name .\#\* \) -exec rm -f {} \;
286 $(MAKE) -C test clean
287 $(MAKE) -C ldso clean
288 $(MAKE) -C libc/unistd clean
289 $(MAKE) -C libc/sysdeps/linux/common clean
290 $(MAKE) -C libc/sysdeps/linux/$(TARGET_ARCH) clean
291 $(MAKE) -C extra/gcc-uClibc clean
293 dist release: distclean
295 rm -rf uClibc-$(VERSION); \
296 cp -a uClibc uClibc-$(VERSION); \
297 find uClibc-$(VERSION)/ -type d \
298 -name CVS -exec rm -rf {} \; ; \
299 find uClibc-$(VERSION)/ -type d \
300 -name .\#* -exec rm -rf {} \; ; \
302 tar -cvzf uClibc-$(VERSION).tar.gz --exclude CVS uClibc-$(VERSION)/;
304 .PHONY: dummy subdirs