OSDN Git Service

- add/use variables to make build-tools configurable
[uclinux-h8/uClibc.git] / Makefile.in
1 # Makefile for uClibc
2 #
3 # Copyright (C) 2000-2005 Erik Andersen <andersen@uclibc.org>
4 #
5 # Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
6 #
7
8 #--------------------------------------------------------------
9 # You shouldn't need to mess with anything beyond this point...
10 #--------------------------------------------------------------
11 clean_targets := clean realclean distclean \
12         objclean-y headers_clean-y utils_clean
13 noconfig_targets := menuconfig config oldconfig silentoldconfig randconfig \
14         defconfig allyesconfig allnoconfig \
15         release dist tags help
16
17 include $(top_builddir)Rules.mak
18 sub_headers := headers
19
20 #suspicious_dependency:=include/bits
21
22 ifeq ($(HAVE_DOT_CONFIG),y)
23
24 # To be able to build the libs rule, we must first have the generated headers.
25 # This is needed when locale support is enabled, but also ensures that the
26 # build process is parallel safe.
27 libs: pregen
28
29 all: pregen libs
30
31 # In this section, we need .config
32 -include .config.cmd
33
34 else # ifeq ($(HAVE_DOT_CONFIG),y)
35
36 all: menuconfig
37
38 headers:
39         @echo "Need to make a config file first, run: make menuconfig"
40         @false
41
42 endif # ifeq ($(HAVE_DOT_CONFIG),y)
43
44 include $(top_srcdir)ldso/Makefile.in
45 include $(top_srcdir)libcrypt/Makefile.in
46 include $(top_srcdir)libintl/Makefile.in
47 include $(top_srcdir)libm/Makefile.in
48 include $(top_srcdir)libnsl/Makefile.in
49 include $(top_srcdir)libresolv/Makefile.in
50 include $(top_srcdir)libutil/Makefile.in
51 include $(top_srcdir)libpthread/Makefile.in
52 include $(top_srcdir)librt/Makefile.in
53 include $(top_srcdir)extra/locale/Makefile.in
54
55 # last included to catch all the objects added by others (locales/threads)
56 include $(top_srcdir)libc/Makefile.in
57
58 ifeq ($(HAVE_DOT_CONFIG),y)
59 # If the .config changes then we have to make sure that our includes are
60 # updated properly. This would normally work by saying that the headers
61 # have uClibc_config.h as prerequisite but since we _symlink_ the headers
62 # and do not (?) want to rely on 'make -L' we better update them right here,
63 # on spot to save us from alot of hazzle.
64 include/bits/uClibc_config.h: extra/config/conf .config $(top_srcdir)extra/scripts/conf-header.sh | include/bits
65         @$(disp_gen)
66         @#superfluous: $(Q)$(INSTALL) -d $(dir $@)
67         $(Q)@$< -s $(top_srcdir)extra/Configs/Config.in
68         $(Q)$(top_srcdir)extra/scripts/conf-header.sh .config > $@
69         $(Q)$(MAKE) headers-y
70
71 # For the moment, we have to keep re-running this target
72 # because the fix includes scripts rely on pre-processers
73 # in order to generate the headers correctly :(.  That
74 # means we can't use the $(HOSTCC) in order to get the
75 # correct output.
76 ifeq ($(ARCH_USE_MMU),y)
77 export header_extra_args =
78 else
79 export header_extra_args = -n
80 endif
81 HEADERS_BITS_COMMON := $(notdir $(wildcard $(top_srcdir)libc/sysdeps/linux/common/bits/*.h))
82 HEADERS_BITS_ARCH   := $(notdir $(wildcard $(top_srcdir)libc/sysdeps/linux/$(TARGET_ARCH)/bits/*.h))
83 HEADERS_BITS_SUBARCH :=
84 ifneq ($(TARGET_SUBARCH),)
85 HEADERS_BITS_SUBARCH := $(notdir $(wildcard $(top_srcdir)libc/sysdeps/linux/$(TARGET_ARCH)/bits/$(TARGET_SUBARCH)/*.h))
86 endif
87 HEADERS_BITS_COMMON := $(filter-out $(HEADERS_BITS_ARCH) $(HEADERS_BITS_SUBARCH) $(HEADERS_BITS_PTHREAD),$(HEADERS_BITS_COMMON))
88
89 HEADERS_SYS_COMMON := $(notdir $(wildcard $(top_srcdir)libc/sysdeps/linux/common/sys/*.h))
90 HEADERS_SYS_ARCH := $(notdir $(wildcard $(top_srcdir)libc/sysdeps/linux/$(TARGET_ARCH)/sys/*.h))
91 HEADERS_SYS_COMMON := $(filter-out $(HEADERS_SYS_ARCH),$(HEADERS_SYS_COMMON))
92
93 ALL_HEADERS_COMMON       := include/fpu_control.h include/dl-osinfo.h \
94                                 include/hp-timing.h
95 ALL_HEADERS_BITS_COMMON  := $(addprefix include/bits/,$(HEADERS_BITS_COMMON))
96 ALL_HEADERS_BITS_ARCH    := $(addprefix include/bits/,$(HEADERS_BITS_ARCH))
97 ifneq ($(TARGET_SUBARCH),)
98 ALL_HEADERS_BITS_SUBARCH := $(addprefix include/bits/,$(HEADERS_BITS_SUBARCH))
99 else
100 ALL_HEADERS_BITS_SUBARCH :=
101 endif
102 ALL_HEADERS_SYS_COMMON   := $(addprefix include/sys/,$(HEADERS_SYS_COMMON))
103 ALL_HEADERS_SYS_ARCH     := $(addprefix include/sys/,$(HEADERS_SYS_ARCH))
104
105 target-headers-sysdep := \
106         $(ALL_HEADERS_COMMON) \
107         $(ALL_HEADERS_BITS_COMMON) \
108         $(ALL_HEADERS_BITS_ARCH) \
109         $(ALL_HEADERS_BITS_SUBARCH) \
110         $(ALL_HEADERS_SYS_COMMON) \
111         $(ALL_HEADERS_SYS_ARCH)
112
113 include/fpu_control.h:
114         @$(disp_ln)
115         $(Q)[ -r libc/sysdeps/linux/$(TARGET_ARCH)/$(@F) ] && \
116                 $(LN) -fs ../libc/sysdeps/linux/$(TARGET_ARCH)/$(@F) $@ || \
117                 $(LN) -fs ../libc/sysdeps/linux/common/$(@F) $@
118
119 include/dl-osinfo.h include/hp-timing.h:
120         $(do_ln) ../libc/sysdeps/linux/common/$(@F) $@
121
122 $(ALL_HEADERS_BITS_COMMON):
123         $(do_ln) ../../libc/sysdeps/linux/common/bits/$(@F) $@
124
125 $(ALL_HEADERS_BITS_ARCH):
126         $(do_ln) ../../libc/sysdeps/linux/$(TARGET_ARCH)/bits/$(@F) $@
127
128 ifneq ($(TARGET_SUBARCH),)
129 $(ALL_HEADERS_BITS_SUBARCH):
130         $(do_ln) ../../../libc/sysdeps/linux/$(TARGET_ARCH)/bits/$(TARGET_SUBARCH)/$(@F) $@
131 endif
132
133 ifneq ($(strip $(ALL_HEADERS_SYS_COMMON)),)
134 $(ALL_HEADERS_SYS_COMMON):
135         $(do_ln) ../../libc/sysdeps/linux/common/sys/$(@F) $@
136 endif
137
138 ifneq ($(strip $(ALL_HEADERS_SYS_ARCH)),)
139 $(ALL_HEADERS_SYS_ARCH):
140         $(do_ln) ../../libc/sysdeps/linux/$(TARGET_ARCH)/sys/$(@F) $@
141 endif
142
143 $(target-headers-sysdep): | include/bits
144
145 sysdep_common_headers-clean:
146         $(RM) $(ALL_HEADERS_COMMON)
147 headers_clean-y += sysdep_common_headers-clean
148
149 # The headers. Arch specific headers are specified via ARCH_HEADERS in
150 # libc/sysdeps/linux/$(TARGET_ARCH)/Makefile.arch which appends those via
151 # libc/sysdeps/linux/Makefile.commonarch to headers-y
152 headers-y += $(target-headers-sysdep)
153
154 headers: include/bits/uClibc_config.h
155
156 pregen: include/bits/sysnum.h headers
157         $(Q)$(if $(UCLIBC_HAS_LOCALE),$(MAKE) -C extra/locale locale_headers)
158
159 include/bits/sysnum.h: $(top_srcdir)extra/scripts/gen_bits_syscall_h.sh
160         $(Q)$(INSTALL) -d $(@D)
161         @$(disp_gen)
162         $(Q)set -e; \
163         cd $(top_builddir); \
164         tmp=`mktemp include/bits/sysnum.h.XXXXXX 2>/dev/null`; \
165         [ -z "$$tmp" ] && tmp='include/bits/sysnum.h.new'; \
166         KERNEL_HEADERS="${KERNEL_HEADERS}" top_builddir=. CC="$(CC) $(CPU_CFLAGS)" $(SHELL) extra/scripts/gen_bits_syscall_h.sh > $$tmp; \
167         if cmp include/bits/sysnum.h $$tmp >/dev/null 2>&1; then \
168                 $(RM) $$tmp; \
169         else \
170                 mv -f $$tmp include/bits/sysnum.h; \
171         fi
172
173 $(LOCAL_INSTALL_PATH):
174         $(Q)$(MAKE) PREFIX=$(shell pwd)/ RUNTIME_PREFIX=./ \
175         DEVEL_PREFIX=$(LOCAL_INSTALL_PATH)/usr/ \
176         HOSTCC="$(HOSTCC)" \
177         install_kernel_headers
178         $(Q)$(MAKE) PREFIX=$(shell pwd)/ RUNTIME_PREFIX=./ \
179         DEVEL_PREFIX=$(LOCAL_INSTALL_PATH)/usr/ \
180         HOSTCC="$(HOSTCC)" \
181         install_dev
182
183 install: install_runtime install_dev
184
185
186 RUNTIME_PREFIX_LIB_FROM_DEVEL_PREFIX_LIB=$(shell $(top_srcdir)extra/scripts/relative_path.sh $(DEVEL_PREFIX)lib $(RUNTIME_PREFIX)lib)
187
188 $(top_builddir)extra/scripts/unifdef: $(top_srcdir)extra/scripts/unifdef.c
189         $(hcompile.u)
190
191 # Installs kernel header files (linux/*, asm/*, asm-generic/*).
192 install_kernel_headers: headers
193         top_builddir=$(top_builddir) \
194         $(top_srcdir)extra/scripts/install_kernel_headers.sh include $(PREFIX)$(DEVEL_PREFIX)include
195
196 # Installs header files.
197 install_headers: headers $(top_builddir)extra/scripts/unifdef
198         $(INSTALL) -d $(PREFIX)$(DEVEL_PREFIX)include
199         top_builddir=$(top_builddir) \
200         $(top_srcdir)extra/scripts/install_headers.sh include $(PREFIX)$(DEVEL_PREFIX)include
201         printf '#ifndef _LIBC_INTERNAL_H\n#define _LIBC_INTERNAL_H 1\n#endif\n' > \
202                 $(PREFIX)$(DEVEL_PREFIX)include/libc-internal.h
203         echo '/* Dont use _syscall#() macros; use the syscall() function */' > \
204                 $(PREFIX)$(DEVEL_PREFIX)include/bits/syscalls.h
205         $(RM) $(PREFIX)$(DEVEL_PREFIX)include/dl-osinfo.h
206         $(RM) $(PREFIX)$(DEVEL_PREFIX)include/_lfs_64.h
207         $(RM) $(PREFIX)$(DEVEL_PREFIX)include/bits/uClibc_uintmaxtostr.h
208         $(RM) $(PREFIX)$(DEVEL_PREFIX)include/bits/kernel_sigaction.h
209         $(RM) $(PREFIX)$(DEVEL_PREFIX)include/bits/kernel_stat.h
210 ifneq ($(UCLIBC_HAS_FLOATS),y)
211         # Remove floating point related headers since float support is disabled.
212         $(RM) $(PREFIX)$(DEVEL_PREFIX)include/complex.h
213         $(RM) $(PREFIX)$(DEVEL_PREFIX)include/fpu_control.h
214         $(RM) $(PREFIX)$(DEVEL_PREFIX)include/ieee754.h
215         $(RM) $(PREFIX)$(DEVEL_PREFIX)include/math.h
216         $(RM) $(PREFIX)$(DEVEL_PREFIX)include/tgmath.h
217         $(RM) $(PREFIX)$(DEVEL_PREFIX)include/bits/uClibc_fpmax.h
218 endif
219 ifneq ($(UCLIBC_HAS_FENV),y)
220         $(RM) $(PREFIX)$(DEVEL_PREFIX)include/fenv.h \
221                 $(PREFIX)$(DEVEL_PREFIX)include/bits/fenv.h \
222                 $(PREFIX)$(DEVEL_PREFIX)include/bits/fenvinline.h
223 endif
224 ifneq ($(UCLIBC_HAS_WCHAR),y)
225         # Remove wide char headers since wide char support is disabled.
226         $(RM) $(PREFIX)$(DEVEL_PREFIX)include/wctype.h
227         $(RM) $(PREFIX)$(DEVEL_PREFIX)include/wchar.h
228 endif
229 ifneq ($(UCLIBC_HAS_LOCALE),y)
230         # Remove iconv header since locale support is disabled.
231         $(RM) $(PREFIX)$(DEVEL_PREFIX)include/iconv.h
232 endif
233 ifneq ($(UCLIBC_HAS_GLIBC_CUSTOM_PRINTF),y)
234         # Remove printf header since custom print specifier support is disabled.
235         $(RM) $(PREFIX)$(DEVEL_PREFIX)include/printf.h
236 endif
237 ifneq ($(UCLIBC_HAS_XLOCALE),y)
238         # Remove xlocale header since extended locale support is disabled.
239         $(RM) $(PREFIX)$(DEVEL_PREFIX)include/xlocale.h
240 endif
241 ifneq ($(UCLIBC_HAS_GETTEXT_AWARENESS),y)
242         # Remove libintl header since gettext support is disabled.
243         $(RM) $(PREFIX)$(DEVEL_PREFIX)include/libintl.h
244 endif
245 ifneq ($(UCLIBC_HAS_REGEX),y)
246         # Remove regex headers since regex support is disabled.
247         $(RM) $(PREFIX)$(DEVEL_PREFIX)include/regex.h
248         $(RM) $(PREFIX)$(DEVEL_PREFIX)include/regexp.h
249 endif
250 ifneq ($(UCLIBC_HAS_WORDEXP),y)
251         # Remove wordexp header since wordexp support is disabled.
252         $(RM) $(PREFIX)$(DEVEL_PREFIX)include/wordexp.h
253 endif
254 ifneq ($(UCLIBC_HAS_FTW),y)
255         # Remove ftw header since ftw support is disabled.
256         $(RM) $(PREFIX)$(DEVEL_PREFIX)include/ftw.h
257 endif
258 ifneq ($(UCLIBC_HAS_GLOB),y)
259         # Remove glob header since glob support is disabled.
260         $(RM) $(PREFIX)$(DEVEL_PREFIX)include/glob.h
261 endif
262 ifneq ($(UCLIBC_HAS_GNU_GETOPT),y)
263 ifneq ($(UCLIBC_HAS_GETOPT_LONG),y)
264         # Remove getopt header since gnu getopt support is disabled.
265         $(RM) $(PREFIX)$(DEVEL_PREFIX)include/getopt.h
266 endif
267 endif
268 ifneq ($(UCLIBC_HAS_SHADOW),y)
269         # Remove shadow header since shadow password support is disabled.
270         $(RM) $(PREFIX)$(DEVEL_PREFIX)include/shadow.h
271 endif
272 ifneq ($(PTHREADS_DEBUG_SUPPORT),y)
273         # Remove thread_db header since thread debug support is disabled.
274         $(RM) $(PREFIX)$(DEVEL_PREFIX)include/thread_db.h
275 endif
276 ifneq ($(UCLIBC_HAS_THREADS),y)
277         # Remove pthread headers since thread support is disabled.
278         $(RM) $(PREFIX)$(DEVEL_PREFIX)include/*thread*.h
279         $(RM) $(PREFIX)$(DEVEL_PREFIX)include/semaphore.h
280         $(RM) $(PREFIX)$(DEVEL_PREFIX)include/bits/*thread*.h
281 endif
282 ifneq ($(HAVE_SHARED),y)
283         # Remove dlfcn header if we don't have shared libraries.
284         $(RM) $(PREFIX)$(DEVEL_PREFIX)include/dlfcn.h
285         $(RM) $(PREFIX)$(DEVEL_PREFIX)include/bits/dlfcn.h
286 endif
287 ifeq ($(UCLIBC_HAS_THREADS_NATIVE),y)
288         # Remove this as it is only used internally.
289         $(RM) $(PREFIX)$(DEVEL_PREFIX)include/tls.h
290 endif
291 ifneq ($(UCLIBC_HAS_GNU_ERROR),y)
292         # Remove error.h upon request
293         $(RM) $(PREFIX)$(DEVEL_PREFIX)include/error.h
294 endif
295 ifneq ($(UCLIBC_HAS_BSD_ERR),y)
296         # Remove err.h upon request
297         $(RM) $(PREFIX)$(DEVEL_PREFIX)include/err.h
298 endif
299 ifneq ($(UCLIBC_SUSV3_LEGACY),y)
300         # Remove timeb.h since the LEGACY ftime() was disabled upon request
301         $(RM) $(PREFIX)$(DEVEL_PREFIX)include/sys/timeb.h
302 endif
303 ifneq ($(UCLIBC_HAS_EPOLL),y)
304         # Remove epoll.h since epoll_*() were disabled upon request
305         $(RM) $(PREFIX)$(DEVEL_PREFIX)include/sys/epoll.h
306 endif
307 ifneq ($(UCLIBC_HAS_XATTR),y)
308         # Remove xattr.h since extended attributes were disabled upon request
309         $(RM) $(PREFIX)$(DEVEL_PREFIX)include/sys/xattr.h
310 endif
311 ifneq ($(UCLIBC_HAS_PTY),y)
312         # Remove pty.h since PTY support was disabled upon request
313         $(RM) $(PREFIX)$(DEVEL_PREFIX)include/pty.h
314 endif
315 ifneq ($(UCLIBC_LINUX_SPECIFIC),y)
316         # Remove linux-specific headers as requested
317         $(RM) $(PREFIX)$(DEVEL_PREFIX)include/sys/inotify.h
318         $(RM) $(PREFIX)$(DEVEL_PREFIX)include/sys/perm.h
319         $(RM) $(PREFIX)$(DEVEL_PREFIX)include/sys/personality.h
320 endif
321 ifneq ($(UCLIBC_SV4_DEPRECATED),y)
322         # Remove ustat.h since deprecated SV4 support was disabled upon request
323         $(RM) $(PREFIX)$(DEVEL_PREFIX)include/ustat.h
324         $(RM) $(PREFIX)$(DEVEL_PREFIX)include/sys/ustat.h
325         $(RM) $(PREFIX)$(DEVEL_PREFIX)include/bits/ustat.h
326 endif
327 ifeq ($(UCLIBC_HAS_REALTIME)$(UCLIBC_HAS_ADVANCED_REALTIME),)
328         # Remove SUSv-realtime related message-queue headers upon request
329         $(RM) $(PREFIX)$(DEVEL_PREFIX)include/mqueue.h
330         $(RM) $(PREFIX)$(DEVEL_PREFIX)include/sys/mqueue.h
331         $(RM) $(PREFIX)$(DEVEL_PREFIX)include/bits/mqueue.h
332 endif
333 ifneq ($(UCLIBC_HAS_REALTIME),y)
334         # Remove SUSv-realtime related headers upon request
335         $(RM) $(PREFIX)$(DEVEL_PREFIX)include/sched.h
336         $(RM) $(PREFIX)$(DEVEL_PREFIX)include/sys/sched.h
337         $(RM) $(PREFIX)$(DEVEL_PREFIX)include/bits/sched.h
338         $(RM) $(PREFIX)$(DEVEL_PREFIX)include/semaphore.h
339         $(RM) $(PREFIX)$(DEVEL_PREFIX)include/sys/semaphore.h
340         $(RM) $(PREFIX)$(DEVEL_PREFIX)include/bits/semaphore.h
341 endif
342 ifneq ($(UCLIBC_HAS_SOCKET),y)
343         # Remove socket related headers upon request
344         $(RM) $(PREFIX)$(DEVEL_PREFIX)include/sys/socket.h
345         $(RM) $(PREFIX)$(DEVEL_PREFIX)include/bits/socket.h
346         $(RM) $(PREFIX)$(DEVEL_PREFIX)include/sys/socketvar.h
347 endif
348 ifneq ($(UCLIBC_HAS_CRYPT),y)
349         # Remove crypt.h since libcrypt was disabled upon request
350         $(RM) $(PREFIX)$(DEVEL_PREFIX)include/crypt.h
351 endif
352 ifneq ($(UCLIBC_SUPPORT_AI_ADDRCONFIG),y)
353         # Remove ifaddrs.h since the corresponding functionality is disabled
354         $(RM) $(PREFIX)$(DEVEL_PREFIX)include/ifaddrs.h
355 endif
356
357 # Installs development library links.
358 install_dev: install_headers all
359         $(INSTALL) -d $(PREFIX)$(DEVEL_PREFIX)lib
360         -$(INSTALL) -m 644 lib/*.[ao] $(PREFIX)$(DEVEL_PREFIX)lib/
361 ifeq ($(HAVE_SHARED),y)
362         for i in `find lib/ -type l -name 'lib[a-zA-Z]*.so' | \
363         $(SED) -e 's/lib\///'` ; do \
364                 $(LN) -sf $(RUNTIME_PREFIX_LIB_FROM_DEVEL_PREFIX_LIB)$$i.$(MAJOR_VERSION) \
365                 $(PREFIX)$(DEVEL_PREFIX)lib/$$i; \
366         done
367         if [ -f $(top_builddir)lib/libc.so -a -f $(PREFIX)$(RUNTIME_PREFIX)lib/$(SHARED_MAJORNAME) ] ; then \
368                 $(RM) $(PREFIX)$(DEVEL_PREFIX)lib/libc.so; \
369                 $(SED) -e 's:$(NONSHARED_LIBNAME):$(DEVEL_PREFIX)lib/$(NONSHARED_LIBNAME):' \
370                     -e 's:$(SHARED_MAJORNAME):$(RUNTIME_PREFIX)lib/$(SHARED_MAJORNAME):' \
371                     -e 's:$(UCLIBC_LDSO):$(RUNTIME_PREFIX)lib/$(UCLIBC_LDSO):' \
372                     $(top_builddir)lib/libc.so > $(PREFIX)$(DEVEL_PREFIX)lib/libc.so; \
373         fi
374 ifeq ($(UCLIBC_HAS_THREADS),y)
375 ifneq ($(LINUXTHREADS_OLD),y)
376         if [ -f $(top_builddir)lib/libpthread.so -a -f $(PREFIX)$(RUNTIME_PREFIX)lib/libpthread.so.$(MAJOR_VERSION) ] ; then \
377                 $(RM) $(PREFIX)$(DEVEL_PREFIX)lib/libpthread.so; \
378                 cp $(top_srcdir)extra/scripts/format.lds $(PREFIX)$(DEVEL_PREFIX)lib/libpthread.so; \
379                 echo "GROUP ( $(RUNTIME_PREFIX)lib/libpthread.so.$(MAJOR_VERSION) $(DEVEL_PREFIX)lib/libpthread_nonshared.a )" \
380                         >> $(PREFIX)$(DEVEL_PREFIX)lib/libpthread.so; \
381         fi
382 endif
383 endif
384 ifeq ($(PTHREADS_DEBUG_SUPPORT),y)
385         $(LN) -sf $(RUNTIME_PREFIX_LIB_FROM_DEVEL_PREFIX_LIB)libthread_db.so.1 \
386                 $(PREFIX)$(DEVEL_PREFIX)lib/libthread_db.so
387 endif
388 ifeq ($(DOPIC),y)
389 #       # If we build shared libraries then the static libs are PIC...
390 #       # Make _pic.a symlinks to make mklibs.py and similar tools happy.
391         if [ -d lib ] ; then \
392                 for i in `find lib/ -type f -name 'lib*.a' | $(SED) -e 's/lib\///'` ; do \
393                         $(LN) -sf $$i $(PREFIX)$(DEVEL_PREFIX)lib/`echo $$i \
394                                 | $(SED) -e 's/\.a$$/_pic.a/'`; \
395                 done ; \
396         fi
397 endif
398 endif
399 ifeq ($(UCLIBC_FORMAT_SHARED_FLAT),y)
400         for file in lib/lib*.gdb; do \
401                 if test -f $$file; then \
402                         $(INSTALL) -m 755 $$file $(PREFIX)$(DEVEL_PREFIX)lib; \
403                         $(INSTALL) -m 755 `echo $$file | $(SED) 's/\.gdb$$//'` \
404                           $(PREFIX)$(DEVEL_PREFIX)lib; \
405                 fi; \
406         done
407 endif
408
409 # Installs run-time libraries
410 install_runtime: all
411 ifeq ($(HAVE_SHARED),y)
412         $(INSTALL) -d $(PREFIX)$(RUNTIME_PREFIX)lib
413         $(INSTALL) -m 644 lib/lib*-$(VERSION).so \
414                 $(PREFIX)$(RUNTIME_PREFIX)lib
415         cd lib && $(TAR) -cf - *.so.* | $(TAR) -xf - -C $(PREFIX)$(RUNTIME_PREFIX)lib
416         @if [ -x lib/$(UCLIBC_LDSO_NAME)-$(VERSION).so ] ; then \
417                 set -e; \
418                 $(SHELL_SET_X); \
419                 $(INSTALL) -m 755 lib/$(UCLIBC_LDSO_NAME)-$(VERSION).so \
420                         $(PREFIX)$(RUNTIME_PREFIX)lib; \
421         fi
422 endif
423
424 utils:
425         $(Q)$(MAKE) CROSS="$(CROSS)" CC="$(CC)" -C utils
426
427 # Installs helper applications, such as 'ldd' and 'ldconfig'
428 install_utils: utils
429         $(MAKE) CROSS="$(CROSS)" CC="$(CC)" -C utils utils_install
430
431 endif # ifeq ($(HAVE_DOT_CONFIG),y)
432
433 include/bits:
434         @$(disp_mkdir)
435         $(Q)$(INSTALL) -d $@
436
437 # configuration
438 # ---------------------------------------------------------------------------
439 extra/config/conf extra/config/mconf: $(suspicious_dependency)
440         $(Q)$(MAKE) -C extra/config $(notdir $@)
441
442 menuconfig: extra/config/mconf $(suspicious_dependency)
443         $(Q)./extra/config/mconf extra/Configs/Config.in
444
445 config: extra/config/conf $(suspicious_dependency)
446         $(Q)./extra/config/conf extra/Configs/Config.in
447
448 oldconfig: extra/config/conf $(suspicious_dependency)
449         $(Q)./extra/config/conf -o extra/Configs/Config.in
450
451 silentoldconfig: extra/config/conf $(suspicious_dependency)
452         $(Q)./extra/config/conf -s extra/Configs/Config.in
453
454 randconfig: extra/config/conf $(suspicious_dependency)
455         $(Q)./extra/config/conf -r extra/Configs/Config.in
456
457 allyesconfig: extra/config/conf $(suspicious_dependency)
458         $(Q)./extra/config/conf -y extra/Configs/Config.in
459         $(SED) -i -e "s/^DODEBUG=.*/# DODEBUG is not set/" .config
460         $(SED) -i -e "s/^DOASSERTS=.*/# DOASSERTS is not set/" .config
461         $(SED) -i -e "s/^SUPPORT_LD_DEBUG_EARLY=.*/# SUPPORT_LD_DEBUG_EARLY is not set/" .config
462         $(SED) -i -e "s/^SUPPORT_LD_DEBUG=.*/# SUPPORT_LD_DEBUG is not set/" .config
463         $(SED) -i -e "s/^UCLIBC_MJN3_ONLY=.*/# UCLIBC_MJN3_ONLY is not set/" .config
464         $(Q)./extra/config/conf -o extra/Configs/Config.in
465
466 allnoconfig: extra/config/conf $(suspicious_dependency)
467         $(Q)./extra/config/conf -n extra/Configs/Config.in
468
469 defconfig: extra/config/conf $(suspicious_dependency)
470         $(Q)./extra/config/conf -d extra/Configs/Config.in \
471                 -D extra/Configs/defconfigs/$(ARCH)
472
473 clean:
474         $(Q)$(RM) -r lib include/bits
475         $(RM) ldso/*/*.a libpthread/*/*.a libc/*.a libcrypt/*.a libintl/*.a \
476                 libm/*.a libnsl/*.a libpthread/*.a libresolv/*.a librt/*.a \
477                 libutil/*.a lib/*.a \
478                 include/fpu_control.h include/dl-osinfo.h include/hp-timing.h
479         +$(MAKE) -s -C test clean
480         +$(MAKE) -C utils utils_clean
481         @set -e; \
482         for i in `(cd libc/sysdeps/linux/common/sys; ls *.h)` ; do \
483                 $(RM) include/sys/$$i; \
484         done; \
485         if [ -d libc/sysdeps/linux/$(TARGET_ARCH)/sys ] ; then \
486                 for i in `(cd libc/sysdeps/linux/$(TARGET_ARCH)/sys; ls *.h)` ; do \
487                         $(RM) include/sys/$$i; \
488                 done; \
489         fi
490         @$(RM) include/linux include/asm*
491         $(RM) $(top_builddir)extra/scripts/unifdef
492         $(RM) -r $(LOCAL_INSTALL_PATH)
493
494 distclean: clean
495         -find . \( -name core -o -name \*.orig -o -name \*~ -o -name .\*.dep \) -exec $(RM) {} \;
496         $(RM) .config .config.old .config.cmd
497         $(RM) extra/locale/*.tgz
498         $(MAKE) -C extra/config distclean
499
500 dist release:
501         $(RM) -r ../uClibc-$(VERSION) ../uClibc-$(VERSION).tar.bz2
502         svn -q export . ../uClibc-$(VERSION)
503         $(TAR) cjf ../uClibc-$(VERSION).tar.bz2 -C .. uClibc-$(VERSION)
504         du -b ../uClibc-$(VERSION).tar.bz2
505
506 test check: test_compile
507         $(Q)$(MAKE) -C test
508
509 test_compile: $(LOCAL_INSTALL_PATH)
510         $(Q)$(MAKE) -C test compile