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 librt
32 ifeq ($(strip $(UCLIBC_HAS_FLOATS)),y)
35 ifeq ($(strip $(UCLIBC_HAS_THREADS)),y)
38 ifeq ($(strip $(UCLIBC_HAS_GETTEXT_AWARENESS)),y)
42 ifeq ($(strip $(HAVE_DOT_CONFIG)),y)
44 all: headers pregen subdirs shared finished
46 # In this section, we need .config
49 shared: $(patsubst %, _shared_dir_%, $(DIRS))
50 $(patsubst %, _shared_dir_%, $(DIRS)): subdirs
51 ifeq ($(strip $(HAVE_SHARED)),y)
53 $(SECHO) Building shared libraries ...
55 $(MAKE) -C $(patsubst _shared_dir_%, %, $@) shared
58 $(SECHO) Not building shared libraries ...
64 $(SECHO) Finally finished compiling ...
67 include/bits/uClibc_config.h: .config
68 @if [ ! -x ./extra/config/conf ] ; then \
69 $(MAKE) -C extra/config conf; \
72 $(INSTALL) -d include/bits
73 @./extra/config/conf -o extra/Configs/Config.in
75 # For the moment, we have to keep re-running this target
76 # because the fix includes scripts rely on pre-processers
77 # in order to generate the headers correctly :(. That
78 # means we can't use the $(HOSTCC) in order to get the
80 ifeq ($(strip $(ARCH_HAS_MMU)),y)
81 export header_extra_args =
83 export header_extra_args = -n
85 headers: include/bits/uClibc_config.h
87 ./extra/scripts/fix_includes.sh \
88 -k $(KERNEL_SOURCE) -t $(TARGET_ARCH) \
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 \
113 TOPDIR=. CC="$(CC)" /bin/sh extra/scripts/gen_bits_syscall_h.sh > include/bits/sysnum.h.new; \
114 if cmp include/bits/sysnum.h include/bits/sysnum.h.new >/dev/null 2>&1; then \
115 $(RM) include/bits/sysnum.h.new; \
117 mv -f include/bits/sysnum.h.new include/bits/sysnum.h; \
119 ifeq ($(strip $(UCLIBC_HAS_THREADS)),y)
120 $(MAKE) -C libpthread headers
122 $(MAKE) -C libc/sysdeps/linux/common headers
123 $(MAKE) -C libc/sysdeps/linux/$(TARGET_ARCH) headers
125 # Command used to download source code
126 WGET:=wget --passive-ftp
128 LOCALE_DATA_FILENAME:=uClibc-locale-030818.tgz
131 ifeq ($(strip $(UCLIBC_DOWNLOAD_PREGENERATED_LOCALE_DATA)),y)
133 if [ ! -f $(LOCALE_DATA_FILENAME) ] ; then \
134 $(WGET) http://www.uclibc.org/downloads/$(LOCALE_DATA_FILENAME) ; \
137 ifeq ($(strip $(UCLIBC_PREGENERATED_LOCALE_DATA)),y)
138 (cd extra/locale; zcat $(LOCALE_DATA_FILENAME) | tar -xvf -)
139 $(MAKE) -C extra/locale pregen
143 subdirs: $(patsubst %, _dir_%, $(DIRS))
144 $(patsubst %, _dir_%, $(DIRS)): headers
145 $(MAKE) -C $(patsubst _dir_%, %, $@)
150 install: install_runtime install_dev finished2
153 RUNTIME_PREFIX_LIB_FROM_DEVEL_PREFIX_LIB=$(shell extra/scripts/relative_path.sh $(DEVEL_PREFIX)lib $(RUNTIME_PREFIX)lib)
155 # Installs header files and development library links.
157 $(INSTALL) -d $(PREFIX)$(DEVEL_PREFIX)lib
158 $(INSTALL) -d $(PREFIX)$(DEVEL_PREFIX)include
159 -$(INSTALL) -m 644 lib/*.[ao] $(PREFIX)$(DEVEL_PREFIX)lib/
160 if [ "$(KERNEL_SOURCE)" == "$(DEVEL_PREFIX)" ] ; then \
161 extra_exclude="--exclude include/linux --exclude include/asm'*'" ; \
165 tar -chf - include --exclude .svn --exclude CVS $$extra_exclude \
166 | tar -xf - -C $(PREFIX)$(DEVEL_PREFIX)
167 $(RM) $(PREFIX)$(DEVEL_PREFIX)include/ssp-internal.h
168 ifneq ($(strip $(UCLIBC_HAS_FLOATS)),y)
169 # Remove floating point related headers since float support is disabled.
170 $(RM) $(PREFIX)$(DEVEL_PREFIX)include/complex.h
171 $(RM) $(PREFIX)$(DEVEL_PREFIX)include/fpu_control.h
172 $(RM) $(PREFIX)$(DEVEL_PREFIX)include/ieee754.h
173 $(RM) $(PREFIX)$(DEVEL_PREFIX)include/math.h
174 $(RM) $(PREFIX)$(DEVEL_PREFIX)include/tgmath.h
175 $(RM) $(PREFIX)$(DEVEL_PREFIX)include/bits/uClibc_fpmax.h
177 ifneq ($(strip $(UCLIBC_HAS_WCHAR)),y)
178 # Remove wide char headers since wide char support is disabled.
179 $(RM) $(PREFIX)$(DEVEL_PREFIX)include/wctype.h
180 $(RM) $(PREFIX)$(DEVEL_PREFIX)include/wchar.h
182 ifneq ($(strip $(UCLIBC_HAS_LOCALE)),y)
183 # Remove iconv header since locale support is disabled.
184 $(RM) $(PREFIX)$(DEVEL_PREFIX)include/iconv.h
186 ifneq ($(strip $(UCLIBC_HAS_GLIBC_CUSTOM_PRINTF)),y)
187 # Remove printf header since custom print specifier support is disabled.
188 $(RM) $(PREFIX)$(DEVEL_PREFIX)include/printf.h
190 ifneq ($(strip $(UCLIBC_HAS_XLOCALE)),y)
191 # Remove xlocale header since extended locale support is disabled.
192 $(RM) $(PREFIX)$(DEVEL_PREFIX)include/xlocale.h
194 ifneq ($(strip $(UCLIBC_HAS_GETTEXT_AWARENESS)),y)
195 # Remove libintl header since gettext support is disabled.
196 $(RM) $(PREFIX)$(DEVEL_PREFIX)include/libintl.h
198 ifneq ($(strip $(UCLIBC_HAS_REGEX)),y)
199 # Remove regex headers since regex support is disabled.
200 $(RM) $(PREFIX)$(DEVEL_PREFIX)include/regex.h
201 $(RM) $(PREFIX)$(DEVEL_PREFIX)include/regexp.h
203 ifneq ($(strip $(UCLIBC_HAS_WORDEXP)),y)
204 # Remove wordexp header since wordexp support is disabled.
205 $(RM) $(PREFIX)$(DEVEL_PREFIX)include/wordexp.h
207 ifneq ($(strip $(UCLIBC_HAS_FTW)),y)
208 # Remove ftw header since ftw support is disabled.
209 $(RM) $(PREFIX)$(DEVEL_PREFIX)include/ftw.h
211 ifneq ($(strip $(UCLIBC_HAS_GLOB)),y)
212 # Remove glob header since glob support is disabled.
213 $(RM) $(PREFIX)$(DEVEL_PREFIX)include/glob.h
215 ifneq ($(strip $(UCLIBC_HAS_GNU_GETOPT)),y)
216 # Remove getopt header since gnu getopt support is disabled.
217 $(RM) $(PREFIX)$(DEVEL_PREFIX)include/getopt.h
219 ifneq ($(strip $(HAS_SHADOW)),y)
220 # Remove shadow header since shadow password support is disabled.
221 $(RM) $(PREFIX)$(DEVEL_PREFIX)include/shadow.h
223 ifneq ($(strip $(PTHREADS_DEBUG_SUPPORT)),y)
224 # Remove thread_db header since thread debug support is disabled.
225 $(RM) $(PREFIX)$(DEVEL_PREFIX)include/thread_db.h
227 ifneq ($(strip $(UCLIBC_HAS_THREADS)),y)
228 # Remove pthread headers since thread support is disabled.
229 $(RM) $(PREFIX)$(DEVEL_PREFIX)include/*thread*.h
230 $(RM) $(PREFIX)$(DEVEL_PREFIX)include/semaphore.h
231 $(RM) $(PREFIX)$(DEVEL_PREFIX)include/bits/*thread*.h
233 -@for i in `find $(PREFIX)$(DEVEL_PREFIX) -type d` ; do \
234 chmod 755 $$i; chmod 644 $$i/*.h > /dev/null 2>&1; \
236 -find $(PREFIX)$(DEVEL_PREFIX) -name .svn | xargs $(RM) -r
237 -chown -R `id | sed 's/^uid=\([0-9]*\).*gid=\([0-9]*\).*$$/\1:\2/'` $(PREFIX)$(DEVEL_PREFIX)
238 ifeq ($(strip $(HAVE_SHARED)),y)
239 for i in `find lib/ -type l -name 'lib[a-zA-Z]*.so' | \
240 sed -e 's/lib\///'` ; do \
241 $(LN) -sf $(RUNTIME_PREFIX_LIB_FROM_DEVEL_PREFIX_LIB)$$i.$(MAJOR_VERSION) \
242 $(PREFIX)$(DEVEL_PREFIX)lib/$$i; \
244 $(RM) $(PREFIX)$(DEVEL_PREFIX)lib/libc.so
245 sed -e '/^GROUP/d' $(TOPDIR)lib/libc.so > $(PREFIX)$(DEVEL_PREFIX)lib/libc.so
246 ifeq ($(strip $(COMPAT_ATEXIT)),y)
247 echo "GROUP ( $(DEVEL_PREFIX)lib/$(NONSHARED_LIBNAME) $(RUNTIME_PREFIX)lib/$(SHARED_MAJORNAME) )" >> \
248 $(PREFIX)$(DEVEL_PREFIX)lib/libc.so
250 echo "GROUP ( $(RUNTIME_PREFIX)lib/$(SHARED_MAJORNAME) $(DEVEL_PREFIX)lib/$(NONSHARED_LIBNAME) )" >> \
251 $(PREFIX)$(DEVEL_PREFIX)lib/libc.so
253 ifeq ($(strip $(PTHREADS_DEBUG_SUPPORT)),y)
254 $(LN) -sf $(RUNTIME_PREFIX_LIB_FROM_DEVEL_PREFIX_LIB)libthread_db.so.1 \
255 $(PREFIX)$(DEVEL_PREFIX)lib/libthread_db.so
257 # # If we build shared libraries then the static libs are PIC...
258 # # Make _pic.a symlinks to make mklibs.py and similar tools happy.
259 if [ -d lib ] ; then \
260 for i in `find lib/ -type f -name '*.a' | sed -e 's/lib\///'` ; do \
261 $(LN) -sf $$i $(PREFIX)$(DEVEL_PREFIX)lib/`echo $$i \
262 | sed -e 's/\.a$$/_pic.a/'`; \
265 $(RM) $(PREFIX)$(DEVEL_PREFIX)lib/uclibc_nonshared_pic.a
266 # Ugh!!! Remember that libdl.a and libdl_pic.a are different. Since
267 # libdl is pretty small, and not likely to benefit from mklibs.py and
268 # similar, lets just remove libdl_pic.a and avoid the issue
269 $(RM) $(PREFIX)$(DEVEL_PREFIX)lib/libdl_pic.a
273 # Installs run-time libraries
275 ifeq ($(strip $(HAVE_SHARED)),y)
276 $(INSTALL) -d $(PREFIX)$(RUNTIME_PREFIX)lib
277 $(INSTALL) -m 644 lib/lib*-$(MAJOR_VERSION).$(MINOR_VERSION).$(SUBLEVEL).so \
278 $(PREFIX)$(RUNTIME_PREFIX)lib
279 cp -dRf lib/*.so.* $(PREFIX)$(RUNTIME_PREFIX)lib
280 @if [ -x lib/ld-uClibc-$(MAJOR_VERSION).$(MINOR_VERSION).$(SUBLEVEL).so ] ; then \
283 $(INSTALL) -m 755 lib/ld-uClibc-$(MAJOR_VERSION).$(MINOR_VERSION).$(SUBLEVEL).so \
284 $(PREFIX)$(RUNTIME_PREFIX)lib; \
289 $(MAKE) CROSS="$(CROSS)" CC="$(CC)" -C utils
291 # Installs helper applications, such as 'ldd' and 'ldconfig'
293 $(MAKE) CROSS="$(CROSS)" CC="$(CC)" -C utils install
297 $(SECHO) Finished installing ...
300 else # ifeq ($(strip $(HAVE_DOT_CONFIG)),y)
305 # ---------------------------------------------------------------------------
307 $(MAKE) -C extra/config conf
310 $(MAKE) -C extra/config ncurses mconf
312 menuconfig: extra/config/mconf
313 $(RM) -r include/bits
314 $(INSTALL) -d include/bits
315 @./extra/config/mconf extra/Configs/Config.in
318 config: extra/config/conf
319 $(RM) -r include/bits
320 $(INSTALL) -d include/bits
321 @./extra/config/conf extra/Configs/Config.in
323 oldconfig: extra/config/conf
324 $(RM) -r include/bits
325 $(INSTALL) -d include/bits
326 @./extra/config/conf -o extra/Configs/Config.in
328 randconfig: extra/config/conf
329 $(RM) -r include/bits
330 $(INSTALL) -d include/bits
331 @./extra/config/conf -r extra/Configs/Config.in
333 allyesconfig: extra/config/conf
334 $(RM) -r include/bits
335 $(INSTALL) -d include/bits
336 @./extra/config/conf -y extra/Configs/Config.in
337 sed -i -e "s/^DODEBUG=.*/# DODEBUG is not set/" .config
338 sed -i -e "s/^DOASSERTS=.*/# DOASSERTS is not set/" .config
339 sed -i -e "s/^SUPPORT_LD_DEBUG_EARLY=.*/# SUPPORT_LD_DEBUG_EARLY is not set/" .config
340 sed -i -e "s/^SUPPORT_LD_DEBUG=.*/# SUPPORT_LD_DEBUG is not set/" .config
341 sed -i -e "s/^UCLIBC_MJN3_ONLY=.*/# UCLIBC_MJN3_ONLY is not set/" .config
342 @./extra/config/conf -o extra/Configs/Config.in
344 allnoconfig: extra/config/conf
345 $(RM) -r include/bits
346 $(INSTALL) -d include/bits
347 @./extra/config/conf -n extra/Configs/Config.in
349 defconfig: extra/config/conf
350 $(RM) -r include/bits
351 $(INSTALL) -d include/bits
352 @./extra/config/conf -d extra/Configs/Config.in
355 - find . \( -name \*.o -o -name \*.a -o -name \*.so -o -name core -o -name .\#\* \) -exec $(RM) {} \;
356 @$(RM) -r lib include/bits
357 $(RM) libc/misc/internals/interp.c
358 $(RM) include/fpu_control.h
359 $(MAKE) -C extra/locale clean
360 $(MAKE) -C ldso clean
361 $(MAKE) -C libpthread clean
362 $(MAKE) -C test clean
363 $(MAKE) -C utils clean
365 for i in `(cd $(TOPDIR)/libc/sysdeps/linux/common/sys; ls *.h)` ; do \
366 $(RM) include/sys/$$i; \
368 if [ -d libc/sysdeps/linux/$(TARGET_ARCH)/sys ] ; then \
369 for i in `(cd libc/sysdeps/linux/$(TARGET_ARCH)/sys; ls *.h)` ; do \
370 $(RM) include/sys/$$i; \
373 @$(RM) include/linux include/asm*
374 @if [ -d libc/sysdeps/linux/$(TARGET_ARCH) ]; then \
375 $(MAKE) -C libc/sysdeps/linux/$(TARGET_ARCH) clean; \
379 $(RM) .config .config.old .config.cmd
380 $(MAKE) -C extra clean
384 $(RM) -r uClibc-$(VERSION); \
385 cp -dRf uClibc uClibc-$(VERSION); \
386 find uClibc-$(VERSION)/ -type f \
387 -name .\#* -exec $(RM) -r {} \; ; \
388 find uClibc-$(VERSION)/ -type d \
389 -name .svn -exec $(RM) -r {} \; ; \
391 tar -cvzf uClibc-$(VERSION).tar.gz uClibc-$(VERSION)/
393 endif # ifeq ($(strip $(HAVE_DOT_CONFIG)),y)
398 .PHONY: dummy subdirs release distclean clean config oldconfig menuconfig utils