5 # This program is free software; you can redistribute it and/or
6 # modify it under the terms of the GNU Library General Public
7 # License as published by the Free Software Foundation; either
8 # version 2 of the License, or (at your option) any later
11 # This program is distributed in the hope that it will be useful,
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 # GNU Library General Public License for more details.
16 # You should have received a copy of the GNU Library General
17 # Public License along with this program; if not, write to the
18 # Free Software Foundation, Inc., 59 Temple Place, Suite 330,
19 # Boston, MA 02111-1307 USA
22 #--------------------------------------------------------------
23 # You shouldn't need to mess with anything beyond this point...
24 #--------------------------------------------------------------
25 noconfig_targets := menuconfig config oldconfig randconfig \
26 defconfig allyesconfig allnoconfig clean distclean \
31 DIRS = ldso libc libcrypt libresolv libnsl libutil libm libpthread librt
32 ifeq ($(strip $(UCLIBC_HAS_GETTEXT_AWARENESS)),y)
36 ifeq ($(strip $(HAVE_DOT_CONFIG)),y)
38 all: headers pregen subdirs shared finished
40 # In this section, we need .config
44 ifeq ($(strip $(HAVE_SHARED)),y)
46 @echo Building shared libraries ...
48 @$(MAKE) -C libc shared
49 @$(MAKE) -C ldso shared
50 @$(MAKE) -C libcrypt shared
51 @$(MAKE) -C libresolv shared
52 @$(MAKE) -C libnsl shared
53 @$(MAKE) -C libutil shared
54 @$(MAKE) -C libm shared
55 @$(MAKE) -C libpthread shared
56 @$(MAKE) -C librt shared
57 ifeq ($(strip $(UCLIBC_HAS_GETTEXT_AWARENESS)),y)
58 @$(MAKE) -C libintl shared
62 @echo Not building shared libraries ...
68 @echo Finally finished compiling ...
71 include/bits/uClibc_config.h: .config
72 @if [ ! -x ./extra/config/conf ] ; then \
73 $(MAKE) -C extra/config conf; \
76 $(INSTALL) -d include/bits
77 @./extra/config/conf -o extra/Configs/Config.in
79 # For the moment, we have to keep re-running this target
80 # because the fix includes scripts rely on pre-processers
81 # in order to generate the headers correctly :(. That
82 # means we can't use the $(HOSTCC) in order to get the
84 headers: include/bits/uClibc_config.h
85 ifeq ($(strip $(ARCH_HAS_MMU)),y)
86 @set -x; ./extra/scripts/fix_includes.sh -k $(KERNEL_SOURCE) -t $(TARGET_ARCH)
88 @set -x; ./extra/scripts/fix_includes.sh -k $(KERNEL_SOURCE) -t $(TARGET_ARCH) -n
92 for i in `ls ../../libc/sysdeps/linux/common/bits/*.h` ; do \
95 if [ -d ../../libc/sysdeps/linux/$(TARGET_ARCH)/bits ] ; then \
96 for i in `ls ../../libc/sysdeps/linux/$(TARGET_ARCH)/bits/*.h` ; do \
102 for i in `ls ../../libc/sysdeps/linux/common/sys/*.h` ; do \
105 if [ -d ../../libc/sysdeps/linux/$(TARGET_ARCH)/sys ] ; then \
106 for i in `ls ../../libc/sysdeps/linux/$(TARGET_ARCH)/sys/*.h` ; do \
112 TOPDIR=. CC="$(CC)" /bin/sh extra/scripts/gen_bits_syscall_h.sh > include/bits/sysnum.h.new; \
113 if cmp include/bits/sysnum.h include/bits/sysnum.h.new >/dev/null 2>&1; then \
114 $(RM) include/bits/sysnum.h.new; \
116 mv -f include/bits/sysnum.h.new include/bits/sysnum.h; \
118 $(MAKE) -C libc/sysdeps/linux/common headers
119 $(MAKE) -C libc/sysdeps/linux/$(TARGET_ARCH) headers
121 # Command used to download source code
122 WGET:=wget --passive-ftp
124 LOCALE_DATA_FILENAME:=uClibc-locale-030818.tgz
127 ifeq ($(strip $(UCLIBC_DOWNLOAD_PREGENERATED_LOCALE_DATA)),y)
129 if [ ! -f $(LOCALE_DATA_FILENAME) ] ; then \
130 $(WGET) http://www.uclibc.org/downloads/$(LOCALE_DATA_FILENAME) ; \
133 ifeq ($(strip $(UCLIBC_PREGENERATED_LOCALE_DATA)),y)
134 (cd extra/locale; zcat $(LOCALE_DATA_FILENAME) | tar -xvf -)
135 $(MAKE) -C extra/locale pregen
139 subdirs: $(patsubst %, _dir_%, $(DIRS))
140 $(patsubst %, _dir_%, $(DIRS)): headers
141 $(MAKE) -C $(patsubst _dir_%, %, $@)
146 install: install_runtime install_dev finished2
149 RUNTIME_PREFIX_LIB_FROM_DEVEL_PREFIX_LIB=$(shell extra/scripts/relative_path.sh $(DEVEL_PREFIX)lib $(RUNTIME_PREFIX)lib)
151 # Installs header files and development library links.
153 $(INSTALL) -d $(PREFIX)$(DEVEL_PREFIX)lib
154 $(INSTALL) -d $(PREFIX)$(DEVEL_PREFIX)include
155 -$(INSTALL) -m 644 lib/*.[ao] $(PREFIX)$(DEVEL_PREFIX)lib/
156 tar -chf - include | tar -xf - -C $(PREFIX)$(DEVEL_PREFIX);
157 ifneq ($(strip $(UCLIBC_HAS_FLOATS)),y)
158 # Remove floating point related headers since float support is disabled.
159 $(RM) $(PREFIX)$(DEVEL_PREFIX)include/complex.h
160 $(RM) $(PREFIX)$(DEVEL_PREFIX)include/fpu_control.h
161 $(RM) $(PREFIX)$(DEVEL_PREFIX)include/ieee754.h
162 $(RM) $(PREFIX)$(DEVEL_PREFIX)include/math.h
163 $(RM) $(PREFIX)$(DEVEL_PREFIX)include/tgmath.h
165 ifneq ($(strip $(UCLIBC_HAS_WCHAR)),y)
166 # Remove wide char headers since wide char support is disabled.
167 $(RM) $(PREFIX)$(DEVEL_PREFIX)include/wctype.h
168 $(RM) $(PREFIX)$(DEVEL_PREFIX)include/wchar.h
170 ifneq ($(strip $(UCLIBC_HAS_LOCALE)),y)
171 # Remove iconv header since locale support is disabled.
172 $(RM) $(PREFIX)$(DEVEL_PREFIX)include/iconv.h
174 ifneq ($(strip $(UCLIBC_HAS_GLIBC_CUSTOM_PRINTF)),y)
175 # Remove printf header since custom print specifier support is disabled.
176 $(RM) $(PREFIX)$(DEVEL_PREFIX)include/printf.h
178 ifneq ($(strip $(UCLIBC_HAS_XLOCALE)),y)
179 # Remove xlocale header since extended locale support is disabled.
180 $(RM) $(PREFIX)$(DEVEL_PREFIX)include/xlocale.h
182 ifneq ($(strip $(UCLIBC_HAS_GETTEXT_AWARENESS)),y)
183 # Remove libintl header since gettext support is disabled.
184 $(RM) $(PREFIX)$(DEVEL_PREFIX)include/libintl.h
186 ifneq ($(strip $(UCLIBC_HAS_REGEX)),y)
187 # Remove regex headers since regex support is disabled.
188 $(RM) $(PREFIX)$(DEVEL_PREFIX)include/regex.h
189 $(RM) $(PREFIX)$(DEVEL_PREFIX)include/regexp.h
191 ifneq ($(strip $(UCLIBC_HAS_WORDEXP)),y)
192 # Remove wordexp header since wordexp support is disabled.
193 $(RM) $(PREFIX)$(DEVEL_PREFIX)include/wordexp.h
195 ifneq ($(strip $(UCLIBC_HAS_FTW)),y)
196 # Remove ftw header since ftw support is disabled.
197 $(RM) $(PREFIX)$(DEVEL_PREFIX)include/ftw.h
199 ifneq ($(strip $(UCLIBC_HAS_GLOB)),y)
200 # Remove glob header since glob support is disabled.
201 $(RM) $(PREFIX)$(DEVEL_PREFIX)include/glob.h
203 ifneq ($(strip $(UCLIBC_HAS_GNU_GETOPT)),y)
204 # Remove getopt header since gnu getopt support is disabled.
205 $(RM) $(PREFIX)$(DEVEL_PREFIX)include/getopt.h
207 ifneq ($(strip $(HAS_SHADOW)),y)
208 # Remove getopt header since shadow password support is disabled.
209 $(RM) $(PREFIX)$(DEVEL_PREFIX)include/shadow.h
211 -@for i in `find $(PREFIX)$(DEVEL_PREFIX) -type d` ; do \
212 chmod 755 $$i; chmod 644 $$i/*.h > /dev/null 2>&1; \
214 -find $(PREFIX)$(DEVEL_PREFIX) -name .svn | xargs $(RM) -r;
215 -chown -R `id | sed 's/^uid=\([0-9]*\).*gid=\([0-9]*\).*$$/\1.\2/'` $(PREFIX)$(DEVEL_PREFIX)
216 ifeq ($(strip $(HAVE_SHARED)),y)
217 for i in `find lib/ -type l -name 'lib[a-zA-Z]*.so' | \
218 sed -e 's/lib\///'` ; do \
219 $(LN) -sf $(RUNTIME_PREFIX_LIB_FROM_DEVEL_PREFIX_LIB)$$i.$(MAJOR_VERSION) \
220 $(PREFIX)$(DEVEL_PREFIX)lib/$$i; \
222 ifeq ($(strip $(PTHREADS_DEBUG_SUPPORT)),y)
223 $(LN) -sf $(RUNTIME_PREFIX_LIB_FROM_DEVEL_PREFIX_LIB)libthread_db.so.1 \
224 $(PREFIX)$(DEVEL_PREFIX)lib/libthread_db.so
226 # # If we build shared libraries then the static libs are PIC...
227 # # Make _pic.a symlinks to make mklibs.py and similar tools happy.
228 for i in `find lib/ -type f -name '*.a' | sed -e 's/lib\///'` ; do \
229 $(LN) -sf $$i $(PREFIX)$(DEVEL_PREFIX)lib/`echo $$i \
230 | sed -e 's/\.a$$/_pic.a/'`; \
232 # Ugh!!! Remember that libdl.a and libdl_pic.a are different!
233 rm -f $(PREFIX)$(DEVEL_PREFIX)lib/libdl_pic.a
234 cp -f ldso/libdl/libdl_pic.a $(PREFIX)$(DEVEL_PREFIX)lib/libdl_pic.a
238 # Installs run-time libraries
240 ifeq ($(strip $(HAVE_SHARED)),y)
241 $(INSTALL) -d $(PREFIX)$(RUNTIME_PREFIX)lib
242 $(INSTALL) -m 644 lib/lib*-$(MAJOR_VERSION).$(MINOR_VERSION).$(SUBLEVEL).so \
243 $(PREFIX)$(RUNTIME_PREFIX)lib
244 cp -dRf lib/*.so.* $(PREFIX)$(RUNTIME_PREFIX)lib
245 @if [ -x lib/ld-uClibc-$(MAJOR_VERSION).$(MINOR_VERSION).$(SUBLEVEL).so ] ; then \
247 $(INSTALL) -m 755 lib/ld-uClibc-$(MAJOR_VERSION).$(MINOR_VERSION).$(SUBLEVEL).so \
248 $(PREFIX)$(RUNTIME_PREFIX)lib; \
253 ifeq ($(strip $(HAVE_SHARED)),y)
255 $(MAKE) CROSS="$(CROSS)" CC="$(CC)" -C utils
260 # Installs helper applications, such as 'ldd' and 'ldconfig'
262 $(MAKE) CROSS="$(CROSS)" CC="$(CC)" -C utils install
263 #ifeq ($(strip $(UCLIBC_HAS_LOCALE)),y)
264 # @$(MAKE) -C libc/misc/wchar iconv.target
265 # $(INSTALL) -d $(PREFIX)$(RUNTIME_PREFIX)/usr/bin;
266 # $(INSTALL) -m 755 libc/misc/wchar/iconv.target $(PREFIX)$(RUNTIME_PREFIX)/usr/bin/iconv
271 @echo Finished installing ...
274 else # ifeq ($(strip $(HAVE_DOT_CONFIG)),y)
279 # ---------------------------------------------------------------------------
281 $(MAKE) -C extra/config conf
284 $(MAKE) -C extra/config ncurses mconf
286 menuconfig: extra/config/mconf
287 $(RM) -r include/bits
288 $(INSTALL) -d include/bits
289 @./extra/config/mconf extra/Configs/Config.in
291 config: extra/config/conf
292 $(RM) -r include/bits
293 $(INSTALL) -d include/bits
294 @./extra/config/conf extra/Configs/Config.in
296 oldconfig: extra/config/conf
297 $(RM) -r include/bits
298 $(INSTALL) -d include/bits
299 @./extra/config/conf -o extra/Configs/Config.in
301 randconfig: extra/config/conf
302 $(RM) -r include/bits
303 $(INSTALL) -d include/bits
304 @./extra/config/conf -r extra/Configs/Config.in
306 allyesconfig: extra/config/conf
307 $(RM) -r include/bits
308 $(INSTALL) -d include/bits
309 @./extra/config/conf -y extra/Configs/Config.in
310 sed -i -e "s/^DODEBUG=.*/# DODEBUG is not set/" .config
311 sed -i -e "s/^DOASSERTS=.*/# DOASSERTS is not set/" .config
312 sed -i -e "s/^SUPPORT_LD_DEBUG_EARLY=.*/# SUPPORT_LD_DEBUG_EARLY is not set/" .config
313 sed -i -e "s/^SUPPORT_LD_DEBUG=.*/# SUPPORT_LD_DEBUG is not set/" .config
314 sed -i -e "s/^UCLIBC_MJN3_ONLY=.*/# UCLIBC_MJN3_ONLY is not set/" .config
315 @./extra/config/conf -o extra/Configs/Config.in
317 allnoconfig: extra/config/conf
318 $(RM) -r include/bits
319 $(INSTALL) -d include/bits
320 @./extra/config/conf -n extra/Configs/Config.in
322 defconfig: extra/config/conf
323 $(RM) -r include/bits
324 $(INSTALL) -d include/bits
325 @./extra/config/conf -d extra/Configs/Config.in
329 - find . \( -name \*.o -o -name \*.a -o -name \*.so -o -name core -o -name .\#\* \) -exec $(RM) {} \;
330 @$(RM) -r tmp lib include/bits libc/tmp _install
331 $(RM) libc/obj.* headers
332 $(MAKE) -C test clean
333 $(MAKE) -C ldso clean
334 $(MAKE) -C libc/misc/internals clean
335 $(MAKE) -C libc/misc/wchar clean
336 $(MAKE) -C libc/unistd clean
337 $(MAKE) -C libc/sysdeps/linux/common clean
338 $(MAKE) -C extra/locale clean
340 for i in `(cd $(TOPDIR)/libc/sysdeps/linux/common/sys; ls *.h)` ; do \
341 $(RM) include/sys/$$i; \
343 if [ -d libc/sysdeps/linux/$(TARGET_ARCH)/sys ] ; then \
344 for i in `(cd libc/sysdeps/linux/$(TARGET_ARCH)/sys; ls *.h)` ; do \
345 $(RM) include/sys/$$i; \
348 @$(RM) include/linux include/asm*
349 @if [ -d libc/sysdeps/linux/$(TARGET_ARCH) ]; then \
350 $(MAKE) -C libc/sysdeps/linux/$(TARGET_ARCH) clean; \
354 $(RM) .config .config.old .config.cmd
355 $(MAKE) -C extra clean
359 $(RM) -r uClibc-$(VERSION); \
360 cp -dRf uClibc uClibc-$(VERSION); \
361 find uClibc-$(VERSION)/ -type f \
362 -name .\#* -exec $(RM) -r {} \; ; \
363 find uClibc-$(VERSION)/ -type d \
364 -name .svn -exec $(RM) -r {} \; ; \
366 tar -cvzf uClibc-$(VERSION).tar.gz uClibc-$(VERSION)/;
368 endif # ifeq ($(strip $(HAVE_DOT_CONFIG)),y)
370 .PHONY: dummy subdirs release distclean clean config oldconfig menuconfig