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 ifeq ($(LDSO_PRESENT), $(TARGET_ARCH))
36 DIRS = extra $(LDSO_DIR) libc libcrypt libresolv libutil libm
38 ifndef $(TARGET_PREFIX)
39 TARGET_PREFIX = `pwd`/_install
42 all: headers uClibc_config.h subdirs $(DO_SHARED) done
45 @$(MAKE) -C libc shared
46 ifeq ($(LDSO_PRESENT), $(TARGET_ARCH))
47 @$(MAKE) -C ldso shared
49 @$(MAKE) -C libcrypt shared
50 @$(MAKE) -C libutil shared
51 @$(MAKE) -C libm shared
55 @echo Finally finished compiling...
59 @rm -f include/asm include/linux include/bits
60 @ln -s $(KERNEL_SOURCE)/include/asm include/asm
61 @if [ ! -f include/asm/unistd.h ] ; then \
63 echo "The path '$(KERNEL_SOURCE)/include/asm' doesn't exist."; \
64 echo "I bet you didn't set KERNEL_SOURCE, TARGET_ARCH or HAS_MMU in \`Config'"; \
65 echo "correctly. Please edit \`Config' and fix these settings."; \
69 @if [ $(HAS_MMU) != "true" ] && [ $(TARGET_ARCH) = "i386" ] ; then \
70 echo "WARNING: I bet your x86 system really has an MMU, right?"; \
71 echo " malloc and friends won't work unless you fix \`Config'"; \
75 @ln -s $(KERNEL_SOURCE)/include/linux include/linux
76 @ln -s ../libc/sysdeps/linux/$(TARGET_ARCH)/bits include/bits
77 (cd include/bits; ln -sf ../../../../../uClibc_config.h uClibc_config.h)
78 $(MAKE) -C libc/sysdeps/linux/$(TARGET_ARCH) headers
80 uClibc_config.h: Config
81 @echo "/* WARNING!!! AUTO-GENERATED FILE!!! DO NOT EDIT!!! */" > uClibc_config.h
82 @echo "#if !defined __FEATURES_H && !defined __need_uClibc_config_h" >> uClibc_config.h
83 @echo "#error Never include <bits/uClibc_config.h> directly; use <features.h> instead." >> uClibc_config.h
84 @echo "#endif" >> uClibc_config.h
85 @echo "#define linux 1" >> uClibc_config.h
86 @echo "#define __linux__ 1" >> uClibc_config.h
87 @if [ "$(HAS_MMU)" = "true" ] ; then \
88 echo "#define __UCLIBC_HAS_MMU__ 1" >> uClibc_config.h ; \
90 echo "#undef __UCLIBC_HAS_MMU__" >> uClibc_config.h ; \
92 @if [ "$(HAS_FLOATING_POINT)" = "true" ] ; then \
93 echo "#define __UCLIBC_HAS_FLOATS__ 1" >> uClibc_config.h ; \
95 echo "#undef __UCLIBC_HAS_FLOATS__" >> uClibc_config.h ; \
97 @if [ "$(HAS_LIBM_FLOAT)" = "true" ] ; then \
98 echo "#define __UCLIBC_HAS_LIBM_FLOAT__ 1" >> uClibc_config.h ; \
100 echo "#undef __UCLIBC_HAS_LIBM_FLOAT__" >> uClibc_config.h ; \
102 @if [ "$(HAS_LIBM_DOUBLE)" = "true" ] ; then \
103 echo "#define __UCLIBC_HAS_LIBM_DOUBLE__ 1" >> uClibc_config.h ; \
105 echo "#undef __UCLIBC_HAS_LIBM_DOUBLE__" >> uClibc_config.h ; \
107 @if [ "$(HAS_LIBM_LONG_DOUBLE)" = "true" ] ; then \
108 echo "#define __UCLIBC_HAS_LIBM_LONG_DOUBLE__ 1" >> uClibc_config.h ; \
110 echo "#undef __UCLIBC_HAS_LIBM_LONG_DOUBLE__" >> uClibc_config.h ; \
112 @if [ "$(HAS_LONG_LONG)" = "true" ] ; then \
113 echo "#define __UCLIBC_HAS_LONG_LONG__ 1" >> uClibc_config.h ; \
115 echo "#undef __UCLIBC_HAS_LONG_LONG__" >> uClibc_config.h ; \
117 @if [ "$(HAS_LOCALE)" = "true" ] ; then \
118 echo "#define __UCLIBC_HAS_LOCALE__ 1" >> uClibc_config.h ; \
119 echo "#define __UCLIBC_LOCALE_DIR \""$(LOCALE_DIR)"\"" >> uClibc_config.h ; \
121 echo "#undef __UCLIBC_HAS_LOCALE__" >> uClibc_config.h ; \
123 @if [ "$(TARGET_ARCH)" = "m68k" ] ; then \
124 echo "#define __VFORK_MACRO__ 1" >> uClibc_config.h ; \
125 if [ `expr "$(CC)" : ".*\(m68k-elf-.*\)"`x = x ]; then \
126 echo "#define const" >> uClibc_config.h ; \
127 echo "#define __const" >> uClibc_config.h ; \
128 echo "#define __extension" >> uClibc_config.h ; \
131 echo "#undef __VFORK_MACRO__" >> uClibc_config.h ; \
133 @if [ "$(TARGET_ARCH)" = "sh" ] ; then \
134 echo "#define NO_UNDERSCORES 1" >> uClibc_config.h ; \
136 echo "#undef NO_UNDERSCORES" >> uClibc_config.h ; \
138 @if [ "$(INCLUDE_RPC)" = "true" ] ; then \
139 echo "#define __UCLIBC_HAS_RPC__ 1" >> uClibc_config.h ; \
141 echo "#undef __UCLIBC_HAS_RPC__" >> uClibc_config.h ; \
144 subdirs: $(patsubst %, _dir_%, $(DIRS))
146 $(patsubst %, _dir_%, $(DIRS)) : dummy
147 $(MAKE) -C $(patsubst _dir_%, %, $@)
154 # Installs shared libraries for a target.
156 ifeq ($(DO_SHARED),shared)
157 install -d $(TARGET_PREFIX)$(ROOT_DIR)/lib
158 cp -fa lib/*.so* $(TARGET_PREFIX)$(ROOT_DIR)/lib;
160 ifeq ($(LDSO_PRESENT), $(TARGET_ARCH))
161 install -d $(TARGET_PREFIX)$(ROOT_DIR)/etc
162 install -d $(TARGET_PREFIX)$(ROOT_DIR)/sbin
163 install -d $(TARGET_PREFIX)$(ROOT_DIR)/usr/bin
164 cp -f ldso/util/ldd $(TARGET_PREFIX)$(ROOT_DIR)/usr/bin
165 cp -f ldso/util/ldconfig $(TARGET_PREFIX)$(ROOT_DIR)/sbin
166 # -@if [ -x ldso/util/ldconfig ] ; then ldso/util/ldconfig; fi
169 # Installs development library and headers
170 # This is done with the assumption that it can blow away anything
171 # in $(DEVEL_PREFIX)$(ROOT_DIR)/include. Probably true only if you're using
172 # a packaging system.
174 ifeq ($(DO_SHARED),shared)
175 install -d $(DEVEL_PREFIX)$(ROOT_DIR)/lib
176 cp -fa lib/*.so* $(DEVEL_PREFIX)$(ROOT_DIR)/lib;
178 install -d $(DEVEL_PREFIX)$(ROOT_DIR)/usr/lib
179 cp -fa lib/*.[ao] $(DEVEL_PREFIX)$(ROOT_DIR)/usr/lib;
180 ifeq ($(LDSO_PRESENT), $(TARGET_ARCH))
181 install -d $(DEVEL_PREFIX)$(ROOT_DIR)/etc
182 install -d $(DEVEL_PREFIX)$(ROOT_DIR)/sbin
183 install -d $(DEVEL_PREFIX)$(ROOT_DIR)/usr/bin
184 cp -f ldso/util/ldd $(DEVEL_PREFIX)$(ROOT_DIR)/usr/bin
185 cp -f ldso/util/ldconfig $(DEVEL_PREFIX)$(ROOT_DIR)/sbin
186 # -@if [ -x ldso/util/ldconfig ] ; then ldso/util/ldconfig; fi
188 install -d $(DEVEL_PREFIX)$(ROOT_DIR)/etc
189 install -d $(DEVEL_PREFIX)$(ROOT_DIR)/usr/include
190 install -d $(DEVEL_PREFIX)$(ROOT_DIR)/usr/include/bits
191 rm -f $(DEVEL_PREFIX)$(ROOT_DIR)/usr/include/asm
192 rm -f $(DEVEL_PREFIX)$(ROOT_DIR)/usr/include/linux
193 ln -s $(KERNEL_SOURCE)/include/asm $(DEVEL_PREFIX)$(ROOT_DIR)/usr/include/asm
194 ln -s $(KERNEL_SOURCE)/include/linux $(DEVEL_PREFIX)$(ROOT_DIR)/usr/include/linux
195 find include/ -type f -depth -not -path "*CVS*" -exec install \
196 -D -m 644 {} $(DEVEL_PREFIX)$(ROOT_DIR)/usr/'{}' ';'
197 find include/bits/ -type f -depth -not -path "*CVS*" -exec install \
198 -D -m 644 {} $(DEVEL_PREFIX)$(ROOT_DIR)/usr/'{}' ';'
199 install -m 644 include/bits/uClibc_config.h $(DEVEL_PREFIX)$(ROOT_DIR)/usr/include/bits/
200 $(MAKE) -C extra/gcc-uClibc install
204 - find include -type l -exec rm -f {} \;
205 - find . \( -name \*.o -o -name \*.a -o -name \*.so -o -name core \) -exec rm -f {} \;
206 ifeq ($(LDSO_PRESENT), $(TARGET_ARCH))
207 $(MAKE) -C ldso clean
210 .PHONY: dummy subdirs