3 # Copyright (C) 2000-2005 Erik Andersen <andersen@uclibc.org>
5 # Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
8 #--------------------------------------------------------------
9 # You shouldn't need to mess with anything beyond this point...
10 #--------------------------------------------------------------
11 noconfig_targets := menuconfig config oldconfig randconfig \
12 defconfig allyesconfig allnoconfig clean distclean \
19 include $(top_builddir)Rules.mak
21 # need to have libc.so built, before we can build the others
22 ifeq ($(HAVE_SHARED),y)
24 DIRS = ldso libcrypt libresolv libnsl libutil librt
27 DIRS = libcrypt libresolv libnsl libutil librt
29 ifeq ($(UCLIBC_HAS_FLOATS),y)
32 ifeq ($(UCLIBC_HAS_THREADS),y)
35 ifeq ($(UCLIBC_HAS_GETTEXT_AWARENESS),y)
39 ifeq ($(HAVE_DOT_CONFIG),y)
43 # In this section, we need .config
48 $(SECHO) Finally finished compiling ...
51 include/bits/uClibc_config.h: .config
52 @if [ ! -x $(top_builddir)extra/config/conf ] ; then \
53 $(MAKE) -C $(top_builddir)extra/config conf; \
55 $(RM) -r $(top_builddir)include/bits
56 $(INSTALL) -d $(top_builddir)include/bits
57 @$(top_builddir)extra/config/conf -o $(top_srcdir)extra/Configs/Config.in
59 # For the moment, we have to keep re-running this target
60 # because the fix includes scripts rely on pre-processers
61 # in order to generate the headers correctly :(. That
62 # means we can't use the $(HOSTCC) in order to get the
64 ifeq ($(ARCH_HAS_MMU),y)
65 export header_extra_args =
67 export header_extra_args = -n
69 headers: $(top_srcdir)include/bits/uClibc_config.h
71 $(top_srcdir)extra/scripts/fix_includes.sh \
72 -k $(KERNEL_SOURCE) -t $(TARGET_ARCH) \
74 if [ -f libc/sysdeps/linux/$(TARGET_ARCH)/fpu_control.h ] ; then \
75 $(LN) -fs ../libc/sysdeps/linux/$(TARGET_ARCH)/fpu_control.h include/ ; \
77 $(LN) -fs ../libc/sysdeps/linux/common/fpu_control.h include/ ; \
79 $(LN) -fs ../libc/sysdeps/linux/common/dl-osinfo.h include/
80 @cd $(top_builddir)include/bits; \
82 for i in `ls ../../libc/sysdeps/linux/common/bits/*.h` ; do \
85 if [ -d ../../libc/sysdeps/linux/$(TARGET_ARCH)/bits ] ; then \
86 for i in `ls ../../libc/sysdeps/linux/$(TARGET_ARCH)/bits/*.h` ; do \
90 @cd $(top_builddir)include/sys; \
92 for i in `ls ../../libc/sysdeps/linux/common/sys/*.h` ; do \
95 if [ -d ../../libc/sysdeps/linux/$(TARGET_ARCH)/sys ] ; then \
96 for i in `ls ../../libc/sysdeps/linux/$(TARGET_ARCH)/sys/*.h` ; do \
100 @cd $(top_builddir); \
103 TOPDIR=. CC="$(CC)" /bin/sh extra/scripts/gen_bits_syscall_h.sh > include/bits/sysnum.h.new; \
104 if cmp include/bits/sysnum.h include/bits/sysnum.h.new >/dev/null 2>&1; then \
105 $(RM) include/bits/sysnum.h.new; \
107 $(RM) include/bits/sysnum.h; \
108 mv -f include/bits/sysnum.h.new include/bits/sysnum.h; \
110 ifeq ($(HAVE_SHARED),y)
111 $(MAKE) -C ldso headers-y
113 ifeq ($(UCLIBC_HAS_THREADS),y)
114 $(MAKE) -C libpthread headers-y
116 $(MAKE) -C libc/sysdeps/linux headers-y
118 # Command used to download source code
119 WGET:=wget --passive-ftp
121 LOCALE_DATA_FILENAME:=uClibc-locale-030818.tgz
124 ifeq ($(UCLIBC_DOWNLOAD_PREGENERATED_LOCALE_DATA),y)
125 (cd $(top_builddir)extra/locale; \
126 if [ ! -f $(LOCALE_DATA_FILENAME) ] ; then \
127 $(WGET) http://www.uclibc.org/downloads/$(LOCALE_DATA_FILENAME) ; \
130 ifeq ($(UCLIBC_PREGENERATED_LOCALE_DATA),y)
131 (cd $(top_builddir)extra/locale; zcat $(LOCALE_DATA_FILENAME) | tar -xvf -)
132 $(MAKE) -C $(top_srcdir)extra/locale pregen
135 pre_subdirs: $(patsubst %, _pre_dir_%, $(PRE_DIRS))
136 $(patsubst %, _pre_dir_%, $(PRE_DIRS)): pregen
137 $(MAKE) -C $(patsubst _pre_dir_%, %, $@)
139 subdirs: $(patsubst %, _dir_%, $(DIRS))
140 $(patsubst %, _dir_%, $(DIRS)): pre_subdirs
141 $(MAKE) -C $(patsubst _dir_%, %, $@)
143 install: install_runtime install_dev finished2
146 RUNTIME_PREFIX_LIB_FROM_DEVEL_PREFIX_LIB=$(shell $(top_srcdir)extra/scripts/relative_path.sh $(DEVEL_PREFIX)lib $(RUNTIME_PREFIX)lib)
148 # Installs header files.
150 $(INSTALL) -d $(PREFIX)$(DEVEL_PREFIX)include
151 if [ "$(KERNEL_SOURCE)" == "$(DEVEL_PREFIX)" ] ; then \
152 extra_exclude="--exclude include/linux --exclude include/asm'*'" ; \
156 tar -chf - include --exclude .svn $$extra_exclude \
157 | tar -xf - -C $(PREFIX)$(DEVEL_PREFIX)
158 $(RM) $(PREFIX)$(DEVEL_PREFIX)include/ssp-internal.h
159 $(RM) $(PREFIX)$(DEVEL_PREFIX)include/dl-osinfo.h
160 ifneq ($(UCLIBC_HAS_FLOATS),y)
161 # Remove floating point related headers since float support is disabled.
162 $(RM) $(PREFIX)$(DEVEL_PREFIX)include/complex.h
163 $(RM) $(PREFIX)$(DEVEL_PREFIX)include/fpu_control.h
164 $(RM) $(PREFIX)$(DEVEL_PREFIX)include/ieee754.h
165 $(RM) $(PREFIX)$(DEVEL_PREFIX)include/math.h
166 $(RM) $(PREFIX)$(DEVEL_PREFIX)include/tgmath.h
167 $(RM) $(PREFIX)$(DEVEL_PREFIX)include/bits/uClibc_fpmax.h
169 ifneq ($(UCLIBC_HAS_WCHAR),y)
170 # Remove wide char headers since wide char support is disabled.
171 $(RM) $(PREFIX)$(DEVEL_PREFIX)include/wctype.h
172 $(RM) $(PREFIX)$(DEVEL_PREFIX)include/wchar.h
174 ifneq ($(UCLIBC_HAS_LOCALE),y)
175 # Remove iconv header since locale support is disabled.
176 $(RM) $(PREFIX)$(DEVEL_PREFIX)include/iconv.h
178 ifneq ($(UCLIBC_HAS_GLIBC_CUSTOM_PRINTF),y)
179 # Remove printf header since custom print specifier support is disabled.
180 $(RM) $(PREFIX)$(DEVEL_PREFIX)include/printf.h
182 ifneq ($(UCLIBC_HAS_XLOCALE),y)
183 # Remove xlocale header since extended locale support is disabled.
184 $(RM) $(PREFIX)$(DEVEL_PREFIX)include/xlocale.h
186 ifneq ($(UCLIBC_HAS_GETTEXT_AWARENESS),y)
187 # Remove libintl header since gettext support is disabled.
188 $(RM) $(PREFIX)$(DEVEL_PREFIX)include/libintl.h
190 ifneq ($(UCLIBC_HAS_REGEX),y)
191 # Remove regex headers since regex support is disabled.
192 $(RM) $(PREFIX)$(DEVEL_PREFIX)include/regex.h
193 $(RM) $(PREFIX)$(DEVEL_PREFIX)include/regexp.h
195 ifneq ($(UCLIBC_HAS_WORDEXP),y)
196 # Remove wordexp header since wordexp support is disabled.
197 $(RM) $(PREFIX)$(DEVEL_PREFIX)include/wordexp.h
199 ifneq ($(UCLIBC_HAS_FTW),y)
200 # Remove ftw header since ftw support is disabled.
201 $(RM) $(PREFIX)$(DEVEL_PREFIX)include/ftw.h
203 ifneq ($(UCLIBC_HAS_GLOB),y)
204 # Remove glob header since glob support is disabled.
205 $(RM) $(PREFIX)$(DEVEL_PREFIX)include/glob.h
207 ifneq ($(UCLIBC_HAS_GNU_GETOPT),y)
208 # Remove getopt header since gnu getopt support is disabled.
209 $(RM) $(PREFIX)$(DEVEL_PREFIX)include/getopt.h
211 ifneq ($(HAS_SHADOW),y)
212 # Remove shadow header since shadow password support is disabled.
213 $(RM) $(PREFIX)$(DEVEL_PREFIX)include/shadow.h
215 ifneq ($(PTHREADS_DEBUG_SUPPORT),y)
216 # Remove thread_db header since thread debug support is disabled.
217 $(RM) $(PREFIX)$(DEVEL_PREFIX)include/thread_db.h
219 ifneq ($(UCLIBC_HAS_THREADS),y)
220 # Remove pthread headers since thread support is disabled.
221 $(RM) $(PREFIX)$(DEVEL_PREFIX)include/*thread*.h
222 $(RM) $(PREFIX)$(DEVEL_PREFIX)include/semaphore.h
223 $(RM) $(PREFIX)$(DEVEL_PREFIX)include/bits/*thread*.h
225 -@for i in `find $(PREFIX)$(DEVEL_PREFIX) -type d` ; do \
226 chmod 755 $$i; chmod 644 $$i/*.h > /dev/null 2>&1; \
228 -find $(PREFIX)$(DEVEL_PREFIX) -name .svn | xargs $(RM) -r
229 -chown -R `id | sed 's/^uid=\([0-9]*\).*gid=\([0-9]*\).*$$/\1:\2/'` $(PREFIX)$(DEVEL_PREFIX)
231 # Installs development library links.
232 install_dev: install_headers
233 $(INSTALL) -d $(PREFIX)$(DEVEL_PREFIX)lib
234 -$(INSTALL) -m 644 lib/*.[ao] $(PREFIX)$(DEVEL_PREFIX)lib/
235 ifeq ($(HAVE_SHARED),y)
236 for i in `find lib/ -type l -name 'lib[a-zA-Z]*.so' | \
237 sed -e 's/lib\///'` ; do \
238 $(LN) -sf $(RUNTIME_PREFIX_LIB_FROM_DEVEL_PREFIX_LIB)$$i.$(MAJOR_VERSION) \
239 $(PREFIX)$(DEVEL_PREFIX)lib/$$i; \
241 if [ -f $(top_builddir)lib/libc.so -a -f $(PREFIX)$(RUNTIME_PREFIX)lib/$(SHARED_MAJORNAME) ] ; then \
242 $(RM) $(PREFIX)$(DEVEL_PREFIX)lib/libc.so; \
243 sed -e 's:$(NONSHARED_LIBNAME):$(DEVEL_PREFIX)lib/$(NONSHARED_LIBNAME):' \
244 -e 's:$(SHARED_MAJORNAME):$(RUNTIME_PREFIX)lib/$(SHARED_MAJORNAME):' \
245 -e 's:$(UCLIBC_LDSO):$(RUNTIME_PREFIX)lib/$(UCLIBC_LDSO):' \
246 $(top_builddir)lib/libc.so > $(PREFIX)$(DEVEL_PREFIX)lib/libc.so; \
248 ifeq ($(PTHREADS_DEBUG_SUPPORT),y)
249 $(LN) -sf $(RUNTIME_PREFIX_LIB_FROM_DEVEL_PREFIX_LIB)libthread_db.so.1 \
250 $(PREFIX)$(DEVEL_PREFIX)lib/libthread_db.so
252 # # If we build shared libraries then the static libs are PIC...
253 # # Make _pic.a symlinks to make mklibs.py and similar tools happy.
254 if [ -d lib ] ; then \
255 for i in `find lib/ -type f -name 'lib*.a' | sed -e 's/lib\///'` ; do \
256 $(LN) -sf $$i $(PREFIX)$(DEVEL_PREFIX)lib/`echo $$i \
257 | sed -e 's/\.a$$/_pic.a/'`; \
262 # Installs run-time libraries
264 ifeq ($(HAVE_SHARED),y)
265 $(INSTALL) -d $(PREFIX)$(RUNTIME_PREFIX)lib
266 $(INSTALL) -m 644 lib/lib*-$(MAJOR_VERSION).$(MINOR_VERSION).$(SUBLEVEL).so \
267 $(PREFIX)$(RUNTIME_PREFIX)lib
268 cp -dRf lib/*.so.* $(PREFIX)$(RUNTIME_PREFIX)lib
269 @if [ -x lib/ld-uClibc-$(MAJOR_VERSION).$(MINOR_VERSION).$(SUBLEVEL).so ] ; then \
272 $(INSTALL) -m 755 lib/ld-uClibc-$(MAJOR_VERSION).$(MINOR_VERSION).$(SUBLEVEL).so \
273 $(PREFIX)$(RUNTIME_PREFIX)lib; \
278 $(MAKE) CROSS="$(CROSS)" CC="$(CC)" -C utils
280 # Installs helper applications, such as 'ldd' and 'ldconfig'
282 $(MAKE) CROSS="$(CROSS)" CC="$(CC)" -C utils install
286 $(SECHO) Finished installing ...
289 else # ifeq ($(HAVE_DOT_CONFIG),y)
294 # ---------------------------------------------------------------------------
296 $(MAKE) -C extra/config conf
299 $(MAKE) -C extra/config ncurses mconf
301 menuconfig: extra/config/mconf
302 $(RM) -r include/bits
303 $(INSTALL) -d include/bits
304 @./extra/config/mconf extra/Configs/Config.in
307 config: extra/config/conf
308 $(RM) -r include/bits
309 $(INSTALL) -d include/bits
310 @./extra/config/conf extra/Configs/Config.in
312 oldconfig: extra/config/conf
313 $(RM) -r include/bits
314 $(INSTALL) -d include/bits
315 @./extra/config/conf -o extra/Configs/Config.in
317 randconfig: extra/config/conf
318 $(RM) -r include/bits
319 $(INSTALL) -d include/bits
320 @./extra/config/conf -r extra/Configs/Config.in
322 allyesconfig: extra/config/conf
323 $(RM) -r include/bits
324 $(INSTALL) -d include/bits
325 @./extra/config/conf -y extra/Configs/Config.in
326 sed -i -e "s/^DODEBUG=.*/# DODEBUG is not set/" .config
327 sed -i -e "s/^DOASSERTS=.*/# DOASSERTS is not set/" .config
328 sed -i -e "s/^SUPPORT_LD_DEBUG_EARLY=.*/# SUPPORT_LD_DEBUG_EARLY is not set/" .config
329 sed -i -e "s/^SUPPORT_LD_DEBUG=.*/# SUPPORT_LD_DEBUG is not set/" .config
330 sed -i -e "s/^UCLIBC_MJN3_ONLY=.*/# UCLIBC_MJN3_ONLY is not set/" .config
331 @./extra/config/conf -o extra/Configs/Config.in
333 allnoconfig: extra/config/conf
334 $(RM) -r include/bits
335 $(INSTALL) -d include/bits
336 @./extra/config/conf -n extra/Configs/Config.in
338 defconfig: extra/config/conf
339 $(RM) -r include/bits
340 $(INSTALL) -d include/bits
341 @./extra/config/conf -d extra/Configs/Config.in
344 @$(RM) -r lib include/bits
345 $(RM) lib*/*.a ldso/*/*.a libpthread/*/*.a
346 $(RM) libc/misc/internals/interp.c
347 $(RM) include/fpu_control.h include/dl-osinfo.h
348 $(MAKE) -C extra/locale clean
349 $(MAKE) -C ldso headers_clean-y
350 $(MAKE) -C libpthread headers_clean-y
351 $(MAKE) -C libc/sysdeps/linux headers_clean-y
352 $(MAKE) -C test clean
353 $(MAKE) -C utils clean
355 for i in `(cd libc/sysdeps/linux/common/sys; ls *.h)` ; do \
356 $(RM) include/sys/$$i; \
358 if [ -d libc/sysdeps/linux/$(TARGET_ARCH)/sys ] ; then \
359 for i in `(cd libc/sysdeps/linux/$(TARGET_ARCH)/sys; ls *.h)` ; do \
360 $(RM) include/sys/$$i; \
363 @$(RM) include/linux include/asm*
364 -find . \( -name \*.o -o -name \*.os -o -name \*.oS \) -exec $(RM) {} \;
367 -find . \( -name core -o -name \*.orig -o -name \*~ \) -exec $(RM) {} \;
368 $(RM) .config .config.old .config.cmd
369 $(RM) extra/locale/*.txt
370 $(MAKE) -C extra clean
374 $(RM) -r ../uClibc-$(VERSION) ../uClibc-$(VERSION).tar.gz
375 svn -q export . ../uClibc-$(VERSION)
376 tar czf ../uClibc-$(VERSION).tar.gz -C .. uClibc-$(VERSION)
377 du -b ../uClibc-$(VERSION).tar.gz
379 endif # ifeq ($(HAVE_DOT_CONFIG),y)
381 include $(top_srcdir)Makerules
386 .PHONY: dummy subdirs release dist distclean clean config oldconfig menuconfig utils