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 ifeq ($(strip $(COMPAT_ATEXIT)),y)
245 if [ -f $(PREFIX)$(DEVEL_PREFIX)lib/libc.so ] ; then \
246 $(RM) $(PREFIX)$(DEVEL_PREFIX)lib/libc.so; \
247 sed -e '/^GROUP/d' $(TOPDIR)lib/libc.so > $(PREFIX)$(DEVEL_PREFIX)lib/libc.so; \
248 echo "GROUP ( $(DEVEL_PREFIX)lib/$(NONSHARED_LIBNAME) $(RUNTIME_PREFIX)lib/$(SHARED_MAJORNAME) )" \
249 >> $(PREFIX)$(DEVEL_PREFIX)lib/libc.so; \
252 if [ -f $(PREFIX)$(DEVEL_PREFIX)lib/libc.so ] ; then \
253 $(RM) $(PREFIX)$(DEVEL_PREFIX)lib/libc.so; \
254 sed -e '/^GROUP/d' $(TOPDIR)lib/libc.so > $(PREFIX)$(DEVEL_PREFIX)lib/libc.so; \
255 echo "GROUP ( $(RUNTIME_PREFIX)lib/$(SHARED_MAJORNAME) $(DEVEL_PREFIX)lib/$(NONSHARED_LIBNAME) )" \
256 >> $(PREFIX)$(DEVEL_PREFIX)lib/libc.so; \
259 ifeq ($(strip $(PTHREADS_DEBUG_SUPPORT)),y)
260 $(LN) -sf $(RUNTIME_PREFIX_LIB_FROM_DEVEL_PREFIX_LIB)libthread_db.so.1 \
261 $(PREFIX)$(DEVEL_PREFIX)lib/libthread_db.so
263 # # If we build shared libraries then the static libs are PIC...
264 # # Make _pic.a symlinks to make mklibs.py and similar tools happy.
265 if [ -d lib ] ; then \
266 for i in `find lib/ -type f -name 'lib*.a' | sed -e 's/lib\///'` ; do \
267 $(LN) -sf $$i $(PREFIX)$(DEVEL_PREFIX)lib/`echo $$i \
268 | sed -e 's/\.a$$/_pic.a/'`; \
271 # Ugh!!! Remember that libdl.a and libdl_pic.a are different. Since
272 # libdl is pretty small, and not likely to benefit from mklibs.py and
273 # similar, lets just remove libdl_pic.a and avoid the issue
274 $(RM) $(PREFIX)$(DEVEL_PREFIX)lib/libdl_pic.a
278 # Installs run-time libraries
280 ifeq ($(strip $(HAVE_SHARED)),y)
281 $(INSTALL) -d $(PREFIX)$(RUNTIME_PREFIX)lib
282 $(INSTALL) -m 644 lib/lib*-$(MAJOR_VERSION).$(MINOR_VERSION).$(SUBLEVEL).so \
283 $(PREFIX)$(RUNTIME_PREFIX)lib
284 cp -dRf lib/*.so.* $(PREFIX)$(RUNTIME_PREFIX)lib
285 @if [ -x lib/ld-uClibc-$(MAJOR_VERSION).$(MINOR_VERSION).$(SUBLEVEL).so ] ; then \
288 $(INSTALL) -m 755 lib/ld-uClibc-$(MAJOR_VERSION).$(MINOR_VERSION).$(SUBLEVEL).so \
289 $(PREFIX)$(RUNTIME_PREFIX)lib; \
294 $(MAKE) CROSS="$(CROSS)" CC="$(CC)" -C utils
296 # Installs helper applications, such as 'ldd' and 'ldconfig'
298 $(MAKE) CROSS="$(CROSS)" CC="$(CC)" -C utils install
302 $(SECHO) Finished installing ...
305 else # ifeq ($(strip $(HAVE_DOT_CONFIG)),y)
310 # ---------------------------------------------------------------------------
312 $(MAKE) -C extra/config conf
315 $(MAKE) -C extra/config ncurses mconf
317 menuconfig: extra/config/mconf
318 $(RM) -r include/bits
319 $(INSTALL) -d include/bits
320 @./extra/config/mconf extra/Configs/Config.in
323 config: extra/config/conf
324 $(RM) -r include/bits
325 $(INSTALL) -d include/bits
326 @./extra/config/conf extra/Configs/Config.in
328 oldconfig: extra/config/conf
329 $(RM) -r include/bits
330 $(INSTALL) -d include/bits
331 @./extra/config/conf -o extra/Configs/Config.in
333 randconfig: extra/config/conf
334 $(RM) -r include/bits
335 $(INSTALL) -d include/bits
336 @./extra/config/conf -r extra/Configs/Config.in
338 allyesconfig: extra/config/conf
339 $(RM) -r include/bits
340 $(INSTALL) -d include/bits
341 @./extra/config/conf -y extra/Configs/Config.in
342 sed -i -e "s/^DODEBUG=.*/# DODEBUG is not set/" .config
343 sed -i -e "s/^DOASSERTS=.*/# DOASSERTS is not set/" .config
344 sed -i -e "s/^SUPPORT_LD_DEBUG_EARLY=.*/# SUPPORT_LD_DEBUG_EARLY is not set/" .config
345 sed -i -e "s/^SUPPORT_LD_DEBUG=.*/# SUPPORT_LD_DEBUG is not set/" .config
346 sed -i -e "s/^UCLIBC_MJN3_ONLY=.*/# UCLIBC_MJN3_ONLY is not set/" .config
347 @./extra/config/conf -o extra/Configs/Config.in
349 allnoconfig: extra/config/conf
350 $(RM) -r include/bits
351 $(INSTALL) -d include/bits
352 @./extra/config/conf -n extra/Configs/Config.in
354 defconfig: extra/config/conf
355 $(RM) -r include/bits
356 $(INSTALL) -d include/bits
357 @./extra/config/conf -d extra/Configs/Config.in
360 @$(RM) -r lib include/bits
362 $(RM) libc/misc/internals/interp.c
363 $(RM) include/fpu_control.h
364 $(MAKE) -C extra/locale clean
365 $(MAKE) -C ldso clean
366 $(MAKE) -C libpthread clean
367 $(MAKE) -C test clean
368 $(MAKE) -C utils clean
370 for i in `(cd $(TOPDIR)/libc/sysdeps/linux/common/sys; ls *.h)` ; do \
371 $(RM) include/sys/$$i; \
373 if [ -d libc/sysdeps/linux/$(TARGET_ARCH)/sys ] ; then \
374 for i in `(cd libc/sysdeps/linux/$(TARGET_ARCH)/sys; ls *.h)` ; do \
375 $(RM) include/sys/$$i; \
378 @$(RM) include/linux include/asm*
379 @if [ -d libc/sysdeps/linux/$(TARGET_ARCH) ]; then \
380 $(MAKE) -C libc/sysdeps/linux/$(TARGET_ARCH) clean; \
382 - find . \( -name \*.o -o -name core -o -name .\#\* \) -exec $(RM) {} \;
385 $(RM) .config .config.old .config.cmd
386 $(RM) extra/locale/*.txt
387 $(MAKE) -C extra clean
391 $(RM) -r uClibc-$(VERSION); \
392 cp -dRf uClibc uClibc-$(VERSION); \
393 find uClibc-$(VERSION)/ -type f \
394 -name .\#* -exec $(RM) -r {} \; ; \
395 find uClibc-$(VERSION)/ -type d \
396 -name .svn -exec $(RM) -r {} \; ; \
398 tar -cvzf uClibc-$(VERSION).tar.gz uClibc-$(VERSION)/
400 endif # ifeq ($(strip $(HAVE_DOT_CONFIG)),y)
405 .PHONY: dummy subdirs release distclean clean config oldconfig menuconfig utils