3 # Copyright (C) 2000-2003 Erik Andersen <andersen@uclibc.org>
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 $(SECHO) 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 $(SECHO) Not building shared libraries ...
68 $(SECHO) 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 ifeq ($(strip $(ARCH_HAS_MMU)),y)
85 export header_extra_args =
87 export header_extra_args = -n
89 headers: include/bits/uClibc_config.h
91 ./extra/scripts/fix_includes.sh \
92 -k $(KERNEL_SOURCE) -t $(TARGET_ARCH) \
96 for i in `ls ../../libc/sysdeps/linux/common/bits/*.h` ; do \
99 if [ -d ../../libc/sysdeps/linux/$(TARGET_ARCH)/bits ] ; then \
100 for i in `ls ../../libc/sysdeps/linux/$(TARGET_ARCH)/bits/*.h` ; do \
106 for i in `ls ../../libc/sysdeps/linux/common/sys/*.h` ; do \
109 if [ -d ../../libc/sysdeps/linux/$(TARGET_ARCH)/sys ] ; then \
110 for i in `ls ../../libc/sysdeps/linux/$(TARGET_ARCH)/sys/*.h` ; do \
117 TOPDIR=. CC="$(CC)" /bin/sh extra/scripts/gen_bits_syscall_h.sh > include/bits/sysnum.h.new; \
118 if cmp include/bits/sysnum.h include/bits/sysnum.h.new >/dev/null 2>&1; then \
119 $(RM) include/bits/sysnum.h.new; \
121 mv -f include/bits/sysnum.h.new include/bits/sysnum.h; \
123 $(MAKE) -C libc/sysdeps/linux/common headers
124 $(MAKE) -C libc/sysdeps/linux/$(TARGET_ARCH) headers
126 # Command used to download source code
127 WGET:=wget --passive-ftp
129 LOCALE_DATA_FILENAME:=uClibc-locale-030818.tgz
132 ifeq ($(strip $(UCLIBC_DOWNLOAD_PREGENERATED_LOCALE_DATA)),y)
134 if [ ! -f $(LOCALE_DATA_FILENAME) ] ; then \
135 $(WGET) http://www.uclibc.org/downloads/$(LOCALE_DATA_FILENAME) ; \
138 ifeq ($(strip $(UCLIBC_PREGENERATED_LOCALE_DATA)),y)
139 (cd extra/locale; zcat $(LOCALE_DATA_FILENAME) | tar -xvf -)
140 $(MAKE) -C extra/locale pregen
144 subdirs: $(patsubst %, _dir_%, $(DIRS))
145 $(patsubst %, _dir_%, $(DIRS)): headers
146 $(MAKE) -C $(patsubst _dir_%, %, $@)
151 install: install_runtime install_dev finished2
154 RUNTIME_PREFIX_LIB_FROM_DEVEL_PREFIX_LIB=$(shell extra/scripts/relative_path.sh $(DEVEL_PREFIX)lib $(RUNTIME_PREFIX)lib)
156 # Installs header files and development library links.
158 $(INSTALL) -d $(PREFIX)$(DEVEL_PREFIX)lib
159 $(INSTALL) -d $(PREFIX)$(DEVEL_PREFIX)include
160 -$(INSTALL) -m 644 lib/*.[ao] $(PREFIX)$(DEVEL_PREFIX)lib/
161 tar -chf - include | tar -xf - -C $(PREFIX)$(DEVEL_PREFIX)
162 ifneq ($(strip $(UCLIBC_HAS_FLOATS)),y)
163 # Remove floating point related headers since float support is disabled.
164 $(RM) $(PREFIX)$(DEVEL_PREFIX)include/complex.h
165 $(RM) $(PREFIX)$(DEVEL_PREFIX)include/fpu_control.h
166 $(RM) $(PREFIX)$(DEVEL_PREFIX)include/ieee754.h
167 $(RM) $(PREFIX)$(DEVEL_PREFIX)include/math.h
168 $(RM) $(PREFIX)$(DEVEL_PREFIX)include/tgmath.h
170 ifneq ($(strip $(UCLIBC_HAS_WCHAR)),y)
171 # Remove wide char headers since wide char support is disabled.
172 $(RM) $(PREFIX)$(DEVEL_PREFIX)include/wctype.h
173 $(RM) $(PREFIX)$(DEVEL_PREFIX)include/wchar.h
175 ifneq ($(strip $(UCLIBC_HAS_LOCALE)),y)
176 # Remove iconv header since locale support is disabled.
177 $(RM) $(PREFIX)$(DEVEL_PREFIX)include/iconv.h
179 ifneq ($(strip $(UCLIBC_HAS_GLIBC_CUSTOM_PRINTF)),y)
180 # Remove printf header since custom print specifier support is disabled.
181 $(RM) $(PREFIX)$(DEVEL_PREFIX)include/printf.h
183 ifneq ($(strip $(UCLIBC_HAS_XLOCALE)),y)
184 # Remove xlocale header since extended locale support is disabled.
185 $(RM) $(PREFIX)$(DEVEL_PREFIX)include/xlocale.h
187 ifneq ($(strip $(UCLIBC_HAS_GETTEXT_AWARENESS)),y)
188 # Remove libintl header since gettext support is disabled.
189 $(RM) $(PREFIX)$(DEVEL_PREFIX)include/libintl.h
191 ifneq ($(strip $(UCLIBC_HAS_REGEX)),y)
192 # Remove regex headers since regex support is disabled.
193 $(RM) $(PREFIX)$(DEVEL_PREFIX)include/regex.h
194 $(RM) $(PREFIX)$(DEVEL_PREFIX)include/regexp.h
196 ifneq ($(strip $(UCLIBC_HAS_WORDEXP)),y)
197 # Remove wordexp header since wordexp support is disabled.
198 $(RM) $(PREFIX)$(DEVEL_PREFIX)include/wordexp.h
200 ifneq ($(strip $(UCLIBC_HAS_FTW)),y)
201 # Remove ftw header since ftw support is disabled.
202 $(RM) $(PREFIX)$(DEVEL_PREFIX)include/ftw.h
204 ifneq ($(strip $(UCLIBC_HAS_GLOB)),y)
205 # Remove glob header since glob support is disabled.
206 $(RM) $(PREFIX)$(DEVEL_PREFIX)include/glob.h
208 ifneq ($(strip $(UCLIBC_HAS_GNU_GETOPT)),y)
209 # Remove getopt header since gnu getopt support is disabled.
210 $(RM) $(PREFIX)$(DEVEL_PREFIX)include/getopt.h
212 ifneq ($(strip $(HAS_SHADOW)),y)
213 # Remove getopt header since shadow password support is disabled.
214 $(RM) $(PREFIX)$(DEVEL_PREFIX)include/shadow.h
216 -@for i in `find $(PREFIX)$(DEVEL_PREFIX) -type d` ; do \
217 chmod 755 $$i; chmod 644 $$i/*.h > /dev/null 2>&1; \
219 -find $(PREFIX)$(DEVEL_PREFIX) -name .svn | xargs $(RM) -r;
220 -chown -R `id | sed 's/^uid=\([0-9]*\).*gid=\([0-9]*\).*$$/\1:\2/'` $(PREFIX)$(DEVEL_PREFIX)
221 ifeq ($(strip $(HAVE_SHARED)),y)
222 for i in `find lib/ -type l -name 'lib[a-zA-Z]*.so' | \
223 sed -e 's/lib\///'` ; do \
224 $(LN) -sf $(RUNTIME_PREFIX_LIB_FROM_DEVEL_PREFIX_LIB)$$i.$(MAJOR_VERSION) \
225 $(PREFIX)$(DEVEL_PREFIX)lib/$$i; \
227 ifeq ($(strip $(PTHREADS_DEBUG_SUPPORT)),y)
228 $(LN) -sf $(RUNTIME_PREFIX_LIB_FROM_DEVEL_PREFIX_LIB)libthread_db.so.1 \
229 $(PREFIX)$(DEVEL_PREFIX)lib/libthread_db.so
231 # # If we build shared libraries then the static libs are PIC...
232 # # Make _pic.a symlinks to make mklibs.py and similar tools happy.
233 for i in `find lib/ -type f -name '*.a' | sed -e 's/lib\///'` ; do \
234 $(LN) -sf $$i $(PREFIX)$(DEVEL_PREFIX)lib/`echo $$i \
235 | sed -e 's/\.a$$/_pic.a/'`; \
237 # Ugh!!! Remember that libdl.a and libdl_pic.a are different. Since
238 # libdl is pretty small, and not likely to benefit from mklibs.py and
239 # similar, lets just remove libdl_pic.a and avoid the issue
240 rm -f $(PREFIX)$(DEVEL_PREFIX)lib/libdl_pic.a
244 # Installs run-time libraries
246 ifeq ($(strip $(HAVE_SHARED)),y)
247 $(INSTALL) -d $(PREFIX)$(RUNTIME_PREFIX)lib
248 $(INSTALL) -m 644 lib/lib*-$(MAJOR_VERSION).$(MINOR_VERSION).$(SUBLEVEL).so \
249 $(PREFIX)$(RUNTIME_PREFIX)lib
250 cp -dRf lib/*.so.* $(PREFIX)$(RUNTIME_PREFIX)lib
251 @if [ -x lib/ld-uClibc-$(MAJOR_VERSION).$(MINOR_VERSION).$(SUBLEVEL).so ] ; then \
254 $(INSTALL) -m 755 lib/ld-uClibc-$(MAJOR_VERSION).$(MINOR_VERSION).$(SUBLEVEL).so \
255 $(PREFIX)$(RUNTIME_PREFIX)lib; \
260 ifeq ($(strip $(HAVE_SHARED)),y)
262 $(MAKE) CROSS="$(CROSS)" CC="$(CC)" -C utils
267 # Installs helper applications, such as 'ldd' and 'ldconfig'
269 $(MAKE) CROSS="$(CROSS)" CC="$(CC)" -C utils install
270 #ifeq ($(strip $(UCLIBC_HAS_LOCALE)),y)
271 # @$(MAKE) -C libc/misc/wchar iconv.target
272 # $(INSTALL) -d $(PREFIX)$(RUNTIME_PREFIX)/usr/bin;
273 # $(INSTALL) -m 755 libc/misc/wchar/iconv.target $(PREFIX)$(RUNTIME_PREFIX)/usr/bin/iconv
278 $(SECHO) Finished installing ...
281 else # ifeq ($(strip $(HAVE_DOT_CONFIG)),y)
286 # ---------------------------------------------------------------------------
288 $(MAKE) -C extra/config conf
291 $(MAKE) -C extra/config ncurses mconf
293 menuconfig: extra/config/mconf
294 $(RM) -r include/bits
295 $(INSTALL) -d include/bits
296 @./extra/config/mconf extra/Configs/Config.in
298 config: extra/config/conf
299 $(RM) -r include/bits
300 $(INSTALL) -d include/bits
301 @./extra/config/conf extra/Configs/Config.in
303 oldconfig: extra/config/conf
304 $(RM) -r include/bits
305 $(INSTALL) -d include/bits
306 @./extra/config/conf -o extra/Configs/Config.in
308 randconfig: extra/config/conf
309 $(RM) -r include/bits
310 $(INSTALL) -d include/bits
311 @./extra/config/conf -r extra/Configs/Config.in
313 allyesconfig: extra/config/conf
314 $(RM) -r include/bits
315 $(INSTALL) -d include/bits
316 @./extra/config/conf -y extra/Configs/Config.in
317 sed -i -e "s/^DODEBUG=.*/# DODEBUG is not set/" .config
318 sed -i -e "s/^DOASSERTS=.*/# DOASSERTS is not set/" .config
319 sed -i -e "s/^SUPPORT_LD_DEBUG_EARLY=.*/# SUPPORT_LD_DEBUG_EARLY is not set/" .config
320 sed -i -e "s/^SUPPORT_LD_DEBUG=.*/# SUPPORT_LD_DEBUG is not set/" .config
321 sed -i -e "s/^UCLIBC_MJN3_ONLY=.*/# UCLIBC_MJN3_ONLY is not set/" .config
322 @./extra/config/conf -o extra/Configs/Config.in
324 allnoconfig: extra/config/conf
325 $(RM) -r include/bits
326 $(INSTALL) -d include/bits
327 @./extra/config/conf -n extra/Configs/Config.in
329 defconfig: extra/config/conf
330 $(RM) -r include/bits
331 $(INSTALL) -d include/bits
332 @./extra/config/conf -d extra/Configs/Config.in
335 - find . \( -name \*.o -o -name \*.a -o -name \*.so -o -name core -o -name .\#\* \) -exec $(RM) {} \;
336 @$(RM) -r tmp lib include/bits libc/tmp _install
337 $(RM) libc/obj.* headers
338 $(MAKE) -C test clean
339 $(MAKE) -C ldso clean
340 $(MAKE) -C libc/misc/internals clean
341 $(MAKE) -C libc/misc/wchar clean
342 $(MAKE) -C libc/unistd clean
343 $(MAKE) -C libc/sysdeps/linux/common clean
344 $(MAKE) -C extra/locale clean
346 for i in `(cd $(TOPDIR)/libc/sysdeps/linux/common/sys; ls *.h)` ; do \
347 $(RM) include/sys/$$i; \
349 if [ -d libc/sysdeps/linux/$(TARGET_ARCH)/sys ] ; then \
350 for i in `(cd libc/sysdeps/linux/$(TARGET_ARCH)/sys; ls *.h)` ; do \
351 $(RM) include/sys/$$i; \
354 @$(RM) include/linux include/asm*
355 @if [ -d libc/sysdeps/linux/$(TARGET_ARCH) ]; then \
356 $(MAKE) -C libc/sysdeps/linux/$(TARGET_ARCH) clean; \
360 $(RM) .config .config.old .config.cmd
361 $(MAKE) -C extra clean
365 $(RM) -r uClibc-$(VERSION); \
366 cp -dRf uClibc uClibc-$(VERSION); \
367 find uClibc-$(VERSION)/ -type f \
368 -name .\#* -exec $(RM) -r {} \; ; \
369 find uClibc-$(VERSION)/ -type d \
370 -name .svn -exec $(RM) -r {} \; ; \
372 tar -cvzf uClibc-$(VERSION).tar.gz uClibc-$(VERSION)/;
374 endif # ifeq ($(strip $(HAVE_DOT_CONFIG)),y)
379 .PHONY: dummy subdirs release distclean clean config oldconfig menuconfig