OSDN Git Service

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